forked from marg-o/brigate
Compare commits
No commits in common. "master" and "master" have entirely different histories.
14
.classpath
14
.classpath
|
@ -8,16 +8,12 @@
|
|||
<attribute name="owner.project.facets" value="jst.web"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.8">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_172">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<!-- <classpathentry kind="lib" path="drivers/mysql-connector-java-5.1.39.jar"/> -->
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
<classpathentry kind="lib" path="C:/Users/margh/Downloads/ojdbc6.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/margh/Downloads/mysql-connector-java-5.1.39.jar"/>
|
||||
<classpathentry kind="output" path="build/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/Dockerfile
|
||||
/docker-compose*
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1 @@
|
|||
/build/
|
||||
/target/
|
||||
/.m2/
|
||||
|
|
6
.project
6
.project
|
@ -20,14 +20,8 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
20
Dockerfile
20
Dockerfile
|
@ -1,20 +0,0 @@
|
|||
FROM maven:latest AS builder
|
||||
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
RUN mvn clean install
|
||||
|
||||
FROM tomcat:8.5
|
||||
ARG PROJECT_NAME=centralino_brigate
|
||||
ARG PROJECT_VERS=0.2.0
|
||||
|
||||
RUN cd /usr/local/tomcat/webapps.dist/ \
|
||||
&& for FILE in *; do \
|
||||
echo "Symlinking: $FILE -> /usr/local/tomcat/webapps/$FILE"; \
|
||||
ln -s $PWD/$FILE /usr/local/tomcat/webapps/$FILE; \
|
||||
done
|
||||
COPY docker/tomcat-users.xml /usr/local/tomcat/conf/
|
||||
COPY docker/host-manager/context.xml /usr/local/tomcat/webapps.dist/host-manager/META-INF/context.xml
|
||||
COPY docker/manager/context.xml /usr/local/tomcat/webapps.dist/manager/META-INF/context.xml
|
||||
COPY --from=builder /src/target/${PROJECT_NAME}-${PROJECT_VERS}.war /usr/local/tomcat/webapps/
|
|
@ -1,12 +0,0 @@
|
|||
FROM maven:latest
|
||||
ARG uid=1000
|
||||
ARG gid=1000
|
||||
|
||||
RUN groupadd -g ${gid} app \
|
||||
&& useradd -m -d /src -u ${uid} -g ${gid} app
|
||||
|
||||
USER app
|
||||
WORKDIR /src
|
||||
|
||||
ENTRYPOINT ["mvn"]
|
||||
CMD ["clean", "install"]
|
45
README.md
45
README.md
|
@ -1,45 +0,0 @@
|
|||
## Centralino Brigate
|
||||
|
||||
App in jsp per sostegno all'attività delle brigate di solidarietà.
|
||||
|
||||
## How to
|
||||
|
||||
### Prerequisiti
|
||||
|
||||
- `docker`
|
||||
- `docker-compose`
|
||||
|
||||
### Dev
|
||||
|
||||
Se si vuole tirar su un ambiente di sviluppo locale con tomcat e un db mysql
|
||||
|
||||
```
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
Si troverà l'app a `http://localhost:8080/centralino_brigate-0.2.0/`. *ATTENZIONE*: NON è
|
||||
production-safe!
|
||||
|
||||
Se si vuole buildare l'artifatto (output in `war` nella cartella `target/`),
|
||||
per prima cosa creare l'immagine per il processo di build con maven (solo la prima volta):
|
||||
|
||||
```
|
||||
$ docker build -t unit/mvn-builder:latest -f Dockerfile.build .
|
||||
```
|
||||
|
||||
Dopo di che:
|
||||
|
||||
```
|
||||
$ docker run --rm -v $PWD:/src -t unit/mvn-builder:latest
|
||||
```
|
||||
|
||||
Se si vuole dettaglio sul processo di build
|
||||
|
||||
```
|
||||
$ docker run --rm -v $PWD:/src -t unit/mvn-builder:latest -e -X clean install
|
||||
```
|
||||
|
||||
|
||||
### Prod
|
||||
|
||||
TODO
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mysql:5
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=password
|
||||
- MYSQL_DATABASE=brigate
|
||||
- MYSQL_USER=brigate
|
||||
- MYSQL_PASSWORD=password
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- ./sql/mysql/:/docker-entrypoint-initdb.d/
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
brigate:
|
||||
build:
|
||||
dockerfile: ./Dockerfile
|
||||
context: .
|
||||
image: unit/centralino_brigate:0.2.0
|
||||
ports:
|
||||
- 8080:8080
|
|
@ -1,3 +0,0 @@
|
|||
<Context antiResourceLocking="false" privileged="true" >
|
||||
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
|
||||
</Context>
|
|
@ -1,3 +0,0 @@
|
|||
<Context antiResourceLocking="false" privileged="true" >
|
||||
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
|
||||
</Context>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<tomcat-users>
|
||||
<role rolename="admin-gui"/>
|
||||
<user username="unit" password="unit" roles="unit,admin-gui,manager-gui"/>
|
||||
</tomcat-users>
|
44
pom.xml
44
pom.xml
|
@ -1,44 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>centralino_brigate</groupId>
|
||||
<artifactId>centralino_brigate</artifactId>
|
||||
<version>0.2.0</version>
|
||||
<packaging>war</packaging>
|
||||
<name>centralino_brigate</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.39</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warSourceDirectory>WebContent</warSourceDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
<!-- vim: set ft=xml et ts=2 sts=0: -->
|
21
script_mysql.sql
Normal file
21
script_mysql.sql
Normal file
|
@ -0,0 +1,21 @@
|
|||
use brigate;
|
||||
|
||||
|
||||
CREATE TABLE CONTATTI
|
||||
( NOME VARCHAR(255) NOT NULL,
|
||||
COGNOME VARCHAR(255) NOT NULL ,
|
||||
SERVIZIO_SOCIALE VARCHAR(255),
|
||||
AREA VARCHAR(255),
|
||||
INDIRIZZO VARCHAR(255) NOT NULL,
|
||||
TELEFONO INTEGER PRIMARY KEY,
|
||||
NUMERO INTEGER NOT NULL ,
|
||||
COMPOSIZIONE_NUCLEO VARCHAR(255) NOT NULL ,
|
||||
NOTE_SACCHETTO VARCHAR(255),
|
||||
ULTIMA_CONSEGNA DATE,
|
||||
EMAIL VARCHAR(256)
|
||||
) ;
|
||||
|
||||
|
||||
CREATE TABLE ORDINI
|
||||
( TELEFONO INTEGER PRIMARY KEy REFERENCES CONTATTI(TELEFONO)
|
||||
) ;
|
|
@ -1,25 +0,0 @@
|
|||
USE brigate;
|
||||
|
||||
CREATE TABLE contatti (
|
||||
nome VARCHAR(255) NOT NULL,
|
||||
cognome VARCHAR(255) NOT NULL,
|
||||
servizio_sociale VARCHAR(255),
|
||||
area VARCHAR(255),
|
||||
indirizzo VARCHAR(255) NOT NULL,
|
||||
telefono INT8 PRIMARY KEY,
|
||||
numero INT8 NOT NULL,
|
||||
composizione_nucleo VARCHAR(255) NOT NULL,
|
||||
note_sacchetto VARCHAR(255),
|
||||
ultima_consegna DATE,
|
||||
email VARCHAR(256)
|
||||
);
|
||||
|
||||
CREATE TABLE ordini (
|
||||
telefono INT8 PRIMARY KEY REFERENCES contatti (telefono)
|
||||
);
|
||||
|
||||
CREATE TABLE utenti (
|
||||
nickname VARCHAR(255) NOT NULL,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
ruolo VARCHAR(255)
|
||||
);
|
|
@ -12,7 +12,7 @@ import bean.Contatto;
|
|||
|
||||
public class ContattoDao implements ContattoDaoI {
|
||||
|
||||
MySqlConnection c = new MySqlConnection();
|
||||
OracleConnection c = new OracleConnection();
|
||||
|
||||
@Override
|
||||
public boolean create(String nome, String cognome, String servizio_sociale, String area, String indirizzo,
|
||||
|
|
|
@ -4,12 +4,9 @@ package dao;
|
|||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import util.Config;
|
||||
|
||||
public class MySqlConnection {
|
||||
|
||||
Config cfg = new Config();
|
||||
|
||||
public static void main(String[] args) {
|
||||
MySqlConnection c = new MySqlConnection();
|
||||
c.open();
|
||||
|
@ -20,10 +17,10 @@ public class MySqlConnection {
|
|||
|
||||
|
||||
public Connection open() {
|
||||
String nomeDriver = "com.mysql.jdbc.Driver";
|
||||
String utente = cfg.getDbUser(); //nome utente
|
||||
String password = cfg.getDbPass(); //password
|
||||
String url = "jdbc:mysql://" + cfg.getDbHost() + ":" + cfg.getDbPort() + "/brigate?autoReconnect=true&useSSL=false";
|
||||
String nomeDriver = "com.mysql.driverDriver";
|
||||
String utente = "brigate"; //nome utente
|
||||
String password = "password"; //password
|
||||
String url = "jdbc:oracle:thin:@localhost:1521:orcl";
|
||||
|
||||
try {
|
||||
Class.forName(nomeDriver);
|
||||
|
|
|
@ -9,7 +9,7 @@ import bean.Utente;
|
|||
|
||||
public class UtenteDao implements UtenteDaoI {
|
||||
|
||||
MySqlConnection c = new MySqlConnection();
|
||||
OracleConnection c = new OracleConnection();
|
||||
|
||||
@Override
|
||||
public boolean registrazione(String nickname, String password, String ruolo) {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package util;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
public class Config {
|
||||
Properties configFile;
|
||||
|
||||
public Config() {
|
||||
configFile = new java.util.Properties();
|
||||
try {
|
||||
configFile.load(this.getClass().getClassLoader().getResourceAsStream("/etc/brigate/brigate.conf"));
|
||||
} catch(FileNotFoundException ex) {
|
||||
System.out.println("Missing config file");
|
||||
}catch(Exception eta) {
|
||||
eta.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getDbUser() {
|
||||
String user = this.configFile.getProperty("db_user", "brigate");
|
||||
return user;
|
||||
}
|
||||
|
||||
public String getDbPass() {
|
||||
String pass = this.configFile.getProperty("db_password", "password");
|
||||
return pass;
|
||||
}
|
||||
|
||||
public String getDbHost() {
|
||||
String host = this.configFile.getProperty("db_url", "db");
|
||||
return host;
|
||||
}
|
||||
|
||||
public String getDbPort() {
|
||||
String port = this.configFile.getProperty("db_port", "3306");
|
||||
return port;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user