Get the FREE Ultimate OpenClaw Setup Guide →

devops-patterns

npx machina-cli add skill shahtuyakov/claude-setup/devops-patterns --openclaw
Files (1)
SKILL.md
5.0 KB

DevOps Patterns

Modern DevOps patterns for infrastructure and deployment automation.

Platform Selection

Frontend Hosting

PlatformBest ForPricing
VercelNext.js, ReactFree tier, $20/user pro
NetlifyStatic, JamstackFree tier, $19/user pro
Cloudflare PagesEdge-firstGenerous free tier

Backend Hosting

PlatformBest ForPricing
RailwayRapid deployment$5 hobby, $20 pro + usage
Fly.ioGlobal edgePay-as-you-go (~$3/small VM)
RenderManaged servicesFree tier, $7+ for services
AWS ECSEnterprise scaleUsage-based

When to Use What

ScenarioRecommendation
Startup/MVPRailway or Render
Next.js appVercel
Global low-latencyFly.io
Enterprise/complexAWS or GCP
Cost-sensitiveFly.io or self-hosted

Reference Files

TopicLoadUse When
Dockerreferences/docker-patterns.mdContainerization
CI/CDreferences/ci-cd.mdGitHub Actions, pipelines
Cloud deploymentreferences/cloud-deployment.mdVercel, Railway, AWS
Kubernetesreferences/kubernetes.mdK8s manifests, Helm
Monitoringreferences/monitoring.mdPrometheus, Grafana, logging
IaCreferences/infrastructure-as-code.mdTerraform, Pulumi

Quick Start Patterns

Dockerfile (Node.js)

FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:20-alpine AS runner
WORKDIR /app
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
USER nodejs
EXPOSE 3000
HEALTHCHECK CMD wget -q --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/main.js"]

GitHub Actions (CI)

name: CI

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: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm run lint
      - run: npm run test
      - run: npm run build

Docker Compose (Development)

version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgresql://postgres:postgres@db:5432/app
      - REDIS_URL=redis://redis:6379
    depends_on:
      - db
      - redis

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: app
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine

volumes:
  postgres_data:

Environment Strategy

┌────────────────────────────────────────┐
│ Local Development                       │
│ - docker-compose up                    │
│ - .env.local                           │
├────────────────────────────────────────┤
│ Preview/Staging                         │
│ - Auto-deploy on PR                    │
│ - Unique preview URLs                  │
│ - Separate database                    │
├────────────────────────────────────────┤
│ Production                             │
│ - Deploy on main merge                 │
│ - Blue-green or rolling                │
│ - Production secrets                   │
└────────────────────────────────────────┘

CI/CD Principles

  1. Fast feedback - Quick tests first, fail fast
  2. Parallel execution - Speed up pipelines
  3. Dependency caching - Reduce build time
  4. Environment secrets - Never commit credentials
  5. Automated deployments - Push-to-deploy workflow
  6. Preview environments - Test before merge

Security Checklist

  • Secrets in vault (not in code)
  • Non-root container user
  • Image vulnerability scanning
  • HTTPS/TLS everywhere
  • Least privilege IAM
  • Environment isolation
  • Audit logging enabled

Container Best Practices

  1. Multi-stage builds - Smaller final images
  2. Alpine/distroless base - Minimal attack surface
  3. Non-root user - Security isolation
  4. Health checks - Container health monitoring
  5. .dockerignore - Exclude unnecessary files
  6. Layer caching - Optimize build order

Source

git clone https://github.com/shahtuyakov/claude-setup/blob/main/skills/devops-patterns/SKILL.mdView on GitHub

Overview

This skill aggregates modern DevOps patterns for infrastructure, CI/CD, and deployment automation. It highlights platform choices (Vercel, Railway, Fly.io, Render, AWS ECS), containerization patterns, IaC with Terraform, and observability to support scalable, repeatable deployments.

How This Skill Works

It provides ready-made patterns and templates for containerization, CI/CD pipelines, and deployment automation, along with reference files and environment guidance. You’ll find practical patterns such as a multi-stage Dockerfile, GitHub Actions workflows, and Docker Compose for local development, plus guidance on mapping environments from Local to Production.

When to Use It

  • Startup/MVP - Railway or Render for rapid deployment
  • Next.js app - Vercel for frontend hosting
  • Global low-latency needs - Fly.io for edge deployment
  • Enterprise/complex deployments - AWS or GCP
  • Cost-sensitive projects - Fly.io or self-hosted options

Quick Start

  1. Step 1: Build a multi-stage Node.js Dockerfile as shown to create a lean production image.
  2. Step 2: Add a GitHub Actions CI workflow to automate checkout, setup, tests, and builds.
  3. Step 3: Use Docker Compose for local development with app, database, and cache services.

Best Practices

  • Choose hosting platforms based on app type and goals (Next.js on Vercel, edge needs on Fly.io, enterprise scale on AWS/GCP).
  • Adopt GitHub Actions for CI/CD to automate tests, builds, and deployments.
  • Keep environments separated: Local development, Preview/Staging, and Production with distinct configs.
  • Use infrastructure as code (Terraform) and modular patterns to codify infrastructure.
  • Build in observability from the start with metrics, logs, and dashboards (Prometheus, Grafana).

Example Use Cases

  • Deploy a Next.js site to Vercel with a GitHub Actions CI workflow.
  • Containerize a Node.js app using the provided Dockerfile pattern and deploy on Railway.
  • Run a Docker Compose setup locally with app, Postgres, and Redis for development.
  • Provision AWS ECS resources with Terraform for scalable enterprise workloads.
  • Implement blue-green or rolling deployments in production to minimize downtime.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers