Merge "use docker-compose healtcheck for DB"
[portal.git] / deliveries / docker-compose.yml
1 # docker-compose for ONAP portal containers: database, microservice, portal apps.
2 # Relies on .env file, which CANNOT be specified via command-line option
3 # Works in multiple environments; does not pull from a Nexus registry.
4 # Exposes the portal apps docker (but not DB nor WMS dockers) on the host network.
5 # Images must be pulled from ONAP Nexus registry after logging in like this:
6 # docker login -u USER -p PASS nexus3.onap.org:10001
7 # Uses healthcheck feature added in docker-compose v2.1
8
9 version: '2.1'
10
11 services:
12
13   cli:
14     image: ${CLI_IMG_NAME}:${PORTAL_TAG}
15     environment:
16       CLI_MODE: 'daemon'
17     ports:
18       - 8080:80
19       - 9090:8080
20     logging:
21       driver: json-file
22
23   # Config files may use hostname "portal-db"
24   portal-db:
25     image: ${DB_IMG_NAME}:${PORTAL_TAG}
26     environment:
27       MYSQL_ROOT_PASSWORD: 'Aa123456'
28     expose:
29       - 3306
30     volumes:
31       # Just specify a path and let the Engine create a volume
32       - /var/lib/mysql
33     logging:
34       driver: json-file
35     healthcheck:
36       test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
37       timeout: 10s
38       retries: 30
39
40   # The app config file uses the docker name above
41   portal-wms:
42     image: ${WMS_IMG_NAME}:${PORTAL_TAG}
43     expose:
44       - 8082
45     links:
46       - portal-db
47     depends_on:
48       portal-db:
49         condition: service_healthy
50     volumes:
51       - ${PROPS_DIR}/ONAPWIDGETMS/application.properties:/application.properties
52     command:
53       - /start-wms-cmd.sh
54     logging:
55       driver: json-file
56
57   # Environment variables here CANNOT override the database URL because
58   # two apps use identical configuration keys with different values
59   portal-apps:
60     image: ${EP_IMG_NAME}:${PORTAL_TAG}
61     ports:
62       - 8989:8080
63       - 8010:8009
64       - 8006:8005
65     links:
66       - portal-db
67       - portal-wms
68     depends_on:
69       portal-db:
70         condition: service_healthy
71       portal-wms:
72         condition: service_started
73     volumes:
74       - ${PROPS_DIR}/ONAPPORTAL/system.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/conf/system.properties
75       - ${PROPS_DIR}/ONAPPORTAL/fusion.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties
76       - ${PROPS_DIR}/ONAPPORTAL/portal.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/portal.properties
77       - ${PROPS_DIR}/ONAPPORTAL/openid-connect.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/openid-connect.properties
78       - ${PROPS_DIR}/ONAPPORTAL/logback.xml:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/logback.xml
79       - ${PROPS_DIR}/ONAPPORTALSDK/fusion.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties
80       - ${PROPS_DIR}/ONAPPORTALSDK/system.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/conf/system.properties
81       - ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties
82       - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml
83       - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs
84     command:
85       - /start-apps-cmd.sh
86       # see comments in .env file
87       - $EXTRA_HOST_IP
88       - $EXTRA_HOST_NAME
89     logging:
90       driver: json-file
91