DevOps
Infrastructure, deployment, CI/CD, containers, and cloud configuration snippets.
100 snippets
Showing 100 of 100 snippets
Docker Compose Multi-Service Setup
Docker Compose configuration for a Node.js app with PostgreSQL, Redis, and Nginx reverse proxy.
Best for: Local development environment with multiple services
Kubernetes Deployment Configuration
Production-ready Kubernetes deployment with replicas, resource limits, health checks, and rolling updates.
Best for: Production container orchestration
Nginx Reverse Proxy Configuration
Nginx config to reverse-proxy requests to a backend with WebSocket support and security headers.
Best for: Serving Node.js apps behind Nginx
GitHub Actions CI/CD Pipeline
Complete GitHub Actions workflow with test, build, and deploy stages for a Node.js application.
Best for: Automated testing and deployment on push
PM2 Process Manager Configuration
PM2 ecosystem file for managing Node.js processes with clustering, log rotation, and auto-restart.
Best for: Running Node.js in production with clustering
Systemd Service File for Node.js
Systemd unit file to run a Node.js app as a managed service with auto-restart and logging.
Best for: Running production services on Linux servers
Environment File Loader Script
Bash script that safely loads environment variables from a .env file with validation and defaults.
Best for: Loading config before starting services
Redis Docker Setup with Persistence
Docker Compose for Redis with persistence, password auth, memory limits, and a health check.
Best for: Local Redis instance for development
PostgreSQL Docker Setup with Init Script
Docker Compose for PostgreSQL with volume persistence, init scripts, and connection pooling.
Best for: Local PostgreSQL for development
Nginx Load Balancer Configuration
Nginx upstream load balancer with weighted round-robin, health checks, and failover handling.
Best for: Distributing traffic across multiple app servers
Nginx SSL Setup with Certbot
Bash script to install and configure SSL certificates with Certbot for Nginx with auto-renewal.
Best for: Setting up HTTPS for production websites
Health Check Endpoint with Dependency Checks
Express health check endpoint that verifies database, Redis, and disk connectivity with status reporting.
Best for: Kubernetes liveness and readiness probes
Nginx Rate Limiting Configuration
Nginx rate limiting with multiple zones for API and login routes, burst handling, and custom error pages.
Best for: Protecting APIs from abuse and DDoS
Linux Cron Job Setup Examples
Common crontab entries for database backups, log cleanup, health checks, and certificate renewal.
Best for: Automated database backups
Logrotate Configuration for Applications
Logrotate config for application logs with daily rotation, compression, and post-rotate hooks.
Best for: Preventing disk space exhaustion from logs
Dockerfile Multi-Stage Build
Multi-stage Dockerfile for Node.js with build, prune, and minimal production image layers.
Best for: Optimized Docker images for production
Terraform AWS EC2 Instance Setup
Terraform configuration to provision an EC2 instance with VPC, security group, and SSH key pair.
Best for: Provisioning cloud infrastructure with code
GitHub Actions Docker Build and Push
GitHub Actions workflow to build a Docker image and push it to GitHub Container Registry on release.
Best for: Automated Docker image publishing on release
Docker Network Configuration
Create and manage Docker networks for container-to-container communication and service isolation.
Best for: Isolating database containers from public access
Ansible Playbook for Server Setup
Ansible playbook to provision a web server with Nginx, Node.js, and firewall configuration.
Best for: Automated server provisioning across environments
Prometheus Monitoring Setup
Docker Compose setup for Prometheus with Grafana, node exporter, and alerting rules.
Best for: Infrastructure monitoring with metrics collection
Database Backup Script with Rotation
Automated PostgreSQL backup script with compression, rotation, and optional S3 upload.
Best for: Automated nightly database backups
SSH Config for Server Management
Organized SSH config file with host aliases, jump hosts, and connection multiplexing for DevOps.
Best for: Managing connections to multiple servers
Makefile for DevOps Automation
Makefile with common DevOps targets for building, testing, deploying, and managing Docker containers.
Best for: Standardizing developer commands across teams
GitHub Actions Test Matrix Strategy
GitHub Actions workflow with matrix strategy to test across multiple Node versions and OS platforms.
Best for: Cross-platform compatibility testing
Docker Volume Management Commands
Essential Docker volume commands for data persistence, backup, migration, and cleanup.
Best for: Persisting database data across container restarts
Kubernetes ConfigMap and Secrets
Create and use Kubernetes ConfigMaps and Secrets for application configuration management.
Best for: Externalizing application configuration in K8s
Fail2ban Security Configuration
Configure Fail2ban to protect SSH and Nginx from brute force attacks with custom jail rules.
Best for: Protecting SSH from brute force attacks
Docker Health Check Patterns
Docker health check configurations for web apps, databases, and message queues with restart policies.
Best for: Ensuring container readiness before traffic routing
Log Rotation Management Script
Automate log rotation with compression, retention policies, and disk space monitoring in Bash.
Best for: Preventing disk space exhaustion from logs
GitHub Actions — Node.js CI Pipeline
Complete CI workflow for Node.js: install, lint, test, build on every push and PR with caching.
Best for: Automated testing on every push and PR
GitHub Actions — Deploy to Cloudflare Pages
Automated deployment pipeline to Cloudflare Pages with build preview for PRs and production on main.
Best for: Zero-config deployment for static Next.js exports
Docker Compose — PostgreSQL Dev Environment
Full Docker Compose setup for PostgreSQL with pgAdmin, init scripts, volumes, and health checks.
Best for: Local database development environment
Kubernetes Deployment Manifest
Production-ready Kubernetes deployment with resource limits, probes, rolling updates, and anti-affinity.
Best for: Deploying containerized applications to Kubernetes
Kubernetes HPA — Horizontal Pod Autoscaler
Configure horizontal pod autoscaling based on CPU, memory, and custom metrics for Kubernetes workloads.
Best for: Auto-scaling APIs based on traffic load
GitHub Actions — Reusable Workflow Pattern
Create reusable workflows called from other workflows with inputs, secrets, and output passing.
Best for: DRY deployment workflows across environments
GitHub Actions — Docker Build and Publish
Build multi-platform Docker images and push to GitHub Container Registry with caching and tagging.
Best for: Publishing Docker images on release tags
Kubernetes ConfigMap and Secret Management
Create and use ConfigMaps and Secrets for application configuration with env vars and volume mounts.
Best for: Managing application configuration in Kubernetes
Docker Compose — Multi-Environment Override
Use Docker Compose override files for dev, staging, and production with shared base configuration.
Best for: Shared base config with environment-specific overrides
Kubernetes Ingress — NGINX Routing Rules
Configure NGINX Ingress for path-based routing, TLS termination, rate limiting, and redirects.
Best for: Routing traffic to multiple services via paths
GitHub Actions — Advanced Matrix Strategy
Complex matrix strategies with include/exclude, fail-fast control, and dynamic matrix generation.
Best for: Cross-platform and multi-version testing
Terraform — AWS S3 + CloudFront Static Site
Provision an S3 static website with CloudFront CDN, SSL certificate, and origin access control.
Best for: Deploying static sites with global CDN distribution
Kubectl Rollout — Restart, Status, and Undo
Essential kubectl rollout commands for deployments: restart, status checks, history, and rollback.
Best for: Zero-downtime deployment restarts
Bash Parallel Jobs — Run Tasks Concurrently
Execute multiple shell commands in parallel with job control, exit code checking, and max concurrency.
Best for: Running CI checks in parallel for faster builds
AWS SDK v3 — S3 Operations in TypeScript
Perform S3 operations with AWS SDK v3: upload, download, list, presigned URLs, and multipart upload.
Best for: Server-side file uploads to S3
Cloudflare Workers — Edge API in TypeScript
Build serverless edge APIs with Cloudflare Workers, KV storage, and request routing.
Best for: Low-latency edge APIs without origin servers
Vercel API — Trigger and List Deployments
Use the Vercel REST API to trigger deployments, list recent builds, and check deployment status.
Best for: Triggering deployments from CI or Slack bots
Kubernetes CronJob — Scheduled Tasks
Create Kubernetes CronJobs for scheduled tasks with history limits, concurrency control, and deadlines.
Best for: Scheduling daily data exports or reports
SSL Certificate Renewal with Certbot
Automate Let's Encrypt SSL certificate issuance and renewal with Certbot and NGINX reload.
Best for: Automated HTTPS setup for web servers
Docker Compose Profiles — Optional Services
Use Docker Compose profiles to selectively start optional services like monitoring, debugging tools.
Best for: Optional monitoring stack for local development
Docker Swarm
DevOps practice: docker-swarm
Best for: infrastructure management
Docker Network
DevOps practice: docker-network
Best for: infrastructure management
Docker Volume
DevOps practice: docker-volume
Best for: infrastructure management
Docker Health Check
DevOps practice: docker-health-check
Best for: infrastructure management
Kubernetes Ingress
DevOps practice: kubernetes-ingress
Best for: infrastructure management
Kubernetes Service Mesh
DevOps practice: kubernetes-service-mesh
Best for: infrastructure management
Kubernetes Operators
DevOps practice: kubernetes-operators
Best for: infrastructure management
Helm Charts
DevOps practice: helm-charts
Best for: infrastructure management
Ansible Automation
DevOps practice: ansible-automation
Best for: infrastructure management
Puppet Infrastructure
DevOps practice: puppet-infrastructure
Best for: infrastructure management
Chef Infrastructure
DevOps practice: chef-infrastructure
Best for: infrastructure management
Terraform Aws
DevOps practice: terraform-aws
Best for: infrastructure management
Cloudformation
DevOps practice: cloudformation
Best for: infrastructure management
Azure Templates
DevOps practice: azure-templates
Best for: infrastructure management
Aws Cdk
DevOps practice: aws-cdk
Best for: infrastructure management
Pulumi Iac
DevOps practice: pulumi-iac
Best for: infrastructure management
Jenkins Pipeline
DevOps practice: jenkins-pipeline
Best for: infrastructure management
Circleci Workflow
DevOps practice: circleci-workflow
Best for: infrastructure management
Travis Ci
DevOps practice: travis-ci
Best for: infrastructure management
Drone Ci
DevOps practice: drone-ci
Best for: infrastructure management
Argocd Deployment
DevOps practice: argocd-deployment
Best for: infrastructure management
Flux Gitops
DevOps practice: flux-gitops
Best for: infrastructure management
Kustomize Templates
DevOps practice: kustomize-templates
Best for: infrastructure management
Skaffold Development
DevOps practice: skaffold-development
Best for: infrastructure management
Prometheus Advanced
DevOps practice: prometheus-advanced
Best for: infrastructure management
Grafana Dashboards
DevOps practice: grafana-dashboards
Best for: infrastructure management
Elk Stack Advanced
DevOps practice: elk-stack-advanced
Best for: infrastructure management
Datadog Monitoring
DevOps practice: datadog-monitoring
Best for: infrastructure management
Jaeger Tracing
DevOps practice: jaeger-tracing
Best for: infrastructure management
Zipkin Distributed
DevOps practice: zipkin-distributed
Best for: infrastructure management
Opentelemetry Instrumentation
DevOps practice: opentelemetry-instrumentation
Best for: infrastructure management
Dynatrace Monitoring
DevOps practice: dynatrace-monitoring
Best for: infrastructure management
Vault Secrets
DevOps practice: vault-secrets
Best for: infrastructure management
Sealed Secrets
DevOps practice: sealed-secrets
Best for: infrastructure management
External Secrets
DevOps practice: external-secrets
Best for: infrastructure management
Certmanager Certificates
DevOps practice: certmanager-certificates
Best for: infrastructure management
Network Policies
DevOps practice: network-policies
Best for: infrastructure management
Pod Security
DevOps practice: pod-security
Best for: infrastructure management
Rbac Authorization
DevOps practice: rbac-authorization
Best for: infrastructure management
Service Accounts
DevOps practice: service-accounts
Best for: infrastructure management
Blue Green Deployment
DevOps practice: blue-green-deployment
Best for: infrastructure management
Canary Release
DevOps practice: canary-release
Best for: infrastructure management
Chaos Engineering
DevOps practice: chaos-engineering
Best for: infrastructure management
Incident Response Runbook
DevOps practice: incident-response-runbook
Best for: infrastructure management
Backup Disaster Recovery
DevOps practice: backup-disaster-recovery
Best for: infrastructure management
Infra Cost Optimization
DevOps practice: infra-cost-optimization
Best for: infrastructure management
Container Image Scanning
DevOps practice: container-image-scanning
Best for: infrastructure management
Dependency Vulnerability Scan
DevOps practice: dependency-vulnerability-scan
Best for: infrastructure management
Rate Limiting Gateway
DevOps practice: rate-limiting-gateway
Best for: infrastructure management
Autoscaling Hpa
DevOps practice: autoscaling-hpa
Best for: infrastructure management