- HF_HOME=/data/huggingface on api and worker: the model cache sat in the container filesystem, so every recreate (down/up, --build, a new image) re-downloaded the model weights — and transcription failed outright wherever the Hugging Face Hub is unreachable - the postgres healthcheck probes $POSTGRES_USER / $POSTGRES_DB instead of a hardcoded sokhan - compose interpolates from the .env next to deploy/docker-compose.yml, not the one at the repo root: the quickstart in both READMEs and the .env.example header now say cp .env.example deploy/.env, and the missing-password error names that path
106 lines
3.6 KiB
YAML
106 lines
3.6 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-sokhan}
|
|
# Required on purpose: shipping a default credential means every
|
|
# deployment that forgets the .env runs an open database.
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (cp .env.example deploy/.env and edit it)}
|
|
POSTGRES_DB: ${POSTGRES_DB:-sokhan}
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
|
|
api:
|
|
# Published to GHCR by the Docker workflow (pushes to main, version
|
|
# tags): `docker compose pull api worker` runs the prebuilt image
|
|
# without building; `up -d --build` keeps building locally.
|
|
image: ghcr.io/abolfazlrwm/sokhan-api:latest
|
|
build:
|
|
context: ../backend
|
|
environment: &backend-env
|
|
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-sokhan}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (cp .env.example deploy/.env and edit it)}@postgres:5432/${POSTGRES_DB:-sokhan}
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_ENABLED: "true"
|
|
DATA_DIR: /data
|
|
HF_HOME: /data/huggingface
|
|
SOKHAN_CORS_ORIGINS: ${SOKHAN_CORS_ORIGINS:-}
|
|
WHISPER_MODEL_SIZE: ${WHISPER_MODEL_SIZE:-medium}
|
|
WHISPER_DEVICE: ${WHISPER_DEVICE:-cpu}
|
|
WHISPER_COMPUTE_TYPE: ${WHISPER_COMPUTE_TYPE:-int8}
|
|
WHISPER_BEAM_SIZE: ${WHISPER_BEAM_SIZE:-5}
|
|
WHISPER_INITIAL_PROMPT: ${WHISPER_INITIAL_PROMPT:-}
|
|
FA_POLISH: ${FA_POLISH:-true}
|
|
PUNCTUATION_ENABLED: ${PUNCTUATION_ENABLED:-true}
|
|
LOW_CONFIDENCE_THRESHOLD: ${LOW_CONFIDENCE_THRESHOLD:-0.5}
|
|
STREAMING_DECODE: ${STREAMING_DECODE:-true}
|
|
WEBHOOK_SIGNING_SECRET: ${WEBHOOK_SIGNING_SECRET:-}
|
|
FREE_MINUTES_PER_USER_PER_MONTH: ${FREE_MINUTES_PER_USER_PER_MONTH:-30}
|
|
PLAN_FREE_MAX_FILE_MINUTES: ${PLAN_FREE_MAX_FILE_MINUTES:-10}
|
|
PLAN_PRO_MAX_FILE_MINUTES: ${PLAN_PRO_MAX_FILE_MINUTES:-180}
|
|
PLAN_PRO_MONTHLY_MINUTES: ${PLAN_PRO_MONTHLY_MINUTES:-1200}
|
|
ADMIN_API_KEY: ${ADMIN_API_KEY:-}
|
|
MAX_UPLOAD_MB: ${MAX_UPLOAD_MB:-200}
|
|
SUMMARY_ENABLED: ${SUMMARY_ENABLED:-false}
|
|
LLM_API_BASE: ${LLM_API_BASE:-}
|
|
LLM_API_KEY: ${LLM_API_KEY:-}
|
|
LLM_MODEL: ${LLM_MODEL:-}
|
|
DIARIZATION_ENGINE: ${DIARIZATION_ENGINE:-stub}
|
|
PYANNOTE_MODEL: ${PYANNOTE_MODEL:-pyannote/speaker-diarization-3.1}
|
|
PYANNOTE_HF_TOKEN: ${PYANNOTE_HF_TOKEN:-}
|
|
volumes:
|
|
- sokhan-data:/data
|
|
ports:
|
|
- "${SOKHAN_API_PORT:-8000}:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
worker:
|
|
image: ghcr.io/abolfazlrwm/sokhan-api:latest
|
|
build:
|
|
context: ../backend
|
|
command: celery -A sokhan.worker.celery_app.celery_app worker --loglevel=info --concurrency=1
|
|
environment: *backend-env
|
|
volumes:
|
|
- sokhan-data:/data
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
web:
|
|
image: ghcr.io/abolfazlrwm/sokhan-web:latest
|
|
build:
|
|
context: ../web
|
|
args:
|
|
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:8000}
|
|
ports:
|
|
- "${SOKHAN_WEB_PORT:-3000}:3000"
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres-data:
|
|
sokhan-data:
|