- bin `ipal-kit` (subcommand `create`): the architecture questions (or --answers JSON), rendering from reference/ through starter.manifest.json (placeholders, @starter:if variants, //: alternatives, demo dropped), answers into AGENTS.md "Project decisions" and ipal-doctor.json, local .env with a fresh PAYLOAD_SECRET, install from the shipped lockfile, ipal-skills, ipal-tokens, generate:types/importmap, typecheck, ipal-doctor when shipped, secret check, first commit - @intecion/ipal-kit/starter: the building blocks (renderSite, validateAnswers, applyVariants, collectBundle, lockfileWithoutPlugin, secretFindings …) - build:starter packs reference/ into dist/starter/template.json.gz (90 KB); starter:gate in prepublishOnly: site from the packed tarball, frozen install, seed, build, targeted SEED_ONLY seed in production mode, full seed refused, pnpm start checks - D15: plugin dependencies pinned exactly (nodemailer 10.3.1) - reference/: @starter:if markers (runs as before), manifest generate/variants/rewrite - docs: project-starter.md, AGENT.md, ipal-setup, ipal-site, ipal-reference (+ api.md), README, PROGRAMISTA §2, CHANGELOG, docs/README, reference index Co-Authored-By: Claude Opus 5.5 <[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 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 | 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 -->
|
|
| `IPAL_IP_HEADER` | | ✓ | `x-forwarded-for` behind Coolify's proxy (`cf-connecting-ip` behind Cloudflare) |
|
|
<!-- @starter:if crawl -->
|
|
| `IPAL_COOKIE_SCAN_URL`, `IPAL_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
|
|
(`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.
|