From bf3c14e5c3e1ddda79e992e11c7415810f16b03a Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Sat, 24 Mar 2018 19:48:52 -0700 Subject: [PATCH 1/2] docker-compose.yml: switch from links to depends_on The `links` option is a legacy option that may eventually be removed entirely. We switch to `depends_on` so that we are still expressing the service dependencies. Note that since `links` allows a `SERVICE:ALIAS` syntax, and `depends_on` does not, we need to tell the `phpmyadmin` service that the mysql container is called `mysql` and not `db` (the latter being the default container name for the phpmyadmin image). --- docker-compose.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e0c4b2570..78601980d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,14 +20,14 @@ services: smr: extends: smr-common - # Links cannot be defined in extended services (i.e. smr-common) - links: + # depends_on cannot be defined in extended services (i.e. smr-common) + depends_on: - mysql smr-dev: extends: smr-common - # Links cannot be defined in extended services (i.e. smr-common) - links: + # depends_on cannot be defined in extended services (i.e. smr-common) + depends_on: - mysql volumes: # Mount the source code instead of copying it. @@ -40,7 +40,7 @@ services: flyway: image: boxfuse/flyway:latest-alpine command: -url=jdbc:mysql://${MYSQL_HOST}/smr_live -user=smr -password=${MYSQL_PASSWORD} migrate - links: + depends_on: - mysql volumes: - ./db/patches:/flyway/sql:ro @@ -68,8 +68,10 @@ services: # Publish to port 8080 ports: - 8080:80 - links: - - mysql:db + environment: + PMA_HOST: mysql + depends_on: + - mysql discord: build: From a8f6a606ad8591c02508c19e4b9cdd20256d080f Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Sat, 24 Mar 2018 20:24:44 -0700 Subject: [PATCH 2/2] docker-compose.yml: add depends_on for more services The `discord`, `irc`, and `npc` services technically depend on the `mysql` service, so we add the dependency for completeness. The dependency was not explicitly expressed before since we almost always had the mysql service running anyway. --- docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 78601980d..ec8b81881 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,6 +77,8 @@ services: build: context: . dockerfile: ./tools/discord/Dockerfile + depends_on: + - mysql volumes: - ./config:/smr/config @@ -84,6 +86,8 @@ services: build: context: . dockerfile: ./tools/irc/Dockerfile + depends_on: + - mysql volumes: - ./config:/smr/config @@ -91,6 +95,8 @@ services: build: context: . dockerfile: ./tools/npc/Dockerfile + depends_on: + - mysql volumes: - ./config:/smr/config