Files
stpweb/.env.example
T
adamfandClaude Opus 5.5 af50e6c8ab
Test and deploy / test (push) Successful in 1m55s
Test and deploy / deploy (push) Successful in 59s
Add a job leads inbox that finds and scores postings
The tracker recorded applications but could not find jobs. A new
pipeline (services/job_leads.go, job_sources.go) polls a watch list of
sources on a timer or on request, files unseen postings as leads, marks
which pass a keyword and location pre-filter, and has Claude score those
against a single search profile through a fourth internal Python route,
/internal/jobs/score.

Sources are Greenhouse, Lever and Ashby company boards (public JSON) and
Adzuna and Reed keyword searches (API keys). The two search fetchers are
written from the providers' documentation and tested only against stubs.

Leads are their own table, not a job status, and are not soft deleted:
the (source_kind, external_id) index is the dedup, so a dismissed lead
has to remain a row. A lead reaches the tracker only by promotion, which
goes through UpsertJobApplication. That upsert moves from the capture
handler into services so promotion and the fetcher can share it; the
capture endpoint's behaviour is unchanged.

/cv/leads is the page: inbox, watch list and profile form. The timer is
off unless JOB_LEADS_ENABLED=true and never runs at start-up, so a
deploy spends no Claude calls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 15:03:46 +01:00

202 lines
9.0 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` service deliberately does neither wholesale — it uses an
# explicit `environment:` allow-list, so it never sees the database password
# or any API key other than the two it uses (TFL_APP_KEY, CLAUDE_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).
# On the Pi, keys and settings can also be changed from the admin panel's
# Environment tab, which rewrites this file in place (previous version kept
# as .env.bak) and restarts what reads the change. See "Editing from the
# admin panel" in DEPLOYMENT.md.
#
# ADDING A VARIABLE
# Add it to backend/services/env_registry.json as well. That file decides
# whether the admin panel shows it, whether it is editable there, and which
# services are restarted when it changes; a backend test fails if the two
# lists differ.
#
# 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) --------------------------------------------------
# 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>/email/callback (callback route already exists in the
# backend). Backend code exchanges a code there. TenantID must be "consumers"
# for a personal outlook.com account.
# The first sync prints an authorisation URL into the container log; visit it,
# consent, and the refresh token is persisted to backend/token/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 (backend) -----------------------------------------------------
# The lead fetcher polls the sources listed on /cv/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=
# --- 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=
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
# TfL Unified API key (500 req/min); used by the Python hotel finder
TFL_APP_KEY=