readest/docker/.env.example
Huang Xin 73e933eb33
fix(docker): apply db migrations on first boot and let the font CDN be overridden (#5550) (#5551)
* fix(docker): apply db migrations on first boot and let the font CDN be overridden (#5550)

A fresh self-hosted stack only ran volumes/db/init/schema.sql, so the
incremental files under volumes/db/migrations never reached the database.
Deployments came up without files.replica_id, the replicas table and the
claim_inbox_item RPC, which broke uploads, replica sync and Send to Readest.

Mount the migrations directory into the db container together with an
apply-migrations.sh hook named so it sorts after the supabase image's own
migrate.sh. It globs the mounted directory, so a new migration file needs no
compose change, and it records what it applied in readest_meta.migrations so
it can be re-run by hand after an upgrade.

The reader also loaded its CJK webfont bundles from storage.readest.com, which
only sends CORS headers for readest.com origins, so they were blocked on a
custom domain. Read the base URL from runtime config via FONT_BASE_URL and keep
the CDN as the default.

Let SUPABASE_PUBLIC_URL and S3_PUBLIC_ENDPOINT be set directly instead of only
being derived from HOST_IP, so the stack can be served from one HTTPS origin.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(docker): add an example nginx config for a single HTTPS origin

Keeps the template out of the README as a copyable file next to .env.example.
Routes / to the client, /auth/v1 and /rest/v1 to kong, and the bucket prefix to
minio with the Host header preserved so presigned signatures still verify.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 10:19:44 +02:00

66 lines
2.2 KiB
Text

# ip used by frontend/client-side urls to access the backend
# (used in compose for SUPABASE_PUBLIC_URL)
HOST_IP=localhost
READEST_IMAGE=ghcr.io/readest/readest:latest
# browser-facing urls, derived from HOST_IP unless set here. behind an https
# reverse proxy, point both at the single public origin (see README).
# SUPABASE_PUBLIC_URL=https://your-domain.com
# S3_PUBLIC_ENDPOINT=https://your-domain.com
# db(psql) config
# change to strong password, min 32 chars
POSTGRES_PASSWORD=your-super-secret-postgres-password
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=postgres
# jwt config
JWT_EXPIRY=3600
JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters
# both ANON_KEY and SERVICE_ROLE_KEY should be generated using the above set secret
# sign this payload -> {"role": "anon"} <- for ANON_KEY with JWT_SECRET
ANON_KEY=your-anon-key-jwt-signed-with-jwt-secret
# sign this payload -> {"role": "service_role"} <- for SERVICE_ROLE_KEY with JWT_SECRET
SERVICE_ROLE_KEY=your-service-role-key-jwt-signed-with-jwt-secret
KONG_HTTP_PORT=8000
# auth (gotrue)
API_EXTERNAL_URL=http://localhost:8000
SITE_URL=http://localhost:3000
ADDITIONAL_REDIRECT_URLS=http://localhost:3000/**,http://localhost:8000/**
# readest auth stuff
DISABLE_SIGNUP=false
ENABLE_EMAIL_SIGNUP=true
ENABLE_EMAIL_AUTOCONFIRM=true
ENABLE_ANONYMOUS_USERS=false
# only needed if ENABLE_EMAIL_AUTOCONFIRM is false
SMTP_HOST=
SMTP_PORT=587
SMTP_USER=
SMTP_PASS=
SMTP_ADMIN_EMAIL=admin@example.com
SMTP_SENDER_NAME=Readest
# PostgREST shiz
PGRST_DB_SCHEMAS=public,graphql_public
# s3 storage through MinIO
OBJECT_STORAGE_TYPE=s3
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin-secret-password
S3_BUCKET_NAME=readest-files
# 1GB fixed quota for storage and 50k for translations
STORAGE_FIXED_QUOTA=1073741824
TRANSLATION_FIXED_QUOTA=50000
# where the reader loads the self-hosted CJK webfont bundles from.
# leave empty to use Readest's CDN (https://storage.readest.com/public/font/dist),
# which only sends CORS headers for readest.com origins - if you serve the app
# from your own domain and want those fonts, mirror the bundles and point this
# at the directory that holds them, e.g. https://your-domain.com/fonts
FONT_BASE_URL=