Commit graph

6 commits

Author SHA1 Message Date
Vadym Samoilenko
96ab1c5da6 fix: run DB migrations via migrator service, not standalone app
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>
2026-02-23 21:31:52 +00:00
Vadym Samoilenko
d34071f9f8 fix: switch from nginx to Traefik for routing and SSL
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>
2026-02-23 14:39:32 +00:00
Vadym Samoilenko
4e23350bfc fix: run migrations via Next.js instrumentation.ts at startup
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>
2026-02-23 14:14:18 +00:00
Vadym Samoilenko
1348188a6c fix: dedicated migrator stage for payload migrate
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>
2026-02-23 14:04:34 +00:00
Vadym Samoilenko
ecc2c94e5f fix: run migrations from build stage (has pnpm)
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>
2026-02-23 13:59:57 +00:00
Vadym Samoilenko
fc4688cc6f feat: add production deploy script and docker-compose
- deploy.sh: idempotent deploy for Ubuntu server (Docker + Nginx + SSL)
- docker-compose.prod.yml: production compose (runner target, localhost-only port)
- .gitignore: exclude .env.production and .deploy-config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 13:41:29 +00:00