← All skills
Engineering https://ai-skills-vault.pages.dev/skills/cloud-deploy-ops.md

Cloud Deploy & Ops

Localhost to monitored production, with a tested rollback.

Download .md All skills
Install URLhttps://ai-skills-vault.pages.dev/skills/cloud-deploy-ops.md
Install prompt tap to copy
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.

When to use this skill

Stage 1 - Choose the platform by constraint

SituationUseWhy
Static site / SPACloudflare Pages, NetlifyFree, global CDN, instant rollback
Next.js with SSRVercel, or Cloudflare WorkersNative support
Containerised API + DBVPS (Hetzner/DO) + Docker Compose, or Fly.io/RailwayCost control, full access
Background jobs + cronSame host as the API, separate processSimplicity
Managed PostgresNeon/Supabase/RDSBackups and failover are not your problem
Global low-latency edge logicCloudflare WorkersCold 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.

Stage 2 - Dockerfile that builds fast and small

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.

Stage 3 - Environment and secrets

Stage 4 - CI/CD

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

Stage 5 - Domains, TLS, headers

Stage 6 - Backups and restore

Stage 7 - Logging and alerting

Stage 8 - Zero-downtime release and rollback

  1. Deploy the new version alongside the old.
  2. Wait for /readyz to pass.
  3. Switch traffic.
  4. Watch error rate and latency for 10 minutes.
  5. Roll back by switching traffic back - and know the exact command before you need it.

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).

Stage 9 - Cost and capacity

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.

Quality checklist

Copy-ready agent prompt

Read 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.
Copied