Skip to content

Commit

Permalink
docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio Esposito committed Aug 18, 2017
1 parent 1410b63 commit 1a845cf
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 19 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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/.
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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




16 changes: 16 additions & 0 deletions survey-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 0 additions & 3 deletions survey-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
14 changes: 14 additions & 0 deletions survey-events/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 0 additions & 3 deletions survey-events/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
14 changes: 14 additions & 0 deletions survey-read/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
6 changes: 1 addition & 5 deletions survey-read/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
14 changes: 14 additions & 0 deletions survey-write/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 0 additions & 3 deletions survey-write/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down

0 comments on commit 1a845cf

Please sign in to comment.