diff --git a/docker/examples/compose.full.yml b/docker/examples/compose.full.yml index bdf2270..8776f64 100644 --- a/docker/examples/compose.full.yml +++ b/docker/examples/compose.full.yml @@ -1,4 +1,4 @@ -name: openreader-example +name: openreader-full services: openreader: diff --git a/docker/examples/compose.local.yml b/docker/examples/compose.local-full.yml similarity index 99% rename from docker/examples/compose.local.yml rename to docker/examples/compose.local-full.yml index 9c0a6d6..b035247 100644 --- a/docker/examples/compose.local.yml +++ b/docker/examples/compose.local-full.yml @@ -1,4 +1,4 @@ -name: openreader-local-build +name: openreader-local-full-build services: openreader: diff --git a/docker/examples/compose.local-slim.yml b/docker/examples/compose.local-slim.yml new file mode 100644 index 0000000..d4795aa --- /dev/null +++ b/docker/examples/compose.local-slim.yml @@ -0,0 +1,52 @@ +name: openreader-local-slim-build + +services: + openreader: + image: openreader:local + build: + context: ../.. + dockerfile: Dockerfile + depends_on: + kokoro-tts: + condition: service_started + environment: + BASE_URL: ${BASE_URL:-http://localhost:3003} + AUTH_SECRET: ${AUTH_SECRET:-local-openreader-auth-secret-change-me} + RUNTIME_SEED_JSON: |- + { + "version": 1, + "runtimeConfig": { + "defaultTtsProvider": "kokoro" + }, + "providers": [ + { + "slug": "kokoro", + "displayName": "Kokoro", + "providerType": "custom-openai", + "baseUrl": "http://kokoro-tts:8880/v1", + "defaultModel": "kokoro", + "enabled": true + } + ] + } + ports: + - "3003:3003" + - "8333:8333" + volumes: + - openreader-docstore:/app/docstore + + kokoro-tts: + image: ghcr.io/remsky/kokoro-fastapi-cpu:v0.2.4 + environment: + ONNX_NUM_THREADS: 8 + ONNX_INTER_OP_THREADS: 4 + ONNX_EXECUTION_MODE: parallel + ONNX_OPTIMIZATION_LEVEL: all + ONNX_MEMORY_PATTERN: "true" + ONNX_ARENA_EXTEND_STRATEGY: kNextPowerOfTwo + API_LOG_LEVEL: DEBUG + ports: + - "8880:8880" + +volumes: + openreader-docstore: diff --git a/docker/examples/compose.yml b/docker/examples/compose.yml index 4745d0e..e83ab7a 100644 --- a/docker/examples/compose.yml +++ b/docker/examples/compose.yml @@ -1,4 +1,4 @@ -name: openreader-slim-example +name: openreader-slim services: openreader: diff --git a/docs-site/docs/deploy/docker-compose.md b/docs-site/docs/deploy/docker-compose.md index 78786d3..08964d7 100644 --- a/docs-site/docs/deploy/docker-compose.md +++ b/docs-site/docs/deploy/docker-compose.md @@ -1,6 +1,6 @@ --- title: Docker Compose -description: Run OpenReader with the slim, full, or local-build Docker Compose examples. +description: Run OpenReader with the slim, full, local-slim, or local-full Docker Compose examples. --- import Tabs from '@theme/Tabs'; @@ -8,7 +8,8 @@ import TabItem from '@theme/TabItem'; Use these examples to run OpenReader with Kokoro-FastAPI and persistent storage. Choose the slim stack for the simplest deployment, or the full stack when you want PostgreSQL, SeaweedFS, NATS, -and the compute worker as separate containers. +and the compute worker as separate containers. Local build variants are also available for both slim +and full stacks to build the application from your current checkout. ## Prerequisites @@ -54,31 +55,42 @@ For details about running the worker separately, see [Compute Worker](./compute-worker). - + -The local-build example uses the full multi-container layout, but builds the OpenReader app and -compute-worker images from the current checkout. +The local-slim example runs a slim setup (OpenReader and Kokoro-FastAPI), but builds the OpenReader app image from the current checkout. ```bash -docker compose -f docker/examples/compose.local.yml up --build +docker compose -f docker/examples/compose.local-slim.yml up --build # Repository convenience command: pnpm compose:local ``` -Compose file: [`docker/examples/compose.local.yml`](https://github.com/richardr1126/openreader/blob/main/docker/examples/compose.local.yml) +Compose file: [`docker/examples/compose.local-slim.yml`](https://github.com/richardr1126/openreader/blob/main/docker/examples/compose.local-slim.yml) + + + + +The local-full example uses the full multi-container layout, but builds the OpenReader app and compute-worker images from the current checkout. + +```bash +docker compose -f docker/examples/compose.local-full.yml up --build +# Repository convenience command: pnpm compose:local:full +``` + +Compose file: [`docker/examples/compose.local-full.yml`](https://github.com/richardr1126/openreader/blob/main/docker/examples/compose.local-full.yml) ## Included services -| Service | Slim | Full | Local Build | -| --- | --- | --- | --- | -| OpenReader | Published image | Published image | Local build | -| Kokoro-FastAPI | Container | Container | Container | -| Database | Embedded SQLite | PostgreSQL container | PostgreSQL container | -| SeaweedFS | Embedded | Container | Container | -| NATS | Embedded | Container | Container | -| Compute worker | Embedded | Published image | Local build | +| Service | Slim | Full | Local Slim | Local Full | +| --- | --- | --- | --- | --- | +| OpenReader | Published image | Published image | Local build | Local build | +| Kokoro-FastAPI | Container | Container | Container | Container | +| Database | Embedded SQLite | PostgreSQL container | Embedded SQLite | PostgreSQL container | +| SeaweedFS | Embedded | Container | Embedded | Container | +| NATS | Embedded | Container | Embedded | Container | +| Compute worker | Embedded | Published image | Embedded | Local build | On first boot, `RUNTIME_SEED_JSON` creates an enabled Kokoro shared provider and selects it as the default TTS provider. @@ -118,15 +130,25 @@ docker compose -f docker/examples/compose.full.yml up ``` - + ```bash BASE_URL=http://192.168.0.XXX:3003 \ S3_ENDPOINT=http://192.168.0.XXX:8333 \ -docker compose -f docker/examples/compose.local.yml up --build +docker compose -f docker/examples/compose.local-slim.yml up --build # Repository convenience command: pnpm compose:local ``` + + + +```bash +BASE_URL=http://192.168.0.XXX:3003 \ +S3_ENDPOINT=http://192.168.0.XXX:8333 \ +docker compose -f docker/examples/compose.local-full.yml up --build +# Repository convenience command: pnpm compose:local:full +``` + @@ -134,7 +156,7 @@ Replace `192.168.0.XXX` with your Docker host's LAN IP and allow inbound TCP por `8333` through its firewall. :::info Internal full-stack endpoint -The full and local-build compute workers continue using `http://seaweedfs:8333` internally. +The full and local-full compute workers continue using `http://seaweedfs:8333` internally. `S3_ENDPOINT` configures the app endpoint and browser-facing presigned URLs. ::: diff --git a/package.json b/package.json index 9c9b62d..55ec014 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,9 @@ "test:compute": "vitest run --project compute-worker", "compose": "docker compose -f docker/examples/compose.yml up", "compose:full": "docker compose -f docker/examples/compose.full.yml up", - "compose:local": "docker compose -f docker/examples/compose.local.yml up --build", + "compose:local": "docker compose -f docker/examples/compose.local-slim.yml up --build", + "compose:local:slim": "docker compose -f docker/examples/compose.local-slim.yml up --build", + "compose:local:full": "docker compose -f docker/examples/compose.local-full.yml up --build", "migrate": "pnpm --filter @openreader/database migrate", "migrate-fs": "pnpm --filter @openreader/bootstrap migrate-storage", "migrate-fs:dry-run": "pnpm --filter @openreader/bootstrap migrate-storage --dry-run true",