deployment

A production-deployment checklist and procedure. Deployment means putting an application where real users can access it, while development and staging are separate environments for building and testing it.

In plain words
What is it for?
Use it when preparing Docker images, configuring application services, checking dependencies such as databases and Redis, and deploying an application to production.
Why use it?
It separates development, staging, and production work and provides checks for containers, services, health monitoring, security, and approval before release.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/zenobia0000/cursor-agentic-coding-template/deployment
Clone the repo
git clone --depth 1 https://github.com/Zenobia0000/cursor-agentic-coding-template

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02808
Opus 5 $0.00000 $0.01404
Sonnet 5 $0.00000 $0.00562
Haiku 4.5 $0.00000 $0.00281

Measured yesterday against content hash fc83bf8fee0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

deployment scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -f https://api.example.com/health || exit 1
Origin

This is a copy

100% identical to deployment — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/process/deployment.mdc · 478 lines

How it starts

The opening of the file, as written. The whole thing — 478 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🚀 部署策略

環境分層

Development:
  - 本地開發環境
  - 熱重載啟用
  - Debug 模式開啟
  - Mock 資料可用

Staging:
  - 類生產環境
  - 真實資料庫(測試資料)
  - 完整監控
  - 自動部署

Production:
  - 生產環境
  - 高可用架構
  - 完整備援
  - 手動批准部署

🐳 容器化配置

Dockerfile 最佳實踐

# Multi-stage build
FROM node:20-alpine AS builder
WORKDIR /app
# 只複製 package files 優化快取
COPY package*.json ./
RUN npm ci --only=production

# 建構階段
COPY . .
RUN npm run build

# 執行階段 - 最小化映像
FROM node:20-alpine AS runner
WORKDIR /app

# 安全性:非 root 使用者
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# 只複製必要檔案
COPY --from=builder --chown=nextjs:nodejs /app/build ./build
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules

USER nextjs
EXPOSE 3000

# 健康檢查
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD node healthcheck.js

CMD ["node", "build/index.js"]

Docker Compose 配置

version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - NODE_ENV=production
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
    networks:
      - app-network
    restart: unless-stopped
    deploy:
      replicas: 2
      resources:
        limits:
          cpus: '1'
          memory: 512M
        reservations:
          cpus: '0.5'
          memory: 256M

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    command: redis-server --appendonly yes
    volumes:
      - redis-data:/data

volumes:
  postgres-data:
  redis-data:

networks:
  app-network:
    driver: bridge

Read the full file on GitHub · 478 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 478 lines · 0 tokens per session scan A fc83bf8fee0a

Subscribe to this mod's changes

deployment is a cursor rule published in the GitHub repository Zenobia0000/cursor-agentic-coding-template (5 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,808 tokens. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to deployment, differing in 0 lines, and is treated as a copy.