-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
258 lines (249 loc) · 10.2 KB
/
Copy pathdocker-compose.yml
File metadata and controls
258 lines (249 loc) · 10.2 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# EfficientAI Docker Compose
#
# Usage:
# docker compose up # Uses latest images
# EFFICIENTAI_VERSION=1.0.0 docker compose up # Uses specific version
#
# For local development, uncomment the 'build' sections below.
services:
db:
image: postgres:15
container_name: efficientai_db
environment:
POSTGRES_USER: ${POSTGRES_USER:-efficientai}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-efficientai}
volumes:
- postgres_data:/var/lib/postgresql/data
# Optional: generic catalog + data DBs for sharding tests (first init only):
# - ./docker/postgres/init-sharding-dbs.sh:/docker-entrypoint-initdb.d/02-init-sharding-dbs.sh:ro
# See config.docker.sharding.example.yml
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-efficientai}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: efficientai_redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
api:
# Pre-built image from GitHub Container Registry
# Use EFFICIENTAI_VERSION env var to pin to a specific version (e.g., 1.0.0)
image: ghcr.io/efficientai-tech/efficientai-api:${EFFICIENTAI_VERSION:-latest}
# For local development, uncomment below and comment out the image line:
build:
context: .
dockerfile: docker/Dockerfile.api
container_name: efficientai_api
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
SECRET_KEY: ${SECRET_KEY:-your-secret-key-change-in-production}
UPLOAD_DIR: /app/uploads
DEBUG: ${DEBUG:-True}
FRONTEND_DIR: /app/frontend/dist
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
# Optional GCS blob storage (set storage.blob_provider: gcs in config.docker.yml):
# BLOB_STORAGE_PROVIDER: gcs
# GCS_BUCKET_NAME: your-gcs-bucket
# GCS_PROJECT_ID: your-gcp-project
# GOOGLE_APPLICATION_CREDENTIALS: /app/secrets/gcp-sa.json
# Optional Azure Blob Storage (set storage.blob_provider: azure in config.docker.yml):
# BLOB_STORAGE_PROVIDER: azure
# AZURE_BLOB_ENABLED: "true"
# AZURE_CONNECTION_STRING: DefaultEndpointsProtocol=https;AccountName=...
# AZURE_CONTAINER_NAME: your-container
SERVICE_MODE: api
# Browser voice-agent WS when split (optional). Vobiz uses vobiz.webhook_base_url on telephony.
# MEDIA_WS_BASE_URL: ${MEDIA_WS_BASE_URL:-ws://localhost:8001}
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
# Optional: mount GCP service account for GCS auth
# - ./secrets/gcp-sa.json:/app/secrets/gcp-sa.json:ro
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: eai start --config /app/config.yml --host 0.0.0.0 --port 8000 --no-build-frontend --no-reload
# Live voice WebSockets (Vobiz inbound/outbound media). Scale horizontally for
# concurrent calls; point MEDIA_WS_BASE_URL at this host (or an LB in front).
media:
image: ghcr.io/efficientai-tech/efficientai-worker:${EFFICIENTAI_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.worker
args:
INSTALL_EXTRAS: "qualitative-voice"
container_name: efficientai_media
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
SERVICE_MODE: media
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
ports:
- "8001:8001"
command: eai telephony-worker --config /app/config.yml --host 0.0.0.0 --port 8001
worker:
# Pre-built image from GitHub Container Registry
# Use EFFICIENTAI_VERSION env var to pin to a specific version (e.g., 1.0.0)
image: ghcr.io/efficientai-tech/efficientai-worker:${EFFICIENTAI_VERSION:-latest}
# For local development, uncomment below and comment out the image line:
build:
context: .
dockerfile: docker/Dockerfile.worker
args:
INSTALL_EXTRAS: "qualitative-voice"
container_name: efficientai_worker
env_file:
- .env
environment:
# Worker uses Docker network, so it reaches DB/Redis via service names
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
# Optional GCS blob storage (match api service env when using gcs):
# GOOGLE_APPLICATION_CREDENTIALS: /app/secrets/gcp-sa.json
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
# Optional: mount GCP service account for GCS auth
# - ./secrets/gcp-sa.json:/app/secrets/gcp-sa.json:ro
command: eai worker --config /app/config.yml --loglevel info --queues celery,audio-metrics --concurrency 8
# Celery Beat — platform schedules + platform task worker (single replica; do not scale).
# Beat enqueues tasks; co-located worker runs evaluate_alerts, refresh_fx_rates, prune_oss_usage_history.
# flush_usage_counters still runs on worker-usage (usage queue).
beat:
image: ghcr.io/efficientai-tech/efficientai-worker:${EFFICIENTAI_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.worker
args:
INSTALL_EXTRAS: ""
container_name: efficientai_beat
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
command: >
sh -c "celery -A app.workers.celery_app worker -Q platform --pool threads --concurrency 2 --loglevel=info &
exec celery -A app.workers.celery_app beat --loglevel=info"
# Dedicated worker for call-import + evaluation queues. Celery drains
# ``imports`` (recording fetch) before ``diarization`` (manual diarise),
# then ``eval-control`` (cancel/retry/materialize), then ``evaluations``
# (fair dispatch + LLM scoring).
# The default ``worker`` service handles ``celery`` (evaluator cron dispatch only)
# and ``audio-metrics`` (Praat/UTMOS audio metric tasks).
# Platform schedules run via ``beat`` (scheduler + ``platform`` queue worker).
worker-imports:
image: ghcr.io/efficientai-tech/efficientai-worker:${EFFICIENTAI_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.worker
args:
INSTALL_EXTRAS: ""
container_name: efficientai_worker_imports
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
# Optional GCS blob storage (match api service env when using gcs):
# GOOGLE_APPLICATION_CREDENTIALS: /app/secrets/gcp-sa.json
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
# Optional: mount GCP service account for GCS auth
# - ./secrets/gcp-sa.json:/app/secrets/gcp-sa.json:ro
# Thread pool: keep concurrency near Redis inflight caps + headroom when sharding
# (each task may hold catalog + shard connections for tens of seconds).
command: eai worker --config /app/config.yml --loglevel info --queues imports,diarization,eval-control,evaluations --pool threads --concurrency 12
# Low-priority usage pricing: Redis flush + cost recompute/backfill.
worker-usage:
image: ghcr.io/efficientai-tech/efficientai-worker:${EFFICIENTAI_VERSION:-latest}
build:
context: .
dockerfile: docker/Dockerfile.worker
args:
INSTALL_EXTRAS: ""
container_name: efficientai_worker_usage
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-efficientai}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-efficientai}
REDIS_URL: redis://redis:6379/0
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./uploads:/app/uploads
- ./.data:/app/.data
- ./config.docker.yml:/app/config.yml:ro
command: eai worker --config /app/config.yml --loglevel info --queues usage --pool threads --concurrency 4
volumes:
postgres_data: