diff --git a/README.md b/README.md index ec71e22..ded6e6c 100644 --- a/README.md +++ b/README.md @@ -19,18 +19,26 @@ survey-event Log all events happening on the system +## How to build + +`./build.sh` + + ## How to run -`gradle clean build` +Option 1: fatjar + +`java -jar survey-api/build/libs/survey-api-1.0-SNAPSHOT-fat.jar` -`java -jar survey-api/build/libs/survey-api-1.0-SNAPSHOT.jar` +`java -jar survey-read/build/libs/survey-read-1.0-SNAPSHOT-fat.jar` -`java -jar survey-read/build/libs/survey-read-1.0-SNAPSHOT.jar` +`java -jar survey-write/build/libs/survey-write-1.0-SNAPSHOT-fat.jar` -`java -jar survey-write/build/libs/survey-write-1.0-SNAPSHOT.jar` +`java -jar survey-events/build/libs/survey-events-1.0-SNAPSHOT-fat.jar` -`java -jar survey-events/build/libs/survey-events-1.0-SNAPSHOT.jar` +Option 2: +docker-compose up ## How to use diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..79faea1 --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +./gradlew clean build + +docker build -t fesposito/survey-api survey-api/. + +docker build -t fesposito/survey-events survey-events/. + +docker build -t fesposito/survey-read survey-read/. + +docker build -t fesposito/survey-write survey-write/. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..63e5a84 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '2.1' + +services: + survey-api: + image: fesposito/survey-api + + survey-events: + image: fesposito/survey-events + + survey-read: + image: fesposito/survey-read + + survey-write: + image: fesposito/survey-write + + + + diff --git a/survey-api/Dockerfile b/survey-api/Dockerfile new file mode 100644 index 0000000..042cd21 --- /dev/null +++ b/survey-api/Dockerfile @@ -0,0 +1,16 @@ +FROM openjdk:8-jre-alpine + +ENV VERTICLE_FILE survey-api-1.0-SNAPSHOT-fat.jar + +# Set the location of the verticles +ENV VERTICLE_HOME /usr/verticles + +EXPOSE 8080 + +# Copy your fat jar to the container +COPY build/libs/$VERTICLE_FILE $VERTICLE_HOME/ + +# Launch the verticle +WORKDIR $VERTICLE_HOME +ENTRYPOINT ["sh", "-c"] +CMD ["exec java -jar $VERTICLE_FILE -cluster"] diff --git a/survey-api/build.gradle b/survey-api/build.gradle index 354a52b..bdf5e32 100644 --- a/survey-api/build.gradle +++ b/survey-api/build.gradle @@ -8,9 +8,6 @@ shadowJar { classifier = 'fat' mainClassName = 'com.surveygorilla.api.MainApi' - /*manifest { - attributes 'Main-Verticle': 'com.surveygorilla.api.SurveyApiVerticle' - }*/ mergeServiceFiles { include 'META-INF/survey-api/io.vertx.core.spi.VerticleFactory' } diff --git a/survey-events/Dockerfile b/survey-events/Dockerfile new file mode 100644 index 0000000..efb69c6 --- /dev/null +++ b/survey-events/Dockerfile @@ -0,0 +1,14 @@ +FROM openjdk:8-jre-alpine + +ENV VERTICLE_FILE survey-events-1.0-SNAPSHOT-fat.jar + +# Set the location of the verticles +ENV VERTICLE_HOME /usr/verticles + +# Copy your fat jar to the container +COPY build/libs/$VERTICLE_FILE $VERTICLE_HOME/ + +# Launch the verticle +WORKDIR $VERTICLE_HOME +ENTRYPOINT ["sh", "-c"] +CMD ["exec java -jar $VERTICLE_FILE -cluster"] diff --git a/survey-events/build.gradle b/survey-events/build.gradle index 184194a..68eab70 100644 --- a/survey-events/build.gradle +++ b/survey-events/build.gradle @@ -8,9 +8,6 @@ shadowJar { classifier = 'fat' mainClassName = 'com.surveygorilla.event.MainEvent' - manifest { - attributes 'Main-Verticle': 'com.surveygorilla.event.SurveyEventVerticle' - } mergeServiceFiles { include 'META-INF/survey-api/io.vertx.core.spi.VerticleFactory' } diff --git a/survey-read/Dockerfile b/survey-read/Dockerfile new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/survey-read/Dockerfile @@ -0,0 +1,14 @@ +FROM openjdk:8-jre-alpine + +ENV VERTICLE_FILE survey-read-1.0-SNAPSHOT-fat.jar + +# Set the location of the verticles +ENV VERTICLE_HOME /usr/verticles + +# Copy your fat jar to the container +COPY build/libs/$VERTICLE_FILE $VERTICLE_HOME/ + +# Launch the verticle +WORKDIR $VERTICLE_HOME +ENTRYPOINT ["sh", "-c"] +CMD ["exec java -jar $VERTICLE_FILE -cluster"] diff --git a/survey-read/build.gradle b/survey-read/build.gradle index 397a1dc..c28b0db 100644 --- a/survey-read/build.gradle +++ b/survey-read/build.gradle @@ -7,11 +7,7 @@ dependencies { shadowJar { classifier = 'fat' mainClassName = 'com.surveygorilla.read.MainRead' - /* - manifest { - Attributes 'Main-Verticle': 'com.surveygorilla.read.SurveyReadVerticle' - } - */ + mergeServiceFiles { include 'META-INF/survey-api/io.vertx.core.spi.VerticleFactory' } diff --git a/survey-write/Dockerfile b/survey-write/Dockerfile new file mode 100644 index 0000000..d9e1253 --- /dev/null +++ b/survey-write/Dockerfile @@ -0,0 +1,14 @@ +FROM openjdk:8-jre-alpine + +ENV VERTICLE_FILE survey-write-1.0-SNAPSHOT-fat.jar + +# Set the location of the verticles +ENV VERTICLE_HOME /usr/verticles + +# Copy your fat jar to the container +COPY build/libs/$VERTICLE_FILE $VERTICLE_HOME/ + +# Launch the verticle +WORKDIR $VERTICLE_HOME +ENTRYPOINT ["sh", "-c"] +CMD ["exec java -jar $VERTICLE_FILE -cluster"] diff --git a/survey-write/build.gradle b/survey-write/build.gradle index c4d4e61..17c9580 100644 --- a/survey-write/build.gradle +++ b/survey-write/build.gradle @@ -8,9 +8,6 @@ shadowJar { classifier = 'fat' mainClassName = 'com.surveygorilla.write.MainWrite' - /*manifest { - Attributes 'Main-Verticle': 'com.surveygorilla.write.SurveyWriteVerticle' - }*/ mergeServiceFiles { include 'META-INF/survey-api/io.vertx.core.spi.VerticleFactory' }