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 10 environment:
11 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 12 - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
13   - - "MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-3306}"
14 13 volumes:
15 14 - db:/var/lib/mysql/
16 15 # create network to allow images to communicate with other images within the same network
17 16 networks:
18 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 24 # service image of python, that let users to interact with python scripts such as pyros.
21 25 install:
... ... @@ -47,20 +51,14 @@ services:
47 51 networks:
48 52 - pyros-network
49 53 #ipv4_address: "${IP_PYROS_USER}"
50   -
  54 + restart: always
  55 +
51 56 # declaring volumes
52 57 volumes:
53 58 db:
54 59 driver: local
55   -
56 60 # declaring networks
57 61 networks:
58 62 pyros-network:
59 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 64 \ No newline at end of file
  65 + driver: bridge
68 66 \ No newline at end of file
... ...