-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
121 lines (116 loc) · 3.14 KB
/
docker-compose.yml
File metadata and controls
121 lines (116 loc) · 3.14 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: ${DATABASE__DB:-deribit_tracker}
POSTGRES_USER: ${DATABASE__USER:-postgres}
POSTGRES_PASSWORD: ${DATABASE__PASSWORD:-your_secure_password}
ports:
- "${DATABASE__PORT:-5433}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE__USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
env_file:
- .env
redis:
image: redis:7-alpine
ports:
- "${REDIS__PORT:-6379}:6379"
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
env_file:
- .env
app:
build: .
ports:
- "${APP_PORT:-8000}:8000"
environment:
DATABASE__HOST: postgres
DATABASE__PORT: 5432
DATABASE__USER: ${DATABASE__USER:-postgres}
DATABASE__PASSWORD: ${DATABASE__PASSWORD:-your_secure_password}
DATABASE__DB: ${DATABASE__DB:-deribit_tracker}
REDIS__HOST: redis
REDIS__PORT: 6379
APPLICATION__DEBUG: ${APPLICATION__DEBUG:-false}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- .:/app
command: >
sh -c "
echo 'Applying migrations...' &&
poetry run alembic upgrade head &&
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000
"
env_file:
- .env
celery_worker:
build: .
environment:
DATABASE__HOST: postgres
DATABASE__PORT: 5432
DATABASE__USER: ${DATABASE__USER:-postgres}
DATABASE__PASSWORD: ${DATABASE__PASSWORD:-your_secure_password}
DATABASE__DB: ${DATABASE__DB:-deribit_tracker}
REDIS__HOST: redis
REDIS__PORT: 6379
CELERY__WORKER_CONCURRENCY: ${CELERY__WORKER_CONCURRENCY:-1}
CELERY__BEAT_ENABLED: ${CELERY__BEAT_ENABLED:-false}
CELERY__TASK_TRACK_STARTED: ${CELERY__TASK_TRACK_STARTED:-true}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- .:/app
command: >
poetry run celery -A app.tasks.celery_app worker
--loglevel=info
--concurrency=${CELERY__WORKER_CONCURRENCY:-1}
--pool=solo
--queues=price_collection
env_file:
- .env
celery_beat:
build: .
environment:
DATABASE__HOST: postgres
DATABASE__PORT: 5432
DATABASE__USER: ${DATABASE__USER:-postgres}
DATABASE__PASSWORD: ${DATABASE__PASSWORD:-your_secure_password}
DATABASE__DB: ${DATABASE__DB:-deribit_tracker}
REDIS__HOST: redis
REDIS__PORT: 6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
celery_worker:
condition: service_started
volumes:
- .:/app
command: >
poetry run celery -A app.tasks.celery_app beat
--loglevel=info
--scheduler=celery.beat:PersistentScheduler
env_file:
- .env
volumes:
postgres_data:
redis_data: