-
Notifications
You must be signed in to change notification settings - Fork 234
/
docker-compose.yml
413 lines (390 loc) · 13.2 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
services:
# webserver to handle all traffic. This can use let's encrypt to generate a SSL cert.
traefik:
image: "traefik:v2.9"
command:
- --log.level=INFO
- --api=true
- --api.dashboard=true
# Entrypoints
- --entrypoints.web.address=:80
# Docker setup
- --providers.docker=true
- --providers.docker.endpoint=unix:///var/run/docker.sock
- --providers.docker.exposedbydefault=false
- --providers.docker.watch=true
restart: "unless-stopped"
networks:
- pecan
security_opt:
- no-new-privileges:true
ports:
- "${TRAEFIK_HTTP_PORT-80}:80"
volumes:
- "traefik:/config"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=web"
- "traefik.http.routers.traefik.rule=Host(`traefik.pecan.localhost`)"
- "traefik.http.routers.traefik.service=api@internal"
# ----------------------------------------------------------------------
# Job management system. Jobs are distributed through the message
# system. PEcAn uses this to distribute the work/load across multiple
# containers.
# ----------------------------------------------------------------------
# rabbitmq to connect to extractors
rabbitmq:
image: rabbitmq:3.8-management
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-guest}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-guest}
labels:
- "traefik.enable=true"
- "traefik.http.services.rabbitmq.loadbalancer.server.port=15672"
- "traefik.http.routers.rabbitmq.entrypoints=web"
- "traefik.http.routers.rabbitmq.rule=Host(`rabbitmq.pecan.localhost`)"
volumes:
- rabbitmq:/var/lib/rabbitmq
healthcheck:
test: rabbitmqctl ping
interval: 10s
timeout: 5s
retries: 5
# ----------------------------------------------------------------------
# Database to hold the data from PEcAn and BETY.
# ----------------------------------------------------------------------
# postgresql + postgis to hold all the data
postgres:
image: mdillon/postgis:9.5
restart: unless-stopped
networks:
- pecan
volumes:
- postgres:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
interval: 10s
timeout: 5s
retries: 5
# ----------------------------------------------------------------------
# BETY rails frontend to the database
# ----------------------------------------------------------------------
bety:
image: pecan/bety:${BETY_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- UNICORN_WORKER_PROCESSES=1
- SECRET_KEY_BASE=${BETY_SECRET_KEY:-notasecret}
- RAILS_RELATIVE_URL_ROOT=/bety
- LOCAL_SERVER=${BETY_LOCAL_SERVER:-99}
volumes:
- bety:/home/bety/log
depends_on:
postgres:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.services.bety.loadbalancer.server.port=8000"
- "traefik.http.routers.bety.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/bety/`)"
healthcheck:
test: "curl --silent --fail http://localhost:8000/${RAILS_RELATIVE_URL_ROOT} > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# ----------------------------------------------------------------------
# RStudio
# ----------------------------------------------------------------------
rstudio:
image: pecan/base:${PECAN_VERSION:-latest}
command: /work/rstudio.sh
restart: unless-stopped
networks:
- pecan
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
- KEEP_ENV=RABBITMQ_URI RABBITMQ_PREFIX RABBITMQ_PORT FQDN NAME
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
- RABBITMQ_PREFIX=/
- RABBITMQ_PORT=15672
- FQDN=${PECAN_FQDN:-docker}
- NAME=${PECAN_NAME:-docker}
- USER=${PECAN_RSTUDIO_USER:-carya}
- PASSWORD=${PECAN_RSTUDIO_PASS:-illinois}
- USERID=${UID:-1001}
- GROUPID=${GID:-1001}
volumes:
- pecan:/data
- rstudio:/home
labels:
- "traefik.enable=true"
- "traefik.http.routers.rstudio.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/rstudio/`)"
- "traefik.http.routers.rstudio.service=rstudio"
- "traefik.http.routers.rstudio.middlewares=rstudio-stripprefix,rstudio-headers"
- "traefik.http.services.rstudio.loadbalancer.server.port=8787"
- "traefik.http.middlewares.rstudio-headers.headers.customrequestheaders.X-RStudio-Root-Path=/rstudio"
- "traefik.http.middlewares.rstudio-stripprefix.stripprefix.prefixes=/rstudio"
- "traefik.http.routers.rstudio-local.entrypoints=web"
- "traefik.http.routers.rstudio-local.rule=Host(`rstudio.pecan.localhost`)"
- "traefik.http.routers.rstudio-local.service=rstudio-local"
- "traefik.http.services.rstudio-local.loadbalancer.server.port=8787"
# ----------------------------------------------------------------------
# PEcAn application
# ----------------------------------------------------------------------
# PEcAn documentation as well as PEcAn home page
docs:
image: pecan/docs:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
labels:
- "traefik.enable=true"
- "traefik.http.services.docs.loadbalancer.server.port=80"
- "traefik.http.routers.docs.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/`)"
healthcheck:
test: "curl --silent --fail http://localhost/ > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# PEcAn web front end, this is just the PHP code
pecan:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/web:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
- FQDN=${PECAN_FQDN:-docker}
- NAME=${PECAN_NAME:-docker}
- SECRET_KEY_BASE=${BETY_SECRET_KEY:-thisisnotasecret}
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.services.pecan.loadbalancer.server.port=8080"
- "traefik.http.routers.pecan.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/pecan/`)"
volumes:
- pecan:/data
- pecan:/var/www/html/pecan/data
healthcheck:
test: "curl --silent --fail http://localhost/pecan/ > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# PEcAn model monitor
monitor:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/monitor:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
- FQDN=${PECAN_FQDN:-docker}
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.monitor.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/monitor/`)"
- "traefik.http.routers.monitor.middlewares=monitor-stripprefix"
- "traefik.http.middlewares.monitor-stripprefix.stripprefix.prefixes=/monitor"
volumes:
- pecan:/data
healthcheck:
test: "curl --silent --fail http://localhost:9999/monitor/ > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# PEcAn executor, executes jobs. Does not the actual models
executor:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/executor:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
- RABBITMQ_PREFIX=/
- RABBITMQ_PORT=15672
- FQDN=${PECAN_FQDN:-docker}
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# ----------------------------------------------------------------------
# PEcAn models, list each model you want to run below
# ----------------------------------------------------------------------
# PEcAn FATES model runner
fates:
user: "${UID:-1001}:${GID:-1001}"
image: ghcr.io/noresmhub/ctsm-api:latest
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# PEcAn basgra model runner
basgra:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/model-basgra-basgra_n_v1.0:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# PEcAn sipnet model runner
sipnet:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/model-sipnet-git:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# PEcAn ED model runner
ed2:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/model-ed2-2.2.0:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# PEcAn MAESPA model runner
maespa:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/model-maespa-git:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# PEcAn BioCro model runner
biocro:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/model-biocro-0.95:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
depends_on:
rabbitmq:
condition: service_healthy
volumes:
- pecan:/data
# ----------------------------------------------------------------------
# Shiny Apps
# ----------------------------------------------------------------------
# PEcAn DB Sync visualization
dbsync:
image: pecan/shiny-dbsync:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
depends_on:
postgres:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.dbsync.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/dbsync/`)"
- "traefik.http.routers.dbsync.middlewares=dbsync-stripprefix"
- "traefik.http.middlewares.dbsync-stripprefix.stripprefix.prefixes=/monitor"
healthcheck:
test: "curl --silent --fail http://localhost/dbsync/ > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# ----------------------------------------------------------------------
# PEcAn API
# ----------------------------------------------------------------------
api:
user: "${UID:-1001}:${GID:-1001}"
image: pecan/api:${PECAN_VERSION:-latest}
restart: unless-stopped
networks:
- pecan
environment:
- PGHOST=${PGHOST:-postgres}
- HOST_ONLY=${HOST_ONLY:-FALSE}
- AUTH_REQ=${AUTH_REQ:-FALSE}
- RABBITMQ_URI=${RABBITMQ_URI:-amqp://guest:guest@rabbitmq/%2F}
- DATA_DIR=${DATA_DIR:-/data/}
- DBFILES_DIR=${DBFILES_DIR:-/data/dbfiles/}
- SECRET_KEY_BASE=${BETY_SECRET_KEY:-thisisnotasecret}
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/api/`)"
- "traefik.http.services.api.loadbalancer.server.port=8000"
depends_on:
postgres:
condition: service_healthy
volumes:
- pecan:/data/
healthcheck:
test: "curl --silent --fail http://localhost/api/ping > /dev/null || exit 1"
interval: 10s
timeout: 5s
retries: 5
# ----------------------------------------------------------------------
# Name of network to be used by all containers
# ----------------------------------------------------------------------
networks:
pecan:
# ----------------------------------------------------------------------
# Volumes used by the PEcAn stack. These volumes are used to make sure
# we have persistent data. You can use add the commented section to your
# docker-compose.override.yml to have the docker volumes placed at a
# specific location.
# ----------------------------------------------------------------------
volumes:
traefik:
postgres:
bety:
rabbitmq:
pecan:
rstudio: