-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-compose.deploy.yml
More file actions
96 lines (91 loc) · 2.62 KB
/
docker-compose.deploy.yml
File metadata and controls
96 lines (91 loc) · 2.62 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
services:
db:
image: postgis/postgis:16-3.4
environment:
POSTGRES_DB: ${POSTGRES_DB:-espalert}
POSTGRES_USER: ${POSTGRES_USER:-espalert}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- espalert_pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-espalert} -d ${POSTGRES_DB:-espalert}"]
interval: 10s
timeout: 5s
retries: 5
restart: always
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
volumes:
- espalert_redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: always
api:
build:
context: ./apps/api
dockerfile: Dockerfile
ports:
- "8001:8000"
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
DATABASE_URL_SYNC: postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
ENVIRONMENT: production
DEBUG: "false"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: >
sh -c "
alembic upgrade head &&
gunicorn app.main:app -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 --access-logfile - --error-logfile -
"
restart: always
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
worker:
build:
context: ./apps/api
dockerfile: Dockerfile
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
DATABASE_URL_SYNC: postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
ENVIRONMENT: production
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: celery -A app.tasks.celery_app worker --loglevel=info --concurrency=2
restart: always
beat:
build:
context: ./apps/api
dockerfile: Dockerfile
env_file:
- .env
environment:
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
ENVIRONMENT: production
depends_on:
redis:
condition: service_healthy
command: celery -A app.tasks.celery_app beat --loglevel=info
restart: always
volumes:
espalert_pgdata:
espalert_redisdata: