Example with made-up data

$ git log --oneline container-migration

From servers to containers: what changes

Rossi Meccanica’s business app moves from a hand-configured server to containers described in a file: every change is tested, approved and released in minutes, and rolling back is one command.

Architecture before and after

BEFORE
SRV-01, all in one· app installed by hand· database· nightly scripts· uploaded files· libraries “from back then”updating = fingers crossedno test environment
AFTER
GitCI/CDRegistryDocker server (test and production)proxyappdbbackuptest identical to productionroll back in 1 minute

A real CI/CD pipeline (example)

pipeline #214 · “fix: VAT on credit notes” · branch main

  1. code checkout3 s
  2. automated tests (182 tests)1 min 12 s
  3. image build48 s
  4. vulnerability scan: 0 critical22 s
  5. deploy to test environment15 s
  6. approval: Marco R. (manager)–
  7. deploy to production, no downtime18 s
  8. health check: answers 200 OK5 s

Total: 3 min 3 s of automation + 1 approval click.

A commented docker-compose excerpt

# docker-compose.yml – Rossi Meccanica business app (excerpt)
services:
  proxy:
    # automatic HTTPS, certificates renew themselves
    image: caddy:2.8
    # the only port open to the outside
    ports: ["443:443"]
  app:
    # exact version: rolling back = changing this number
    image: registry.rossi-meccanica.example/gestionale:1.14.2
    # passwords kept out of the code, never in the repository
    env_file: .env
    depends_on:
      db: { condition: service_healthy }
    # if it hangs, it restarts by itself
    restart: unless-stopped
  db:
    image: postgres:16
    # data survives even when the container is recreated
    volumes: ["db-data:/var/lib/postgresql/data"]
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "gestionale"]
  backup:
    image: registry.rossi-meccanica.example/pg-backup:1.3
    # database dump every night at 1:00, then off site
    environment: { SCHEDULE: "0 1 * * *" }

Esempio con dati fittizi

$ git log --oneline migrazione-container

Da server a container: come cambia

Il gestionale di Rossi Meccanica passa da un server configurato a mano a container descritti in un file: ogni modifica viene provata, approvata e pubblicata in pochi minuti, e si torna indietro con un comando.

Architettura prima e dopo

PRIMA
SRV-01, tutto insieme· app installata a mano· database· script notturni· file caricati· librerie “di quella volta”aggiornare = incrociare le ditanessun ambiente di prova
DOPO
GitCI/CDRegistryServer Docker (test e produzione)proxyappdbbackuptest identico alla produzionerollback in 1 minuto

Una pipeline CI/CD vera (esempio)

pipeline #214 · “fix: calcolo IVA sulle note di credito” · ramo main

  1. checkout del codice3 s
  2. test automatici (182 test)1 min 12 s
  3. build dell’immagine48 s
  4. scansione vulnerabilità: 0 critiche22 s
  5. deploy in ambiente di test15 s
  6. approvazione: Marco R. (responsabile)–
  7. deploy in produzione, senza fermo18 s
  8. controllo di salute: risponde 200 OK5 s

Totale: 3 min 3 s di automazione + 1 clic di approvazione.

Un estratto del docker-compose, commentato

# docker-compose.yml – gestionale Rossi Meccanica (estratto)
services:
  proxy:
    # HTTPS automatico, certificati rinnovati da solo
    image: caddy:2.8
    # l’unica porta aperta verso l’esterno
    ports: ["443:443"]
  app:
    # versione precisa: tornare indietro = cambiare questo numero
    image: registry.rossi-meccanica.example/gestionale:1.14.2
    # password fuori dal codice, mai nel repository
    env_file: .env
    depends_on:
      db: { condition: service_healthy }
    # se si blocca, riparte da solo
    restart: unless-stopped
  db:
    image: postgres:16
    # i dati restano anche se il container viene ricreato
    volumes: ["db-data:/var/lib/postgresql/data"]
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "gestionale"]
  backup:
    image: registry.rossi-meccanica.example/pg-backup:1.3
    # copia del database ogni notte all’1:00, poi fuori sede
    environment: { SCHEDULE: "0 1 * * *" }

← Back to services← Torna ai servizi

main Dark modeMilan, ItalyMilano, ItaliaavailableDisponibile
🔥
HADOUKEN!fireball.exe launched  |  damage: CRITICALfireball.exe lanciato  |  danno: CRITICOthis won't fix your bugs, though.questo non sistemerà i tuoi bug, comunque.
$ git log --oneline

a1b2c3d fix: finally fixed that one bug 🐛

e4f5g6h feat: added 3 new bugs while fixing 1

i7j8k9l chore: blamed git for everything

m1n2o3p fix: removed console.logs (most of them)

q4r5s6t deploy: works on prod. somehow.

u7v8w9x docs: updated README to say "it works"

y1z2a3b init: it works on my machine ¯\_(ツ)_/¯

💥
YOU BROKE IT.$ rebuild --from-scratch$ ricostruisci --da-zero
pssh, you have a flashlight.
shake it.
pssh, hai una torcia.
agitala.
is it dark enough now? 🔦abbastanza buio ora? 🔦press ESC to turn the lights onpremi ESC per riaccendere le luci
$ session_check --ping$ session_check --ping

hey... you still there? 👀

ehi... sei ancora lì? 👀

interact with the page to dismissinteragisci con la pagina per chiudere