Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
152 lines (143 loc) · 4.38 KB
/
Copy pathdocker-compose.yml
File metadata and controls
152 lines (143 loc) · 4.38 KB
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
# Copyright © 2021-2025 Geospatial Research Institute Toi Hangarau
# LICENSE: https://github.com/GeospatialResearch/Digital-Twins/blob/master/LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Defines services, their images, and interactions between services.
volumes:
postgres_db_vol:
stored_data:
geoserver_data:
services:
db_postgres:
# Database to store all vector data, states, and links to raster data.
image: postgis/postgis:16-3.5
container_name: db_postgres_digital_twin
restart: always
ports:
- "${POSTGRES_PORT}:5432"
volumes:
- postgres_db_vol:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
healthcheck:
test: pg_isready -h 127.0.0.1 -U $POSTGRES_USER -d $POSTGRES_DB
backend:
# Performs analysis, computation, handles web requests, facilitates database interactions
build:
context: .
dockerfile: src/Dockerfile
container_name: backend_digital_twin
entrypoint: ["src/backend_entrypoint.sh"]
env_file:
- .env
- api_keys.env
- .env.docker-override
volumes:
- stored_data:/stored_data
healthcheck:
test: curl --fail -s http://localhost:5000/ || exit 1
interval: 10s
timeout: 5s
retries: 10
ports:
- "5000:5000"
depends_on:
- db_postgres
- message_broker
- geoserver
celery_worker:
# Performs tasks such as complex computation asynchronously on behalf of backend
build:
context: .
dockerfile: src/Dockerfile
container_name: celery_worker_digital_twin
entrypoint: ["src/celery_worker_entrypoint.sh"]
restart: always
env_file:
- .env
- api_keys.env
- .env.docker-override
volumes:
# Bind host data directories to container, allowing different instances to share data sources.
- stored_data:/stored_data
- geoserver_data:/stored_data/geoserver
ports:
- "5001:5001"
healthcheck:
test: curl --fail -s http://localhost:5001/ || exit 1
interval: 10s
timeout: 5s
retries: 10
depends_on:
- db_postgres
- message_broker
- geoserver
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all # Use all available GPUs
capabilities: [ gpu ]
geoserver:
# Serves geospatial web data through interactions with files and database
build:
context: .
dockerfile: geoserver.Dockerfile
container_name: geoserver_digital_twin
volumes:
- geoserver_data:/opt/geoserver_data
depends_on:
- db_postgres
environment:
- SKIP_DEMO_DATA=true
- CORS_ENABLED=true
- ROOT_WEBAPP_REDIRECT=true
- GEOSERVER_ADMIN_USER=$GEOSERVER_ADMIN_NAME
- GEOSERVER_ADMIN_PASSWORD=$GEOSERVER_ADMIN_PASSWORD
ports:
- "${GEOSERVER_PORT}:8080"
restart: always
healthcheck:
test: curl --fail -s http://localhost:8080/geoserver || exit 1
timeout: 5s
retries: 10
terria_map:
# Front-end using terria.js
build:
context: terriajs
ports:
- "${WWW_PORT}:3001"
environment:
- CESIUM_ACCESS_TOKEN=$CESIUM_ACCESS_TOKEN
- LINZ_BASEMAPS_API_KEY=$LINZ_BASEMAPS_API_KEY
- BACKEND_HOST=$BACKEND_HOST
- BACKEND_PORT=$BACKEND_PORT
healthcheck:
test: curl --fail -s http://localhost:3001/ || exit 1
timeout: 5s
retries: 10
message_broker:
# Communicates between backend and workers to assign tasks and store state
image: redis:7
container_name: message_broker_digital_twin
ports:
- "6379:6379"
healthcheck:
test: redis-cli ping | grep PONG
timeout: 1s
retries: 10
restart: always