petclinic-uncached

added database

5/3/2019 8:03:10 PM

Details

docker-compose.yml 26(+25 -1)

diff --git a/docker-compose.yml b/docker-compose.yml
index f079574..64ac9da 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,7 +3,12 @@ services:
   application:
     build: .
     container_name: petclinic
+    depends_on:
+    - "database"
+    links:
+      - database
     environment:
+      - JAVA_OPTS="-Xms4096m -Xmx6124m"
       - TRACER_SERIALISE_INTERNALS=false
       - TRACER_VERBOSE=true
       - TRACER_ENABLE=true
@@ -19,5 +24,24 @@ services:
       options:
         max-size: "10m"
         max-file: "10"
+
+  database:
+    image: mysql:5.7.22
+    expose:
+      - 3306
+    volumes:
+      - ../../dumps/petclinic.sql:/docker-entrypoint-initdb.d/init.sql
+      - database:/var/lib/mysql
+    environment:
+      MYSQL_USER: root
+      MYSQL_ROOT_PASSWORD: root
+      MYSQL_DATABASE: petclinic
+    restart: unless-stopped
+    logging:
+      options:
+        max-size: "10m"
+        max-file: "10"
+
 volumes:
-  application:
\ No newline at end of file
+  application:
+  database:
\ No newline at end of file

pom.xml 4(+2 -2)

diff --git a/pom.xml b/pom.xml
index cb32d5b..8486e5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,11 +67,11 @@
     </dependency>
 
     <!-- Databases - Uses HSQL by default -->
-    <dependency>
+    <!-- <dependency>
       <groupId>org.hsqldb</groupId>
       <artifactId>hsqldb</artifactId>
       <scope>runtime</scope>
-    </dependency>
+    </dependency> -->
     <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index fb07c6c..3c0f90d 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,7 +1,11 @@
 # database init, supports mysql too
-database=hsqldb
-spring.datasource.schema=classpath*:db/${database}/schema.sql
-spring.datasource.data=classpath*:db/${database}/data.sql
+#database=hsqldb
+#spring.datasource.schema=classpath*:db/${database}/schema.sql
+#spring.datasource.data=classpath*:db/${database}/data.sql
+database=mysql
+spring.datasource.url=jdbc:mysql://database:3306/petclinic
+spring.datasource.username=root
+spring.datasource.password=root
 
 # Web
 spring.thymeleaf.mode=HTML