Localhost to monitored production, with a tested rollback.
Read the skill at https://ai-skills-vault.pages.dev/skills/cloud-deploy-ops.md and install it as a skill in your agent. Follow it exactly, including its checklists. Then ask me the questions it requires and do the work.
The deploy is not the finish line. The ability to roll back at 2am is.
| Situation | Use | Why |
|---|---|---|
| Static site / SPA | Cloudflare Pages, Netlify | Free, global CDN, instant rollback |
| Next.js with SSR | Vercel, or Cloudflare Workers | Native support |
| Containerised API + DB | VPS (Hetzner/DO) + Docker Compose, or Fly.io/Railway | Cost control, full access |
| Background jobs + cron | Same host as the API, separate process | Simplicity |
| Managed Postgres | Neon/Supabase/RDS | Backups and failover are not your problem |
| Global low-latency edge logic | Cloudflare Workers | Cold starts near zero |
Rule: pick managed for anything you would be sad to lose (database, object storage, email). Pick self-hosted for anything you can rebuild in an hour.
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
FROM node:20-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./node_modules
COPY . .
USER node
EXPOSE 3000
CMD ["node","server.js"]
Rules: multi-stage, non-root user, .dockerignore with node_modules, .git, .env. Pin base image major versions. One process per container. Never bake secrets into an image - they arrive as environment variables at runtime.
.env committed by accident.undefined is a self-inflicted wound.on: { push: { branches: [main] } }
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci
- run: npm run typecheck
- run: npm run lint
- run: npm test -- --run
- run: npm run build
main. Preview deploys for pull requests.A/AAAA for the server, CNAME for managed hosts.Strict-Transport-Security, X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, Referrer-Policy, a CSP that you have tested in report-only mode first.www to apex or the reverse - pick one and make it permanent./healthz that does not touch the database, plus /readyz that does.docker logs is not observability./readyz to pass.For managed hosts, use their instant rollback. For a VPS: keep the previous image tagged, docker compose up -d with the old tag. Database migrations must be backward-compatible for one release so a rollback does not corrupt data (expand → migrate → contract).
Know three numbers: monthly cost, cost per 1,000 requests, and the traffic at which you must scale. Set a billing alert. Check the bill monthly - the top three line items are usually fixable.
/healthz and /readyz implementedRead the skill at the URL above. Ask me what I am deploying and where. Then produce: the platform recommendation with reasons from the Stage 1 table, a multi-stage Dockerfile and compose file, the GitHub Actions pipeline, the env-var validation code, the health endpoints, the security headers, the backup and restore procedure with the exact commands, and the alert rules with runbook lines. Finish with the rollback command written out so I can paste it at 2am.