@@ -865,11 +865,21 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
865
865
- traefik.http.routers.rabbitmq.entrypoints=web
866
866
- traefik.http.routers.rabbitmq.rule=Host(`rabbitmq.pecan.localhost`)
867
867
volumes: rabbitmq:/var/lib/rabbitmq
868
+ healthcheck:
869
+ test: rabbitmqctl ping
870
+ interval: 10s
871
+ timeout: 5s
872
+ retries: 5
868
873
postgres:
869
874
image: mdillon/postgis:9.5
870
875
restart: unless-stopped
871
876
networks: pecan
872
877
volumes: postgres:/var/lib/postgresql/data
878
+ healthcheck:
879
+ test: pg_isready -U postgres
880
+ interval: 10s
881
+ timeout: 5s
882
+ retries: 5
873
883
bety:
874
884
image: pecan/bety:${BETY_VERSION:-latest}
875
885
restart: unless-stopped
@@ -880,19 +890,29 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
880
890
- RAILS_RELATIVE_URL_ROOT=/bety
881
891
- LOCAL_SERVER=${BETY_LOCAL_SERVER:-99}
882
892
volumes: bety:/home/bety/log
883
- depends_on: postgres
893
+ depends_on:
894
+ postgres:
895
+ condition: service_healthy
884
896
labels:
885
897
- traefik.enable=true
886
898
- traefik.http.services.bety.loadbalancer.server.port=8000
887
899
- traefik.http.routers.bety.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/bety/`)
900
+ healthcheck:
901
+ test: curl --silent --fail http://localhost:8000/${RAILS_RELATIVE_URL_ROOT}
902
+ > /dev/null || exit 1
903
+ interval: 10s
904
+ timeout: 5s
905
+ retries: 5
888
906
rstudio:
889
907
image: pecan/base:${PECAN_VERSION:-latest}
890
908
command: /work/rstudio.sh
891
909
restart: unless-stopped
892
910
networks: pecan
893
911
depends_on:
894
- - rabbitmq
895
- - postgres
912
+ postgres:
913
+ condition: service_healthy
914
+ rabbitmq:
915
+ condition: service_healthy
896
916
environment:
897
917
- KEEP_ENV=RABBITMQ_URI RABBITMQ_PREFIX RABBITMQ_PORT FQDN NAME
898
918
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
@@ -928,6 +948,11 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
928
948
- traefik.enable=true
929
949
- traefik.http.services.docs.loadbalancer.server.port=80
930
950
- traefik.http.routers.docs.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/`)
951
+ healthcheck:
952
+ test: curl --silent --fail http://localhost/ > /dev/null || exit 1
953
+ interval: 10s
954
+ timeout: 5s
955
+ retries: 5
931
956
pecan:
932
957
user: ${UID:-1001}:${GID:-1001}
933
958
image: pecan/web:${PECAN_VERSION:-latest}
@@ -939,8 +964,10 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
939
964
- NAME=${PECAN_NAME:-docker}
940
965
- SECRET_KEY_BASE=${BETY_SECRET_KEY:-thisisnotasecret}
941
966
depends_on:
942
- - postgres
943
- - rabbitmq
967
+ postgres:
968
+ condition: service_healthy
969
+ rabbitmq:
970
+ condition: service_healthy
944
971
labels:
945
972
- traefik.enable=true
946
973
- traefik.http.services.pecan.loadbalancer.server.port=8080
@@ -949,6 +976,11 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
949
976
volumes:
950
977
- pecan:/data
951
978
- pecan:/var/www/html/pecan/data
979
+ healthcheck:
980
+ test: curl --silent --fail http://localhost/pecan/ > /dev/null || exit 1
981
+ interval: 10s
982
+ timeout: 5s
983
+ retries: 5
952
984
monitor:
953
985
user: ${UID:-1001}:${GID:-1001}
954
986
image: pecan/monitor:${PECAN_VERSION:-latest}
@@ -957,14 +989,24 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
957
989
environment:
958
990
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
959
991
- FQDN=${PECAN_FQDN:-docker}
960
- depends_on: rabbitmq
992
+ depends_on:
993
+ postgres:
994
+ condition: service_healthy
995
+ rabbitmq:
996
+ condition: service_healthy
961
997
labels:
962
998
- traefik.enable=true
963
999
- traefik.http.routers.monitor.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) &&
964
1000
PathPrefix(`/monitor/`)
965
1001
- traefik.http.routers.monitor.middlewares=monitor-stripprefix
966
1002
- traefik.http.middlewares.monitor-stripprefix.stripprefix.prefixes=/monitor
967
1003
volumes: pecan:/data
1004
+ healthcheck:
1005
+ test: curl --silent --fail http://localhost:9999/monitor/ > /dev/null || exit
1006
+ 1
1007
+ interval: 10s
1008
+ timeout: 5s
1009
+ retries: 5
968
1010
executor:
969
1011
user: ${UID:-1001}:${GID:-1001}
970
1012
image: pecan/executor:${PECAN_VERSION:-latest}
@@ -976,68 +1018,89 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
976
1018
- RABBITMQ_PORT=15672
977
1019
- FQDN=${PECAN_FQDN:-docker}
978
1020
depends_on:
979
- - postgres
980
- - rabbitmq
1021
+ postgres:
1022
+ condition: service_healthy
1023
+ rabbitmq:
1024
+ condition: service_healthy
981
1025
volumes: pecan:/data
982
1026
fates:
983
1027
user: ${UID:-1001}:${GID:-1001}
984
1028
image: ghcr.io/noresmhub/ctsm-api:latest
985
1029
restart: unless-stopped
986
1030
networks: pecan
987
1031
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
988
- depends_on: rabbitmq
1032
+ depends_on:
1033
+ rabbitmq:
1034
+ condition: service_healthy
989
1035
volumes: pecan:/data
990
1036
basgra:
991
1037
user: ${UID:-1001}:${GID:-1001}
992
1038
image: pecan/model-basgra-basgra_n_v1.0:${PECAN_VERSION:-latest}
993
1039
restart: unless-stopped
994
1040
networks: pecan
995
1041
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
996
- depends_on: rabbitmq
1042
+ depends_on:
1043
+ rabbitmq:
1044
+ condition: service_healthy
997
1045
volumes: pecan:/data
998
1046
sipnet:
999
1047
user: ${UID:-1001}:${GID:-1001}
1000
1048
image: pecan/model-sipnet-git:${PECAN_VERSION:-latest}
1001
1049
restart: unless-stopped
1002
1050
networks: pecan
1003
1051
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1004
- depends_on: rabbitmq
1052
+ depends_on:
1053
+ rabbitmq:
1054
+ condition: service_healthy
1005
1055
volumes: pecan:/data
1006
1056
ed2:
1007
1057
user: ${UID:-1001}:${GID:-1001}
1008
1058
image: pecan/model-ed2-2.2.0:${PECAN_VERSION:-latest}
1009
1059
restart: unless-stopped
1010
1060
networks: pecan
1011
1061
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1012
- depends_on: rabbitmq
1062
+ depends_on:
1063
+ rabbitmq:
1064
+ condition: service_healthy
1013
1065
volumes: pecan:/data
1014
1066
maespa:
1015
1067
user: ${UID:-1001}:${GID:-1001}
1016
1068
image: pecan/model-maespa-git:${PECAN_VERSION:-latest}
1017
1069
restart: unless-stopped
1018
1070
networks: pecan
1019
1071
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1020
- depends_on: rabbitmq
1072
+ depends_on:
1073
+ rabbitmq:
1074
+ condition: service_healthy
1021
1075
volumes: pecan:/data
1022
1076
biocro:
1023
1077
user: ${UID:-1001}:${GID:-1001}
1024
1078
image: pecan/model-biocro-0.95:${PECAN_VERSION:-latest}
1025
1079
restart: unless-stopped
1026
1080
networks: pecan
1027
1081
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1028
- depends_on: rabbitmq
1082
+ depends_on:
1083
+ rabbitmq:
1084
+ condition: service_healthy
1029
1085
volumes: pecan:/data
1030
1086
dbsync:
1031
1087
image: pecan/shiny-dbsync:${PECAN_VERSION:-latest}
1032
1088
restart: unless-stopped
1033
1089
networks: pecan
1034
- depends_on: postgres
1090
+ depends_on:
1091
+ postgres:
1092
+ condition: service_healthy
1035
1093
labels:
1036
1094
- traefik.enable=true
1037
1095
- traefik.http.routers.dbsync.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) &&
1038
1096
PathPrefix(`/dbsync/`)
1039
1097
- traefik.http.routers.dbsync.middlewares=dbsync-stripprefix
1040
1098
- traefik.http.middlewares.dbsync-stripprefix.stripprefix.prefixes=/monitor
1099
+ healthcheck:
1100
+ test: curl --silent --fail http://localhost/dbsync/ > /dev/null || exit 1
1101
+ interval: 10s
1102
+ timeout: 5s
1103
+ retries: 5
1041
1104
api:
1042
1105
user: ${UID:-1001}:${GID:-1001}
1043
1106
image: pecan/api:${PECAN_VERSION:-latest}
@@ -1055,8 +1118,15 @@ <h3><span class="header-section-number">25.4.2</span> PEcAn’s <code>docker-com
1055
1118
- traefik.enable=true
1056
1119
- traefik.http.routers.api.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/api/`)
1057
1120
- traefik.http.services.api.loadbalancer.server.port=8000
1058
- depends_on: postgres
1121
+ depends_on:
1122
+ postgres:
1123
+ condition: service_healthy
1059
1124
volumes: pecan:/data/
1125
+ healthcheck:
1126
+ test: curl --silent --fail http://localhost/api/ping > /dev/null || exit 1
1127
+ interval: 10s
1128
+ timeout: 5s
1129
+ retries: 5
1060
1130
networks:
1061
1131
pecan: ~
1062
1132
volumes:
@@ -1270,7 +1340,12 @@ <h3><span class="header-section-number">25.4.8</span> <code>postgres</code><a hr
1270
1340
image: mdillon/postgis:9.5
1271
1341
restart: unless-stopped
1272
1342
networks: pecan
1273
- volumes: postgres:/var/lib/postgresql/data</ code > </ pre >
1343
+ volumes: postgres:/var/lib/postgresql/data
1344
+ healthcheck:
1345
+ test: pg_isready -U postgres
1346
+ interval: 10s
1347
+ timeout: 5s
1348
+ retries: 5</ code > </ pre >
1274
1349
< p > Some additional details about our configuration:</ p >
1275
1350
< ul >
1276
1351
< li > < p > < code > image</ code > – This pulls a container with PostgreSQL + PostGIS pre-installed.
@@ -1298,7 +1373,12 @@ <h3><span class="header-section-number">25.4.9</span> <code>rabbitmq</code><a hr
1298
1373
- traefik.http.services.rabbitmq.loadbalancer.server.port=15672
1299
1374
- traefik.http.routers.rabbitmq.entrypoints=web
1300
1375
- traefik.http.routers.rabbitmq.rule=Host(`rabbitmq.pecan.localhost`)
1301
- volumes: rabbitmq:/var/lib/rabbitmq</ code > </ pre >
1376
+ volumes: rabbitmq:/var/lib/rabbitmq
1377
+ healthcheck:
1378
+ test: rabbitmqctl ping
1379
+ interval: 10s
1380
+ timeout: 5s
1381
+ retries: 5</ code > </ pre >
1302
1382
< p > Note that the < code > traefik.http.routers.rabbitmq.rule</ code > indicates that browsing to < a href ="http://rabbitmq.pecan.localhost/ " class ="uri "> http://rabbitmq.pecan.localhost/</ a > leads to the RabbitMQ management console.</ p >
1303
1383
< p > By default, the RabbitMQ management console has username/password < code > guest/guest</ code > , which is highly insecure.
1304
1384
For production instances of PEcAn, we highly recommend changing these credentials to something more secure, and removing access to the RabbitMQ management console via Traefik.</ p >
@@ -1319,11 +1399,19 @@ <h3><span class="header-section-number">25.4.10</span> <code>bety</code><a href=
1319
1399
- RAILS_RELATIVE_URL_ROOT=/bety
1320
1400
- LOCAL_SERVER=${BETY_LOCAL_SERVER:-99}
1321
1401
volumes: bety:/home/bety/log
1322
- depends_on: postgres
1402
+ depends_on:
1403
+ postgres:
1404
+ condition: service_healthy
1323
1405
labels:
1324
1406
- traefik.enable=true
1325
1407
- traefik.http.services.bety.loadbalancer.server.port=8000
1326
- - traefik.http.routers.bety.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/bety/`)</ code > </ pre >
1408
+ - traefik.http.routers.bety.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/bety/`)
1409
+ healthcheck:
1410
+ test: curl --silent --fail http://localhost:8000/${RAILS_RELATIVE_URL_ROOT} >
1411
+ /dev/null || exit 1
1412
+ interval: 10s
1413
+ timeout: 5s
1414
+ retries: 5</ code > </ pre >
1327
1415
< p > The BETY container Dockerfile is located in the root directory of the < a href ="https://github.com/PecanProject/bety "> BETY GitHub repository</ a > (< a href ="https://github.com/PecanProject/bety/blob/master/Dockerfile "> direct link</ a > ).</ p >
1328
1416
</ div >
1329
1417
< div id ="pecan-dc-docs " class ="section level3 hasAnchor " number ="25.4.11 ">
@@ -1337,7 +1425,12 @@ <h3><span class="header-section-number">25.4.11</span> <code>docs</code><a href=
1337
1425
labels:
1338
1426
- traefik.enable=true
1339
1427
- traefik.http.services.docs.loadbalancer.server.port=80
1340
- - traefik.http.routers.docs.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/`)</ code > </ pre >
1428
+ - traefik.http.routers.docs.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/`)
1429
+ healthcheck:
1430
+ test: curl --silent --fail http://localhost/ > /dev/null || exit 1
1431
+ interval: 10s
1432
+ timeout: 5s
1433
+ retries: 5</ code > </ pre >
1341
1434
</ div >
1342
1435
< div id ="pecan-dc-web " class ="section level3 hasAnchor " number ="25.4.12 ">
1343
1436
< h3 > < span class ="header-section-number "> 25.4.12</ span > < code > web</ code > < a href ="pecan-docker.html#pecan-dc-web " class ="anchor-section " aria-label ="Anchor link to header "> </ a > </ h3 >
@@ -1364,8 +1457,10 @@ <h3><span class="header-section-number">25.4.13</span> <code>executor</code><a h
1364
1457
- RABBITMQ_PORT=15672
1365
1458
- FQDN=${PECAN_FQDN:-docker}
1366
1459
depends_on:
1367
- - postgres
1368
- - rabbitmq
1460
+ postgres:
1461
+ condition: service_healthy
1462
+ rabbitmq:
1463
+ condition: service_healthy
1369
1464
volumes: pecan:/data</ code > </ pre >
1370
1465
< p > Its Dockerfile is ships with the PEcAn source code, in < a href ="https://github.com/PecanProject/pecan/blob/develop/docker/executor/Dockerfile "> < code > docker/executor/Dockerfile</ code > </ a > .
1371
1466
Its image is built on top of the < code > pecan/base</ code > image (< a href ="https://github.com/PecanProject/pecan/blob/develop/docker/base/Dockerfile "> < code > docker/base/Dockerfile</ code > </ a > ), which contains the actual PEcAn source.
@@ -1386,14 +1481,24 @@ <h3><span class="header-section-number">25.4.14</span> <code>monitor</code><a hr
1386
1481
environment:
1387
1482
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1388
1483
- FQDN=${PECAN_FQDN:-docker}
1389
- depends_on: rabbitmq
1484
+ depends_on:
1485
+ postgres:
1486
+ condition: service_healthy
1487
+ rabbitmq:
1488
+ condition: service_healthy
1390
1489
labels:
1391
1490
- traefik.enable=true
1392
1491
- traefik.http.routers.monitor.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) &&
1393
1492
PathPrefix(`/monitor/`)
1394
1493
- traefik.http.routers.monitor.middlewares=monitor-stripprefix
1395
1494
- traefik.http.middlewares.monitor-stripprefix.stripprefix.prefixes=/monitor
1396
- volumes: pecan:/data</ code > </ pre >
1495
+ volumes: pecan:/data
1496
+ healthcheck:
1497
+ test: curl --silent --fail http://localhost:9999/monitor/ > /dev/null || exit
1498
+ 1
1499
+ interval: 10s
1500
+ timeout: 5s
1501
+ retries: 5</ code > </ pre >
1397
1502
</ div >
1398
1503
< div id ="pecan-dc-models " class ="section level3 hasAnchor " number ="25.4.15 ">
1399
1504
< h3 > < span class ="header-section-number "> 25.4.15</ span > Model-specific containers< a href ="pecan-docker.html#pecan-dc-models " class ="anchor-section " aria-label ="Anchor link to header "> </ a > </ h3 >
@@ -1405,7 +1510,9 @@ <h3><span class="header-section-number">25.4.15</span> Model-specific containers
1405
1510
restart: unless-stopped
1406
1511
networks: pecan
1407
1512
environment: RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
1408
- depends_on: rabbitmq
1513
+ depends_on:
1514
+ rabbitmq:
1515
+ condition: service_healthy
1409
1516
volumes: pecan:/data</ code > </ pre >
1410
1517
< p > The PEcAn source contains Dockerfiles for ED2 (< a href ="https://github.com/PecanProject/pecan/blob/develop/models/ed/Dockerfile. "> < code > models/ed/Dockerfile</ code > </ a > ) and SIPNET (< a href ="https://github.com/PecanProject/pecan/blob/develop/models/sipnet/Dockerfile "> < code > models/sipnet/Dockerfile</ code > </ a > ) that can serve as references.
1411
1518
For additional tips on constructing a Dockerfile for your model, see < a href ="model-docker.html#model-docker "> Dockerfiles for Models</ a > .</ p >
0 commit comments