Reference site: Example Studio on ipal-kit (reference/), index for agents, CI job

reference/ is one complete client site on the plugin (made-up company, pl/en,
MongoDB, every library block and template, token standard light/dark, forms,
consent, SEO/GEO, enforced CSP, 2FA, base + demo seeds, Coolify runbook,
smoke tests). It uses the plugin as file:.. (injected) and is not shipped.

- docs/agent/reference-site/INDEX.md (generated by scripts/reference-index.mjs,
  kept current by test/referenceIndex.test.ts)
- AGENT.md section and pointers in ipal-site, ipal-setup, ipal-reference,
  ipal-upgrade, ipal-block; release steps in PROGRAMISTA §8.1b
- CI: reference (fast) on every push, reference-full on main; doctor steps
  wired, commented until ipal-doctor ships

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:17:11 +01:00
co-authored by Claude Opus 5.5
parent 8bb5ebd394
commit 8adac41f92
129 changed files with 18440 additions and 1 deletions
+74
View File
@@ -0,0 +1,74 @@
# Deploy — Example Studio
The project runbook. The full procedure is the plugin's `node_modules/@intecion/ipal-kit/docs/deployment.md`;
this file lists only what this project sets. The team's flow: **build and check locally → push → Coolify builds
and runs the app from the repo**. MongoDB is a separate Coolify resource on the same server and Docker network.
There is no Dockerfile and no image of our own.
## 1. Before every push — the local check
```bash
pnpm generate:types && pnpm generate:importmap # committed files up to date (git diff shows nothing)
pnpm typecheck
pnpm build # page routes ● (SSG), needs the local database
ALLOW_LOCAL_MEDIA=1 PORT=3100 pnpm start # production build on local disk (never set in Coolify)
pnpm exec ipal-doctor --strict # 0 findings (when the doctor ships)
pnpm test:e2e # smoke tests, after `pnpm payload run e2e/create-test-admin.ts`
```
## 2. The Coolify application
| Setting | Value |
|---|---|
| Source | the Git repository, branch `main` |
| Build pack | default (Nixpacks) — Node from `engines` (`>=22 <23`) and `.nvmrc` |
| Install command | `pnpm install --frozen-lockfile` |
| Build command | `pnpm generate:types && pnpm build` |
| Start command | `pnpm start` (`next start` with `--disable-proto=throw`) |
| Port | 3000 — no host port mapping (it disables rolling updates) |
| Health check | `GET /api/health` → 200 (503 without the database) |
| Domains | `https://example-studio.pl,https://www.example-studio.pl`, redirect www → apex (matches `NEXT_PUBLIC_SERVER_URL`) |
## 3. The Coolify MongoDB resource
- Same server and Docker network as the app; never exposed publicly.
- `DATABASE_URI=mongodb://<user>:<password>@<internal-host>:27017/example-studiopl_prod?authSource=admin`
(database name from `databaseNamesFor('example-studio.pl')`; `instrumentation.ts` checks it).
- Scheduled backups to S3/R2, and **Backup now** before every seed or bulk change.
- MongoDB needs no migrations.
## 4. Environment variables (Coolify → Environment Variables)
| Variable | Build | Runtime | Note |
|---|---|---|---|
| `DATABASE_URI` | ✓ | ✓ | build prerenders pages from the database |
| `PAYLOAD_SECRET` | ✓ | ✓ | random, ≥ 32 characters |
| `NEXT_PUBLIC_SERVER_URL` | ✓ | ✓ | `https://example-studio.pl` |
| `R2_BUCKET`, `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY` | | ✓ | required in production |
| `R2_PUBLIC_URL` | ✓ | ✓ | empty = media served by the app |
| `IPAL_IP_HEADER` | | ✓ | `x-forwarded-for` behind Coolify's proxy (`cf-connecting-ip` behind Cloudflare) |
| `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` | | ✓ | the shared cookie-crawler service |
| `INDEXNOW_KEY` | | ✓ | or generate the key in Site integrations |
| `ALLOW_LOCAL_MEDIA` | — | — | **never set here** (local / CI only) |
Turnstile, SMTP and analytics keys go into the panel (Site integrations), not env.
## 5. Seeds on production — named records only
After launch never run the whole seed: the editors' changes must survive. In Coolify → the app → **Terminal**:
```bash
SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed # 1. read the plan
# 2. Coolify → MongoDB resource → Backup now
SEED_ONLY="pages:kontakt" pnpm seed # 3. the real run
```
Keys: `pages:<pl slug>`, `forms:<title>`, `global:<slug>`. A run without `SEED_ONLY` is refused on production
(`IPAL_SEED_ALLOW_FULL=1` only with the owner's explicit OK). The container is built from the whole repo, so the
Payload CLI and `src/seed/` are there.
## 6. DNS (the team adds the records; check with `dig`)
| Record | Value |
|---|---|
| `A` apex, `A`/`CNAME` www | the Coolify server |
| `CAA` (only if the zone has CAA) | `0 issue "letsencrypt.org"` |
| `TXT` apex | `google-site-verification=<code>` — Search Console *Domain* property, verified via DNS |
| SPF / DKIM / DMARC | from the mailbox provider of the From address (Site integrations → SMTP) |
After DNS: Site integrations → Send test, submit `https://example-studio.pl/sitemap.xml` in Search Console and Bing.
## 7. Rollback
Coolify → Deployments → redeploy the previous commit. Restore the MongoDB backup only when data changed.