- New Go backend binary (backend + runner) replacing old scraper/ - Rename SCRAPER_API_URL → BACKEND_API_URL in UI env and docker-compose - Rename scraperFetch → backendFetch across all 19 UI server files - Remove SCRAPER_PROXY env var and proxy transport from browser.Config - Add Meilisearch, Valkey, Caddy to docker-compose - Add docs/: api-endpoints.md, request-flow.mermaid.md, data-flow.mermaid.md
84 lines
3.2 KiB
Caddyfile
84 lines
3.2 KiB
Caddyfile
# v3/Caddyfile
|
|
#
|
|
# Caddy reverse proxy for LibNovel v3.
|
|
#
|
|
# Environment variables consumed (set in docker-compose.yml):
|
|
# DOMAIN — public hostname, e.g. libnovel.example.com
|
|
# Use "localhost" for local dev (no TLS cert attempted).
|
|
# CADDY_ACME_EMAIL — Let's Encrypt notification email (empty = no email)
|
|
#
|
|
# Routing rules:
|
|
# /health → backend:8080 (liveness probe)
|
|
# /scrape* → backend:8080 (scrape task creation)
|
|
# /api/browse → backend:8080 (MinIO-cached browse pages)
|
|
# /api/book-preview/* → backend:8080 (live scrape, no store write)
|
|
# /api/chapter-text-preview/*/* → backend:8080 (live chapter, no store write)
|
|
# /api/chapter-text/*/* → backend:8080 (chapter markdown from MinIO)
|
|
# /api/reindex/* → backend:8080 (rebuild chapter index)
|
|
# /api/cover/* → backend:8080 (proxy cover image)
|
|
# /api/audio-proxy/*/* → backend:8080 (proxy generated audio)
|
|
# /api/scrape/* → backend:8080 (scrape job status/tasks)
|
|
# /* (everything else) → ui:3000 (SvelteKit — handles all
|
|
# remaining /api/* routes too)
|
|
#
|
|
# The SvelteKit UI itself proxies to the backend for: ranking, voices, search,
|
|
# browse-page, presign, audio, progress, and the Go /api/progress endpoint.
|
|
# MinIO and PocketBase are NOT exposed publicly.
|
|
{
|
|
# Email for Let's Encrypt ACME account registration.
|
|
# Optional — omit to use an anonymous ACME account.
|
|
{$CADDY_ACME_EMAIL:}
|
|
}
|
|
|
|
{$DOMAIN:localhost} {
|
|
# ── Liveness probe ───────────────────────────────────────────────────────
|
|
handle /health {
|
|
reverse_proxy backend:8080
|
|
}
|
|
|
|
# ── Scrape task creation (Go backend only) ───────────────────────────────
|
|
handle /scrape* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
|
|
# ── Backend-only API paths ────────────────────────────────────────────────
|
|
# These paths are served exclusively by the Go scraper and are not
|
|
# implemented in the SvelteKit UI.
|
|
handle /api/browse {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/book-preview/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/chapter-text-preview/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/chapter-text/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/reindex/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/cover/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/audio-proxy/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
handle /api/scrape/* {
|
|
reverse_proxy backend:8080
|
|
}
|
|
|
|
# ── SvelteKit UI (catch-all — includes all remaining /api/* routes) ───────
|
|
handle {
|
|
reverse_proxy ui:3000
|
|
}
|
|
|
|
# ── Logging ──────────────────────────────────────────────────────────────
|
|
log {
|
|
output stdout
|
|
format json
|
|
}
|
|
}
|