- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms); past CHANGELOG entries and the proposals in docs/dev are not rewritten - AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames - iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required - env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup - skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were - reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated Co-Authored-By: Claude Fable 5.2 <[email protected]>
86 lines
4.8 KiB
Markdown
86 lines
4.8 KiB
Markdown
# 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 iapl-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 | both hosts: `example-studio.pl` and `www.example-studio.pl` (with `https://`), redirect to the host of `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.
|
|
<!-- @starter:if !r2 -->
|
|
#: - **Media on local disk** (no R2): Coolify → the app → **Persistent Storage** → a volume for the `media` folder
|
|
#: (the upload collection's `staticDir`), or every redeploy deletes the uploads (deployment.md §4.8).
|
|
<!-- @starter:endif -->
|
|
|
|
## 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` |
|
|
<!-- @starter:if r2 -->
|
|
| `R2_BUCKET`, `R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY` | | ✓ | required in production |
|
|
| `R2_PUBLIC_URL` | ✓ | ✓ | empty = media served by the app |
|
|
<!-- @starter:endif -->
|
|
<!-- @starter:if graph -->
|
|
#: | `GRAPH_TENANT_ID`, `GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER` | | ✓ | e-mail through Microsoft Graph (all four) |
|
|
<!-- @starter:endif -->
|
|
| `IAPL_IP_HEADER` | | ✓ | `x-forwarded-for` behind Coolify's proxy (`cf-connecting-ip` behind Cloudflare) |
|
|
<!-- @starter:if crawl -->
|
|
| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | | ✓ | the shared cookie-crawler service |
|
|
<!-- @starter:endif -->
|
|
| `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
|
|
(`IAPL_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.
|