Merge branch 'fix/deploy-self-hosting'
This commit is contained in:
6 files changed
+31
-8
No files matched your search
@@ -1,5 +1,6 @@
|
||||
# Sokhan configuration
|
||||
# Copy this file to .env and adjust the values.
|
||||
# For docker compose, copy it to deploy/.env instead.
|
||||
# Every variable below has a working default for local development.
|
||||
|
||||
# --- Core ---
|
||||
|
||||
@@ -5,6 +5,19 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Compose: the Whisper model cache now lives on the `sokhan-data` volume
|
||||
(`HF_HOME=/data/huggingface`). Previously it sat in the container's own
|
||||
filesystem, so every recreate (`down`/`up`, `--build`, a new image)
|
||||
re-downloaded the weights — and transcription failed outright where the
|
||||
Hugging Face Hub is unreachable.
|
||||
- Compose: the postgres healthcheck probes the configured `POSTGRES_USER` and
|
||||
`POSTGRES_DB` instead of a hardcoded `sokhan`.
|
||||
- Quickstart (both READMEs) and `.env.example` now say to copy the env file to
|
||||
`deploy/.env`; the missing-password error names that path too. Copying it to
|
||||
the repo root left `POSTGRES_PASSWORD` unset for compose.
|
||||
|
||||
### Added
|
||||
|
||||
- **Persian accuracy stack (v2)** — measured on the 12-clip Common Voice
|
||||
|
||||
+5
-1
@@ -145,6 +145,8 @@ faster-whisper، یک ورکر Celery، یک داشبورد Next.js که فار
|
||||
```bash
|
||||
git clone https://github.com/Abolfazlrwm/sokhan.git
|
||||
cd sokhan
|
||||
cp .env.example deploy/.env # compose فایل .env کنار فایل compose را میخواند
|
||||
# در deploy/.env مقدار POSTGRES_PASSWORD را یک رمز طولانی و تصادفی بگذارید
|
||||
docker compose -f deploy/docker-compose.yml up -d --build
|
||||
```
|
||||
|
||||
@@ -152,7 +154,9 @@ docker compose -f deploy/docker-compose.yml up -d --build
|
||||
- API و مستندات: http://localhost:8000/docs
|
||||
|
||||
ورکر مدل Whisper تنظیمشده را در اولین رونویسی دانلود میکند
|
||||
(`WHISPER_MODEL_SIZE`، پیشفرض `small`). برای فعالکردن خلاصهسازی،
|
||||
(`WHISPER_MODEL_SIZE`، پیشفرض `small`) و آن را روی ولوم `sokhan-data`
|
||||
(`HF_HOME=/data/huggingface`) نگه میدارد، پس ساخت دوبارهٔ کانتینرها مدل را
|
||||
دوباره دانلود نمیکند. برای فعالکردن خلاصهسازی،
|
||||
`SUMMARY_ENABLED=true` و متغیرهای LLM خود را در فایل `.env` کنار
|
||||
`docker-compose.yml` بگذارید. برای اعمال مهاجرتهای اسکیما بهصورت دستی:
|
||||
|
||||
|
||||
@@ -143,6 +143,8 @@ default — a GPU is not required.
|
||||
```bash
|
||||
git clone https://github.com/Abolfazlrwm/sokhan.git
|
||||
cd sokhan
|
||||
cp .env.example deploy/.env # compose reads the .env next to the compose file
|
||||
# edit deploy/.env and set POSTGRES_PASSWORD to a long random value
|
||||
docker compose -f deploy/docker-compose.yml up -d --build
|
||||
```
|
||||
|
||||
@@ -150,7 +152,9 @@ docker compose -f deploy/docker-compose.yml up -d --build
|
||||
- API and docs: http://localhost:8000/docs
|
||||
|
||||
The worker downloads the configured Whisper model on first transcription
|
||||
(`WHISPER_MODEL_SIZE`, default `small`). To enable summaries, set
|
||||
(`WHISPER_MODEL_SIZE`, default `small`) and caches it on the `sokhan-data`
|
||||
volume (`HF_HOME=/data/huggingface`), so recreating the containers does not
|
||||
download it again. To enable summaries, set
|
||||
`SUMMARY_ENABLED=true` and your LLM variables in a `.env` file next to
|
||||
`docker-compose.yml`. To apply schema migrations manually:
|
||||
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ COPY alembic ./alembic
|
||||
|
||||
RUN pip install --no-cache-dir .
|
||||
|
||||
# Non-root runtime user; uvicorn binds 8000 (unprivileged) and the app keeps
|
||||
# no local writable state (postgres via DATABASE_URL).
|
||||
RUN useradd --system --uid 1000 --create-home appuser
|
||||
RUN useradd --system --uid 1000 --create-home appuser \
|
||||
&& mkdir -p /data/audio \
|
||||
&& chown -R appuser:appuser /data
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
@@ -5,12 +5,12 @@ services:
|
||||
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 (see .env.example)}
|
||||
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 sokhan"]
|
||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
@@ -33,10 +33,11 @@ services:
|
||||
build:
|
||||
context: ../backend
|
||||
environment: &backend-env
|
||||
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-sokhan}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}@postgres:5432/${POSTGRES_DB:-sokhan}
|
||||
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}
|
||||
|
||||
Reference in new issue
Block a user