-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
174 lines (165 loc) · 6.71 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: push-analytics-e2e
services:
web:
image: '${DHIS2_IMAGE:-dhis2/core:41}'
ports:
- '127.0.0.1:8080:8080' # DHIS2
- '127.0.0.1:8081:8081' # Debugger: connect using commandline flag -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8081
- '127.0.0.1:9010:9010' # JMX port (for example for VisualVM)
networks:
mynetwork:
ipv4_address: 172.26.0.6
volumes:
- ./docker/dhis.conf:/opt/dhis2/dhis.conf:ro
- ./docker/log4j2.xml:/opt/dhis2/log4j2.xml:ro
environment:
DHIS2_IMAGE: ${DHIS2_IMAGE}
JAVA_OPTS:
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8081 \
-Dlog4j2.configurationFile=/opt/dhis2/log4j2.xml
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ['CMD', 'curl', '-f', '127.0.0.1:8080/dhis-web-login']
start_period: 600s
interval: 5s
timeout: 600s
retries: 120
db:
image: ghcr.io/baosystems/postgis:12-3.3
ports:
- 5432:5432
networks:
mynetwork:
ipv4_address: 172.26.0.7
volumes:
- ./docker/db-dump:/docker-entrypoint-initdb.d/
environment:
POSTGRES_USER: dhis
POSTGRES_DB: dhis
POSTGRES_PASSWORD: &postgres_password dhis
PGPASSWORD: *postgres_password # needed by psql in healthcheck
healthcheck:
test:
[
'CMD-SHELL',
'psql --no-password --quiet --username $$POSTGRES_USER postgres://127.0.0.1/$$POSTGRES_DB -p 5432 --command "SELECT ''ok''" > /dev/null',
]
start_period: 300s
interval: 1s
timeout: 300s
retries: 300
depends_on:
db-dump:
condition: service_completed_successfully # make sure the DB dump has been downloaded
db-dump:
image: busybox # busybox wget version does not have --no-clobber, so we need to do the [ -f ] test
command: sh -c '[ -f dump.sql.gz ] && echo "dump.sql.gz exists" || wget --output-document dump.sql.gz $$DHIS2_DB_DUMP_URL' # only download file if it does not exist
environment:
- DHIS2_DB_DUMP_URL=${DHIS2_DB_DUMP_URL}
working_dir: /opt/dump
volumes:
- ./docker/db-dump:/opt/dump
networks:
mynetwork:
ipv4_address: 172.26.0.8
fake-smtp-server:
image: gessnerfl/fake-smtp-server:2.2.0
hostname: 'fake-smtp-server'
restart: always
environment:
- FAKESMTP_AUTHENTICATION_USERNAME=${FAKESMTP_AUTHENTICATION_USERNAME}
- FAKESMTP_AUTHENTICATION_PASSWORD=${FAKESMTP_AUTHENTICATION_PASSWORD}
- FAKESMTP_PORT=${FAKESMTP_PORT}
- SERVER_PORT=${FAKESMTP_SERVER_PORT}
- MANAGEMENT_SERVER_PORT=${FAKESMTP_MANAGEMENT_SERVER_PORT}
ports:
- '${FAKESMTP_PORT}:${FAKESMTP_PORT}' #expose smtp port
- '${FAKESMTP_SERVER_PORT}:${FAKESMTP_SERVER_PORT}' #expose web ui
- '${FAKESMTP_MANAGEMENT_SERVER_PORT}:${FAKESMTP_MANAGEMENT_SERVER_PORT}' #expose management api
networks:
mynetwork:
ipv4_address: 172.26.0.9
post-install-scripts:
image: alpine:latest
environment:
- BASE_URL=${DHIS2_CORE_URL}
- USERNAME=admin
- PASSWORD=district
- APPS_TO_INSTALL='${APPS_TO_INSTALL:-Line Listing}'
volumes:
- ./docker/scripts:/opt/scripts
working_dir: /opt/scripts
command: >
sh -c "apk update --no-cache &&
apk add --no-cache bash curl jq &&
./install_apps_from_app_hub.sh &&
./generate_analytics_tables.sh"
networks:
mynetwork:
ipv4_address: 172.26.0.11
depends_on:
web:
condition: service_healthy
push-analytics:
hostname: 'push-analytics'
# Use a published image for demos
# image: 'dhis2/push-analytics:1.0.0-alpha.4'
# For the e2e suite or debugging docker specific issues use a local image with the most recent changes
# To build this image, run `npm run create-local-docker-image`
image: ${PUSH_ANALYTICS_IMAGE:-dhis2/push-analytics:local}
ports:
- '${PORT}:${PORT}'
networks:
mynetwork:
# This IP needs to be present to `switch_user_allow_listed_ips` in `dhis.conf`
ipv4_address: 172.26.0.10
environment:
- HOST=${HOST}
- PORT=${PORT}
- DHIS2_CORE_URL=${DHIS2_CORE_URL}
- DHIS2_CORE_MAJOR_VERSION=${DHIS2_CORE_MAJOR_VERSION}
- DHIS2_CORE_ADMIN_USERNAME=${DHIS2_CORE_ADMIN_USERNAME}
- DHIS2_CORE_ADMIN_PASSWORD=${DHIS2_CORE_ADMIN_PASSWORD}
- DHIS2_CORE_SESSION_TIMEOUT=${DHIS2_CORE_SESSION_TIMEOUT}
- MAX_THREADS=${MAX_THREADS}
- NODE_ENV=${NODE_ENV}
- LOG_LEVEL=${LOG_LEVEL}
- PUSH_ANALYTICS_IMAGE=${PUSH_ANALYTICS_IMAGE}
# ensure line-listing is installed and analytics tables have been generated
depends_on:
post-install-scripts:
condition: service_completed_successfully
e2e:
hostname: e2e
image: node:lts-alpine
networks:
mynetwork:
ipv4_address: 172.26.0.12
environment:
- HOST=${HOST}
- PORT=${PORT}
command: >
sh -c "npm install npm@latest -g &&
npm ci --yes --ignore-scripts --include=dev &&
npx tsc -p ./tsconfig.e2e.json --noEmit && TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true node --test --test-reporter spec --require ts-node/register $(find ./e2e -name '*.e2e.ts')"
working_dir: /opt/app
volumes:
- ./package.json:/opt/app/package.json
- ./package-lock.json:/opt/app/package-lock.json
- ./tsconfig.json:/opt/app/tsconfig.json
- ./tsconfig.e2e.json:/opt/app/tsconfig.e2e.json
- ./e2e:/opt/app/e2e
volumes:
db-dump:
networks:
mynetwork:
ipam:
config:
- subnet: 172.26.0.0/24