Communitygithub.com

Deployment-Patterns

Deployment-Workflows, CI/CD-Pipeline-Muster, Docker-Containerisierung, Health Checks, Rollback-Strategien und Produktionsbereitschafts-Checklisten für Webanwendungen. Verwenden Sie dies beim Einrichten von CI/CD, Containerisieren einer App oder Überprüfen der Produktionsbereitschaft vor einem Release.

Was ist Deployment-Patterns?

Dieses Skill, "Deployment Patterns", ist ein umfassender Leitfaden für Entwickler und DevOps-Ingenieure, die CI/CD-Pipelines, Docker-Containerisierung und Produktionsbereitstellungen einrichten oder optimieren möchten. Es deckt die gängigsten Deployment-Strategien ab, darunter Rolling, Blue-Green und Canary Deployments, und erklärt deren Vor- und Nachteile sowie ideale Einsatzszenarien. Der Skill bietet sofort einsetzbare Multi-Stage Dockerfile-Vorlagen für Node.js, Go und Python/Django und betont Best Practices wie minimale Image-Größe, Verwendung von Non-Root-Benutzern und Implementierung von Health Checks. Zusätzlich enthält er detaillierte CI/CD-Pipeline-Konfigurationen für GitHub Actions, Anleitungen für Health Check-Endpunkte und Kubernetes-Proben sowie eine umfassende Produktionsbereitschafts-Checkliste, die Aspekte wie Anwendung, Infrastruktur, Monitoring, Sicherheit und Betrieb abdeckt. Das Skill unterstützt Entwickler dabei, robuste, skalierbare und ausfallsichere Deployment-Prozesse zu etablieren und ist als Hilfsmittel für die Plattformen Claude Code, Cursor und Codex konzipiert.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/deployment-patterns

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Deployment Patterns

Produktionsbereitstellungs-Workflows und CI/CD-Best Practices.

Wann aktivieren

  • Einrichten von CI/CD-Pipelines
  • Dockerisieren einer Anwendung
  • Planen der Deployment-Strategie (Blue-Green, Canary, Rolling)
  • Implementieren von Health Checks und Readiness Probes
  • Vorbereiten einer Produktionsfreigabe
  • Konfigurieren umgebungsspezifischer Einstellungen

Deployment-Strategien

Rolling Deployment (Standard)

Ersetzen Sie Instanzen schrittweise – alte und neue Versionen laufen während des Rollouts parallel.

Instanz 1: v1 → v2  (zuerst aktualisieren)
Instanz 2: v1        (läuft noch v1)
Instanz 3: v1        (läuft noch v1)

Instanz 1: v2
Instanz 2: v1 → v2  (zweites Update)
Instanz 3: v1

Instanz 1: v2
Instanz 2: v2
Instanz 3: v1 → v2  (letztes Update)

Vorteile: Null Ausfallzeit, schrittweiser Rollout Nachteile: Zwei Versionen laufen parallel – rückwärtskompatible Änderungen erforderlich Anwenden bei: Standard-Deployments, rückwärtskompatiblen Änderungen

Blue-Green Deployment

Betreiben Sie zwei identische Umgebungen. Schalten Sie den Datenverkehr atomar um.

Blue  (v1) ← Datenverkehr
Green (v2)   im Leerlauf, führt neue Version aus

# Nach Verifikation:
Blue  (v1)   im Leerlauf (wird Standby)
Green (v2) ← Datenverkehr

Vorteile: Sofortiger Rollback (Zurückschalten zu Blue), saubere Umschaltung Nachteile: Erfordert 2x Infrastruktur während des Deployments Anwenden bei: Kritischen Diensten, Null-Toleranz für Probleme

Canary Deployment

Leiten Sie zunächst einen kleinen Prozentsatz des Datenverkehrs auf die neue Version.

v1: 95 % des Datenverkehrs
v2:  5 % des Datenverkehrs (Canary)

# Wenn die Metriken gut aussehen:
v1: 50 % des Datenverkehrs
v2: 50 % des Datenverkehrs

# Abschluss:
v2: 100 % des Datenverkehrs

Vorteile: Erkennt Probleme mit echtem Traffic vor dem vollständigen Rollout Nachteile: Erfordert Infrastruktur zur Traffic-Aufteilung und Monitoring Anwenden bei: Diensten mit hohem Traffic, riskanten Änderungen, Feature Flags

Docker

Multi-Stage Dockerfile (Node.js)

# Stage 1: Abhängigkeiten installieren
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --production=false

# Stage 2: Build
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
RUN npm prune --production

# Stage 3: Produktions-Image
FROM node:22-alpine AS runner
WORKDIR /app

RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001
USER appuser

COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/package.json ./

ENV NODE_ENV=production
EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1

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

Multi-Stage Dockerfile (Go)

FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /server ./cmd/server

FROM alpine:3.19 AS runner
RUN apk --no-cache add ca-certificates
RUN adduser -D -u 1001 appuser
USER appuser

COPY --from=builder /server /server

EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:8080/health || exit 1
CMD ["/server"]

Multi-Stage Dockerfile (Python/Django)

FROM python:3.12-slim AS builder
WORKDIR /app
RUN pip install --no-cache-dir uv
COPY requirements.txt .
RUN uv pip install --system --no-cache -r requirements.txt

FROM python:3.12-slim AS runner
WORKDIR /app

RUN useradd -r -u 1001 appuser
USER appuser

COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY . .

ENV PYTHONUNBUFFERED=1
EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/')" || exit 1
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "4"]

Docker Best Practices

# GUTE Praktiken
- Spezifische Versions-Tags verwenden (node:22-alpine, nicht node:latest)
- Multi-Stage-Builds zur Minimierung der Image-Größe
- Als Nicht-Root-Benutzer ausführen
- Abhängigkeitsdateien zuerst kopieren (Layer-Caching)
- .dockerignore verwenden, um node_modules, .git, Tests auszuschließen
- HEALTHCHECK-Anweisung hinzufügen
- Ressourcenlimits in docker-compose oder k8s setzen

# SCHLECHTE Praktiken
- Als Root ausführen
- :latest-Tags verwenden
- Das gesamte Repository in einer COPY-Schicht kopieren
- Dev-Abhängigkeiten im Produktions-Image installieren
- Secrets im Image speichern (Umgebungsvariablen oder Secrets Manager verwenden)

CI/CD-Pipeline

GitHub Actions (Standard-Pipeline)

name: CI/CD

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

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm test -- --coverage
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: coverage
          path: coverage/

  build:
    needs: test
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v4
      - uses: docker/setup-buildx-action@v3
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          push: true
          tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

  deploy:
    needs: build
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    environment: production
    steps:
      - name: Nach Produktion bereitstellen
        run: |
          # Plattformspezifischer Deployment-Befehl
          # Railway: railway up
          # Vercel: vercel --prod
          # K8s: kubectl set image deployment/app app=ghcr.io/${{ github.repository }}:${{ github.sha }}
          echo "Bereitstellung von ${{ github.sha }}"

Pipeline-Stufen

PR geöffnet:
  lint → typecheck → Unit-Tests → Integrationstests → Preview-Deploy

Nach Merge in main:
  lint → typecheck → Unit-Tests → Integrationstests → Image bauen → im Staging bereitstellen → Smoke-Tests → Produktions-Deploy

Health Checks

Health Check-Endpunkt

// Einfacher Health Check
app.get("/health", (req, res) => {
  res.status(200).json({ status: "ok" });
});

// Detaillierter Health Check (für internes Monitoring)
app.get("/health/detailed", async (req, res) => {
  const checks = {
    database: await checkDatabase(),
    redis: await checkRedis(),
    externalApi: await checkExternalApi(),
  };

  const allHealthy = Object.values(checks).every(c => c.status === "ok");

  res.status(allHealthy ? 200 : 503).json({
    status: allHealthy ? "ok" : "degraded",
    timestamp: new Date().toISOString(),
    version: process.env.APP_VERSION || "unknown",
    uptime: process.uptime(),
    checks,
  });
});

async function checkDatabase(): Promise<HealthCheck> {
  try {
    await db.query("SELECT 1");
    return { status: "ok", latency_ms: 2 };
  } catch (err) {
    return { status: "error", message: "Datenbank nicht erreichbar" };
  }
}

Kubernetes Probes

livenessProbe:
  httpGet:
    path: /health
    port: 3000
  initialDelaySeconds: 10
  periodSeconds: 30
  failureThreshold: 3

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

startupProbe:
  httpGet:
    path: /health
    port: 3000
  initialDelaySeconds: 0
  periodSeconds: 5
  failureThreshold: 30    # 30 * 5s = 150s maximale Startzeit

Umgebungskonfiguration

Twelve-Factor App Pattern

# Alle Konfiguration über Umgebungsvariablen – niemals im Code
DATABASE_URL=postgres://user:pass@host:5432/db
REDIS_URL=redis://host:6379/0
API_KEY=${API_KEY}           # vom Secrets Manager injiziert
LOG_LEVEL=info
PORT=3000

# Umgebungsspezifisches Verhalten
NODE_ENV=production          # oder staging, development
APP_ENV=production           # explizite App-Umgebung

Konfigurationsvalidierung

import { z } from "zod";

const envSchema = z.object({
  NODE_ENV: z.enum(["development", "staging", "production"]),
  PORT: z.coerce.number().default(3000),
  DATABASE_URL: z.string().url(),
  REDIS_URL: z.string().url(),
  JWT_SECRET: z.string().min(32),
  LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
});

// Beim Start validieren – schnell fehlschlagen, wenn Konfiguration falsch ist
export const env = envSchema.parse(process.env);

Rollback-Strategie

Sofortiger Rollback

# Docker/Kubernetes: auf vorheriges Image verweisen
kubectl rollout undo deployment/app

# Vercel: vorheriges Deployment fördern
vercel rollback

# Railway: vorherigen Commit erneut bereitstellen
railway up --commit <previous-sha>

# Datenbank: Migration zurückrollen (wenn umkehrbar)
npx prisma migrate resolve --rolled-back <migrationsname>

Rollback-Checkliste

  • Vorheriges Image/Artefakt ist verfügbar und getaggt
  • Datenbankmigrationen sind rückwärtskompatibel (keine destruktiven Änderungen)
  • Feature Flags können neue Funktionen ohne Deployment deaktivieren
  • Monitoring-Warnungen für Fehlerratenspitzen konfiguriert
  • Rollback vor dem Produktionsrelease im Staging getestet

Produktionsbereitschafts-Checkliste

Vor jedem Produktions-Deployment:

Anwendung

  • Alle Tests bestanden (Unit-, Integrations-, E2E-Tests)
  • Keine hartcodierten Secrets im Code oder in Konfigurationsdateien
  • Fehlerbehandlung deckt alle Randfälle ab
  • Logging ist strukturiert (JSON) und enthält keine personenbezogenen Daten
  • Health Check-Endpunkt gibt aussagekräftigen Status zurück

Infrastruktur

  • Docker-Image baut reproduzierbar (festgepinnte Versionen)
  • Umgebungsvariablen dokumentiert und beim Start validiert
  • Ressourcenlimits gesetzt (CPU, Arbeitsspeicher)
  • Horizontale Skalierung konfiguriert (min./max. Instanzen)
  • SSL/TLS auf allen Endpunkten aktiviert

Monitoring

  • Anwendungsmetriken exportiert (Request-Rate, Latenz, Fehler)
  • Warnungen für Fehlerrate > Schwellwert konfiguriert
  • Log-Aggregation eingerichtet (strukturierte Logs, durchsuchbar)
  • Uptime-Monitoring auf dem Health-Endpunkt

Sicherheit

  • Abhängigkeiten auf CVEs geprüft
  • CORS nur für erlaubte Ursprünge konfiguriert
  • Rate Limiting auf öffentlichen Endpunkten aktiviert
  • Authentifizierung und Autorisierung verifiziert
  • Sicherheitsheader gesetzt (CSP, HSTS, X-Frame-Options)

Betrieb

  • Rollback-Plan dokumentiert und getestet
  • Datenbankmigration gegen produktionsgroße Daten getestet
  • Runbook für häufige Fehlerszenarien
  • Bereitschaftsrotation und Eskalationspfad definiert

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

Verwandte Skills