-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcompose.yaml
103 lines (96 loc) · 2.41 KB
/
compose.yaml
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
services:
backend:
network_mode: host
restart: always
build: .
env_file: .env
depends_on:
- db
- rabbitmq
command: >
gunicorn accompanist.main:app
--workers ${NUM_WORKERS}
--worker-class uvicorn.workers.UvicornWorker
--bind=127.0.0.1:${FASTAPI_PORT}
volumes:
- ./storage-volume:/storage
environment:
- STORAGE_PATH=/storage
celery-worker:
network_mode: host
restart: always
build: .
env_file: .env
depends_on:
- db
- rabbitmq
command:
celery -A accompanist.celery.main.app worker --loglevel info -E --concurrency ${CELERY_CONCURRENCY}
volumes:
- ./storage-volume:/storage
environment:
- STORAGE_PATH=/storage
deploy: # GPU is used only by celery worker
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
celery-flower:
network_mode: host
restart: always
build: .
env_file: .env
depends_on:
- celery-worker
command:
celery -A accompanist.celery.main.app flower
environment:
- STORAGE_PATH=/storage
# Allow controlling tasks with Flower without authentication
- FLOWER_UNAUTHENTICATED_API=true
frontend:
restart: always
ports:
- ${DEPLOYMENT_HOST}:${DOCKER_FRONTEND_PORT}:80
build:
context: ./frontend
dockerfile: Dockerfile
args:
NGINX_PORT: ${NGINX_PORT}
DEPLOYMENT_HOST: ${DEPLOYMENT_HOST}
nginx: # for serving lots of static files & redirecting to FastAPI
image: nginx:latest
restart: always
network_mode: host
env_file: .env
build:
context: ./nginx
dockerfile: Dockerfile
volumes:
- ${STORAGE_PATH}:/usr/share/nginx/html/static
db:
image: postgres:16
restart: always
ports:
- ${DB_PORT}:5432
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_PASSWORD=${DB_PASS}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- postgres-volume:/var/lib/postgresql/data
- ./accompanist/tests/create_test_db.sql:/docker-entrypoint-initdb.d/create_test_db.sql
rabbitmq:
image: rabbitmq
restart: always
ports:
- ${RABBITMQ_PORT}:5672
volumes:
postgres-volume:
# ./storage-volume is used as a bind mount