Skip to content

Commit

Permalink
Adding initialization, build and test scripts. Modifying mysql host n…
Browse files Browse the repository at this point in the history
…ame on hibernate.cfg.xml. Adding healthcheck param on docker-compose.
  • Loading branch information
Sírius Roberto da Costa Gomes committed Aug 31, 2018
1 parent 8c1d952 commit afd679f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/src/main/resources/hibernate.cfg.xml
Expand Up @@ -5,7 +5,7 @@
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">
jdbc:mysql://db:3306/dojo</property>
jdbc:mysql://mysql:3306/dojo</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">k2j32ks4</property>
<property name="hibernate.connection.pool_size">10</property>
Expand Down
2 changes: 1 addition & 1 deletion backend/test.ps1
Expand Up @@ -5,7 +5,7 @@ docker rm $(docker ps -aq)
echo "Removing all docker volumes"
docker volume rm $(docker volume ls -q)
echo "Booting docker-compose test file"
docker-compose --file ..\docker\docker-compose.yml up -d
docker-compose --file .\src\test\resources\docker-compose.yml up -d
sleep 10
echo "Starting build and tests"
mvn clean test
Expand Down
15 changes: 15 additions & 0 deletions build.ps1
@@ -0,0 +1,15 @@
echo "Stopping all running docker containers"
docker stop $(docker ps -aq)
echo "Removing all docker containers"
docker rm $(docker ps -aq)
echo "Removing all docker volumes"
docker volume rm $(docker volume ls -q)
cd backend
echo "Booting docker-compose test file"
docker-compose --file .\src\test\resources\docker-compose.yml up -d
sleep 10
echo "Starting build and tests"
mvn package
echo "Stopping all running docker containers"
docker stop $(docker ps -aq)
cd ..
5 changes: 5 additions & 0 deletions docker/docker-compose.yml
Expand Up @@ -25,6 +25,11 @@ services:
build: ../backend/
ports:
- 8090:8080
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 1s
timeout: 3s
retries: 60
depends_on:
- mysql
networks:
Expand Down
2 changes: 2 additions & 0 deletions run.ps1
@@ -0,0 +1,2 @@
echo "Booting docker-compose production file"
docker-compose --file .\docker\docker-compose.yml up --build

0 comments on commit afd679f

Please sign in to comment.