Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计异常

deployment部署

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

1,211

周安装

52

GitHub Stars

6

下载量

424
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:deployment(部署)
来源仓库:https://github.com/mgd34msu/goodvibes-plugin
仓库路径:skills/deployment
安装命令:
npx skills add https://github.com/mgd34msu/goodvibes-plugin --skill deployment
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/mgd34msu/goodvibes-plugin --skill deployment

简介

deployment 辅助云资源部署与基础设施运维,强调健康检查、回滚与监控机制。

  • 适合整理 CI/CD 流程、分析资源配置或排查环境问题的任务。
  • 提供预览部署、自动化流水线与健康端点设计指导。
  • 涉及删除或修改网络配置时,应提前评估影响范围。
  • 建议遵循“快速失败”原则,在构建阶段完成变量校验。

SKILL.md

Resources

scripts/
  validate-deployment.sh
references/
  deployment-platforms.md

Deployment

This skill guides you through deploying applications to production using modern platforms and tools. Use this workflow when deploying Next.js, full-stack apps, containerized services, or serverless functions.

When to Use This Skill

  • Deploying applications to Vercel, Railway, Fly.io, or AWS
  • Setting up CI/CD pipelines with GitHub Actions
  • Configuring Docker containers for production
  • Implementing health checks and monitoring
  • Creating preview deployments for pull requests
  • Setting up rollback and canary deployment strategies

Platform Selection

Choose the right platform based on your application needs:

Vercel (Best for Next.js)

When to use:

  • Next.js applications (App Router or Pages Router)
  • Static sites with edge functions
  • Automatic preview deployments per PR
  • Zero-config deployments

Setup:

# Install Vercel CLI
npm install -g vercel

# Deploy
vercel --prod

Environment variables:

# Set production secrets
vercel env add DATABASE_URL production
vercel env add NEXTAUTH_SECRET production

Railway (Best for Full-Stack)

When to use:

  • Full-stack apps with databases
  • Monorepo deployments
  • PostgreSQL, Redis, MongoDB hosting
  • WebSocket support

Setup:

# Install Railway CLI
npm install -g @railway/cli

# Login and deploy
railway login
railway up

railway.json:

{
  "$schema": "https://railway.app/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "buildCommand": "npm run build"
  },
  "deploy": {
    "startCommand": "npm start",
    "healthcheckPath": "/api/health",
    "healthcheckTimeout": 100,
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 3
  }
}

Fly.io (Best for Containers)

When to use:

  • Custom container requirements
  • Global edge deployment
  • Long-running processes
  • Fine-grained scaling control

Setup:

# Install Fly CLI
curl -L https://fly.io/install.sh | sh

# Initialize and deploy
fly launch
fly deploy

fly.toml:

app = "my-app"
primary_region = "sjc"

[build]
  dockerfile = "Dockerfile"

[env]
  PORT = "8080"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

[[http_service.checks]]
  grace_period = "10s"
  interval = "30s"
  method = "GET"
  timeout = "5s"
  path = "/api/health"

[[vm]]
  cpu_kind = "shared"
  cpus = 1
  memory_mb = 256

Docker (Best for Self-Hosted)

When to use:

  • Self-hosted infrastructure
  • VPS deployments (DigitalOcean, Linode)
  • Local development parity
  • Multi-service orchestration

See references/deployment-platforms.md for Dockerfile examples.

AWS (Best for Enterprise)

When to use:

  • Enterprise requirements
  • Compliance/regulatory needs
  • Complex infrastructure
  • Multi-region deployments

Services:

  • ECS Fargate: Serverless containers
  • Lambda: Serverless functions
  • Amplify: Full-stack deployments
  • Elastic Beanstalk: Managed platform

Environment Configuration

.env Management

Never commit secrets to git. Always use.env.example for documentation:

.env.example:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"

# Authentication
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="generate-with-openssl-rand-base64-32"

# External APIs
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."

# Feature Flags
NEXT_PUBLIC_ENABLE_ANALYTICS="false"

Environment Variable Validation

Validate environment variables at build time to fail fast:

src/env.mjs:

import { z } from 'zod';

const server = z.object({
  DATABASE_URL: z.string().url(),
  NEXTAUTH_SECRET: z.string().min(32),
  STRIPE_SECRET_KEY: z.string().startsWith('sk_'),
});

const client = z.object({
  NEXT_PUBLIC_APP_URL: z.string().url(),
});

const processEnv = {
  DATABASE_URL: process.env.DATABASE_URL,
  NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
  STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
  NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
};

const merged = server.merge(client);
const parsed = merged.safeParse(processEnv);

if (!parsed.success) {
  console.error('[FAIL] Invalid environment variables:', parsed.error.flatten().fieldErrors);
  throw new Error('Invalid environment variables');
}

export const env = parsed.data;

Import at the top of your app to validate on startup:

import { env } from './env.mjs';

// Use typed, validated env
const db = new PrismaClient({
  datasources: { db: { url: env.DATABASE_URL } },
});

CI/CD Pipelines

GitHub Actions Workflow

Create .github/workflows/deploy.yml:

name: Deploy

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  NODE_VERSION: '20'

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Lint
        run: npm run lint

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm test

  build:
    runs-on: ubuntu-latest
    needs: [lint, test]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build
        env:
          SKIP_ENV_VALIDATION: true

  deploy:
    runs-on: ubuntu-latest
    needs: [build]
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to Vercel
        uses: amondnet/vercel-action@v25
        with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }}
          vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
          vercel-args: '--prod'

Caching Strategies

Speed up CI/CD with proper caching:

- name: Cache dependencies
  uses: actions/cache@v4
  with:
    path: |
      ~/.npm
      .next/cache
    key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
    restore-keys: |
      ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
      ${{ runner.os }}-nextjs-

Docker Production Setup

Multi-Stage Dockerfile

Create an optimized production Dockerfile:

Dockerfile (Next.js):

FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED=1

RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

CMD ["node", "server.js"]

next.config.js:

module.exports = {
  output: 'standalone', // Required for Docker
};

.dockerignore

Exclude unnecessary files from the Docker build:

Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
.gitignore
.env*.local
.vscode
.idea
dist
build
coverage
*.md
!README.md

Build and Run

# Build the image
docker build -t my-app .

# Run with environment variables
docker run -p 3000:3000 \
  -e DATABASE_URL="postgresql://..." \
  -e NEXTAUTH_SECRET="..." \
  my-app

Health Checks

Health Check Endpoint

Create a health check endpoint for monitoring:

app/api/health/route.ts:

import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';

export async function GET() {
  try {
    // Check database connection
    await prisma.$queryRaw`SELECT 1`;

    return NextResponse.json({
      status: 'healthy',
      timestamp: new Date().toISOString(),
      uptime: process.uptime(),
      database: 'connected',
    });
  } catch (error) {
    return NextResponse.json(
      {
        status: 'unhealthy',
        timestamp: new Date().toISOString(),
        database: 'disconnected',
        error: error instanceof Error ? error.message : 'Unknown error',
      },
      { status: 503 }
    );
  }
}

Docker Health Check

Add health check to Dockerfile:

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
  CMD node -e "require('http').get('http://localhost:3000/api/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"

Kubernetes Liveness/Readiness

livenessProbe:
  httpGet:
    path: /api/health
    port: 3000
  initialDelaySeconds: 15
  periodSeconds: 20

readinessProbe:
  httpGet:
    path: /api/health
    port: 3000
  initialDelaySeconds: 5
  periodSeconds: 10

Preview Deployments

Automatic PR Previews

Vercel and Railway automatically create preview deployments for pull requests.

GitHub Actions for Railway:

on:
  pull_request:
    branches: [main]

jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to Railway (PR)
        uses: bervProject/railway-deploy@main
        with:
          railway_token: ${{ secrets.RAILWAY_TOKEN }}
          service: ${{ secrets.RAILWAY_SERVICE }}

Comment on PR with Preview URL

- name: Comment PR
  uses: actions/github-script@v7
  with:
    script: |
      github.rest.issues.createComment({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        body: '[DEPLOY] Preview deployed to: https://pr-${{ github.event.number }}.myapp.com'
      })

Rollback Strategies

Instant Rollback (Vercel)

# List deployments
vercel ls

# Promote a previous deployment to production
vercel promote <deployment-url>

Blue-Green Deployment

Deploy new version alongside old, then switch traffic:

# Deploy new version (green)
fly deploy --strategy bluegreen

# Traffic switches automatically after health checks pass
# Rollback if needed:
fly releases rollback

Canary Deployment

Gradually shift traffic to new version:

Fly.io canary:

# Deploy canary (10% traffic)
fly deploy --strategy canary

# Promote to 100% if successful
fly releases promote

Monitoring and Error Tracking

Sentry Integration

npm install @sentry/nextjs

sentry.client.config.ts:

import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  tracesSampleRate: 1.0,
  environment: process.env.NODE_ENV,
  enabled: process.env.NODE_ENV === 'production',
});

sentry.server.config.ts:

import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  tracesSampleRate: 1.0,
  environment: process.env.NODE_ENV,
});

Uptime Monitoring

Use external services to monitor availability:

Monitor your /api/health endpoint every 1-5 minutes.

Log Aggregation

Vercel:

  • Built-in log streaming
  • Integration with Datadog, LogDNA, Axiom

Railway:

  • Built-in logs in dashboard
  • Export to external services

Self-hosted:

# Use Docker logging driver
docker run --log-driver=json-file \
  --log-opt max-size=10m \
  --log-opt max-file=3 \
  my-app

Database Migrations in CI/CD

Prisma Migrations

Run migrations before deployment:

GitHub Actions:

- name: Run migrations
  run: npx prisma migrate deploy
  env:
    DATABASE_URL: ${{ secrets.DATABASE_URL }}

Railway: Add to railway.json:

{
  "deploy": {
    "startCommand": "npx prisma migrate deploy && npm start"
  }
}

Migration Safety

Never run destructive migrations automatically:

  1. Backwards compatible migrations first

- Add new columns as nullable - Deploy code that works with old and new schema - Run migration - Deploy code that requires new schema - Remove old columns in future migration

  1. Manual approval for production - name: Run migrations if: github.event_name == 'workflow_dispatch' run: npx prisma migrate deploy

Precision Tool Integration

Validate Deployment with precision_exec

Use precision_exec to run deployment commands with expectations:

precision_exec:
  commands:
    - cmd: "npm run build"
      expect:
        exit_code: 0
    - cmd: "docker build -t my-app ."
      expect:
        exit_code: 0
    - cmd: "npm run typecheck"
      expect:
        exit_code: 0
  verbosity: minimal

Health Check with precision_fetch

Validate deployment health:

precision_fetch:
  requests:
    - url: "https://my-app.com/api/health"
      method: GET
      expect:
        status: 200
        body_contains: '"status":"healthy"'

Discover Deployment Gaps

Before deploying, check for missing configuration:

discover:
  queries:
    - id: env_example
      type: glob
      patterns: [".env.example"]
    - id: dockerfile
      type: glob
      patterns: ["Dockerfile", "docker-compose.yml"]
    - id: ci_config
      type: glob
      patterns: [".github/workflows/*.yml"]
    - id: health_check
      type: grep
      pattern: '/api/health|/health'
      glob: "**/*.{ts,tsx,js,jsx}"
  output_mode: count_only

Pre-Deployment Checklist

Run the validation script:

./plugins/goodvibes/skills/outcome/deployment/scripts/validate-deployment.sh /path/to/project

The script checks:

  1. Dockerfile exists
  2. .env.example exists and documents required variables
  3. CI/CD configuration present
  4. Health check endpoint implemented
  5. .dockerignore exists
  6. No hardcoded secrets in code
  7. Build command succeeds
  8. Database migration configuration present

Common Pitfalls

1. Missing Environment Variables

Problem: Deployment fails because environment variables aren't set.

Solution: Document all variables in.env.example and validate at build time with zod.

2. Database Connection Pooling

Problem: Serverless functions exhaust database connections.

Solution: Use connection pooling (PgBouncer, Prisma Accelerate, Supabase pooler).

// Use connection pooler in serverless
const prisma = new PrismaClient({
  datasources: {
    db: {
      url: process.env.DATABASE_URL, // Use pooled connection string
    },
  },
});

3. Build Output Not Optimized

Problem: Large Docker images, slow cold starts.

Solution: Use multi-stage builds, standalone output for Next.js, proper.dockerignore.

4. Migrations Run on Every Deploy

Problem: Prisma migrations run on every container start.

Solution: Separate migration step from app startup in CI/CD.

5. No Rollback Plan

Problem: Bad deployment breaks production with no easy fix.

Solution: Use platforms with instant rollback (Vercel, Railway, Fly.io) or maintain previous Docker images.

Summary

Key Principles:

  1. Validate environment variables at build time - Fail fast, not in production
  2. Automate everything - CI/CD should handle lint, test, build, deploy
  3. Health checks are mandatory - Every service needs a health endpoint
  4. Preview deployments for every PR - Catch issues before merging
  5. Always have a rollback plan - Instant rollback > fixing forward
  6. Monitor from day one - Error tracking and uptime monitoring are not optional
  7. Migrations are dangerous - Run them carefully with backwards compatibility

Next Steps:

  1. Run validate-deployment.sh on your project
  2. Set up CI/CD pipeline with GitHub Actions
  3. Configure environment variables in your platform
  4. Add health check endpoint
  5. Test deployment to staging environment
  6. Deploy to production
  7. Set up monitoring and alerting

For detailed platform configurations and templates, see references/deployment-platforms.md.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.19%
按下载量换算145

Claude

29.39%
按下载量换算125

Cursor

16.68%
按下载量换算71

Gemini CLI

9.84%
按下载量换算42

安全审计

Gen Agent Trust Hub

未通过

Socket

未通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills