OwlTheEngineer
How It Actually WorksEpisode 51 · DevOps

How CI/CD actually works: what happens when you git push

Why manual FTP and SSH deployments cause late-night production outages, and how automated pipelines package immutable containers with zero downtime.

Owl · 2 min read · 0 views
– comments
Ep 51 · DevOps
60s VISUAL BREAKDOWN
Episode 51
Watch the fast visual breakdown or discuss on social:

In the early days of web development, deploying code meant opening an FTP client or SSH terminal late at night, copying modified files onto a live server, and hoping nothing broke.

If a developer forgot to update a database schema or uploaded an incompatible dependency, the entire website crashed immediately—leading to stressful emergency rollbacks.

CI/CD (Continuous Integration and Continuous Deployment) replaces manual deployments with an automated, reproducible factory line.


The Problem with Manual Deployments

When humans deploy code manually, three critical failure points emerge:

[ Developer Machine ] ──── (Manual SCP / FTP) ────> [ Live Production Server ]
        │                                                     │
   "Works fine here"                                   ❌ Missing .env config
   Node.js v20                                         ❌ Running Node.js v18
   Local SQLite DB                                     ❌ Production PostgreSQL
  1. Environment Drift: Code that runs on a developer’s laptop fails in production due to different OS packages, Node/Python versions, or missing environment variables.
  2. Untested Commits: Unchecked syntax errors or broken database queries reach live users before anyone notices.
  3. Downtime During Updates: Overwriting files in-place causes active user sessions to crash mid-request.

Part 1: Continuous Integration (CI)

Continuous Integration is the automated quality gatekeeper. The moment a developer pushes a branch or opens a Pull Request, an isolated runner executes a battery of checks.

git push origin feature-branch
              │
              ▼
    [ Ephemeral CI Runner ]  (Docker Container)
              │
              ├─ 1. Lint & Code Style Check (ESLint, Prettier)
              ├─ 2. Security & Vulnerability Scan (npm audit, Snyk)
              ├─ 3. Unit & Integration Tests (Mock DB / Redis)
              │
              ▼
   ✅ All Tests Pass? ──> Ready for Merge & Build
   ❌ Any Test Fails?  ──> Build Halts (Blocks PR)

The CI Rules:

  • Ephemeral Environment: Tests run inside a fresh, pristine container—not on someone’s dirty local machine.
  • Fail-Fast: If a single unit test or lint check fails, the pipeline halts immediately and alerts the developer. Bad code never reaches main.

Part 2: Continuous Deployment (CD)

Once code is merged into main, Continuous Deployment takes the verified code and ships it to production without human intervention.

[ Merged to Main ] ──> [ Docker Build & Tag ] ──> [ Container Registry ]
                                                          │
                                                          ▼
                                              [ Kubernetes / Cloud Cluster ]
                                                          │
                                              ┌───────────┴───────────┐
                                              ▼                       ▼
                                       (Old Pods v1)           (New Pods v2)
                                     [Live Traffic 100%]     [Health Check 200 OK]
                                              │                       │
                                              ▼                       ▼
                                         (Drained)           [Live Traffic 100%]

1. Immutable Artifact Packaging

Instead of updating files on an existing server, the pipeline builds an immutable Docker container image tagged with the exact git commit SHA (e.g. myapp:sha-b6b3b9b).

2. Zero-Downtime Rolling Update

The cloud orchestrator spins up the new version (v2) alongside the existing version (v1).

3. Readiness Health Checks

Before directing real user traffic to v2, the load balancer polls the /healthz endpoint:

  • If the app boots up and connects to the database successfully (HTTP 200 OK), traffic shifts to v2.
  • If v2 crashes or times out, traffic remains on v1, and the bad deployment is automatically terminated with zero user disruption.

Summary Checklist

  • CI (Continuous Integration): Automated linting, security audits, and unit tests running on every git push.
  • CD (Continuous Deployment): Automated packaging into Docker containers and zero-downtime rolling releases.
  • The Core Benefit: Eliminates manual human mistakes, catches bugs before users see them, and turns software releases into a routine, non-event.
SYSTEM DESIGN CHECK

Test Your Understanding

Quick architectural scenario challenge based on this breakdown.

SCENARIO

A 3rd-party payment gateway starts timing out with 504 errors during peak traffic.

Q1.How should a downstream dependency failure be handled to protect upstream service availability?

Comments –