Commit 1db8bdb96a186665cbb97d146e723a4e1b218c34

Authored by Alexis Koralewski
1 parent 731dda11
Exists in dev

removing mysql tcp port, adding healthcheck to see if the db container is ready to execture queries

Showing 1 changed file with 8 additions and 10 deletions   Show diff stats
docker/docker-compose.yml
@@ -10,12 +10,16 @@ services: @@ -10,12 +10,16 @@ services:
10 environment: 10 environment:
11 # note : as db is an image of mysql, this root password will be set on the first installation on the image, if the value is changed, it will not be updated in the database 11 # note : as db is an image of mysql, this root password will be set on the first installation on the image, if the value is changed, it will not be updated in the database
12 - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}" 12 - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
13 - - "MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-3306}"  
14 volumes: 13 volumes:
15 - db:/var/lib/mysql/ 14 - db:/var/lib/mysql/
16 # create network to allow images to communicate with other images within the same network 15 # create network to allow images to communicate with other images within the same network
17 networks: 16 networks:
18 - pyros-network 17 - pyros-network
  18 + healthcheck:
  19 + test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD' ]
  20 + timeout: 10s
  21 + interval: 5s
  22 + retries: 20
19 23
20 # service image of python, that let users to interact with python scripts such as pyros. 24 # service image of python, that let users to interact with python scripts such as pyros.
21 install: 25 install:
@@ -47,20 +51,14 @@ services: @@ -47,20 +51,14 @@ services:
47 networks: 51 networks:
48 - pyros-network 52 - pyros-network
49 #ipv4_address: "${IP_PYROS_USER}" 53 #ipv4_address: "${IP_PYROS_USER}"
50 - 54 + restart: always
  55 +
51 # declaring volumes 56 # declaring volumes
52 volumes: 57 volumes:
53 db: 58 db:
54 driver: local 59 driver: local
55 -  
56 # declaring networks 60 # declaring networks
57 networks: 61 networks:
58 pyros-network: 62 pyros-network:
59 #bridge is the default network driver 63 #bridge is the default network driver
60 - driver: bridge  
61 - ipam:  
62 - driver: default  
63 - config:  
64 - # we can define any ip adresses  
65 - - subnet: 172.28.0.0/16  
66 - gateway: 172.28.5.254  
67 \ No newline at end of file 64 \ No newline at end of file
  65 + driver: bridge
68 \ No newline at end of file 66 \ No newline at end of file