-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
171 lines (158 loc) · 4.75 KB
/
Copy pathdocker-compose.yml
File metadata and controls
171 lines (158 loc) · 4.75 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: relier-cluster
# =============================================================================
# Local development stack, lightweight single-node Redis.
#
# Dev runs ONE Redis node (Sentinel disabled) to stay fast. Persistence is
# still on: redis.conf enables AOF + RDB, so dev data survives restarts.
#
# What dev does NOT exercise is failover. To test the Sentinel / HA path
# locally, run the full topology from the production manifest instead:
#
# REDIS_PASSWORD=dev SENTINEL_PASSWORD=dev \
# docker compose -f docker-compose.prod.yml up
#
# Production always uses docker-compose.prod.yml (master + replicas + Sentinels).
# =============================================================================
# Shared environment injected into every app container.
x-app-env: &app-env
RELIER_REDIS_URL: redis://redis:6379/0
RELIER_OTEL_ENABLED: "true"
RELIER_OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4317
services:
# =====================================================================
# Infrastructure
# =====================================================================
redis:
image: redis:7.2-alpine
container_name: relier-redis
# Shares the data-node config with the HA topology so dev and prod have
# identical persistence behaviour (AOF + RDB + noeviction). The replication
# directives in the file are inert on a standalone node.
command: redis-server /etc/relier/redis.conf
ports:
- "6379:6379"
volumes:
- ./scripts/redis/redis.conf:/etc/relier/redis.conf:ro
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
# =========================================================================
# Application, Celery workers and the resurrector
# =========================================================================
worker-high:
build:
context: .
dockerfile: Dockerfile
command: >
celery -A relier.tasks.app worker
--loglevel=info
--concurrency=8
-Q high_priority,default
--hostname=rl-worker-high@%h
volumes:
- ./src:/app/src
- ./scripts:/app/scripts
environment:
<<: *app-env
depends_on:
redis:
condition: service_healthy
otel-collector:
condition: service_started
worker-default:
build:
context: .
dockerfile: Dockerfile
command: >
celery -A relier.tasks.app worker
--loglevel=info
--concurrency=8
-Q default,low_priority
--hostname=rl-worker-default@%h
volumes:
- ./src:/app/src
- ./scripts:/app/scripts
environment:
<<: *app-env
depends_on:
redis:
condition: service_healthy
otel-collector:
condition: service_started
worker-recovery:
build:
context: .
dockerfile: Dockerfile
command: >
celery -A relier.tasks.app worker
--loglevel=info
--concurrency=8
-Q re-queue
--hostname=rl-worker-re-queue@%h
volumes:
- ./src:/app/src
- ./scripts:/app/scripts
environment:
<<: *app-env
depends_on:
redis:
condition: service_healthy
otel-collector:
condition: service_started
resurrector:
build:
context: .
dockerfile: Dockerfile
container_name: relier-resurrector
command: rl run-resurrector
volumes:
- ./src:/app/src
- ./scripts:/app/scripts
environment:
<<: *app-env
RELIER_LOG_LEVEL: INFO
depends_on:
redis:
condition: service_healthy
otel-collector:
condition: service_started
# =====================================================================
# Observability, OpenTelemetry → Prometheus → Grafana
# =====================================================================
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/etc/otel-collector-config.yml"]
volumes:
- ./scripts/otel-collector-config.yml:/etc/otel-collector-config.yml:ro
ports:
- "4317:4317"
- "4318:4318"
- "8889:8889"
prometheus:
image: prom/prometheus:latest
volumes:
- ./scripts/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
depends_on:
- otel-collector
grafana:
image: grafana/grafana:latest
volumes:
- ./scripts/grafana/provisioning:/etc/grafana/provisioning:ro
- ./scripts/grafana-dashboards:/var/lib/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
ports:
- "3000:3000"
depends_on:
- prometheus
volumes:
redis_data:
grafana_data: