From: Manoop Talasila Date: Sat, 28 Oct 2017 03:41:36 +0000 (+0000) Subject: Merge "use docker-compose healtcheck for DB" X-Git-Tag: v2.2.0~57 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=ff3619ea67dd2f008b2378f59511f3a22ce23177;hp=6f2918cc2a4f67b692f91e4e5a40c122a75ed402;p=portal.git Merge "use docker-compose healtcheck for DB" --- diff --git a/deliveries/docker-compose.yml b/deliveries/docker-compose.yml index de8afd76..a5db5471 100644 --- a/deliveries/docker-compose.yml +++ b/deliveries/docker-compose.yml @@ -1,9 +1,10 @@ # docker-compose for ONAP portal containers: database, microservice, portal apps. -# Relies on .env file in current directory. +# Relies on .env file, which CANNOT be specified via command-line option # Works in multiple environments; does not pull from a Nexus registry. # Exposes the portal apps docker (but not DB nor WMS dockers) on the host network. # Images must be pulled from ONAP Nexus registry after logging in like this: # docker login -u USER -p PASS nexus3.onap.org:10001 +# Uses healthcheck feature added in docker-compose v2.1 version: '2.1' @@ -31,9 +32,12 @@ services: - /var/lib/mysql logging: driver: json-file + healthcheck: + test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] + timeout: 10s + retries: 30 - # An environment variable here CAN override the database URL; - # instead the value in the config file uses hostname from above + # The app config file uses the docker name above portal-wms: image: ${WMS_IMG_NAME}:${PORTAL_TAG} expose: @@ -41,15 +45,11 @@ services: links: - portal-db depends_on: - - portal-db + portal-db: + condition: service_healthy volumes: - ${PROPS_DIR}/ONAPWIDGETMS/application.properties:/application.properties command: - - /wait-for.sh - - -t - - "300" - - portal-db:3306 - - -- - /start-wms-cmd.sh logging: driver: json-file @@ -66,8 +66,10 @@ services: - portal-db - portal-wms depends_on: - - portal-db - - portal-wms + portal-db: + condition: service_healthy + portal-wms: + condition: service_started volumes: - ${PROPS_DIR}/ONAPPORTAL/system.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/conf/system.properties - ${PROPS_DIR}/ONAPPORTAL/fusion.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties @@ -80,14 +82,10 @@ services: - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs command: - - /wait-for.sh - - -t - - "300" - - portal-db:3306 - - -- - /start-apps-cmd.sh # see comments in .env file - $EXTRA_HOST_IP - $EXTRA_HOST_NAME logging: driver: json-file +