-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
98 lines (90 loc) · 2.28 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
version: '3.9'
services:
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=testdb
- POSTGRES_INITDB_ARGS=--auth-host=md5
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql/data
backend:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: django_backend
restart: always
ports: # TODO unsafe open ports without reverse proxy like nginx
- "80:8000"
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- REDIS_URL=redis://redis:6379/0
- DEBUG=True
- DATABASE_URL=postgres://postgres:postgres@postgres/postgres
- SECRET_KEY=wzrjq9#%_*fx^@0e7vrw64!ua1*d#_o6df7bvwow)jbwor6n7!
healthcheck:
test: curl --fail http://localhost:8000 || exit 1
interval: 5s
retries: 5
timeout: 10s
volumes:
- ".:/app"
depends_on:
postgres:
condition: service_started
prometheus:
condition: service_started
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '1.5'
memory: 750M
redis:
image: redis:7.0.8-alpine
ports:
- "6379:6379"
healthcheck:
test: [ "CMD-SHELL", "redis-cli ping | grep PONG" ]
interval: 1s
timeout: 3s
retries: 5
prometheus:
image: prom/prometheus:latest
restart: always
volumes:
- ./prometheus-conf.yaml:/etc/prometheus/prometheus.yml:ro
- ./prometheus-rules.yaml:/etc/prometheus/django_rules.yml:ro
command:
- --config.file=/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
grafana:
image: grafana/grafana:9.3.6
container_name: grafana
ports:
- "3000:3000"
volumes:
- grafana-storage:/var/lib/grafana
postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest
restart: always
environment:
- DATA_SOURCE_NAME=postgresql://postgres:postgres@postgres:5432/testdb?sslmode=disable
ports:
- "9187:9187"
depends_on:
postgres:
condition: service_started
links:
- postgres
- prometheus
volumes:
postgres:
grafana-storage: