Compare commits
3
Commits
bfe2fe2782
...
94a6abba97
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a6abba97 | ||
|
|
65f2408ad4 | ||
|
|
46f06a033b |
@@ -20,8 +20,8 @@
|
||||
#
|
||||
# The dummy Postgres credentials only work on a database volume created with
|
||||
# them: an existing dbdata volume keeps whatever password it was initialised
|
||||
# with. Only POSTGRES_DB is created on a fresh volume; the jobs and
|
||||
# tracker databases and roles still have to be created by hand (.env.example).
|
||||
# with. Only POSTGRES_DB is created on a fresh volume; the tracker database
|
||||
# and role still have to be created by hand (.env.example).
|
||||
# =============================================================================
|
||||
|
||||
# --- Postgres ----------------------------------------------------------------
|
||||
@@ -30,9 +30,6 @@ POSTGRES_PASSWORD=dev-postgres-password
|
||||
POSTGRES_DB=site
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_HOST=db
|
||||
POSTGRES_JOBS_DB=jobs
|
||||
POSTGRES_JOBS_USER=jobs
|
||||
POSTGRES_JOBS_PASSWORD=dev-jobs-password
|
||||
POSTGRES_TRACKER_DB=tracker
|
||||
POSTGRES_TRACKER_USER=tracker
|
||||
POSTGRES_TRACKER_PASSWORD=dev-tracker-password
|
||||
@@ -51,30 +48,7 @@ GITEA_RUNNER_HOST=
|
||||
GITEA_RUNNER_NAME=dev-runner
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN=dev-dummy-runner-token
|
||||
|
||||
# --- Email ingest (job tracker) -----------------------------------------------
|
||||
# Sync is off; the credentials are fake, so a manual sign-in fails at Microsoft.
|
||||
EMAIL_BACKEND=graph
|
||||
MSGRAPH_CLIENT_ID=00000000-0000-0000-0000-000000000000
|
||||
MSGRAPH_CLIENT_SECRET=dev-dummy-msgraph-secret
|
||||
MSGRAPH_TENANT_ID=consumers
|
||||
MSGRAPH_REDIRECT_URI=http://localhost/jobs/api/email/callback
|
||||
IMAP_HOST=imap.invalid
|
||||
IMAP_PORT=993
|
||||
IMAP_EMAIL=[email protected]
|
||||
IMAP_PASSWORD=dev-dummy-imap-password
|
||||
EMAIL_SYNC_INTERVAL=
|
||||
EMAIL_SYNC_ENABLED=false
|
||||
|
||||
# --- Job leads (job tracker) --------------------------------------------------
|
||||
# The timer is off; "Check now" still works for the keyless board sources.
|
||||
JOB_LEADS_ENABLED=false
|
||||
JOB_LEADS_INTERVAL=
|
||||
ADZUNA_APP_ID=dev-dummy-adzuna-id
|
||||
ADZUNA_APP_KEY=dev-dummy-adzuna-key
|
||||
REED_API_KEY=dev-dummy-reed-key
|
||||
|
||||
# --- SilverBullet (notes) ---------------------------------------------------
|
||||
SILVERBULLET_HOST=silverbullet
|
||||
SILVERBULLET_PORT=3000
|
||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
||||
SILVERBULLET_PUBLIC_PORT=3000
|
||||
@@ -139,9 +113,6 @@ SEED_DB=true
|
||||
PYTHON_HOST=python
|
||||
PYTHON_PORT=8000
|
||||
|
||||
# --- Job tracker (/jobs/) -----------------------------------------------------
|
||||
JOBS_IMAGE_TAG=
|
||||
|
||||
# --- USACO site (/usaco/) ------------------------------------------------------
|
||||
USACO_IMAGE_TAG=
|
||||
USACO_GIT_TOKEN=dev-dummy-gitea-token
|
||||
@@ -165,3 +136,5 @@ S3_ENDPOINT=http://garage:3900
|
||||
S3_REGION=garage
|
||||
S3_BUCKET=uploads
|
||||
GARAGE_CAPACITY=1G
|
||||
|
||||
STPPRIV_LAN_IP=192.0.2.1
|
||||
|
||||
+20
-73
@@ -8,8 +8,8 @@
|
||||
# names and published ports are built.
|
||||
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
|
||||
# variables inside that container. backend, db and icecast2 do this.
|
||||
# The `python` and `jobs` services deliberately do neither wholesale — each
|
||||
# uses an explicit `environment:` allow-list, so neither sees the site's
|
||||
# The `python` service deliberately does neither wholesale — each
|
||||
# uses an explicit `environment:` allow-list, so it never sees the site's
|
||||
# database password, the JWT secret, or any key it does not use.
|
||||
#
|
||||
# HOW TO USE
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# ADDING A VARIABLE
|
||||
# Add it to .env.dev as well, with a dummy value, so the dev stack keeps
|
||||
# starting. If the python or jobs service reads it, add it to that service's
|
||||
# starting. If the python service reads it, add it to that service's
|
||||
# `environment:` list in docker-compose.yml too, or the container never
|
||||
# receives it.
|
||||
#
|
||||
@@ -33,9 +33,9 @@
|
||||
# =============================================================================
|
||||
|
||||
# --- Postgres ----------------------------------------------------------------
|
||||
# One instance, three databases: POSTGRES_DB for the Go backend,
|
||||
# POSTGRES_JOBS_DB for the job tracker and POSTGRES_TRACKER_DB for the
|
||||
# activity tracker (each of the last two with its own role). Gitea's database
|
||||
# One instance, two databases: POSTGRES_DB for the Go backend and
|
||||
# POSTGRES_TRACKER_DB for the activity tracker (with its own role). The job
|
||||
# tracker's database moved to stppriv's own Postgres. Gitea's database
|
||||
# is in the Gitea LXC's own Postgres. 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).
|
||||
@@ -45,9 +45,6 @@ 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=
|
||||
@@ -73,63 +70,13 @@ 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=
|
||||
|
||||
# --- 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 docker-compose.yml (the caddy service's list), so they can be left
|
||||
# blank.
|
||||
SILVERBULLET_HOST=silverbullet
|
||||
SILVERBULLET_PORT=3000
|
||||
# The public read-only notes site at /notes/. The editor, and the vault's only
|
||||
# writer, is stppriv (priv.DOMAIN/sb/); silverbullet-git here only pulls.
|
||||
# Both default in docker-compose.yml.
|
||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
||||
SILVERBULLET_PUBLIC_PORT=3000
|
||||
# Seconds between notes commit/push cycles (default 300).
|
||||
# Seconds between notes pulls (default 300).
|
||||
SILVERBULLET_GIT_INTERVAL=
|
||||
|
||||
# --- Go backend --------------------------------------------------------------
|
||||
@@ -144,8 +91,8 @@ 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
|
||||
# HOST path, interpolated straight into the bind mounts: read-write into
|
||||
# silverbullet-git (which pulls it), read-only into the backend and
|
||||
# silverbullet-public. Must be an absolute path that exists on the host or the
|
||||
# stack will not start.
|
||||
OBSIDIAN_DIR=
|
||||
@@ -202,8 +149,8 @@ CLOUDFLARE_DNS_API_TOKEN=
|
||||
# --- Third-party API keys (backend) ------------------------------------------
|
||||
# CLAUDE_API_KEY is used by the python service, which makes the main site's
|
||||
# Claude calls: the rowing photo reader, the job posting reader and the email
|
||||
# pipeline's classifier. The backend no longer calls Claude itself. The jobs
|
||||
# and usaco containers get the same key for their own calls.
|
||||
# pipeline's classifier. The backend no longer calls Claude itself. The usaco
|
||||
# container gets the same key for its own calls.
|
||||
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
|
||||
@@ -221,12 +168,6 @@ SEED_DB=
|
||||
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
|
||||
@@ -287,6 +228,12 @@ RECEIPT_WEB_UPSTREAM=100.107.152.119:8765
|
||||
# `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`.
|
||||
RECEIPT_WEB_TOKEN=
|
||||
|
||||
# --- stppriv (priv.DOMAIN) ---------------------------------------------------
|
||||
# The private-tools LXC's LAN IP. Its Caddy asks /api/auth/validate-admin
|
||||
# directly, not via the tunnel, and requests from this IP skip the api rate
|
||||
# limit. Blank matches nothing.
|
||||
STPPRIV_LAN_IP=
|
||||
|
||||
# --- Partner Radar (radar.DOMAIN) ----------------------------------------------
|
||||
# A separate compose project on this host (adamf/cto, `make stpvm`), whose web
|
||||
# container joins app-network as `radar-web`. Only set this to point
|
||||
|
||||
@@ -59,9 +59,9 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
|
||||
|
||||
**Frontend** (`vue/`): Vue 3 SPA with Vite, Tailwind CSS v4, Pinia stores, Vue Router. Built in a separate container; assets served by Caddy (production) or proxied to Vite dev server (dev mode).
|
||||
|
||||
**Python API** (`python/`): FastAPI app served by uvicorn on port 8000. Caddy proxies `/py/` to it and strips the prefix, so routes in `python/app/main.py` are written relative to `/`. Swagger UI at `/py/docs`. Dev mode mounts `python/app` and runs uvicorn with `--reload`. **The site's Claude call lives here**, behind an internal route: `/internal/rowing/read` (behind `POST /api/rowing`). The Go backend calls it directly over the Docker network through `services.CallPython`, and Caddy 404s `/py/internal/`. The model is one setting, shared with the job tracker, `CLAUDE_MODEL` (default `claude-sonnet-5-5`), set in `.env`; `python/app/claude.py` shapes the request per model. Adding another route is a short recipe in `python/README.md` ("Internal routes").
|
||||
**Python API** (`python/`): FastAPI app served by uvicorn on port 8000. Caddy proxies `/py/` to it and strips the prefix, so routes in `python/app/main.py` are written relative to `/`. Swagger UI at `/py/docs`. Dev mode mounts `python/app` and runs uvicorn with `--reload`. **The site's Claude call lives here**, behind an internal route: `/internal/rowing/read` (behind `POST /api/rowing`). The Go backend calls it directly over the Docker network through `services.CallPython`, and Caddy 404s `/py/internal/`. The model is one setting, `CLAUDE_MODEL` (default `claude-sonnet-5-5`), set in `.env`; `python/app/claude.py` shapes the request per model. Adding another route is a short recipe in `python/README.md` ("Internal routes").
|
||||
|
||||
**Job tracker** (`jobs` service, `/jobs/`): the job application tracker, leads inbox, email pipeline and capture userscript now live in their own repo (`adamf/job-tracker` on Gitea) and run here as a published image, with their own Postgres database and role. It has no login: it asks the backend's `/auth/validate-admin` with the visitor's cookies. Nothing of it is left in `backend/`, `python/` or `vue/`; Caddy redirects the old `/cv/jobs`, `/cv/leads` and userscript URLs to `/jobs/`. A push to that repo's `main` publishes the image and rolls this stack's `jobs` container onto it; pin `JOBS_IMAGE_TAG` in `.env` to hold a version. Its variables are passed through the `jobs` service's explicit `environment:` list in `docker-compose.yml`.
|
||||
**Job tracker and notes editor** (on stppriv): the job tracker (`adamf/job-tracker`) and the SilverBullet editor run on their own LXC, from the `adamf/stppriv` repo, at `priv.<DOMAIN>` behind Cloudflare Access. Caddy here 301s `/sb/`, `/jobs/` and the old `/cv/jobs`, `/cv/leads` and userscript URLs there. stppriv is the notes vault's only writer; `silverbullet-git` here runs with `SYNC_MODE=pull` and feeds `/notes/`.
|
||||
|
||||
**Gitea** (own repo, `adamf/stpgit`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from the `adamf/stpgit` repo (this repo's `gitea/` directory until then) with their own Postgres (`gitea-db`) and `.env`, deployed by hand there and never by CI. Everything on stpvm reaches it as `GITEA_HOST` (`git.<DOMAIN>`, :3000 HTTP and :2222 SSH), pinned to the LXC's LAN IP (`GITEA_UPSTREAM`) by `extra_hosts` in containers and `/etc/hosts` on the host; public DNS for that name is Cloudflare, which carries only HTTPS. There is no Gitea container or forwarder in this stack since 2026-11-24. The act_runner stays on stpvm. Runbook: that repo's README, summarised in "Gitea LXC" in `DEPLOYMENT.md` §7.
|
||||
|
||||
@@ -100,7 +100,7 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
|
||||
- **Adding a GraphQL entity**: model in `models/models.go` (and the AutoMigrate list), schema file with directives, mapping in `gqlgen.yml`, `make generate`, fill in the resolvers; on the frontend a store built with `createCrudStore`. Model `ID uint` binds directly via `graphql.UintID` — there are no hand-written ID resolvers. Full recipe in `backend/README.md`.
|
||||
- **Per-service permissions**: a non-admin account can be granted individual gated services (today only `receipt`, for `/receipt/`) in the admin panel's Manage Users tab. The keys are the registry `services.PermissionTypes` (`backend/services/permissions.go`), stored in `User.Permissions`; admins hold them all. Caddy's *permission gate* (`import permission_gate <key>` in a route, see `caddy/routes.caddy` and the snippet in `caddy/Caddyfile`) asks `GET /auth/validate/<key>`, which reads the user row, so grants apply on the next request. Making another service grantable is a registry entry plus swapping its route from `import admin_gate` to `import permission_gate <key>`. `/auth/validate-admin` and the admin gate are unchanged.
|
||||
- **Spotify tokens**: Persisted to `/backend/token/spotify_token.json` inside the container, surviving restarts.
|
||||
- **Environment variables**: every variable goes in `.env.example`, and a dummy value for it in `.env.dev`. One the Python service or the job tracker reads must also be added to the `python` or `jobs` service's explicit `environment:` list in `docker-compose.yml`, or the container never receives it. `.env` is edited by hand on the host; there is no admin-panel editor.
|
||||
- **Environment variables**: every variable goes in `.env.example`, and a dummy value for it in `.env.dev`. One the Python service reads must also be added to the `python` service's explicit `environment:` list in `docker-compose.yml`, or the container never receives it. `.env` is edited by hand on the host; there is no admin-panel editor.
|
||||
- **Gitea feed**: Backend proxies and caches (1 min TTL) the Gitea activity feed API.
|
||||
- **All GORM models use soft delete** (`gorm.DeletedAt` field). Note that a `uniqueIndex` still collides with soft-deleted rows.
|
||||
|
||||
|
||||
+12
-17
@@ -34,8 +34,8 @@ dials out and publishes no port; see "Cloudflare Tunnel" in §3.
|
||||
--------------------------------------------- (same container
|
||||
| | | | | | as icecast2)
|
||||
v v v v v v |
|
||||
/api/ /radio/ /v2/ /sb/ /notes/ /py/ |
|
||||
backend icecast2 gitea sb sb-pub python |
|
||||
/api/ /radio/ /v2/ /notes/ /py/ |
|
||||
backend icecast2 gitea sb-pub python |
|
||||
| ^ |
|
||||
| | |
|
||||
| +-------------------------------------------------------+
|
||||
@@ -89,11 +89,9 @@ Deploys of this stack never touch Gitea.
|
||||
| caddy (the edge) | `caddy` | 80, 443 (fixed IP `172.28.255.251`) | everything below | **80, 443** |
|
||||
| backend (Go) | `${BACKEND_HOST}` | `${BACKEND_PORT}` (8080) | `${BACKEND_ENDPOINT}` = `/api/` | no |
|
||||
| db (Postgres 16) | `${POSTGRES_HOST}` | 5432 | none | no |
|
||||
| silverbullet (editor) | `${SILVERBULLET_HOST}` | `${SILVERBULLET_PORT}` | `/sb/` (admin-gated) | no |
|
||||
| silverbullet-public (notes site) | `${SILVERBULLET_PUBLIC_HOST}` | `${SILVERBULLET_PUBLIC_PORT}` | `/notes/` (**public**, read-only) | no |
|
||||
| silverbullet-git | n/a | n/a | none (timer loop) | no |
|
||||
| python (FastAPI) | `${PYTHON_HOST}` | `${PYTHON_PORT}` | `/py/`, docs at `/py/docs` | no |
|
||||
| jobs (job tracker, published image) | `jobs` | 8080 | `/jobs/` (admin-gated by Caddy `forward_auth`; capture API and userscript public, bearer-token) | no |
|
||||
| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (pages admin-gated by Caddy `forward_auth`; `/api/v1/` bearer/app-checked) | no |
|
||||
| icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** |
|
||||
| vue | `vue` | 5173 (dev only) | `/` (dev only) | no |
|
||||
@@ -131,13 +129,14 @@ The config is `caddy/Caddyfile` (global options and snippets), `caddy/routes.cad
|
||||
it, so stripping the prefix serves a blank page with nothing in the log).
|
||||
- **Upstreams resolve when dialled.** Caddy starts with any upstream container
|
||||
missing and answers 502 until it appears; it never refuses to start over one.
|
||||
- **Admin gate.** `/sb/`, `/jobs/`, `/tracker/`, `/dozzle/`, `/garage/`, `/radio/admin/` and `/uploads/private/` are
|
||||
- **Admin gate.** `/tracker/`, `/dozzle/`, `/garage/`, `/radio/admin/` and `/uploads/private/` are
|
||||
protected by `forward_auth` to the backend's `/auth/validate-admin` (the
|
||||
`admin_gate` snippet); a 401/403 redirects to the SPA login. Most of these services have no auth of their own at that path; the
|
||||
job and activity trackers also check the session themselves. Their carve-outs, which a session
|
||||
cookie never reaches, stay public at the edge and are guarded by bearer tokens in the apps:
|
||||
`/jobs/api/capture` and `/jobs/job-capture.user.js`, `/tracker/api/v1/` and `/tracker/tracker.user.js`.
|
||||
Paths are matched cleaned and case-insensitively, so `/SB/` or `/uploads/x/../private/y`
|
||||
activity tracker also checks the session itself. Its carve-outs, which a session
|
||||
cookie never reaches, stay public at the edge and are guarded by bearer tokens in the app:
|
||||
`/tracker/api/v1/` and `/tracker/tracker.user.js`. `/sb/` and `/jobs/` 301 to stppriv
|
||||
(`priv.<DOMAIN>`, behind Cloudflare Access; see the `adamf/stppriv` README).
|
||||
Paths are matched cleaned and case-insensitively, so `/TRACKER/` or `/uploads/x/../private/y`
|
||||
land on the gate too. With the backend down every gated path answers 502: it fails closed.
|
||||
- **Permission gate.** `/receipt/` asks `/auth/validate/receipt` instead (the
|
||||
`permission_gate` snippet), which also lets in a
|
||||
@@ -239,7 +238,6 @@ The override layer changes these services and disables `cloudflared`:
|
||||
- **backend** — `DEV_MODE`, GraphQL playground and introspection on, a localhost
|
||||
Spotify redirect URI, and **`SEED_DB=true`**.
|
||||
- **python** — `uvicorn --reload` with `python/app` bind-mounted.
|
||||
- **jobs** — seeded, with the GraphQL playground on.
|
||||
- **cloudflared** — put in the `disabled` profile, so it never starts: a dev
|
||||
stack must never join the production tunnel.
|
||||
|
||||
@@ -421,10 +419,9 @@ of deleting the directory:
|
||||
| `./caddy/data` | Caddy's TLS certificates, **private keys** and ACME account | Gitignored. Never commit. Losing it means a re-issue on the next start (§3). |
|
||||
| `./certbot/conf` | The old certbot certificate and keys | Unused since 2026-11-17; kept as the rollback until it is cleaned up (§7). |
|
||||
| `./backend/token/` | **Spotify OAuth refresh token** (`spotify_token.json`) | Gitignored. Without this mount, Spotify would need re-authorising after every rebuild. |
|
||||
| `./jobs-data` | The job tracker's **capture token hash** and Graph OAuth session | Gitignored. Must be owned by uid 1000, the user the `jobs` image runs as. |
|
||||
| `./logs` | Backend logs (`go.log`); Caddy's JSON request-body log in `logs/caddy/payloads.log` | Caddy rotates the payload log itself (50 MiB, five kept). `logs/nginx/` is nginx's, finished. |
|
||||
| `./icecast2/fallback_music` | Radio fallback MP3s | Copied to the host by hand, not git |
|
||||
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | Read-write to backend and silverbullet, **read-only** to silverbullet-public |
|
||||
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | A pull-only clone (`silverbullet-git`); **read-only** to backend and silverbullet-public |
|
||||
|
||||
Gitea's state (`data/`, `config/` and the `gitea_gitea_db` volume, in the
|
||||
`adamf/stpgit` checkout) is on the Gitea LXC, not here; see "Gitea LXC" in §7. The pre-move copy is in
|
||||
@@ -452,13 +449,11 @@ Gitea's own variables are in the `.env` of its checkout on the Gitea LXC (the
|
||||
`adamf/stpgit` repo's `.env.example`);
|
||||
there it receives explicit `GITEA__section__KEY` variables (Gitea's own
|
||||
convention for overriding `app.ini` keys). Here, `python` receives an explicit
|
||||
allow-list (as do `jobs`, `caddy` and the rest), so it never sees the database password or any API key other than
|
||||
allow-list (as do `caddy` and the rest), so it never sees the database password or any API key other than
|
||||
the two it uses (`TFL_APP_KEY`, and `CLAUDE_API_KEY`, plus `CLAUDE_MODEL`,
|
||||
which picks the model). The Python service
|
||||
makes the site's one Claude call (the rowing photo reader); the `jobs` container
|
||||
(the job tracker, built from its own repo) makes its own, and gets a similar
|
||||
allow-list with its own database role. The backend receives `CLAUDE_API_KEY`
|
||||
through `env_file` but does not use it. A new variable for either service has
|
||||
makes the site's one Claude call (the rowing photo reader). The backend receives `CLAUDE_API_KEY`
|
||||
through `env_file` but does not use it. A new variable for it has
|
||||
to be added to its allow-list as well as
|
||||
`.env.example`.
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@ backend (8080) ── Go API (GraphQL + REST)
|
||||
db (5432) ── PostgreSQL 16
|
||||
icecast2 (8000) ── Audio Streaming (Icecast2 + Liquidsoap)
|
||||
gitea (3000) ── Self-Hosted Git
|
||||
silverbullet (3000) ── Obsidian Notes Editor (SilverBullet 2.11.0)
|
||||
silverbullet-public (3000) ── Public read-only notes site (same image, SB_READ_ONLY)
|
||||
silverbullet-git ── Commits/pushes notes edits to the notes repo
|
||||
silverbullet-git ── Pulls the notes repo (the editor and its pushes are on stppriv)
|
||||
python (8000) ── Python API (FastAPI)
|
||||
```
|
||||
|
||||
@@ -52,9 +51,9 @@ python (8000) ── Python API (FastAPI)
|
||||
- Fan shrines (GTO, Evangelion, Demoman, Skip Skip Benben)
|
||||
- Self-hosted Git (Gitea) with CI/CD and commit feed on homepage
|
||||
- Printable CV with role-specific sections
|
||||
- Job application tracker with status workflow and CSV export (admin-only, `/cv/jobs`)
|
||||
- Job application tracker: runs on stppriv (`priv.<DOMAIN>/jobs/`), from the `adamf/job-tracker` repo
|
||||
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
|
||||
- Admin-gated routes: `/sb`, `/jobs`, `/tracker`, `/dozzle`, `/garage` and more require the admin session, checked by Caddy's `forward_auth` against the backend
|
||||
- Admin-gated routes: `/tracker`, `/dozzle`, `/garage` and more require the admin session, checked by Caddy's `forward_auth` against the backend
|
||||
- Landing page with animated stamps section
|
||||
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
|
||||
- Backend healthcheck (reported in `docker ps`; nothing restarts on it)
|
||||
@@ -67,10 +66,10 @@ python (8000) ── Python API (FastAPI)
|
||||
| `/stp` | Home dashboard with grid layout |
|
||||
| `/admin` | Admin login + panel (authenticated) |
|
||||
| `/cv` | Curriculum Vitae (printable) |
|
||||
| `/cv/jobs` | Job application tracker (admin-only, hidden print) |
|
||||
| `/cv/jobs` | 301 to the job tracker on stppriv |
|
||||
| `/bookmarks` | Bookmarks (database-backed, grouped by category) |
|
||||
| `/notes/:path` | Obsidian notes (read-only SilverBullet, public; `private/` excluded) |
|
||||
| `/sb/` | Obsidian note editor (via SilverBullet, admin-only) |
|
||||
| `/sb/` | 301 to the note editor on stppriv (`priv.<DOMAIN>/sb/`) |
|
||||
| `/shrines` | Fan shrine index + individual shrines |
|
||||
|
||||
## API
|
||||
@@ -180,11 +179,11 @@ Access tokens are valid for 7 days; refresh tokens for 365 days. `ValidateAdmin`
|
||||
| `/radio` | icecast:8000 | Audio streaming |
|
||||
| `/gitea` | gitea:3000 | Git service |
|
||||
| `/notes` | silverbullet-public:3000 | Obsidian notes (public, read-only) |
|
||||
| `/sb` | silverbullet:3000 | Obsidian notes editor (admin-only) |
|
||||
| `/sb`, `/jobs` | 301 to `priv.<DOMAIN>` | Editor and job tracker, on stppriv |
|
||||
| `/py` | python:8000 | Python API (FastAPI; docs at `/py/docs`) |
|
||||
| `/uploads` | local alias | User-uploaded files |
|
||||
|
||||
`/sb` is protected by `forward_auth` to the backend's `/auth/validate-admin`. Requests without a valid admin session are redirected to `/admin/login`. The full table is `caddy/routes.caddy`; `DEPLOYMENT.md` §1 explains it.
|
||||
Admin-only routes such as `/tracker` are protected by `forward_auth` to the backend's `/auth/validate-admin`. Requests without a valid admin session are redirected to `/admin/login`. The full table is `caddy/routes.caddy`; `DEPLOYMENT.md` §1 explains it.
|
||||
|
||||
### Deprecated Endpoints
|
||||
|
||||
@@ -213,11 +212,9 @@ Create a `.env` file in the project root. All services read from this file.
|
||||
| `UPTIMEKUMA_PORT` | Uptime Kuma port (planned) |
|
||||
| `WALLABAG_HOST` | Wallabag hostname (planned) |
|
||||
| `WALLABAG_PORT` | Wallabag port (planned) |
|
||||
| `SILVERBULLET_HOST` | SilverBullet hostname (defaults to `silverbullet`) |
|
||||
| `SILVERBULLET_PORT` | SilverBullet port (defaults to `3000`) |
|
||||
| `SILVERBULLET_PUBLIC_HOST` | Public notes SilverBullet hostname (defaults to `silverbullet-public`) |
|
||||
| `SILVERBULLET_PUBLIC_PORT` | Public notes SilverBullet port (defaults to `3000`) |
|
||||
| `SILVERBULLET_GIT_INTERVAL` | Seconds between notes commit/push cycles (defaults to `300`) |
|
||||
| `SILVERBULLET_GIT_INTERVAL` | Seconds between notes pulls (defaults to `300`) |
|
||||
| `GITEA_RUNNER_HOST` | Gitea runner hostname |
|
||||
| `GITEA_RUNNER_NAME` | Gitea runner display name |
|
||||
| `GITEA_RUNNER_REGISTRATION_TOKEN` | Token to register Gitea Actions runner |
|
||||
@@ -260,9 +257,9 @@ Gitea is not part of this stack. It runs in its own LXC from the `adamf/stpgit`
|
||||
### Obsidian Notes Setup
|
||||
|
||||
1. Set `OBSIDIAN_DIR` in `.env` to the absolute path of your Obsidian vault on the host machine
|
||||
2. The vault is mounted read-write into `silverbullet` at `/data`, which serves it as an
|
||||
editor at `/sb/`, and read-only into `silverbullet-public`, which serves it publicly at
|
||||
`/notes/` with `SB_READ_ONLY`
|
||||
2. The vault is a pull-only clone of the notes repo (`silverbullet-git`, `SYNC_MODE=pull`),
|
||||
mounted read-only into `silverbullet-public`, which serves it publicly at `/notes/` with
|
||||
`SB_READ_ONLY`. The editor, and the vault's only writer, is on stppriv (`priv.<DOMAIN>/sb/`)
|
||||
3. `private/` and `templates/` (at any depth), and dot-folders such as `.git`, are kept off
|
||||
`/notes/` by `SB_SPACE_IGNORE` **and** Caddy deny rules — the Caddy rules are the ones that
|
||||
actually enforce it. See `DEPLOYMENT.md` ("Public notes privacy boundary")
|
||||
|
||||
+1
-1
@@ -22,10 +22,10 @@ RUN set -e; \
|
||||
BACKEND_HOST=backend BACKEND_PORT=8080 BACKEND_ENDPOINT=/api \
|
||||
ICECAST_HOST=icecast2 ICECAST_PORT=8000 \
|
||||
GITEA_HOST=gitea GITEA_PORT=3000 \
|
||||
SILVERBULLET_HOST=silverbullet SILVERBULLET_PORT=3000 \
|
||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public SILVERBULLET_PUBLIC_PORT=3000 \
|
||||
PYTHON_HOST=python PYTHON_PORT=8000 \
|
||||
RECEIPT_WEB_UPSTREAM=127.0.0.1:9 RECEIPT_WEB_TOKEN=validate \
|
||||
STPPRIV_LAN_IP=192.0.2.1 \
|
||||
CLOUDFLARE_DNS_API_TOKEN=validate-placeholder-token-0000000000000 \
|
||||
caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile; \
|
||||
done; \
|
||||
|
||||
+18
-8
@@ -105,25 +105,24 @@ must 404 - py-internal /py//internal/rowing/read --path-as-is -X POST
|
||||
|
||||
echo "# admin gate, signed out: must redirect to the login, with the original URI"
|
||||
for p in \
|
||||
/sb/ /sb/index.html /jobs/ /jobs/api/graphql /tracker/ /tracker/dashboard \
|
||||
/dozzle/ /garage/ /radio/admin/stats.xsl /uploads/private/x.png \
|
||||
"/jobs/leads?x=1"; do
|
||||
/tracker/ /tracker/dashboard \
|
||||
/dozzle/ /garage/ /radio/admin/stats.xsl /uploads/private/x.png; do
|
||||
must 302 "$LOGIN$p" gate "$p"
|
||||
done
|
||||
must 302 "${LOGIN}/uploads/x/../private/x.png" gate /uploads/x/../private/x.png --path-as-is
|
||||
show gate "$BASE/SB/"
|
||||
show gate "$BASE/TRACKER/"
|
||||
must 302 "${LOGIN}/receipt/" permission /receipt/
|
||||
|
||||
if [ -n "${EDGE_COOKIE:-}" ]; then
|
||||
echo "# admin gate, signed in: must be let through"
|
||||
for p in /sb/ /jobs/ /tracker/ /dozzle/ /garage/ /radio/admin/stats.xsl \
|
||||
for p in /tracker/ /dozzle/ /garage/ /radio/admin/stats.xsl \
|
||||
/receipt/; do
|
||||
not_login gate "$p" -H "Cookie: $EDGE_COOKIE"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "# carve-outs and public routes (status depends on the upstream)"
|
||||
for p in /jobs/api/capture /jobs/job-capture.user.js /tracker/api/v1/events \
|
||||
for p in /tracker/api/v1/events \
|
||||
/tracker/tracker.user.js /tracker/readyz /usaco/ /notes/ /radio/status.xsl \
|
||||
/py/ /py/docs /api/ /api/me /; do
|
||||
show public "$BASE$p"
|
||||
@@ -138,9 +137,20 @@ must 301 "$GIT/adamf/stpweb/src/branch/main/README.md" gitea /gitea/adamf/stpweb
|
||||
must 301 "$GIT/adamf/stpweb.git/info/refs?service=git-upload-pack" gitea "/gitea/adamf/stpweb.git/info/refs?service=git-upload-pack"
|
||||
must 301 "$GIT/adamf/stpweb/commit/0000000" gitea /gitea/adamf/stpweb/commit/0000000
|
||||
|
||||
echo "# the editor and job tracker are on stppriv: must 301 there, path kept"
|
||||
PRIV="https://priv.${GIT_HOST#www.}"
|
||||
for p in /sb/ /sb/index.html /SB/ /jobs/ /jobs/api/graphql "/jobs/leads?x=1" \
|
||||
/jobs/api/capture /jobs/job-capture.user.js; do
|
||||
must 301 "$PRIV$p" priv "$p"
|
||||
done
|
||||
must 301 "$PRIV/sb/" priv /sb
|
||||
must 301 "$PRIV/jobs/" priv /jobs
|
||||
must 301 "$PRIV/jobs/" priv /cv/jobs
|
||||
must 301 "$PRIV/jobs/job-capture.user.js" priv /job-capture.user.js
|
||||
|
||||
echo "# bare prefixes and moved URLs"
|
||||
for p in /api /radio /dozzle /garage /notes /sb /py /jobs /usaco \
|
||||
/tracker /receipt /cv/jobs /cv/leads /job-capture.user.js "/gitea?x=1"; do
|
||||
for p in /api /radio /dozzle /garage /notes /py /usaco \
|
||||
/tracker /receipt /cv/leads "/gitea?x=1"; do
|
||||
show redirect "$BASE$p"
|
||||
done
|
||||
|
||||
|
||||
+24
-31
@@ -44,17 +44,17 @@ redir /dozzle /dozzle/ 301
|
||||
redir /garage /garage/ 301
|
||||
redir /gitea https://git.{$DOMAIN}/ 301
|
||||
redir /notes /notes/ 301
|
||||
redir /sb /sb/ 301
|
||||
redir /sb https://priv.{$DOMAIN}/sb/ 301
|
||||
redir /py /py/ 301
|
||||
redir /jobs /jobs/ 301
|
||||
redir /jobs https://priv.{$DOMAIN}/jobs/ 301
|
||||
redir /usaco /usaco/ 301
|
||||
redir /tracker /tracker/ 301
|
||||
redir /receipt /receipt/ 301
|
||||
|
||||
# Old job tracker URLs; the userscript's old @updateURL finds its update here.
|
||||
redir /cv/jobs /jobs/ 301
|
||||
redir /cv/leads /jobs/leads 301
|
||||
redir /job-capture.user.js /jobs/job-capture.user.js 301
|
||||
redir /cv/jobs https://priv.{$DOMAIN}/jobs/ 301
|
||||
redir /cv/leads https://priv.{$DOMAIN}/jobs/leads 301
|
||||
redir /job-capture.user.js https://priv.{$DOMAIN}/jobs/job-capture.user.js 301
|
||||
|
||||
# ---- Backend API ---------------------------------------------------------------
|
||||
|
||||
@@ -66,6 +66,20 @@ handle {$BACKEND_ENDPOINT}/ws* {
|
||||
}
|
||||
}
|
||||
|
||||
# stppriv's admin_gate checks every one of its requests here from one LAN IP,
|
||||
# so it would exhaust the per-IP api limit. Public traffic always arrives from
|
||||
# cloudflared, so it can never match.
|
||||
@stppriv_gate {
|
||||
path {$BACKEND_ENDPOINT}/auth/validate-admin
|
||||
remote_ip {$STPPRIV_LAN_IP}
|
||||
}
|
||||
handle @stppriv_gate {
|
||||
uri strip_prefix {$BACKEND_ENDPOINT}
|
||||
reverse_proxy {$BACKEND_HOST}:{$BACKEND_PORT} {
|
||||
import proxy
|
||||
}
|
||||
}
|
||||
|
||||
# On top of the backend's own 5/min.
|
||||
handle {$BACKEND_ENDPOINT}/auth/login* {
|
||||
import limit login 5 1m
|
||||
@@ -130,13 +144,9 @@ handle /radio/admin/* {
|
||||
}
|
||||
}
|
||||
|
||||
# No prefix strip: with SB_URL_PREFIX the app builds its URLs from /sb, and a
|
||||
# stripped prefix loads a blank page.
|
||||
# The notes editor is on stppriv, behind Cloudflare Access.
|
||||
handle /sb/* {
|
||||
import admin_gate
|
||||
reverse_proxy {$SILVERBULLET_HOST}:{$SILVERBULLET_PORT} {
|
||||
import proxy
|
||||
}
|
||||
redir https://priv.{$DOMAIN}{uri} 301
|
||||
}
|
||||
|
||||
# ---- Public services -----------------------------------------------------------
|
||||
@@ -181,27 +191,10 @@ handle /py/* {
|
||||
}
|
||||
|
||||
# ---- Job tracker (/jobs/) ----
|
||||
# Not stripped: the app lives at /jobs/. The capture API (bearer token) and
|
||||
# the userscript (fetched without cookies, holds no secrets) bypass the gate.
|
||||
handle /jobs/api/capture* {
|
||||
import limit api 30 1s
|
||||
reverse_proxy jobs:8080 {
|
||||
import proxy
|
||||
}
|
||||
}
|
||||
|
||||
handle /jobs/job-capture.user.js {
|
||||
reverse_proxy jobs:8080 {
|
||||
import proxy
|
||||
}
|
||||
}
|
||||
|
||||
# On stppriv. A 301 turns a POST into a GET, so capture clients must call
|
||||
# priv. directly.
|
||||
handle /jobs/* {
|
||||
import admin_gate
|
||||
import limit api 30 1s
|
||||
reverse_proxy jobs:8080 {
|
||||
import proxy
|
||||
}
|
||||
redir https://priv.{$DOMAIN}{uri} 301
|
||||
}
|
||||
|
||||
# ---- USACO (/usaco/) ----
|
||||
|
||||
@@ -26,14 +26,6 @@ services:
|
||||
command: ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path /py --reload"]
|
||||
volumes:
|
||||
- ./python/app:/app/app
|
||||
# No hot reload in this image; use its own repo's `npm run dev` for that.
|
||||
jobs:
|
||||
environment:
|
||||
- DEV_MODE=true
|
||||
- SEED_DB=true
|
||||
- GQL_PLAYGROUND=true
|
||||
- GQL_INTROSPECTION=true
|
||||
- MSGRAPH_REDIRECT_URI=https://localhost/jobs/api/email/callback
|
||||
cloudflared:
|
||||
# Never start: a dev stack on the tunnel would get real visitors.
|
||||
profiles:
|
||||
|
||||
+6
-59
@@ -65,14 +65,13 @@ services:
|
||||
- ICECAST_PORT=${ICECAST_PORT}
|
||||
- GITEA_HOST=${GITEA_HOST}
|
||||
- GITEA_PORT=${GITEA_PORT}
|
||||
- SILVERBULLET_HOST=${SILVERBULLET_HOST:-silverbullet}
|
||||
- SILVERBULLET_PORT=${SILVERBULLET_PORT:-3000}
|
||||
- SILVERBULLET_PUBLIC_HOST=${SILVERBULLET_PUBLIC_HOST:-silverbullet-public}
|
||||
- SILVERBULLET_PUBLIC_PORT=${SILVERBULLET_PUBLIC_PORT:-3000}
|
||||
- PYTHON_HOST=${PYTHON_HOST:-python}
|
||||
- PYTHON_PORT=${PYTHON_PORT:-8000}
|
||||
# A dead port by default, so /receipt/ reads "offline".
|
||||
- RECEIPT_WEB_UPSTREAM=${RECEIPT_WEB_UPSTREAM:-127.0.0.1:9}
|
||||
- STPPRIV_LAN_IP=${STPPRIV_LAN_IP:-192.0.2.1}
|
||||
- RECEIPT_WEB_TOKEN=${RECEIPT_WEB_TOKEN:-}
|
||||
# The adamf/cto stack's web container; "offline" while that stack is down.
|
||||
- RADAR_UPSTREAM=${RADAR_UPSTREAM:-radar-web:80}
|
||||
@@ -149,7 +148,8 @@ services:
|
||||
volumes:
|
||||
# Spotify refresh token; without this every deploy forces a re-auth.
|
||||
- ./backend/token/:/backend/token
|
||||
- ${OBSIDIAN_DIR}:/backend/notes
|
||||
# Read-only: stppriv is the vault's only writer.
|
||||
- ${OBSIDIAN_DIR}:/backend/notes:ro
|
||||
- ./logs:/backend/logs
|
||||
- uploads:/backend/uploads
|
||||
- ./icecast2/fallback_music:/backend/fallback_music
|
||||
@@ -198,25 +198,6 @@ services:
|
||||
ports:
|
||||
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:${LIQUIDSOAP_HARBOR_PORT:-8001}"
|
||||
|
||||
# Vault editor at /sb/ (admin-gated).
|
||||
silverbullet:
|
||||
image: ghcr.io/silverbulletmd/silverbullet:2.11.0
|
||||
container_name: "${SILVERBULLET_HOST:-silverbullet}"
|
||||
restart: always
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
SB_PORT: "${SILVERBULLET_PORT:-3000}"
|
||||
# Caddy must not strip /sb/: the app builds its URLs from this.
|
||||
SB_URL_PREFIX: /sb
|
||||
# Newline separated; commas are silently ignored.
|
||||
SB_SPACE_IGNORE: |
|
||||
.obsidian
|
||||
PUID: "1000"
|
||||
PGID: "1000"
|
||||
volumes:
|
||||
- ${OBSIDIAN_DIR}:/data
|
||||
|
||||
# Public read-only notes at /notes/. private/ stays private only with all
|
||||
# three: SB_SPACE_IGNORE (hides from listings, not direct fetches), Caddy's
|
||||
# /notes/ deny regex (keep its folder list in step), and SB_REVISIONS
|
||||
@@ -242,8 +223,8 @@ services:
|
||||
volumes:
|
||||
- ${OBSIDIAN_DIR}:/data:ro
|
||||
|
||||
# Commits/pulls the vault. Separate from SilverBullet so its shell backend
|
||||
# stays off (it would give command execution to anyone past the admin gate).
|
||||
# Pulls the vault (SYNC_MODE=pull: never commits or pushes). The editor and
|
||||
# the only writer is on stppriv; two writers would conflict.
|
||||
silverbullet-git:
|
||||
image: alpine/git:v2.54.0
|
||||
container_name: "${SILVERBULLET_GIT_HOST:-silverbullet-git}"
|
||||
@@ -256,6 +237,7 @@ services:
|
||||
# Match SilverBullet's uid so .git objects stay host-owned.
|
||||
user: "1000:1000"
|
||||
environment:
|
||||
SYNC_MODE: pull
|
||||
SYNC_INTERVAL: "${SILVERBULLET_GIT_INTERVAL:-300}"
|
||||
GIT_AUTHOR_NAME: silverbullet
|
||||
GIT_AUTHOR_EMAIL: "silverbullet@${DOMAIN}"
|
||||
@@ -292,41 +274,6 @@ services:
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
# Job tracker (adamf/job-tracker). No login of its own: it asks
|
||||
# validate-admin with the visitor's cookies. ./jobs-data must be uid 1000.
|
||||
jobs:
|
||||
image: adam-french.co.uk/adamf/job-tracker:${JOBS_IMAGE_TAG:-latest}
|
||||
container_name: jobs
|
||||
restart: always
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
- DATABASE_URL=postgres://${POSTGRES_JOBS_USER:-jobs}:${POSTGRES_JOBS_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_JOBS_DB:-jobs}?sslmode=disable
|
||||
- AUTH_VALIDATE_URL=http://${BACKEND_HOST}:${BACKEND_PORT}/auth/validate-admin
|
||||
- CLAUDE_API_KEY=${CLAUDE_API_KEY:-}
|
||||
- CLAUDE_MODEL=${CLAUDE_MODEL:-}
|
||||
- EMAIL_BACKEND=${EMAIL_BACKEND:-}
|
||||
- EMAIL_SYNC_ENABLED=${EMAIL_SYNC_ENABLED:-}
|
||||
- EMAIL_SYNC_INTERVAL=${EMAIL_SYNC_INTERVAL:-}
|
||||
- MSGRAPH_CLIENT_ID=${MSGRAPH_CLIENT_ID:-}
|
||||
- MSGRAPH_CLIENT_SECRET=${MSGRAPH_CLIENT_SECRET:-}
|
||||
- MSGRAPH_TENANT_ID=${MSGRAPH_TENANT_ID:-}
|
||||
- MSGRAPH_REDIRECT_URI=${MSGRAPH_REDIRECT_URI:-}
|
||||
- IMAP_HOST=${IMAP_HOST:-}
|
||||
- IMAP_PORT=${IMAP_PORT:-}
|
||||
- IMAP_EMAIL=${IMAP_EMAIL:-}
|
||||
- IMAP_PASSWORD=${IMAP_PASSWORD:-}
|
||||
- JOB_LEADS_ENABLED=${JOB_LEADS_ENABLED:-}
|
||||
- JOB_LEADS_INTERVAL=${JOB_LEADS_INTERVAL:-}
|
||||
- ADZUNA_APP_ID=${ADZUNA_APP_ID:-}
|
||||
- ADZUNA_APP_KEY=${ADZUNA_APP_KEY:-}
|
||||
- REED_API_KEY=${REED_API_KEY:-}
|
||||
volumes:
|
||||
- ./jobs-data:/data
|
||||
|
||||
# USACO log (adamf/usaco). Git is its store, cloned into ./usaco-data
|
||||
# (must be uid 1000). The S3_* vars are all-or-nothing, hence the :+ forms.
|
||||
# stop_grace_period must exceed the app's SHUTDOWN_GRACE (5m).
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Commits and syncs the vault. The "Sync notes" button (the vault's Sync.md)
|
||||
# touches TRIGGER_FILE for an immediate sync; only its mtime matters, and it
|
||||
# must never be deleted here or SilverBullet re-uploads it in a loop.
|
||||
# Syncs the vault with the notes repo.
|
||||
# SYNC_MODE=push (default): commit local edits, pull --rebase, push. Use on
|
||||
# the ONE host that edits the vault (stppriv).
|
||||
# SYNC_MODE=pull: fast-forward only, never commits or pushes. Use on every
|
||||
# read-only consumer (stpweb's /notes/ and backend).
|
||||
# The "Sync notes" button (the vault's Sync.md) touches TRIGGER_FILE for an
|
||||
# immediate sync; only its mtime matters, and it must never be deleted here or
|
||||
# SilverBullet re-uploads it in a loop.
|
||||
|
||||
set -u
|
||||
|
||||
SPACE=/space
|
||||
MODE="${SYNC_MODE:-push}"
|
||||
INTERVAL="${SYNC_INTERVAL:-300}"
|
||||
TRIGGER_FILE="$SPACE/${SYNC_TRIGGER_FILE:-sync-request.md}"
|
||||
POLL=2
|
||||
|
||||
log() { echo "[git-sync] $(date -Iseconds) $*"; }
|
||||
|
||||
case "$MODE" in
|
||||
push|pull) ;;
|
||||
*) log "ERROR: SYNC_MODE must be push or pull, got '$MODE'"; while true; do sleep 3600; done ;;
|
||||
esac
|
||||
|
||||
git config --global --add safe.directory "$SPACE"
|
||||
|
||||
if [ ! -d "$SPACE/.git" ]; then
|
||||
@@ -27,7 +38,7 @@ trigger_mtime() {
|
||||
[ -f "$TRIGGER_FILE" ] && stat -c %Y "$TRIGGER_FILE" 2>/dev/null || echo ""
|
||||
}
|
||||
|
||||
sync_once() {
|
||||
sync_push() {
|
||||
git add -A
|
||||
if ! git diff --cached --quiet; then
|
||||
if git commit -q -m "notes: $(date -Iseconds)"; then
|
||||
@@ -43,11 +54,15 @@ sync_once() {
|
||||
fi
|
||||
}
|
||||
|
||||
sync_pull() {
|
||||
git pull --ff-only -q || log "WARN: pull failed (diverged, auth or network)"
|
||||
}
|
||||
|
||||
last_trigger=$(trigger_mtime)
|
||||
log "watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
|
||||
log "mode=$MODE, watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
|
||||
|
||||
while true; do
|
||||
sync_once
|
||||
if [ "$MODE" = push ]; then sync_push; else sync_pull; fi
|
||||
|
||||
# Sleep in short slices so an on-demand request is picked up quickly.
|
||||
waited=0
|
||||
|
||||
@@ -20,9 +20,24 @@ const password = ref("");
|
||||
const submitting = ref(false);
|
||||
const errorMsg = ref("");
|
||||
|
||||
// stppriv's gate sends people here with an absolute priv.<domain> URL.
|
||||
function isPrivUrl(dest) {
|
||||
try {
|
||||
const url = new URL(dest);
|
||||
return url.protocol === "https:" && url.host === `priv.${window.location.hostname.replace(/^www\./, "")}`;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Caddy-gated paths aren't Vue routes, so landing on "404" means a full page
|
||||
// load. Only site-relative paths are followed, or it's an open redirect.
|
||||
// load. Only site-relative paths (and stppriv) are followed, or it's an open
|
||||
// redirect.
|
||||
function goTo(dest) {
|
||||
if (isPrivUrl(dest)) {
|
||||
window.location.assign(dest);
|
||||
return;
|
||||
}
|
||||
if (typeof dest !== "string" || !dest.startsWith("/") || dest.startsWith("//")) {
|
||||
router.push(home());
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,7 @@ const social_links = [
|
||||
{ name: "Github", link: "https://github.com/SteveThePug" },
|
||||
{ name: "Spotify", link: "https://open.spotify.com/user/stevethepug" },
|
||||
{ name: "Notes", link: "/notes/" },
|
||||
{ name: "Notes (edit)", link: "/sb/" },
|
||||
{ name: "Notes (edit)", link: "https://priv.adam-french.co.uk/sb/" },
|
||||
];
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user