Move Garage and garage-webui to stpcore
Test and deploy / test (push) Successful in 18s
Test and deploy / deploy (push) Successful in 30s

Garage now runs on the stpcore LXC (adamf/stpcore), the shared core
other stacks depend on. caddy, backend and usaco pin the name `garage`
to it with GARAGE_UPSTREAM; /garage/ goes to stpcore's Caddy with
X-Core-Token. The disk fallback for /uploads/ is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-26 14:32:33 +00:00
co-authored by Claude Opus 5.5
parent d0ff2e125b
commit 223c8ae35a
13 changed files with 108 additions and 237 deletions
+40 -35
View File
@@ -76,6 +76,26 @@ forwarder here published 3000/2222 and everything used `localhost`.)
A new machine or container that talks to Gitea needs the same pin, or a
`~/.ssh/config` entry pointing the name at the tailnet name `stpgit` for SSH.
### Garage runs on stpcore
Garage (the S3 object store behind `/uploads/`) and garage-webui are not in
this stack either. They run on the `stpcore` LXC, from `adamf/stpcore`, the
shared core every other stack depends on; its README is the runbook. The name
`garage` is pinned to that LXC's LAN IP (`GARAGE_UPSTREAM`) by `extra_hosts`
in `caddy`, `backend` and `usaco`, so the configs still say `garage:3900`
(S3), `garage:3902` (website) and `garage:3909` (stpcore's Caddy in front of
garage-webui, which wants the `X-Core-Token` this Caddy adds after the admin
gate). Nothing here depends on it being up: see "Garage" in §7.
```
stpvm (pin: garage -> stpcore LAN IP) stpcore LXC (LAN IP)
backend S3 PUT (uploads) ------+ +----------------------+
usaco S3 (usaco-audio) ------+--> garage:3900 ---> | garage :3900 S3 |
caddy /uploads/ -----------------> garage:3902 --> | :3902 web |
caddy /garage/ (+X-Core-Token) --> garage:3909 --> | caddy -> garage-webui|
+----------------------+
```
Gitea's public address is `https://git.<DOMAIN>/` (its `ROOT_URL`), served by
the LXC's own Cloudflare tunnel, not by this edge; Caddy only 301s the old
`/gitea/*` URLs there and still proxies the registry at the apex's `/v2/`.
@@ -101,8 +121,8 @@ Deploys of this stack never touch Gitea.
| Partner Radar (adamf/cto, its own compose project) | `radar-web` (alias of that project's `web`, on app-network) | 80 | `radar.<DOMAIN>`, the whole host (its own login, no gate; zones `radar` and `radar_login`). Started from the cto checkout with `make stpvm`; 503 "offline" when that stack is down | no |
| traffic (tails the payload log) | `traffic` | — (no network) | none; its stdout is what Dozzle shows | no |
| autoheal (restarts unhealthy caddy) | `autoheal` | — (no network) | none; reads the Docker socket | no |
| garage (S3 object store) | `garage` | 3900 S3, 3902 web, 3903 admin | none directly; `/uploads/` falls back to its web endpoint for files not on the volume | no |
| garage-webui (Garage admin UI) | `garage-webui` | 3909 | `/garage/` (admin-gated by Caddy `forward_auth`) | no |
| garage (S3 object store, adamf/stpcore) | — (runs on the **stpcore** LXC; `garage` pinned to `GARAGE_UPSTREAM`) | 3900 S3, 3902 web | `/uploads/` from its website endpoint first, then the `uploads` volume; backend and usaco use S3 | no |
| garage-webui (Garage admin UI, adamf/stpcore) | — (on **stpcore**, behind its Caddy) | 3909 on stpcore | `/garage/` (admin-gated by Caddy `forward_auth`; Caddy adds `X-Core-Token`). 503 "offline" when stpcore is down | no |
Container names come from `.env`, and Caddy builds its upstreams from the same
variables (passed through the caddy service's `environment:` list). **Renaming
@@ -407,8 +427,6 @@ Setup, once:
| ---------- | ----------------------------------------------------- | -------------------------------------------------- |
| `dbdata` | Postgres: the app database and the trackers' databases | All posts, users and messages, and the trackers' data |
| `uploads` | Uploads from before Garage, private attachments, and any upload Garage refused | Those files |
| `garage_meta` | Garage's metadata: buckets, keys, object index, layout | Everything in the bucket (the bytes in `garage_data` are unreadable without it) |
| `garage_data` | The bucket's object bytes | Every upload stored in Garage |
| `vue_dist` | The built SPA | Nothing — rebuilt on next deploy |
| `caddy_config` | Caddy's autosaved JSON config | Nothing — rewritten on every start |
@@ -621,43 +639,35 @@ The app schema is recreated by GORM auto-migration on backend start (there are n
migration files). The job and activity trackers' databases are not
auto-created; their READMEs have the commands.
**Garage (the `/uploads/` bucket).** Public uploads live in a Garage bucket,
with the `uploads` volume as a safety net. Nothing breaks while Garage is down
or not set up:
**Garage (the `/uploads/` bucket).** Public uploads live in a Garage bucket
on the stpcore LXC (`adamf/stpcore`, whose README is the runbook: setup,
keys, the move from this host, backups), with the `uploads` volume here as a
safety net. Nothing breaks while stpcore is down or not set up:
- the backend writes to disk until `S3_ENDPOINT` is set, and falls back to
disk (with a log line) whenever Garage refuses a write;
disk (with a log line) whenever Garage refuses a write or can't be reached;
- Caddy serves `/uploads/` from Garage and falls back to the volume when
Garage has no such file or is unreachable, and it starts without the
`garage` container.
Garage has no such file or is unreachable (2s connect timeout);
- `/garage/` answers 503 "offline".
Turning it on:
1. Fill in `GARAGE_RPC_SECRET`, `GARAGE_ADMIN_TOKEN`, `S3_ACCESS_KEY_ID` and
`S3_SECRET_ACCESS_KEY` in `.env` **before** the deploy that adds the
containers (otherwise `garage` crash-loops on a blank secret until they
are set; nothing else is affected). `.env.example` says how to generate
each.
2. Deploy, then `garage/bootstrap.sh` (idempotent; it creates the layout, the
`uploads` bucket and the backend's key, and opens the bucket to the
website endpoint).
3. Set `S3_ENDPOINT=http://garage:3900` and `docker compose up -d backend`.
The backend logs `[upload] storing uploads in bucket uploads ...` on start.
4. Check: upload something through a canvas page or chat, then
`docker compose exec garage /garage bucket info uploads` shows the object
count going up, and the returned `/uploads/...` URL loads.
Pointing this stack at it: set `GARAGE_UPSTREAM` (stpcore's LAN IP),
`GARAGE_WEBUI_TOKEN` (same as stpcore's), `S3_ACCESS_KEY_ID` /
`S3_SECRET_ACCESS_KEY` (same as stpcore's, imported by its
`garage/bootstrap.sh`) and `S3_ENDPOINT=http://garage:3900`, then
`docker compose up -d caddy backend usaco`. The backend logs
`[upload] storing uploads in bucket uploads ...` on start.
Moving the old files in (so they show in garage-webui, and so the bucket
holds everything):
```
export $(grep -E '^S3_(ACCESS_KEY_ID|SECRET_ACCESS_KEY)=' .env)
docker run --rm --network web_server_app-network \
export $(grep -E '^(S3_ACCESS_KEY_ID|S3_SECRET_ACCESS_KEY|GARAGE_UPSTREAM)=' .env)
docker run --rm \
-v web_server_uploads:/data:ro \
-e AWS_ACCESS_KEY_ID="$S3_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$S3_SECRET_ACCESS_KEY" \
-e AWS_DEFAULT_REGION=garage \
amazon/aws-cli:2.38.0 s3 sync /data s3://uploads --exclude 'private/*' \
--endpoint-url http://garage:3900
--endpoint-url "http://$GARAGE_UPSTREAM:3900"
```
The copies left on the volume are then only a fallback for when Garage is
@@ -666,19 +676,14 @@ served from its disk copy, if it has one. Once the bucket has been trusted for
a while, remove everything but `private/` from the volume.
**Rollback:** blank `S3_ENDPOINT` and `docker compose up -d backend`. Files
written to the bucket in the meantime stay reachable as long as `garage` runs;
written to the bucket in the meantime stay reachable as long as stpcore runs;
to drop Garage entirely, first copy them back
(`aws s3 sync s3://uploads /data` with the volume mounted read-write).
**Managing files:** garage-webui at `/garage/` (site admin login). Files
uploaded there are public at `/uploads/<path>` and skip the backend's type
checks; keep them under a prefix such as `media/`. Uploads through it are
capped at 2 GB by Caddy.
**Backups:** Garage here is one node on the same disk — it is not a backup.
Back up `garage_meta` and `garage_data` together (meta without data, or the
reverse, is useless); Garage also snapshots its metadata every 6h inside
`garage_meta`.
capped at 2 GB by Caddy, here and on stpcore.
**Gitea LXC.** Gitea runs in its own Proxmox LXC (§1), from a checkout of its
own repo, `adamf/stpgit` (until 2026-11-24 this repo's `gitea/` directory),