In Next.js standalone output (output: 'standalone') the src/migrations/
directory is not present on the filesystem, so payload.db.migrate()
could not discover migration files → home_page table was never created
→ getHomePage() threw a DB error → Server Components render failed.
Fix:
- Add `migrator` service to docker-compose.prod.yml (builds from the
`migrator` Dockerfile stage which has the full src/ tree)
- migrator runs `pnpm payload migrate` before app starts
- app depends_on migrator: service_completed_successfully
- Remove payload.db.migrate() from instrumentation.ts (migrator handles it)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Server uses Traefik (traefik-public network) with Cloudflare DNS
cert resolver. Nginx not needed. Add Traefik labels to app service,
connect to traefik-public + internal networks, remove nginx/certbot.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tsx v4 + Node.js 22 ESM does not handle extensionless .ts imports.
instrumentation.ts uses compiled/bundled code — no resolution issues.
Migrations run automatically before first request on every app start.
Removes external migrator container approach entirely.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Build stage runs pnpm build which changes ESM resolution context.
New migrator stage has deps+src only — clean env for tsx/payload migrate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runner stage is minimal — no pnpm. Add migrator service using
build target which has full node_modules + pnpm.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>