diff --git a/.env.example b/.env.example index d16067f..bb1571b 100644 --- a/.env.example +++ b/.env.example @@ -15,9 +15,8 @@ # # 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). -# After changing a value on the Pi, recreate the services that read it: +# On the host, edit .env in place. After changing a value, recreate the +# services that read it: # docker compose up -d . # # ADDING A VARIABLE diff --git a/.gitignore b/.gitignore index d22d15b..02e6aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -75,7 +75,6 @@ __screenshots__/ .deploy *.xcf -sync-secrets.sh # Local-only outstanding-work notes, deliberately not published TODO-NEXT.md diff --git a/CLAUDE.md b/CLAUDE.md index e7e81d8..714247f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -93,7 +93,7 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun - **GraphQL auth is declared in the schema.** The `/api/graphql` endpoint has no guarding middleware; `AuthContextMiddleware` only makes the user *available*. A field is protected by annotating it `@admin` or `@signedIn` in `graph/schema/*.graphql` (implemented in `graph/directives.go`). `graph/directives_test.go` fails if a mutation has neither directive and is not on its short public allow-list (`login`, `logout`, `refreshToken`), so a new mutation cannot ship unguarded by accident; a new *query* is public unless you annotate it. Finer rules (post ownership, hiding private messages) stay in the resolver. See `backend/graph/doc.go`. - **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`. - **Spotify tokens**: Persisted to `/backend/token/spotify_token.json` inside the container, surviving restarts. -- **Environment variables**: every variable goes in `.env.example`. 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 Pi (or synced with `sync-secrets.sh`); there is no admin-panel editor. +- **Environment variables**: every variable goes in `.env.example`. 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. - **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. diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 8d98f93..0bfb9c4 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -338,7 +338,7 @@ of deleting the directory: | `./gitea/data` | Git repositories, LFS objects, avatars, sessions | The actual git data | | `./gitea/config` | Gitea's live `app.ini` | Gitignored; generated from the template on first boot and then owned by Gitea | | `./logs` | Backend logs (`go.log`); nginx's JSON request-body log in `logs/nginx/payloads.log` | The payload log grows without bound; rotate it on the host (§7, "Incoming request bodies") | -| `./icecast2/fallback_music` | Radio fallback MP3s | Synced by `sync-secrets.sh`, not git | +| `./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 | **Ephemeral:** anything else inside a container. Notably the Vue build, the @@ -371,11 +371,9 @@ through `env_file` but does not use it. A new variable for either service has to be added to its allow-list as well as `.env.example`. -**`.env` reaches the host via `./sync-secrets.sh`**, which syncs exactly two -things between this checkout and `adamf@stpvm.tailf20278.ts.net:~/deploy/web_server`: -`.env`, and `icecast2/fallback_music/*.mp3`. The sync is **bidirectional and -resolved by modification time — newer wins, with no merge.** Editing `.env` on -both machines silently loses one side's edits. Run it before and after editing. +**`.env` is edited by hand on the host**, in +`~/deploy/web_server`. Nothing syncs it from a laptop checkout, so a laptop's +`.env` (often with dev values) never reaches production by accident. An unset variable is not an error: `envsubst` renders it as an empty string, which for a password field means _no password_. After editing `.env`, confirm @@ -383,8 +381,7 @@ with `docker compose config`. ### Changing a value on the host -Edit `.env` (on the laptop, then `./sync-secrets.sh`; or on the host directly, -then sync back), and recreate only the services that read the variable: +Edit `.env` on the host, and recreate only the services that read the variable: `docker compose up -d `. A plain `up -d` would also restart Postgres, since nginx, db, icecast2 and certbot load the whole file. @@ -522,12 +519,6 @@ manually before Gitea will start: docker compose exec db createdb -U "$POSTGRES_USER" "$POSTGRES_GITEA_DB" ``` -**Sync secrets / fallback music** (from the laptop checkout, not the host): - -``` -./sync-secrets.sh -``` - **Set up the CI runner on a fresh host:** ``` diff --git a/docker-compose.yml b/docker-compose.yml index 86304cd..788e3c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,8 +13,8 @@ # # ENV VARS # Everything interpolated as ${VAR} below is read by the docker compose CLI -# from ./.env at the repo root (which is gitignored — see sync-secrets.sh for -# how it is distributed to the Pi). Note the two distinct mechanisms: +# from ./.env at the repo root (gitignored, and edited by hand on the host). +# Note the two distinct mechanisms: # - ${VAR} in this file -> substituted by compose when parsing # - `env_file: ./.env` -> the whole file injected into the container # Many services need both: the container name comes from substitution, the