1---
2name: devops
3description: Automate deployments, manage infrastructure, and build reliable CI/CD pipelines.
4metadata:
5 source: https://skillmd.com/skills/modbender/devops
6 clawdbot:
7 emoji: 🔧
8 os:
9 - linux
10 - darwin
11 - win32
12---
13
14# DevOps Rules
15
16## CI/CD Pipelines
17- Fail fast: run linting and unit tests before expensive integration tests — saves time and compute
18- Cache dependencies between runs — `npm install` on every build wastes minutes
19- Pin action versions with SHA, not tags — `actions/checkout@v3` can change, SHA is immutable
20- Secrets in environment variables, never in code or logs — mask them in CI output
21- Parallel jobs for independent steps — test, lint, and build can run simultaneously
22
23## Deployment Strategies
24- Blue-green: run new version alongside old, switch traffic atomically — instant rollback by switching back
25- Canary: route percentage of traffic to new version — catch issues before full rollout
26- Rolling: update instances incrementally — balance between speed and risk
27- Always have rollback plan before deploying — know exactly how to revert
28- Deploy the same artifact to all environments — build once, promote through stages
29
30## Infrastructure as Code
31- Version control all infrastructure — terraform, ansible, cloudformation in git
32- Never apply changes without plan/diff review — `terraform plan` before `apply`
33- State files contain secrets — store remotely with encryption, never in git
34- Modules for reusable components — don't copy-paste infrastructure definitions
35- Separate environments with workspaces or directories — dev changes shouldn't affect prod
36
37## Containers
38- One process per container — containers are not VMs
39- Health checks are mandatory — orchestrators need them for routing and restarts
40- Don't run as root — use non-root USER in Dockerfile
41- Immutable images: config via environment, not baked in — same image in all environments
42- Tag images with git SHA, not just `latest` — know exactly what's deployed
43
44## Secrets Management
45- Never store secrets in environment files committed to git — use vault, sealed secrets, or CI secret storage
46- Rotate secrets regularly — automation makes rotation painless
47- Different secrets per environment — dev leak shouldn't compromise prod
48- Audit secret access — know who accessed what and when
49- Secrets in memory, not disk when possible — temp files persist longer than expected
50
51## Monitoring & Alerting
52- Four golden signals: latency, traffic, errors, saturation — start here
53- Alert on symptoms, not causes — "users seeing errors" not "CPU high"
54- Every alert must be actionable — if you can't do anything, it's noise
55- Dashboard per service with key metrics — one glance shows health
56- Structured logs (JSON) for machine parsing — grep works, but queries are better
57
58## Reliability
59- Define SLOs before building alerting — what does "healthy" mean for this service?
60- Error budgets: some failures are acceptable — 99.9% means 8 hours downtime/year is OK
61- Chaos engineering in staging — break things intentionally before prod breaks accidentally
62- Runbooks for common incidents — 3am is not the time to figure out recovery steps
63- Post-mortems without blame — focus on systems, not people
64
65## Common Mistakes
66- SSH into prod to fix things — all changes through automation, or you'll forget what you did
67- No staging environment — "works on my machine" doesn't mean works in prod
68- Ignoring flaky tests — they erode trust in CI, either fix or delete
69- Manual steps in deployment — if it's not automated, it'll be done wrong eventually
70- Monitoring only happy paths — check error rates and edge cases too
71
72## Networking
73- Internal services don't need public IPs — use private subnets, expose only load balancers
74- TLS everywhere, including internal traffic — zero trust, even behind firewall
75- DNS for service discovery — hardcoded IPs break when things move
76- Load balancer health checks separate from app health — LB needs fast response, app health can be thorough
77- Firewall default deny — explicitly allow what's needed, block everything else