Opt-in and built so Garage can never take the site down: - the backend writes to the bucket only once S3_ENDPOINT is set, and falls back to the uploads volume (with a log line) if a write fails; - nginx serves /uploads/ from the volume first and Garage's anonymous website endpoint second, so every existing URL keeps working and nginx boots with no garage container; - nothing depends_on garage and no variable is required, so a missing secret cannot fail a deploy. Private attachments stay on disk, since nginx cannot gate a bucket. garage/bootstrap.sh sets up the layout, bucket, key and website access; the runbook is "Garage" in DEPLOYMENT.md. Also lifts the body limit on the internal auth subrequest, which 413'd large uploads to gated locations, and reserves the garage and dozzle page slugs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
284 lines
13 KiB
Bash
284 lines
13 KiB
Bash
# =============================================================================
|
|
# .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 and published ports are built.
|
|
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
|
|
# variables inside that container. nginx, backend, db, icecast2,
|
|
# certbot and gitea all do this.
|
|
# The `python` and `jobs` services deliberately do neither wholesale — each
|
|
# uses an explicit `environment:` allow-list, so neither sees the site's
|
|
# database password, the JWT secret, or any key it does not use.
|
|
#
|
|
# HOW TO USE
|
|
# cp .env.example .env then fill in every value.
|
|
# On the host, edit .env in place. After changing a value, recreate the
|
|
# services that read it:
|
|
# docker compose up -d <service>.
|
|
#
|
|
# ADDING A VARIABLE
|
|
# If the python or jobs service reads it, add it to that service's
|
|
# `environment:` list in docker-compose.yml too, or the container never
|
|
# receives it.
|
|
#
|
|
# 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, four databases: POSTGRES_DB for the Go backend,
|
|
# POSTGRES_GITEA_DB for Gitea, POSTGRES_JOBS_DB for the job tracker and
|
|
# POSTGRES_TRACKER_DB for the activity tracker (each of the last two with its
|
|
# own role). Only POSTGRES_DB is auto-created on first init; the others must
|
|
# be created by hand on a fresh volume (the job-tracker and ccp READMEs have
|
|
# the commands).
|
|
# POSTGRES_HOST doubles as the db container's name.
|
|
POSTGRES_USER=
|
|
POSTGRES_PASSWORD=
|
|
POSTGRES_DB=
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_HOST=db
|
|
POSTGRES_JOBS_DB=jobs
|
|
POSTGRES_JOBS_USER=jobs
|
|
POSTGRES_JOBS_PASSWORD=
|
|
POSTGRES_TRACKER_DB=tracker
|
|
POSTGRES_TRACKER_USER=tracker
|
|
POSTGRES_TRACKER_PASSWORD=
|
|
|
|
# --- 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
|
|
# The host's Tailscale MagicDNS name (e.g. stpvm.tailf20278.ts.net), shown in
|
|
# Gitea's SSH clone URLs. Not the public domain: 2222 is reachable only over
|
|
# the tailnet. Becomes Gitea's SSH_DOMAIN and DOMAIN. Blank means localhost.
|
|
GITEA_SSH_DOMAIN=
|
|
|
|
# --- 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 (job tracker) -----------------------------------------------
|
|
# EMAIL_BACKEND selects the mail source: "graph" (Microsoft Graph API, OAuth)
|
|
# or "imap" (fallback; Microsoft has retired IMAP basic auth for outlook.com,
|
|
# so imap+app-password only works with non-Microsoft providers like Gmail).
|
|
# For "graph": register an Entra "app registration" for a personal Microsoft
|
|
# account at azure.microsoft.com > Microsoft Entra ID > App registrations
|
|
# (default tenant = "consumers"); add a delegated Mail.Read permission with
|
|
# admin/user consent, and create a client secret. Redirect URI type "Web",
|
|
# value must live behind the site's real HTTPS origin, e.g.
|
|
# https://<YOUR_DOMAIN>/jobs/api/email/callback (served by the job tracker,
|
|
# which exchanges the code there). TenantID must be "consumers" for a personal
|
|
# outlook.com account.
|
|
# The tracker's Settings page (/jobs/settings) shows the authorisation link
|
|
# until you sign in; the refresh token is persisted to
|
|
# jobs-data/msgraph_token.json.
|
|
# OAuth flow reference: https://learn.microsoft.com/en-us/graph/auth-v2-user
|
|
EMAIL_BACKEND=
|
|
MSGRAPH_CLIENT_ID=
|
|
MSGRAPH_CLIENT_SECRET=
|
|
MSGRAPH_TENANT_ID=consumers
|
|
MSGRAPH_REDIRECT_URI=
|
|
# IMAP_PASSWORD should be an app-specific password, not the account password.
|
|
# Only read when EMAIL_BACKEND=imap.
|
|
IMAP_HOST=
|
|
IMAP_PORT=993
|
|
IMAP_EMAIL=
|
|
IMAP_PASSWORD=
|
|
EMAIL_SYNC_INTERVAL=
|
|
EMAIL_SYNC_ENABLED=
|
|
|
|
# --- Job leads (job tracker) --------------------------------------------------
|
|
# The lead fetcher polls the sources listed on /jobs/leads and files new
|
|
# postings in the leads inbox. JOB_LEADS_ENABLED=true runs it on a timer;
|
|
# "Check now" on that page works whether or not it is set. JOB_LEADS_INTERVAL
|
|
# is a Go duration (default 6h). Scoring uses CLAUDE_API_KEY, above.
|
|
# The board sources (Greenhouse, Lever, Ashby) need no key. The two search
|
|
# sources do, both free:
|
|
# Adzuna: https://developer.adzuna.com/ (an application id and a key)
|
|
# Reed: https://www.reed.co.uk/developers/jobseeker
|
|
# A search source whose key is blank reports that on the page; nothing else
|
|
# is affected.
|
|
JOB_LEADS_ENABLED=
|
|
JOB_LEADS_INTERVAL=
|
|
ADZUNA_APP_ID=
|
|
ADZUNA_APP_KEY=
|
|
REED_API_KEY=
|
|
|
|
# --- 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.
|
|
|
|
# --- SilverBullet (notes) ---------------------------------------------------
|
|
# Two instances over the same vault: the admin-only editor at /sb/, and the
|
|
# public read-only notes site at /notes/ (which replaced Quartz). All four
|
|
# default in nginx/entrypoint.sh and docker-compose.yml, so they can be left
|
|
# blank.
|
|
SILVERBULLET_HOST=silverbullet
|
|
SILVERBULLET_PORT=3000
|
|
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
|
SILVERBULLET_PUBLIC_PORT=3000
|
|
# Seconds between notes commit/push cycles (default 300).
|
|
SILVERBULLET_GIT_INTERVAL=
|
|
|
|
# --- 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 the bind mounts: read-write into the
|
|
# backend, silverbullet and silverbullet-git, read-only into
|
|
# silverbullet-public. 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=
|
|
|
|
# --- Cloudflare Tunnel -------------------------------------------------------
|
|
# Token of the remotely managed tunnel the `cloudflared` container runs
|
|
# (Zero Trust -> Networks -> Tunnels -> your tunnel -> the `--token` value in
|
|
# the install command). Hostnames and origin settings are configured in the
|
|
# dashboard, not here; see "Cloudflare Tunnel" in DEPLOYMENT.md. Blank leaves
|
|
# the container restarting with an error and the site reachable directly.
|
|
CLOUDFLARE_TUNNEL_TOKEN=
|
|
# Cloudflare API token for certbot's DNS-01 challenge (My Profile -> API
|
|
# Tokens -> Create Token -> "Edit zone DNS", limited to this zone). Set, the
|
|
# certificate renews without any inbound port, so the router's 80/443
|
|
# forwards can close. Blank falls back to HTTP-01 on port 80.
|
|
CLOUDFLARE_DNS_API_TOKEN=
|
|
|
|
# --- Third-party API keys (backend) ------------------------------------------
|
|
# CLAUDE_API_KEY is used by the python service, which makes every Claude call
|
|
# in the stack: the rowing photo reader, the job posting reader and the email
|
|
# pipeline's classifier. The backend no longer calls Claude itself.
|
|
CLAUDE_API_KEY=
|
|
# Which model those calls use: claude-haiku-4-5 (cheapest), claude-sonnet-5-5
|
|
# (the default when blank) or claude-opus-5-5. Recreate the python service
|
|
# to apply a change.
|
|
CLAUDE_MODEL=
|
|
STEAM_API_KEY=
|
|
STEAM_ID=
|
|
|
|
# --- 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
|
|
|
|
# --- Job tracker (/jobs/) -----------------------------------------------------
|
|
# An image built and published by the job-tracker repo's CI. Blank runs
|
|
# :latest; set a commit sha to pin. Changing it needs
|
|
# `docker compose pull jobs && docker compose up -d jobs`.
|
|
JOBS_IMAGE_TAG=
|
|
|
|
# --- USACO site (/usaco/) ------------------------------------------------------
|
|
# An image built and published by the usaco repo's CI. Blank runs :latest; set
|
|
# a commit sha to pin. Changing it needs
|
|
# `docker compose pull usaco && docker compose up -d usaco`.
|
|
USACO_IMAGE_TAG=
|
|
# Gitea access token (repository: read and write on adamf/usaco). The site
|
|
# clones with it and pushes the admin's edits back.
|
|
USACO_GIT_TOKEN=
|
|
# Shared secret of the usaco repo's push webhook in Gitea
|
|
# (http://usaco:8080/usaco/api/hooks/gitea). Blank turns the hook off and
|
|
# the site only pulls every 10 minutes. Generate with `openssl rand -hex 32`.
|
|
USACO_WEBHOOK_SECRET=
|
|
|
|
# --- Activity tracker (/tracker/) --------------------------------------------
|
|
# An image built and published by the ccp repo's CI. Blank runs :latest; set a
|
|
# commit sha to pin. Changing it needs
|
|
# `docker compose pull activity-tracker && docker compose up -d activity-tracker`.
|
|
ACTIVITY_TRACKER_IMAGE_TAG=
|
|
# IANA timezone that decides where a "day" starts in daily summaries. Blank is UTC.
|
|
TRACKER_TZ=Europe/London
|
|
|
|
# TfL Unified API key (500 req/min); used by the Python hotel finder
|
|
TFL_APP_KEY=
|
|
|
|
# --- Garage object store (public /uploads/) -----------------------------------
|
|
# See garage/garage.toml and DEPLOYMENT.md ("Garage"). Everything here is
|
|
# optional for the site to run: with S3_ENDPOINT blank the backend keeps
|
|
# writing uploads to the `uploads` volume exactly as before.
|
|
#
|
|
# Garage's own secrets, passed to the garage and garage-webui containers.
|
|
# Generate each with `openssl rand -hex 32`. The RPC secret must never change
|
|
# once the node has data; the admin token unlocks garage-webui's whole API.
|
|
GARAGE_RPC_SECRET=
|
|
GARAGE_ADMIN_TOKEN=
|
|
# The backend's S3 access, imported into Garage by garage/bootstrap.sh.
|
|
# Garage only accepts this shape:
|
|
# S3_ACCESS_KEY_ID "GK" + 24 hex (echo GK$(openssl rand -hex 12))
|
|
# S3_SECRET_ACCESS_KEY 64 hex (openssl rand -hex 32)
|
|
S3_ACCESS_KEY_ID=
|
|
S3_SECRET_ACCESS_KEY=
|
|
# Blank keeps uploads on disk. Set to http://garage:3900 (after running
|
|
# garage/bootstrap.sh) to store new public uploads in the bucket; recreate the
|
|
# backend after changing it. If a write to Garage fails the backend logs it and
|
|
# writes to disk instead, and nginx serves the file from there.
|
|
S3_ENDPOINT=
|
|
# Optional; these defaults match garage.toml and bootstrap.sh.
|
|
S3_REGION=garage
|
|
S3_BUCKET=uploads
|
|
# Optional, bootstrap.sh only: the node's capacity in the layout. With one node
|
|
# it only has to be non-zero; it is not a quota. Default 20G.
|
|
GARAGE_CAPACITY=
|