Refuse a TRUST_PROXY the apps can't start with; Accounts reads loopback
A server configuration with TRUST_PROXY=TRUE made an Events install build for minutes, then fail: Express threw "invalid IP address: TRUE" at startup. - scripts/lib/envtpl.cjs: VALUE_RULES checked before any .env is written (exit 4, naming the value and the fix), for every release. - Contracts 1.6.0: agent.checkEnvValue / agent.invalidValues, the same rules for the Hub. - Accounts 1.0.1: TRUST_PROXY read as Events reads it; loopback used to turn proxy trust off. - Docs: CHANGELOGs, WHATS-NEW, HANDOVER, AGENT-1.0-PLAN, ROLLOUT-1.0, READMEs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -188,7 +188,10 @@ monorepo, listing every variable with its layer, whether it's required, and a de
|
||||
**For Joshua to set per server before the first install:** the database settings and
|
||||
`TRUST_PROXY`. Behind frp the app sees every connection from frpc on `127.0.0.1`, and the
|
||||
visitor's address arrives in `X-Forwarded-For` from FastPanel's nginx, so the expected value is
|
||||
`loopback` (the Hub suggests it).
|
||||
`loopback` (the Hub suggests it). A value the apps can't start with (e.g. `TRUE`, which crashed
|
||||
the Events backend after a whole install's build) is refused when the configuration is saved (Hub
|
||||
2.3.3), before a job is made, and again by the crosscode script before it writes a `.env`
|
||||
(`checkEnvValue` in `@crosscode/contracts` 1.6.0, `VALUE_RULES` in `scripts/lib/envtpl.cjs`).
|
||||
|
||||
## 6. frp and the central server
|
||||
|
||||
|
||||
+4
-1
@@ -80,7 +80,10 @@ rollout.
|
||||
- **The agent pins the Hub's job key** when it joins. Back up `events-hub/backend/keys/` (licence
|
||||
and job keys); replacing the job key means every server joins again.
|
||||
- **A new `.env` variable** goes in three env templates: `apps/<product>/env.template.json`,
|
||||
`scripts/products/<product>.env.template.json` and the Hub's `envTemplates/<product>.json`.
|
||||
`scripts/products/<product>.env.template.json` and the Hub's `envTemplates/<product>.json`. If
|
||||
the app refuses some values at startup (as Events does a `TRUST_PROXY` it can't parse), add a
|
||||
rule to both `checkEnvValue` in `packages/contracts/src/agent.ts` (the Hub) and `VALUE_RULES` in
|
||||
`scripts/lib/envtpl.cjs` (the server), so a bad value stops before an install's build.
|
||||
- **A new Events install never takes over an existing database**: moving an existing site is
|
||||
`adopt`, not a New install pointed at the old database.
|
||||
- **Prisma in the monorepo:** each app other than Events sets its own generator `output`, so
|
||||
|
||||
+2
-1
@@ -43,7 +43,8 @@ Follow `events-hub/deployment.md` → "Upgrading to 2.1":
|
||||
- [ ] Hub → Servers → Add server → **Church**; run the command as root. It installs Node tools,
|
||||
the agent (`/opt/crosscode/agent`) and the crosscode script (`/opt/crosscode/tools`, from
|
||||
main), and starts `crosscode-agent`. The agent listens on nothing.
|
||||
- [ ] On the server's page: its configuration. `TRUST_PROXY=loopback` behind frp; the database:
|
||||
- [ ] On the server's page: its configuration. `TRUST_PROXY=loopback` behind frp (lowercase;
|
||||
`TRUE` stops the Events backend starting, and the Hub refuses it from 2.3.3); the database:
|
||||
`DB_HOST`/`DB_PORT`/`DB_ADMIN_URL` for a separate PostgreSQL, or nothing for the local one.
|
||||
- [ ] `systemctl status crosscode-agent` is active; the server's stats show on the Hub.
|
||||
- [ ] The first time the agent changes `frpc.ini` it adds the admin lines and **restarts frpc once**
|
||||
|
||||
Reference in New Issue
Block a user