-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
61 lines (58 loc) · 1.32 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
61 lines (58 loc) · 1.32 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
# Production compose — extends the base docker-compose.yml.
#
# Usage:
# cp .env.example .env # fill in real values
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# This overlay adds:
# - Redis for distributed rate limiting
# - Resource limits (CPU / memory)
# - Log rotation
# - Restart policy
# - Health checks
services:
app:
environment:
- FLASK_ENV=production
- LOG_LEVEL=${LOG_LEVEL:-WARNING}
- RATE_LIMIT_BACKEND=redis
- RATE_LIMIT_REDIS_URL=redis://redis:6379/0
- PREFERRED_URL_SCHEME=${PREFERRED_URL_SCHEME:-https}
depends_on:
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: "2.0"
memory: 1g
reservations:
cpus: "0.5"
memory: 256m
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
deploy:
resources:
limits:
cpus: "0.5"
memory: 128m
logging:
driver: json-file
options:
max-size: "5m"
max-file: "3"
volumes:
redis-data: