forked from baosystems/docker-dhis2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
137 lines (130 loc) · 4.13 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
---
volumes:
dhis2_files:
dhis2_init_progress:
pass_pg_dhis:
pass_pg_postgres:
pg_data:
services:
pass_init:
image: busybox
volumes:
- type: volume
source: pass_pg_dhis
target: /pass_pg_dhis
- type: volume
source: pass_pg_postgres
target: /pass_pg_postgres
command: >
sh -c "
if [[ ! -f /pass_pg_dhis/pass_pg_dhis.txt ]] ; then
echo '[INFO]: Generating random string for /pass_pg_dhis/pass_pg_dhis.txt'
tr -d '-' < /proc/sys/kernel/random/uuid | base64 | head -c 32 > /pass_pg_dhis/pass_pg_dhis.txt
fi ;
if [[ ! -f /pass_pg_postgres/pass_pg_postgres.txt ]] ; then
echo '[INFO]: Generating random string for /pass_pg_postgres/pass_pg_postgres.txt'
tr -d '-' < /proc/sys/kernel/random/uuid | base64 | head -c 32 > /pass_pg_postgres/pass_pg_postgres.txt
fi
"
database:
image: ghcr.io/baosystems/postgis:${POSTGIS_TAG:-14}
depends_on:
pass_init:
condition: service_completed_successfully
restart: unless-stopped
volumes:
- type: volume
source: pass_pg_postgres
target: /pass_pg_postgres
read_only: true
- type: volume
source: pg_data
target: /var/lib/postgresql/data
volume:
nocopy: true
environment:
POSTGRES_PASSWORD_FILE: /pass_pg_postgres/pass_pg_postgres.txt
shm_size: 256mb # https://github.com/docker-library/postgres/issues/416
command: > # Options "synchronous_commit" through "max_locks_per_transaction" are some of the DHIS2 recommendations (https://docs.dhis2.org/en/manage/performing-system-administration/dhis-core-version-236/installation.html#install_postgresql_installation)
postgres
-c "listen_addresses=*"
-c "synchronous_commit=off"
-c "checkpoint_completion_target=0.8"
-c "wal_writer_delay=10000ms"
-c "random_page_cost=1.1"
-c "max_locks_per_transaction=96"
healthcheck:
test: ["CMD", "pg_isready", "-Upostgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 2s
dhis2_init:
image: ghcr.io/baosystems/dhis2:${DHIS2_TAG:-latest}
depends_on:
database:
condition: service_healthy
volumes:
- type: volume
source: dhis2_init_progress
target: /dhis2-init.progress
- type: volume
source: dhis2_files
target: /opt/dhis2/files
volume:
nocopy: true
- type: volume
source: pass_pg_dhis
target: /pass_pg_dhis
read_only: true
- type: volume
source: pass_pg_postgres
target: /pass_pg_postgres
read_only: true
environment:
DHIS2_DATABASE_HOST: database # Matches the name of the Compose service running PostgreSQL
DHIS2_DATABASE_PASSWORD_FILE: /pass_pg_dhis/pass_pg_dhis.txt
DHIS2_INIT_SKIP: 20_dhis2-initwar.sh # String like "item1.sh,item2.sh"
PGPASSWORD_FILE: /pass_pg_postgres/pass_pg_postgres.txt
command:
- dhis2-init.sh # Override the image default
dhis2:
image: ghcr.io/baosystems/dhis2:${DHIS2_TAG:-latest}
depends_on:
database:
condition: service_healthy
dhis2_init:
condition: service_completed_successfully
restart: unless-stopped
volumes:
- type: volume
source: dhis2_files
target: /opt/dhis2/files
- type: volume
source: pass_pg_dhis
target: /pass_pg_dhis
read_only: true
environment:
DHIS2_DATABASE_HOST: database
DHIS2_DATABASE_PASSWORD_FILE: /pass_pg_dhis/pass_pg_dhis.txt
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8080/dhis-web-commons/security/login.action"]
interval: 1m30s
timeout: 30s
retries: 3
start_period: 60s
reverse_proxy:
image: caddy:${CADDY_TAG:-latest}
depends_on:
dhis2:
condition: service_started
restart: unless-stopped
command:
- "caddy"
- "reverse-proxy"
- "--from=:8080"
- "--to=dhis2:8080"
ports:
- target: 8080
published: 8080 # Accessible on port 8080 on the host machine
protocol: tcp