garofalodeveloperThiago Garofalo

Infrastructure and disaster recovery: from ransomware to three clouds in five days

Period: September 2026 to date · Role: architecture, operations, restore tests, migrations and disaster drills · Status: in production on an ARM VM on Oracle Cloud in São Paulo since 2026-11-12, with a standby server drilled on 2026-12-05 · Updated: 2026-12-05

One-sentence summary: after ransomware encrypted the group’s physical servers, I rebuilt operations in containers in the cloud, with hourly backups, a copy that not even I can delete, restores proven for real and the ability to switch providers in a single morning, which was done twice in five days.

1. Context and problem

On 2026-09-23, ransomware hit the network of the industrial group I run. The virtualization host was compromised and the virtual machines, including the commercial ERP’s database server, were encrypted. The ERP never came back.

The rebuild started with what brought in revenue: a quoting system with ICMS tax substitution, in production on 2026-09-30, on a VPS with Docker. Then came management accounting, the websites and Asset Tecnologia’s systems. The infrastructure question became a single one: if it happens again tomorrow, what is lost and how long does it take to come back?

The answer required three things: a copy that an attacker with full access cannot delete, a proven (not assumed) restore and independence from any single provider.

2. Results

Indicator Today
Maximum data loss on critical databases 1 hour
Immutable copy Object Lock in Compliance mode, 60 days
Restore tested every month, on its own, in a disposable container, with row counts compared to production
A backup that fails sends an email within minutes, through a service outside the servers
Copies outside the main provider three destinations, two of them encrypted, plus a standby server
Cutover time to another provider about 16 minutes, measured on 2026-11-12
System up on the standby from the latest dump (drill) about 4.5 minutes of machine time, measured on 2026-12-05
Cost of the main server within Oracle Cloud’s free tier

3. Backup architecture

flowchart LR
  APP[Containers<br/>apps and databases] --> H[pg_dump<br/>hourly<br/>critical databases]
  APP --> D[Daily pg_dump<br/>all databases<br/>and configuration]
  H --> B2[(Backblaze B2<br/>Object Lock<br/>Compliance 60 days)]
  D --> B2
  H --> GPG[GPG encryption<br/>private key<br/>outside the cloud]
  D --> GPG
  GPG --> GD[(Google Drive)]
  GPG --> OD[(OneDrive)]
  B2 -. read-only key,<br/>restricted to a prefix .-> RES[Standby server]
  APP -. databases pulled<br/>every hour .-> RES

4. Tests that prove instead of assume

Test Date Result
Permanently delete an object in B2 2026-10-07 Denied by the provider. Overwriting created a new version and kept the original
Restore the ERP database from B2 2026-10-07 and 2026-11-02 Dump downloaded and restored in a disposable container, with table row counts matching production
Restore a new system’s database before opening it to users 2026-11-05 New database with the same tables, migrations and reference data
Standby key writing outside its scope 2026-11-06 Access denied
Automatic monthly restore on the 1st of every month, since 2026-11-20 Downloads the latest daily dump of each database from B2, restores it in a disposable container and checks: every table in the dump’s index, none empty and no drop above 20% against the previous month. On the PC side, 40 random files per source downloaded and compared byte by byte with the encrypted copy
Main server outage drill 2026-12-05 A whole system came up on the standby server from scratch, with data matching production (details in section 5)

Every backup and test job pings an external monitor (Healthchecks.io) when it starts and when it ends. If it fails, or simply does not run, an email goes out. Living outside the servers is the point: the alert goes out even if the main server goes down entirely. The same monitor watches the disk on all three servers, certificate expiry on every domain and, since 2026-12-05, application errors and slowness.

5. Disaster drill: how long it really takes

Until December, the answer to “what if the main server disappeared right now” was an estimate. On 2026-12-05 it became a measurement. I picked the most sensitive system, the accounting SaaS, which stores clients’ encrypted A1 digital certificates, and brought up a full copy on the standby server without touching production or DNS.

flowchart LR
  C[Code<br/>production version] --> I[Image built<br/>on the standby]
  DU[(Last hour's dump<br/>already on the standby)] --> R[New database<br/>restored]
  I --> A[App up<br/>isolated network<br/>external jobs off]
  R --> A
  A --> V{Check<br/>row counts and<br/>encrypted data}
Step Elapsed time
Code received and extracted 14 s
Image built (ARM, no cache) 250 s
Database restored from the dump 261 s
Application responding, with login about 265 s

What the drill found that the documentation did not: the standby server’s configuration file was readable only by the administrator, and the application runs unprivileged (one of the security audit’s fixes). The app came up, but without configuration, answering “no database”. In a real outage, that would have cost diagnosis time at the worst possible moment. The fix became part of the runbook, which now also gives up after 2 minutes with the log on screen instead of waiting forever.

6. Three clouds in five days

The container design, with each system in its own compose file and the data in dumps, was put to the test twice in the same week.

Date From To Reason How
2026-11-07 VPS at Hetzner (Europe) AWS in São Paulo Latency: first response dropped from about 0.75 s to 0.05 s, a difference users noticed System by system, with matching table counts before the DNS switch; about 30 containers; certificates issued in about 1 minute
2026-11-12 AWS in São Paulo ARM VM on Oracle Cloud in São Paulo Zero cost on the ARM free tier, with more memory, keeping data in Brazil ARM images built on the new server and tested while stopped; at cutover, 9 databases copied with identical row counts, 36 containers, DNS switched and certificates reissued in about 16 minutes

After the second migration, AWS stayed as a stopped standby with the cutover databases, and a server at Hetzner pulls the production databases every hour. If Oracle goes down, there is somewhere to go back to without relying on the cloud backup.

7. Engineering decisions

8. Lessons

9. Next steps

The three steps listed here in November are done: failure alerts for every backup job (2026-11-20), automatic monthly restores (2026-11-20) and the first main server outage drill (2026-12-05). Next:

  1. Repeat the drill on the other systems with client data (clinics, ERP and the legal product), one runbook per system.
  2. Drill the last mile: proxy, certificate and DNS switch to the standby, with a test subdomain.
  3. Redo it every six months and whenever the backup setup changes.

10. Stack

Docker Compose · PostgreSQL 16 · Caddy with automatic certificates · Cloudflare (DNS and proxy) · nginx for static sites · Ubuntu 24.04 on ARM (Oracle Cloud, São Paulo) · ARM standby server at Hetzner · rclone · Backblaze B2 with Object Lock · GPG · Healthchecks.io · cron with a lock against concurrent runs.