Document codebase: comments, per-area READMEs, deployment guide
Readability pass across all four areas of the stack. Comments explain why rather than what, concentrated at the points where behaviour is non-obvious: concurrency, caching, auth, scraping and nginx templating. Backend: doc comments on every exported declaration across handlers, services, models and resolvers. Resolver commentary lives inside function bodies so gqlgen does not strip it on regeneration; schema files use # comments rather than description blocks so introspection output is unchanged. Extracted the duplicated auth-cookie blocks into helpers. Frontend: header comments on every component, store and view, including STATUS: notes marking which of the parallel/legacy views are still live. Documented the non-reactive animation-state pattern, the homeData hub and the WebSocket stale-socket guard. Removed a few dead imports and named the reconnect-backoff and poll-interval constants. Python: module and function docstrings covering the Travelodge scraping contract, the deadline threading, the two-executor concurrency and the NDJSON streaming protocol. Infra: header blocks on every compose file, nginx template, Dockerfile and entrypoint, covering the config selection, envsubst allow-lists, rate-limit semantics and volume persistence. Hoisted the duplicated envsubst variable list in nginx/entrypoint.sh. New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example, backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which stated a 24h access token where main.go sets 7 days. No behaviour change. go build/vet, vite build, py_compile and docker compose config all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
+154
@@ -0,0 +1,154 @@
|
||||
# =============================================================================
|
||||
# .env.example — template for the real ./.env, which is GITIGNORED.
|
||||
#
|
||||
# HOW ENV REACHES THE CONTAINERS — two separate mechanisms, both reading this
|
||||
# same file, and it is worth knowing which is which:
|
||||
# 1. ${VAR} interpolation in docker-compose.yml. Done by the compose CLI when
|
||||
# it parses the file, before any container exists. This is how container
|
||||
# names, published ports and the Hasura database URL are built.
|
||||
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
|
||||
# variables inside that container. nginx, backend, db, icecast2, quartz,
|
||||
# certbot and gitea all do this.
|
||||
# The `python` service deliberately does neither wholesale — it uses an
|
||||
# explicit `environment:` allow-list of three variables, so it never sees the
|
||||
# database password or any API key.
|
||||
#
|
||||
# HOW TO USE
|
||||
# cp .env.example .env then fill in every value.
|
||||
# Distribute to the Raspberry Pi with ./sync-secrets.sh (newer file wins in
|
||||
# either direction — see that script's header before editing on both hosts).
|
||||
#
|
||||
# CAUTION: an unset variable does not fail loudly. envsubst renders it as an
|
||||
# empty string, which for a password field means "no password". After editing,
|
||||
# check `docker compose config` shows what you expect.
|
||||
#
|
||||
# NOTHING IN THIS FILE HAS A REAL VALUE. Values are blank or obviously
|
||||
# placeholder on purpose; never commit a filled-in copy.
|
||||
# =============================================================================
|
||||
|
||||
# --- Postgres ----------------------------------------------------------------
|
||||
# One instance, two databases: POSTGRES_DB for the Go backend, POSTGRES_GITEA_DB
|
||||
# for Gitea. Only POSTGRES_DB is auto-created on first init; the Gitea one must
|
||||
# be created by hand on a fresh volume.
|
||||
# POSTGRES_HOST doubles as the db container's name.
|
||||
POSTGRES_USER=
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_DB=
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_HOST=db
|
||||
|
||||
# --- Gitea -------------------------------------------------------------------
|
||||
# GITEA_HOST is the container name AND the nginx upstream host.
|
||||
# The three secrets below are passed as GITEA__section__KEY overrides so the
|
||||
# committed app.ini.template can keep those fields blank. Generate each as a
|
||||
# long random hex string.
|
||||
GITEA_HOST=gitea
|
||||
GITEA_PORT=3000
|
||||
GITEA_INTERNAL_TOKEN=
|
||||
GITEA_LFS_JWT_SECRET=
|
||||
GITEA_OAUTH2_JWT_SECRET=
|
||||
POSTGRES_GITEA_DB=gitea
|
||||
|
||||
# --- Gitea Actions runner ----------------------------------------------------
|
||||
# The runner is NOT a container; it runs on the Pi via gitea-runner/run.sh.
|
||||
# The registration token is SINGLE-USE: it is exchanged for a permanent
|
||||
# identity in gitea-runner/.runner on first registration, after which this
|
||||
# value is ignored. Mint it in Site Administration -> Actions -> Runners.
|
||||
GITEA_RUNNER_HOST=
|
||||
GITEA_RUNNER_NAME=pi-runner
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN=
|
||||
|
||||
# --- Email ingest (backend) --------------------------------------------------
|
||||
# IMAP_PASSWORD should be an app-specific password, not the account password.
|
||||
EMAIL_BACKEND=
|
||||
IMAP_HOST=
|
||||
IMAP_PORT=993
|
||||
IMAP_EMAIL=
|
||||
IMAP_PASSWORD=
|
||||
EMAIL_SYNC_INTERVAL=
|
||||
EMAIL_SYNC_ENABLED=
|
||||
|
||||
# --- Services that nginx substitutes but no longer runs -----------------------
|
||||
# Kept because nginx/entrypoint.sh lists them in its envsubst allow-list; no
|
||||
# compose service uses them today. Harmless if blank.
|
||||
UPTIMEKUMA_HOST=
|
||||
UPTIMEKUMA_PORT=
|
||||
WALLABAG_HOST=
|
||||
WALLABAG_PORT=
|
||||
|
||||
# --- Quartz (notes site at /notes/) ------------------------------------------
|
||||
QUARTZ_HOST=quartz
|
||||
QUARTZ_PORT=8080
|
||||
|
||||
# --- Go backend --------------------------------------------------------------
|
||||
# BACKEND_HOST is the container name and the nginx upstream.
|
||||
# BACKEND_ENDPOINT is the public URL prefix nginx mounts the API at and then
|
||||
# strips; the Vue app's GraphQL client assumes /api.
|
||||
# BACKEND_SECRET signs the JWTs stored in the auth cookies — rotating it logs
|
||||
# everyone out.
|
||||
BACKEND_PORT=8080
|
||||
BACKEND_HOST=backend
|
||||
BACKEND_SECRET=
|
||||
BACKEND_ENDPOINT=/api
|
||||
|
||||
# --- Obsidian vault ----------------------------------------------------------
|
||||
# HOST path, interpolated straight into two bind mounts: read-write into the
|
||||
# backend, read-only into quartz. Must be an absolute path that exists on the
|
||||
# host or the stack will not start.
|
||||
OBSIDIAN_DIR=
|
||||
|
||||
# --- Spotify -----------------------------------------------------------------
|
||||
# The redirect URI must match EXACTLY what is registered in the Spotify
|
||||
# developer dashboard. The dev override sets its own localhost value.
|
||||
# The resulting refresh token is persisted to ./backend/token/ so it survives
|
||||
# rebuilds.
|
||||
SPOTIFY_CLIENT_ID=
|
||||
SPOTIFY_CLIENT_SECRET=
|
||||
SPOTIFY_REDIRECT_URI=
|
||||
SPOTIFY_AUTH_STATE=
|
||||
|
||||
# --- Icecast / liquidsoap radio ----------------------------------------------
|
||||
# ICECAST_SOURCE_PASSWORD is used TWICE: liquidsoap authenticates to icecast
|
||||
# with it, and a live-broadcasting client authenticates to the liquidsoap
|
||||
# harbor port with it. Anyone holding it can take over the stream.
|
||||
# LIQUIDSOAP_HARBOR_PORT is the only non-nginx port published to the host.
|
||||
ICECAST_SOURCE_PASSWORD=
|
||||
ICECAST_RELAY_PASSWORD=
|
||||
ICECAST_ADMIN_USER=
|
||||
ICECAST_ADMIN_PASSWORD=
|
||||
ICECAST_HOST=icecast2
|
||||
ICECAST_PORT=8000
|
||||
ICECAST_MOUNT=/stream
|
||||
LIQUIDSOAP_HARBOR_MOUNT=/live
|
||||
LIQUIDSOAP_HARBOR_PORT=8001
|
||||
|
||||
# --- TLS / identity ----------------------------------------------------------
|
||||
# DOMAIN is the APEX domain with no scheme and no www; certbot requests both
|
||||
# it and www.DOMAIN on one certificate, and nginx canonicalises to www.
|
||||
# EMAIL is the Let's Encrypt account address for expiry notices.
|
||||
DOMAIN=
|
||||
EMAIL=
|
||||
|
||||
# --- Third-party API keys (backend) ------------------------------------------
|
||||
CLAUDE_API_KEY=
|
||||
STEAM_API_KEY=
|
||||
STEAM_ID=
|
||||
|
||||
# --- Hasura (admin-only DB console at /hasura/) ------------------------------
|
||||
# Additionally gated by an nginx auth_request against the backend's admin check,
|
||||
# so the admin secret is not the only barrier.
|
||||
HASURA_GRAPHQL_ADMIN_SECRET=
|
||||
HASURA_HOST=hasura
|
||||
HASURA_PORT=8080
|
||||
|
||||
# --- Development-only switch -------------------------------------------------
|
||||
# Leave EMPTY/false in production. docker-compose.dev.yml sets SEED_DB=true for
|
||||
# local work; setting it on the Pi would inject test data into the live site.
|
||||
SEED_DB=
|
||||
|
||||
# --- Python FastAPI service (/py/) -------------------------------------------
|
||||
PYTHON_HOST=python
|
||||
PYTHON_PORT=8000
|
||||
|
||||
# TfL Unified API key (500 req/min); used by the Python hotel finder
|
||||
TFL_APP_KEY=
|
||||
Reference in New Issue
Block a user