Skip to content

Deployment

瑞成 PMS 以單一 Next.js 服務next-app/)部署。主要目標是 ZeaburGCP Cloud Run + Cloud SQL 為備援路線。deploy-config skill 兩條路都有說明。

Zeabur Deployment

Environment Variables (set in Zeabur before build)

env
# Required (runtime)
DATABASE_URL=postgresql://user:pass@host:5432/db
AUTH_SECRET=<openssl rand -base64 32>
AUTH_URL=https://your-app.zeabur.app
AUTH_TRUST_HOST=true

# Optional — build-time (baked into the bundle)
NEXT_PUBLIC_APP_URL=https://your-app.zeabur.app
NEXT_PUBLIC_SENTRY_DSN=https://...@sentry.io/...

瑞成 PMS 以工牌編號 + 密碼(Credentials)登入,不使用 OAuth;也沒有金流 (Stripe / ECPay 等 billing 功能已從產品移除)。因此無需設定 OAuth 或 payment provider 環境變數。

NEXT_PUBLIC_* are baked at build time — set them in the Zeabur dashboard before the build runs. AUTH_SECRET, DATABASE_URL, and other secrets are read at runtime; keep them out of NEXT_PUBLIC_*.

Deploy Steps

  1. Push your repo to GitHub.
  2. Create a Zeabur project → Add Service → point at next-app/.
  3. Zeabur auto-detects Next.js via next-app/zbpack.json.
  4. Set environment variables in the Zeabur dashboard.
  5. Trigger a deploy. Health check: https://your-app.zeabur.app/api/health.

Migrations run automatically at startup via the package start/prestart chain (pnpm db:migrate).

GCP Cloud Run + Cloud SQL

Build from next-app/Dockerfile, push to Artifact Registry, deploy to Cloud Run, and attach Cloud SQL (Postgres) via the Cloud SQL connector. lib/db.ts lazy-inits the connection so the build succeeds without DATABASE_URL — the runtime reads it from the Cloud Run env. See the deploy-config skill (Road 2) for the CLI walkthrough.

Cloudflare Pages (dev-docs)

The dev-docs/ VitePress site deploys to Cloudflare Pages via the gh-cf-deploy skill.

Build settings:

  • Build command: pnpm build
  • Build output directory: .vitepress/dist
  • Root directory: dev-docs
  • Environment variables: VITEPRESS_API_BASE(將 API playground 指向你部署後的 Next.js app)

Docker

A root docker-compose.yml runs the whole stack (Postgres, Mailpit, Next.js app) locally:

bash
docker compose up --build -d   # app on http://localhost:3000, Mailpit on http://localhost:8025
docker compose down            # stop (add -v to drop the db volume)

For production Docker, build next-app/Dockerfile directly.

Released under the MIT License.