Skip to content

Commit 817973b

Browse files
committed
healthcheck for components + add dependencies
1 parent b72fd98 commit 817973b

File tree

5 files changed

+112
-12
lines changed

5 files changed

+112
-12
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
run-silent:
2-
docker-compose up -d
2+
docker compose up -d
33

44
run:
5-
docker-compose up
5+
docker compose up
66

77
# run without the docker-compose.override.yml
88
run-core:
9-
docker-compose -f docker-compose.yml up
9+
docker compose -f docker-compose.yml up

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ The default docker-compose file contains all geOrchestra modules.
3232

3333
It's recommended to double-check the `docker-compose.yml` and `docker-compose.override.yml` files if you need to comment useless modules (e.g extractor, mapstore,... ).
3434

35+
You need to use the new Compose plugin V2, `docker-compose` (V1) is not supported by default: [https://docs.docker.com/compose/install/linux/](https://docs.docker.com/compose/install/linux/).
36+
If you still want to use the old `docker-compose` (V1), you need to remove all the parameters `depends_on` from the files `docker-compose.yml` and `docker-compose.override.yml`.
37+
3538
To run:
3639

3740
```

docker-compose.override.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ services:
1919
georchestra-127-0-1-1.traefik.me:
2020
image: traefik:2.9
2121
depends_on:
22-
- traefik-me-certificate-downloader
22+
traefik-me-certificate-downloader:
23+
condition: service_completed_successfully
24+
healthcheck:
25+
test: traefik healthcheck --ping
2326
ports:
2427
- "80:80"
2528
- "443:443"

docker-compose.yml

+100-8
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ services:
4848

4949
proxy:
5050
image: georchestra/security-proxy:latest
51+
healthcheck:
52+
test: ["CMD-SHELL", "curl -s -f localhost:8080/_static/bootstrap_3.0.0/css/bootstrap-theme.min.css >/dev/null || exit 1"]
53+
interval: 30s
54+
timeout: 10s
55+
retries: 10
5156
depends_on:
52-
- ldap
53-
- database
57+
ldap:
58+
condition: service_healthy
59+
database:
60+
condition: service_healthy
5461
volumes:
5562
- ./config:/etc/georchestra
5663
environment:
@@ -61,8 +68,14 @@ services:
6168

6269
cas:
6370
image: georchestra/cas:latest
71+
healthcheck:
72+
test: ["CMD-SHELL", "curl -s -f localhost:8080/cas/login >/dev/null || exit 1"]
73+
interval: 30s
74+
timeout: 10s
75+
retries: 10
6476
depends_on:
65-
- ldap
77+
ldap:
78+
condition: service_healthy
6679
volumes:
6780
- ./config:/etc/georchestra
6881
environment:
@@ -73,6 +86,11 @@ services:
7386

7487
header:
7588
image: georchestra/header:latest
89+
healthcheck:
90+
test: ["CMD-SHELL", "curl -s -f localhost:8080/header/img/logo.png >/dev/null || exit 1"]
91+
interval: 30s
92+
timeout: 10s
93+
retries: 10
7694
volumes:
7795
- ./config:/etc/georchestra
7896
environment:
@@ -83,8 +101,16 @@ services:
83101

84102
geoserver:
85103
image: georchestra/geoserver:latest
104+
healthcheck:
105+
test: ["CMD-SHELL", "curl -s -f localhost:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&REQUEST=GetCapabilities >/dev/null || exit 1"]
106+
interval: 30s
107+
timeout: 10s
108+
retries: 10
86109
depends_on:
87-
- ldap
110+
ldap:
111+
condition: service_healthy
112+
database:
113+
condition: service_healthy
88114
volumes:
89115
- ./config:/etc/georchestra
90116
- geoserver_datadir:/mnt/geoserver_datadir
@@ -99,9 +125,16 @@ services:
99125

100126
console:
101127
image: georchestra/console:latest
128+
healthcheck:
129+
test: ["CMD-SHELL", "curl -s -f localhost:8080/console/account/new >/dev/null || exit 1"]
130+
interval: 30s
131+
timeout: 10s
132+
retries: 10
102133
depends_on:
103-
- ldap
104-
- database
134+
ldap:
135+
condition: service_healthy
136+
database:
137+
condition: service_healthy
105138
volumes:
106139
- ./config:/etc/georchestra
107140
environment:
@@ -112,6 +145,20 @@ services:
112145

113146
geonetwork:
114147
image: georchestra/geonetwork:latest
148+
healthcheck:
149+
test: ["CMD-SHELL", "curl -s -f localhost:8080/geonetwork/srv/eng/catalog.search >/dev/null || exit 1"]
150+
interval: 30s
151+
timeout: 10s
152+
retries: 10
153+
depends_on:
154+
console:
155+
condition: service_healthy
156+
database:
157+
condition: service_healthy
158+
kibana:
159+
condition: service_healthy
160+
elasticsearch:
161+
condition: service_healthy
115162
depends_on:
116163
- console
117164
- database
@@ -133,6 +180,11 @@ services:
133180

134181
datahub:
135182
image: geonetwork/geonetwork-ui-datahub:latest
183+
healthcheck:
184+
test: ["CMD-SHELL", "curl -s -f localhost:80/datahub/ >/dev/null || exit 1"]
185+
interval: 30s
186+
timeout: 10s
187+
retries: 10
136188
environment:
137189
ASSETS_DIRECTORY_OVERRIDE: /etc/georchestra/datahub/assets
138190
CONFIG_DIRECTORY_OVERRIDE: /etc/georchestra/datahub/conf
@@ -142,8 +194,14 @@ services:
142194

143195
analytics:
144196
image: georchestra/analytics:latest
197+
healthcheck:
198+
test: ["CMD-SHELL", "curl -s -f localhost:8080/analytics/ >/dev/null || exit 1"]
199+
interval: 30s
200+
timeout: 10s
201+
retries: 10
145202
depends_on:
146-
- database
203+
database:
204+
condition: service_healthy
147205
volumes:
148206
- ./config:/etc/georchestra
149207
environment:
@@ -154,8 +212,14 @@ services:
154212

155213
mapstore:
156214
image: georchestra/mapstore:latest
215+
healthcheck:
216+
test: ["CMD-SHELL", "curl -s -f localhost:8080/mapstore/configs/config.json >/dev/null || exit 1"]
217+
interval: 30s
218+
timeout: 10s
219+
retries: 10
157220
depends_on:
158-
- database
221+
database:
222+
condition: service_healthy
159223
volumes:
160224
- ./config:/etc/georchestra
161225
- mapstore_extensions:/mnt/mapstore_extensions
@@ -165,6 +229,11 @@ services:
165229
postgis:
166230
# used by datafeeder to ingest uploaded user datasets into
167231
image: postgis/postgis:13-3.1-alpine
232+
healthcheck:
233+
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
234+
interval: 10s
235+
timeout: 3s
236+
retries: 3
168237
environment:
169238
- POSTGRES_DB=datafeeder
170239
- POSTGRES_USER=georchestra
@@ -175,6 +244,16 @@ services:
175244

176245
datafeeder:
177246
image: georchestra/datafeeder:latest
247+
healthcheck:
248+
test: ["CMD-SHELL", "curl -s -f localhost:8080/datafeeder >/dev/null || exit 1"]
249+
interval: 30s
250+
timeout: 10s
251+
retries: 10
252+
depends_on:
253+
database:
254+
condition: service_healthy
255+
postgis:
256+
condition: service_healthy
178257
volumes:
179258
- ./config:/etc/georchestra
180259
- datafeeder_uploads:/tmp/datafeeder
@@ -183,16 +262,29 @@ services:
183262

184263
import:
185264
image: georchestra/datafeeder-frontend:latest
265+
healthcheck:
266+
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider localhost:80/ >/dev/null || exit 1"]
267+
interval: 30s
268+
timeout: 10s
269+
retries: 10
186270
volumes:
187271
- ./config:/etc/georchestra
188272

189273
elasticsearch:
190274
image: elasticsearch:7.9.0
275+
healthcheck:
276+
test: ["CMD-SHELL", "curl -s -f localhost:9200/_cat/health >/dev/null || exit 1"]
277+
interval: 30s
278+
timeout: 10s
279+
retries: 10
191280
environment:
192281
discovery.type: single-node
193282

194283
kibana:
195284
image: kibana:7.9.0
285+
depends_on:
286+
elasticsearch:
287+
condition: service_healthy
196288
environment:
197289
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
198290
volumes:

resources/traefik.yml

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ api:
2929

3030
log:
3131
level: INFO
32+
33+
ping: {}

0 commit comments

Comments
 (0)