Let Cloudron turn on named admins, the ops token, and Umami after the image is built.
Tracker env is read at request time and the CSP already allows the analytics host, so staging can set a rule admin, an ops bearer token, and the cookieless Umami site without rebuilding.
This commit is contained in:
1 parent
36112f95d3
commit
f7d88a7d5c
9 files changed
+132
-49
No files matched your search
@@ -91,9 +91,15 @@ per-app in the manifest and provisioned at install time.
|
||||
(`start.sh` chowns `/app/data` for the `node` user). When unset, upload
|
||||
routes return `server_misconfigured`. See [CONTRIBUTING.md](../../CONTRIBUTING.md)
|
||||
API table.
|
||||
- `RULE_ADMIN_EMAILS` — comma-separated named admins. Required on staging
|
||||
so `/rule-counts` exists and an admin read of a private Rule is logged.
|
||||
- `OPS_PRUNE_TOKEN` — bearer token for `POST /api/ops/prune` and
|
||||
`GET /api/ops/rule-counts`. Unset hides prune; together with an empty
|
||||
admin list, `/api/ops/rule-counts` answers 404.
|
||||
- `NEXT_PUBLIC_UMAMI_SRC` / `NEXT_PUBLIC_UMAMI_WEBSITE_ID` — optional
|
||||
Umami tracker. Unset until the companion Umami app is installed.
|
||||
Cookie-free mode is set on Umami, not here. See
|
||||
Cookie-free mode is set on Umami, not here. The app reads these at
|
||||
request time, so `cloudron env set` does not need a rebuild. See
|
||||
[ops-runbook.md](ops-runbook.md) §9.3.
|
||||
|
||||
## 4. Platform settings
|
||||
@@ -465,11 +471,15 @@ production env vars, and verify the vertical slice before apex cutover
|
||||
SMTP_FROM="CommunityRule <hello@communityrule.info>" \
|
||||
ENABLE_PRIVACY_POLICY=true \
|
||||
NEXT_PUBLIC_ENABLE_BACKEND_SYNC=true \
|
||||
UPLOAD_ROOT=/app/data/uploads
|
||||
UPLOAD_ROOT=/app/data/uploads \
|
||||
RULE_ADMIN_EMAILS="<named-admin-emails>" \
|
||||
OPS_PRUNE_TOKEN="$(openssl rand -hex 32)"
|
||||
```
|
||||
Rotating `SESSION_SECRET` logs everyone out. `SMTP_FROM` must be an address
|
||||
SES accepts on `communityrule.info` (platform mail addon is SES-relayed with
|
||||
custom-from allowed — §3).
|
||||
custom-from allowed — §3). Named admins can open private Rules and
|
||||
`/rule-counts`; keep `OPS_PRUNE_TOKEN` in 1Password. Umami is a separate
|
||||
app — [ops-runbook.md](ops-runbook.md) §9.3.
|
||||
5. **Confirm the app is running** in the Cloudron dashboard (Logs tab). Look
|
||||
for a clean `prisma migrate deploy` and Next.js listening on port 3000.
|
||||
6. **Seed facet data (one-time per environment)** — templates + `MethodFacet`
|
||||
@@ -501,6 +511,11 @@ steps below are still required.
|
||||
resume works after re-login.
|
||||
- [ ] **Upload (optional):** with `UPLOAD_ROOT` set, attach a community photo
|
||||
in create flow and confirm it renders after publish.
|
||||
- [ ] **Rule counts:** `GET /api/ops/rule-counts` is 401 logged out, 200
|
||||
with `Authorization: Bearer $OPS_PRUNE_TOKEN` or a named-admin
|
||||
session. `/rule-counts` is reachable after signing in as a named admin.
|
||||
- [ ] **Umami:** homepage HTML includes the tracker (`data-website-id`).
|
||||
The Umami site has cookies turned off.
|
||||
|
||||
**If something fails:**
|
||||
|
||||
|
||||
+22
-11
@@ -250,10 +250,10 @@ persist across image updates unless changed:
|
||||
| `ENABLE_PRIVACY_POLICY` | `true` on staging so `/privacy` is reachable. Unset in production until counsel has read the policy (404, no public links). |
|
||||
| `NEXT_PUBLIC_ENABLE_BACKEND_SYNC` | `true` in staging/production — Postgres draft persistence. |
|
||||
| `UPLOAD_ROOT` | `/app/data/uploads` on Cloudron — required for file uploads. |
|
||||
| `OPS_PRUNE_TOKEN` | Bearer token for `POST /api/ops/prune`. Unset hides the route. Optional; the daily scheduler runs the prune inside the container without it. |
|
||||
| `OPS_PRUNE_TOKEN` | Bearer token for `POST /api/ops/prune` and `GET /api/ops/rule-counts`. Unset hides prune. Optional for the daily scheduler, which runs prune inside the container without it. |
|
||||
| `WORKSHOP_INQUIRY_PURGE_TOKEN` | Bearer token for `POST /api/workshop-inquiries/purge`. Unset hides that route. |
|
||||
| `RULE_ADMIN_EMAILS` | Named admins. Comma-separated. Can open private Rules and `/rule-counts`. |
|
||||
| `NEXT_PUBLIC_UMAMI_SRC` | Umami script URL. Unset: no tracker. Pair with `NEXT_PUBLIC_UMAMI_WEBSITE_ID`. |
|
||||
| `RULE_ADMIN_EMAILS` | Named admins. Comma-separated. Can open private Rules and `/rule-counts`. Every admin read of a private Rule is logged. |
|
||||
| `NEXT_PUBLIC_UMAMI_SRC` | Umami script URL. Unset: no tracker. Pair with `NEXT_PUBLIC_UMAMI_WEBSITE_ID`. Read at request time. |
|
||||
| `NEXT_PUBLIC_UMAMI_WEBSITE_ID` | Umami website id for this hostname. |
|
||||
|
||||
Full detail: [`ops-backend-deploy.md` §3](ops-backend-deploy.md#3-environment-variables).
|
||||
@@ -267,6 +267,8 @@ Full detail: [`ops-backend-deploy.md` §3](ops-backend-deploy.md#3-environment-v
|
||||
| Container crash on start | Migration failure | App logs around `prisma migrate deploy`; fix forward with new migration |
|
||||
| Magic link not sent | Mail addon, `SMTP_FROM`, or SES DNS | Cloudron mail logs (`CLOUDRON_MAIL_SMTP_*`); inbox/spam; SPF/DKIM for SES (§8.1) |
|
||||
| Upload `server_misconfigured` | `UPLOAD_ROOT` unset | `cloudron env set --app <app> UPLOAD_ROOT=/app/data/uploads` |
|
||||
| `/api/ops/rule-counts` is 404 | Neither `RULE_ADMIN_EMAILS` nor `OPS_PRUNE_TOKEN` is set | Set both. Strangers then get 401; a named admin or the bearer token gets 200. |
|
||||
| No Umami script in the HTML | Tracker env unset, or cookies still on in Umami | Install Umami with `--no-sso` (§9.3), turn cookies off, set both `NEXT_PUBLIC_UMAMI_*` vars |
|
||||
| No “Recommended” on method cards | Seed not run | §3.4 — `node prisma/seed.bundle.cjs` |
|
||||
| Rate limit too aggressive after deploy | Expected per §6.1 | Single instance only; limits reset on container restart |
|
||||
|
||||
@@ -369,11 +371,19 @@ Sign-in mail failures log a request id, not the email address.
|
||||
|
||||
### 9.3 Umami (site counts)
|
||||
|
||||
Umami is a **second Cloudron app**, not this image. Install the Umami
|
||||
Cloudron package (or Docker) on a hostname such as
|
||||
`analytics.communityrule.info`. Create a website for this app’s public
|
||||
origin. In Umami → website settings, **turn off cookies** (tracker
|
||||
collects aggregate page views only).
|
||||
Umami is a **second Cloudron app**, not this image. Install the store
|
||||
package with Cloudron SSO off so logged-out visitors can load the
|
||||
tracker:
|
||||
|
||||
```bash
|
||||
cloudron install --appstore-id is.umami.cloudronapp \
|
||||
--location analytics.communityrule.info --no-sso
|
||||
```
|
||||
|
||||
Create a website for this app’s public origin (staging:
|
||||
`https://staging.communityrule.info`). Umami 3’s tracker **sets no
|
||||
cookies** by default; leave session replay off. Change the package
|
||||
default admin password on first login. Copy the website id.
|
||||
|
||||
Then on this CommunityRule app:
|
||||
|
||||
@@ -384,9 +394,10 @@ cloudron env set --app staging.communityrule.info \
|
||||
NEXT_PUBLIC_UMAMI_WEBSITE_ID=<website-id>
|
||||
```
|
||||
|
||||
Unset both to ship no tracker. The snippet sets `data-do-not-track` and
|
||||
`data-exclude-search` so query strings (share and export tokens) are not
|
||||
sent to Umami.
|
||||
The app reads those two names at request time. Unset both to ship no
|
||||
tracker. The snippet sets `data-do-not-track` and `data-exclude-search`
|
||||
so query strings (share and export tokens) are not sent to Umami. The
|
||||
content security policy always allows `https://analytics.communityrule.info`.
|
||||
|
||||
### 9.4 Backups
|
||||
|
||||
|
||||
Reference in new issue
Block a user