docs(docs): Step 8 / R1 — files foundation, worker loop, avatar: CLAUDE, DEPLOY (.env.worker, CSP), SUPABASE, RUST, TEST_STRATEGY, WORKSPACE, IDENTITY §5, design README, plan as-built note, CHANGELOG; R1 plan and verifier contract

This commit is contained in:
bchanot committed 2026-10-13 19:39:52 +02:00
1 parent 0c6053c174
commit 62eb4e5d82
13 files changed
+235 -35

No files matched your search

+28 -3
View File
@@ -21,10 +21,13 @@ The host should publish only ports `22`, `80`, `443` to the internet. The
container port (`8080` by default) should stay loopback-only — the host
reverse proxy reads from it on `127.0.0.1:8080`.
Rust (plan R0, `docs/development/RUST.md`): the repository also builds a
Rust (plan R0/R1, `docs/development/RUST.md`): the repository also builds a
worker image (`crates/worker/Dockerfile`, static musl binary on
`distroless/static`, container `faunosteo_worker`). It is not deployed yet
(its job loop arrives at R1); the live deployment above is unchanged. The
`distroless/static`, container `faunosteo_worker`, service `worker` under the
Compose profile `worker`). Since Step 8 it carries the files job loop (avatar
processing, purge sweeps: `docs/development/STORAGE.md` §3). It is not deployed
yet: it needs the self-hosted Supabase stack beside it, which production does
not run today; the live deployment above is unchanged. The
production VPS never needs a Rust toolchain: Rust is compiled on the Ubuntu
development machine (native toolchain) or inside Docker builder images, and
production images will be pulled by digest ("Image deploy by digest",
@@ -101,6 +104,28 @@ the service_role key never leaves the Supabase host (see
The `.env` file is not sensitive but should still be `chmod 600` to keep
local identity overrides private.
### Worker environment (`.env.worker`, Step 8)
The files worker (`docker compose --profile worker up -d worker`) reads a
second env file, `.env.worker`, never the app `.env`: it holds the service
key. `chmod 600`, excluded from every backup copy of env files, readable
through `docker inspect` by the `docker` group (documented limit). The
assistant cannot write `.env*` files in this repository: create it by hand
from the table (STORAGE.md §3.2 lists the optional tuning variables).
| Variable | Required | Notes |
| --- | --- | --- |
| `SUPABASE_URL` | yes | Kong origin on the Supabase compose network (`http://supabase_kong_faunosteo:8000` on the local CLI stack; the self-hosted stack's own Kong name in production). Never the public URL when the stack is on the same host. |
| `SUPABASE_SERVICE_ROLE_KEY` | yes | the service key; on self-hosted a long-lived JWT (revoking it = rotating `JWT_SECRET`). Never in `.env`, env.js or the repository. |
| `WORKER_ID` | no | tag of the log lines (default `worker-<pid>`). |
The service joins the external network named by `SUPABASE_NETWORK`
(default `supabase_network_faunosteo`, the local CLI stack); it publishes no
port, runs read-only with every capability dropped, 512 MiB, 1 CPU, 64 pids.
Browser side, the production CSP `connect-src` must name the Supabase
origin the app talks to (already required since Step 7), and `img-src`
keeps `blob:` (the avatar is shown from a blob URL downloaded under RLS).
---
## Provision the VPS