⚙️

DevOps

Infrastructure, deployment, CI/CD, containers, and cloud configuration snippets.

100 snippets

Showing 100 of 100 snippets

bashintermediate

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

#docker#compose
bashadvanced

Kubernetes Deployment Configuration

Production-ready Kubernetes deployment with replicas, resource limits, health checks, and rolling updates.

Best for: Production container orchestration

#kubernetes#deployment
bashintermediate

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

#nginx#reverse-proxy
bashintermediate

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

#github-actions#ci-cd
javascriptintermediate

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

#pm2#process-manager
bashintermediate

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

#systemd#linux
bashbeginner

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

#env#bash
bashbeginner

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

#redis#docker
bashbeginner

PostgreSQL Docker Setup with Init Script

Docker Compose for PostgreSQL with volume persistence, init scripts, and connection pooling.

Best for: Local PostgreSQL for development

#postgres#docker
bashadvanced

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#load-balancer
bashintermediate

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

#ssl#certbot
typescriptintermediate

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

#health-check#monitoring
bashintermediate

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

#nginx#rate-limiting
bashbeginner

Linux Cron Job Setup Examples

Common crontab entries for database backups, log cleanup, health checks, and certificate renewal.

Best for: Automated database backups

#cron#linux
bashbeginner

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

#logrotate#logging
bashintermediate

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

#docker#dockerfile
bashadvanced

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

#terraform#aws
bashintermediate

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

#github-actions#docker
bashintermediate

Docker Network Configuration

Create and manage Docker networks for container-to-container communication and service isolation.

Best for: Isolating database containers from public access

#docker#networking
bashadvanced

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

#ansible#automation
bashadvanced

Prometheus Monitoring Setup

Docker Compose setup for Prometheus with Grafana, node exporter, and alerting rules.

Best for: Infrastructure monitoring with metrics collection

#prometheus#monitoring
bashintermediate

Database Backup Script with Rotation

Automated PostgreSQL backup script with compression, rotation, and optional S3 upload.

Best for: Automated nightly database backups

#backup#postgres
bashbeginner

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

#ssh#config
bashintermediate

Makefile for DevOps Automation

Makefile with common DevOps targets for building, testing, deploying, and managing Docker containers.

Best for: Standardizing developer commands across teams

#makefile#automation
bashintermediate

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

#github-actions#testing
bashbeginner

Docker Volume Management Commands

Essential Docker volume commands for data persistence, backup, migration, and cleanup.

Best for: Persisting database data across container restarts

#docker#volumes
bashintermediate

Kubernetes ConfigMap and Secrets

Create and use Kubernetes ConfigMaps and Secrets for application configuration management.

Best for: Externalizing application configuration in K8s

#kubernetes#configmap
bashintermediate

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

#fail2ban#security
bashbeginner

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

#docker#healthcheck
bashintermediate

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

#bash#devops
yamlbeginner

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#ci-cd
yamlintermediate

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

#github-actions#cloudflare
yamlbeginner

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

#docker-compose#postgres
yamlintermediate

Kubernetes Deployment Manifest

Production-ready Kubernetes deployment with resource limits, probes, rolling updates, and anti-affinity.

Best for: Deploying containerized applications to Kubernetes

#kubernetes#deployment
yamladvanced

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

#kubernetes#autoscaling
yamlintermediate

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#ci-cd
yamlintermediate

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

#github-actions#docker
yamlbeginner

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

#kubernetes#configmap
yamlintermediate

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

#docker-compose#environments
yamlintermediate

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

#kubernetes#ingress
yamladvanced

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

#github-actions#matrix
bashadvanced

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

#terraform#aws
bashbeginner

Kubectl Rollout — Restart, Status, and Undo

Essential kubectl rollout commands for deployments: restart, status checks, history, and rollback.

Best for: Zero-downtime deployment restarts

#kubernetes#kubectl
bashintermediate

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

#bash#parallel
typescriptintermediate

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

#aws#s3
typescriptintermediate

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

#cloudflare#workers
typescriptintermediate

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

#vercel#api
yamlbeginner

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

#kubernetes#cronjob
bashintermediate

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

#ssl#certbot
yamlbeginner

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-compose#profiles
bashbeginner

Docker Swarm

DevOps practice: docker-swarm

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Docker Network

DevOps practice: docker-network

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Docker Volume

DevOps practice: docker-volume

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Docker Health Check

DevOps practice: docker-health-check

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Kubernetes Ingress

DevOps practice: kubernetes-ingress

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Kubernetes Service Mesh

DevOps practice: kubernetes-service-mesh

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Kubernetes Operators

DevOps practice: kubernetes-operators

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Helm Charts

DevOps practice: helm-charts

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Ansible Automation

DevOps practice: ansible-automation

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Puppet Infrastructure

DevOps practice: puppet-infrastructure

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Chef Infrastructure

DevOps practice: chef-infrastructure

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Terraform Aws

DevOps practice: terraform-aws

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Cloudformation

DevOps practice: cloudformation

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Azure Templates

DevOps practice: azure-templates

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Aws Cdk

DevOps practice: aws-cdk

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Pulumi Iac

DevOps practice: pulumi-iac

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Jenkins Pipeline

DevOps practice: jenkins-pipeline

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Circleci Workflow

DevOps practice: circleci-workflow

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Travis Ci

DevOps practice: travis-ci

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Drone Ci

DevOps practice: drone-ci

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Argocd Deployment

DevOps practice: argocd-deployment

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Flux Gitops

DevOps practice: flux-gitops

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Kustomize Templates

DevOps practice: kustomize-templates

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Skaffold Development

DevOps practice: skaffold-development

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Prometheus Advanced

DevOps practice: prometheus-advanced

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Grafana Dashboards

DevOps practice: grafana-dashboards

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Elk Stack Advanced

DevOps practice: elk-stack-advanced

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Datadog Monitoring

DevOps practice: datadog-monitoring

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Jaeger Tracing

DevOps practice: jaeger-tracing

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Zipkin Distributed

DevOps practice: zipkin-distributed

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Opentelemetry Instrumentation

DevOps practice: opentelemetry-instrumentation

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Dynatrace Monitoring

DevOps practice: dynatrace-monitoring

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Vault Secrets

DevOps practice: vault-secrets

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Sealed Secrets

DevOps practice: sealed-secrets

Best for: infrastructure management

#devops#infrastructure
bashintermediate

External Secrets

DevOps practice: external-secrets

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Certmanager Certificates

DevOps practice: certmanager-certificates

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Network Policies

DevOps practice: network-policies

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Pod Security

DevOps practice: pod-security

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Rbac Authorization

DevOps practice: rbac-authorization

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Service Accounts

DevOps practice: service-accounts

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Blue Green Deployment

DevOps practice: blue-green-deployment

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Canary Release

DevOps practice: canary-release

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Chaos Engineering

DevOps practice: chaos-engineering

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Incident Response Runbook

DevOps practice: incident-response-runbook

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Backup Disaster Recovery

DevOps practice: backup-disaster-recovery

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Infra Cost Optimization

DevOps practice: infra-cost-optimization

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Container Image Scanning

DevOps practice: container-image-scanning

Best for: infrastructure management

#devops#infrastructure
bashadvanced

Dependency Vulnerability Scan

DevOps practice: dependency-vulnerability-scan

Best for: infrastructure management

#devops#infrastructure
bashbeginner

Rate Limiting Gateway

DevOps practice: rate-limiting-gateway

Best for: infrastructure management

#devops#infrastructure
bashintermediate

Autoscaling Hpa

DevOps practice: autoscaling-hpa

Best for: infrastructure management

#devops#infrastructure