-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
155 lines (144 loc) · 4.99 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
services:
web:
build:
dockerfile: Dockerfile
## Old docker-compose asked for context but this was still insufficient
## since it could then "link" the built image here to be used for the worker
# context: .
image: datalad-registry
depends_on:
broker:
condition: service_healthy
db:
condition: service_healthy
ports:
- "${WEB_PORT_AT_HOST}:5000"
environment: &env
FLASK_APP: "datalad_registry:create_app"
DATALAD_REGISTRY_OPERATION_MODE: "${DATALAD_REGISTRY_OPERATION_MODE}"
DATALAD_REGISTRY_INSTANCE_PATH: /app/instance
DATALAD_REGISTRY_DATASET_CACHE: /data/cache
# URL for any service to reach the web service API
DATALAD_REGISTRY_WEB_API_URL: "http://web:5000/api/v2"
CELERY_BROKER_URL: "${CELERY_BROKER_URL}"
CELERY_RESULT_BACKEND: "redis://backend:6379"
# db service access info
SQLALCHEMY_DATABASE_URI: "${SQLALCHEMY_DATABASE_URI}"
command: [ "/sbin/my_init", "--", "bash", "-c", "flask init-db && exec flask run --host=0.0.0.0" ]
volumes:
- ${WEB_PATH_AT_HOST}/instance:/app/instance
worker:
image: datalad-registry
depends_on:
broker:
condition: service_healthy
db:
condition: service_healthy
command: [
"/sbin/my_init", "--",
"celery", "-A", "datalad_registry.make_celery:celery_app", "worker", "--loglevel", "INFO", "--pool", "prefork"
]
volumes:
- ${WORKER_PATH_AT_HOST}/data/cache:/data/cache
environment:
<<: *env
healthcheck:
test: celery -A datalad_registry.make_celery:celery_app status --timeout 1 --json | grep pong
interval: 30s
timeout: 30s
retries: 3
start_period: 3m
scheduler:
image: datalad-registry
depends_on:
broker:
condition: service_healthy
command: [
"/sbin/my_init", "--",
"celery", "-A", "datalad_registry.make_celery:celery_app", "beat", "-s", "/data/celerybeat-schedule", "-l", "INFO"
]
volumes:
- ${SCHEDULER_PATH_AT_HOST}/data:/data
environment:
<<: *env
healthcheck:
test: celery -A datalad_registry.make_celery:celery_app status --timeout 1 --json | grep pong
interval: 30s
timeout: 30s
retries: 3
start_period: 3m
# Monitor for Celery service
monitor:
image: datalad-registry
depends_on:
broker:
condition: service_healthy
environment:
<<: *env
FLOWER_BROKER_API: "${FLOWER_BROKER_API}"
FLOWER_PERSISTENT: "True"
FLOWER_DB: "/data/flower"
FLOWER_STATE_SAVE_INTERVAL: "60000" # 1 minute (in milliseconds)
FLOWER_NATURAL_TIME: "True"
FLOWER_BASIC_AUTH: "$FLOWER_BASIC_AUTH"
ports:
- "127.0.0.1:${MONITOR_PORT_AT_HOST}:5555"
command: [ "/sbin/my_init", "--", "celery", "-A", "datalad_registry.make_celery:celery_app", "flower" ]
volumes:
- ${MONITOR_PATH_AT_HOST}/data:/data
healthcheck:
test: RESPONSE=$$(curl -s http://localhost:5555/healthcheck); echo $$RESPONSE; if [ "$$RESPONSE" = "OK" ]; then exit 0; else exit 1; fi
interval: 30s
timeout: 30s
retries: 3
start_period: 3m
broker:
image: docker.io/rabbitmq:3-management
hostname: dlreg-broker
environment:
RABBITMQ_DEFAULT_USER: "${RABBITMQ_DEFAULT_USER}"
RABBITMQ_DEFAULT_PASS: "${RABBITMQ_DEFAULT_PASS}"
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbit consumer_timeout 43200000" # 12 hours in milliseconds
ports:
- "127.0.0.1:${BROKER_PORT_AT_HOST}:5672"
- "127.0.0.1:${BROKER_MANAGEMENT_PORT_AT_HOST}:15672"
userns_mode: "keep-id" # This has an effect only after podman-compose 1.0.3 possibly
# See https://github.com/containers/podman-compose/issues/166
# for details.
# For podman-compose 1.0.3 or earlier, use
# `PODMAN_USERNS=keep-id podman-compose up`
volumes:
- ${BROKER_PATH_AT_HOST}/home:/var/lib/rabbitmq
healthcheck: # https://www.rabbitmq.com/monitoring.html#health-checks
test: rabbitmq-diagnostics ping
interval: 30s
timeout: 30s
retries: 3
start_period: 1m
# Result backend for Celery
backend:
image: docker.io/redis:7
ports:
- "127.0.0.1:${BACKEND_PORT_AT_HOST}:6379"
db:
image: docker.io/postgres:15
environment:
POSTGRES_DB: "${POSTGRES_DB}"
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_INITDB_ARGS: --encoding utf8 --locale C
ports:
- "${DB_PORT_AT_HOST}:5432"
userns_mode: "keep-id" # This has an effect only after podman-compose 1.0.3 possibly
# See https://github.com/containers/podman-compose/issues/166
# for details.
# For podman-compose 1.0.3 or earlier, use
# `PODMAN_USERNS=keep-id podman-compose up`
volumes:
- ${DB_PATH_AT_HOST}/data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
interval: 30s
timeout: 30s
retries: 3
start_period: 1m