← Back to DevOps Basics

DevOps Basics — Quick Summary

Quick revision: every topic, key terms, and mnemonics for DevOps Basics.


This is a quick revision doc covering all 18 topics in the DevOps Basics collection. These are the interview essentials — open the linked notes if you want depth.

Networking Fundamentals

How DNS Works

What it is. DNS is the internet’s phone book — translates google.com into an IP like 142.250.190.14.

Key terms.

Commands.

dig pman47.cc +short
dig pman47.cc MX
dig @8.8.8.8 pman47.cc
nslookup -type=MX pman47.cc

Remember. Lower TTL the day before a migration. After changes, verify with dig. CNAMEs can’t sit at root domain.

Networking Basics for Devs

What it is. IP addresses identify machines, ports identify services on a machine, TCP/UDP move the data.

Key terms.

URL flow. DNS lookup → TCP handshake → TLS handshake → HTTP request → response → render.

Remember. Docker container can’t be reached from host? Bind to 0.0.0.0, not 127.0.0.1. lsof -i :3000 finds who owns a port.

SSL, TLS & HTTPS

What it is. TLS encrypts traffic between browser and server. HTTPS = HTTP + TLS.

Key terms.

Code.

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem \
  -sha256 -days 365 -nodes -subj "/CN=localhost"

Remember. “SSL cert” usually means TLS cert. Caddy auto-issues + auto-renews. Padlock = TLS cert signed by trusted CA.

SSH Basics

What it is. Encrypted remote shell access — every server admin uses it daily.

Key terms.

Commands.

ssh-keygen -t ed25519 -C "me@example.com"
ssh-copy-id user@server
ssh -L 5432:localhost:5432 -N user@server   # tunnel only
ssh -vvv user@server   # debug
chmod 600 ~/.ssh/id_ed25519

Remember. “Permission denied (publickey)” = wrong key, wrong file perms, or key not in authorized_keys. Use ~/.ssh/config so we never type long commands.

HTTP & Web Protocols

HTTP Methods, Status Codes & Headers

What it is. Request-response language of the web.

Key terms.

Status codes cheat sheet.

CodeMeaning
200OK
201Created (POST success)
204No Content (DELETE success)
301Moved Permanently
302Found (temporary)
304Not Modified
400Bad Request
401Unauthorized (not logged in)
403Forbidden (logged in, not allowed)
404Not Found
409Conflict (duplicate)
422Unprocessable (validation)
429Too Many Requests
500Internal Error
502Bad Gateway
503Service Unavailable

Remember. POST is the only common method that’s neither safe nor idempotent. 401 = “who are you,” 403 = “I know, you can’t.” curl -v shows full request+response.

CORS

What it is. Browser security: page A’s JS can only call page A’s origin unless the server opts in.

Key terms.

The credentials gotcha. With credentials: include, server can NOT use Allow-Origin: *. Must specify exact origin.

Dev fix. Vite/CRA proxy: /api/*http://localhost:8080, browser thinks same-origin.

Remember. CORS is browser-only — curl doesn’t enforce it. JSON Content-Type triggers preflight. Custom headers (Authorization) trigger preflight.

REST API Design Basics

What it is. Conventions making APIs predictable: URLs are nouns, methods are verbs.

Key terms.

Remember. No verbs in URLs (/createUser is bad). Keep nesting ≤ 2 levels deep. Use 422 for validation errors, 409 for conflicts.

Proxy & Reverse Proxy

What it is. A middleman server. Forward proxy hides clients; reverse proxy hides servers.

Key terms.

Code.

location / {
  proxy_pass http://localhost:3000;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
}

Remember. Forward = client’s mask. Reverse = servers’ mask. Almost every prod app sits behind a reverse proxy.

Servers & Infrastructure

Linux Commands Every Dev Should Know

What it is. The minimum CLI we need to function on any server.

Key terms.

Remember. chmod 755 for scripts, 644 for configs, 600 for keys. tail -f log is a daily friend. man <cmd> is the universal helper.

Web Servers — Nginx & Apache

What it is. Listens on a port, receives HTTP, sends responses (static or proxied).

Key terms.

Remember. Nginx for high concurrency / static / reverse proxy. Apache where .htaccess matters. Test config before reload — bad config takes down the site.

Load Balancing Basics

What it is. Spread traffic across multiple servers for capacity + resilience.

Key terms.

Code.

upstream api_servers {
  least_conn;
  server 10.0.0.1:3000 weight=3;
  server 10.0.0.2:3000;
  server 10.0.0.3:3000 backup;
}

Remember. Make apps stateless (Redis sessions) so any server handles any request — no sticky needed. Health checks are non-optional in prod.

Caching — Browser, CDN & Server

What it is. Store data closer to where it’s needed. Single biggest perf win.

Key terms.

Code.

# static asset, cache 1 year
Cache-Control: public, max-age=31536000, immutable
# user-specific data
Cache-Control: private, no-cache
# secrets
Cache-Control: no-store

Remember. Three rules: TTL must match staleness tolerance. Never public for personalized data. Cache-bust via filename hash, not URL query.

Docker & Containers

Docker Basics

What it is. Package app + everything it needs into a container. “Works on my machine” → works everywhere.

Key terms.

Commands.

docker run -d --name app -p 3000:3000 node:20-alpine
docker ps -a
docker logs -f app
docker exec -it app sh
docker stop app && docker rm app
docker run -d -v pgdata:/var/lib/postgresql/data postgres:15

Remember. Containers are ephemeral — without volumes, data dies. Named volumes for prod (Docker manages path), bind mounts for dev (live code).

Writing a Dockerfile

What it is. Recipe for building an image, layer by layer.

Key terms.

Code.

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

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/server.js"]

Remember. Copy package.json BEFORE source — keeps npm install cached when only code changes. Combine related RUNs with && to reduce layers.

Docker Compose

What it is. Define multi-container apps in one YAML, start with one command.

Key terms.

Code.

services:
  api:
    build: .
    ports: ["3000:3000"]
    env_file: [.env]
    depends_on:
      postgres:
        condition: service_healthy
  postgres:
    image: postgres:15-alpine
    environment:
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASS}
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user"]
      interval: 5s
      retries: 5
volumes:
  pgdata:

Commands. docker compose up -d, down [-v], logs -f [svc], exec, ps, up -d --build.

Remember. Service name = hostname inside the network. depends_on alone doesn’t wait for service ready — use healthchecks.

CI/CD & Operations

Environment Variables & Configuration

What it is. Config outside code, different per environment. Same code runs everywhere.

Key terms.

Code.

require("dotenv").config();
const port = process.env.PORT || 3000;

Remember. Never put secrets in Dockerfile ENV — they get baked in. If we leak a secret in git, ROTATE it (don’t just delete commit). .env always in .gitignore.

CI/CD

What it is. Auto build/test/deploy on every push.

Key terms.

Code.

on:
  push: { branches: [main] }
  pull_request:
jobs:
  ci:
    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 test
  deploy:
    needs: ci
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - run: ./deploy.sh

Remember. Main branch is always deployable. PR runs CI; merge runs CD. Cache deps to keep builds fast.

Logging & Monitoring Basics

What it is. Know what’s happening before users tell us.

Key terms.

Code.

app.get("/ready", async (req, res) => {
  try {
    await db.query("SELECT 1");
    await redis.ping();
    res.status(200).json({ status: "ok", uptime: process.uptime() });
  } catch (err) {
    res.status(503).json({ status: "degraded", error: err.message });
  }
});

Remember. Logs answer “what happened?”, metrics answer “is it healthy now?”, alerts answer “wake me up.” Always JSON logs in prod, set level to info. p99 latency matters more than average.