-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
79 lines (73 loc) · 1.73 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
version: '3.8'
volumes:
python-pkgs:
db-data:
cache-data:
x-common: &app-common
build:
context: .
env_file: .env
environment:
DATABASE_URL: psql://db/base_app
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
CACHE_URL: redis://cache:6379/0
SESSION_CACHE_URL: redis://cache:6379/1
CELERY_BROKER_URL: redis://cache:6379/2
CELERY_RESULT_BACKEND: redis://cache:6379/3
user: ${UID:-app_user}
volumes:
- ${COMPOSE_APP_PATH:-.}:/usr/src/app:delegated
- ${COMPOSE_PYTHON_PKG_PATH:-python-pkgs}:/usr/local/lib/python3.8/site-packages:z
services:
app:
<<: *app-common
command:
- uvicorn
- base_app.asgi:application
- --workers=${COMPOSE_WEB_WORKERS:-4}
- --host=0.0.0.0
- --port=8000
- --reload
- --log-level=${COMPOSE_WEB_LOG_LEVEL:-info}
- --lifespan=off
restart: unless-stopped
depends_on:
- cache
- db
tty: true
ports:
- "${COMPOSE_WEB_PORT:-8000}:8000"
task_worker:
<<: *app-common
command:
- celery
- worker
- --events
- --app
- base_app.celery
- --loglevel=${COMPOSE_TASK_LOG_LEVEL:-info}
- --pool=gevent
- --concurrency=${COMPOSE_TASK_CONCURRENCY:-100}
restart: unless-stopped
depends_on:
- cache
- db
db:
image: postgres:12-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: base_app
restart: unless-stopped
ports:
- '${COMPOSE_DB_PORT:-0}:5432'
volumes:
- db-data:/var/lib/postgresql/data
cache:
image: redis:5-alpine
restart: unless-stopped
volumes:
- cache-data:/var/lib/redis
ports:
- '${COMPOSE_CACHE_PORT:-0}:6379'