From a909823e37b3220b2ef7c3c2af0cb18f17f0bfb4 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Tue, 1 Oct 2019 21:09:37 +0200 Subject: [PATCH] Added docker-compose set and update readme --- README.md | 20 ++++++++++++++++++++ docker-compose.yml | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 60bc4ae..ed88edf 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ To configure the starter app to use MySQL, instead of the default Derby, update * datasource.driver=com.mysql.jdbc.Driver * datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3 * hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +* datasource.username=admin +* datasource.password=admin Because the integration tests within the project rely on the default Derby database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured MySQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. @@ -72,6 +74,24 @@ Again, browse to the following link to use the server (note that the port 8080 m [http://localhost:8080/hapi-fhir-jpaserver/](http://localhost:8080/hapi-fhir-jpaserver/) +# Deploy with docker compose + +Docker compose is a simple option to build and deploy container. To deploy with docker compose, you should build the project +with ```mvn clean install``` and then bring up the container with ```docker-compose up -d --build```. The container can be +reached at http://localhost:8080/hapi-fhir-jpaserver/. + +In order to use another port, change the `ports` parameter +inside ``docker-compose.yml`` to ```8888:8080```, where 8888 is a port of your choice. + +The docker compose set also includes my MySQL database, if you choose to use MySQL instead of derby, change the following +properties in hapi.properties: + +* datasource.driver=com.mysql.jdbc.Driver +* datasource.url=jdbc:mysql://hapi-fhir-mysql:3306/hapi +* hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +* datasource.username=admin +* datasource.password=admin + # Running hapi-fhir-jpaserver-example in Tomcat from IntelliJ Install Tomcat. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cd25605 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3" +services: + hapi-fhir-jpaserver-start: + build: . + container_name: hapi-fhir-jpaserver-start + restart: on-failure + ports: + - "8080:8080" + hapi-fhir-mysql: + image: mysql:latest + container_name: hapi-fhir-mysql + restart: always + environment: + MYSQL_DATABASE: 'hapi' + MYSQL_USER: 'admin' + MYSQL_PASSWORD: 'admin' + MYSQL_ROOT_PASSWORD: 'admin' + volumes: + - hapi-fhir-mysql:/var/lib/mysql +volumes: + hapi-fhir-mysql: \ No newline at end of file