- Current active lab:
mainbranch (right now: Lab 05) - Finished labs:
lab/01-networking,lab/02-readiness,lab/03-persistence,lab/04-backup-restore - Flow: finish lab on
main→ push tolab/NN-*branch → scaffold next lab onmain
Your mission: validate multi-backup restore behavior and fix one script-level bug.
- Create two backups at different times
- Change data between snapshots
- Restore expected recovery point
- Verify restored data matches intended snapshot
- Run scripts as-is first and capture actual behavior.
- Don’t edit app or DB config first; inspect scripts.
- Apply a minimal root-cause fix.
- Verify with SQL output as proof.
cd learning-lab-01
sudo docker compose down -v
sudo docker compose up --build -d# reset + seed
sudo docker compose exec db psql -U postgres -d labdb -c "DROP TABLE IF EXISTS notes; CREATE TABLE notes(id serial primary key, txt text); INSERT INTO notes(txt) VALUES ('v1');"
# backup #1
./scripts/backup.sh
# update data and take backup #2
sudo docker compose exec db psql -U postgres -d labdb -c "TRUNCATE notes; INSERT INTO notes(txt) VALUES ('v2');"
./scripts/backup.sh
# simulate loss
sudo docker compose exec db psql -U postgres -d labdb -c "DROP TABLE notes;"
# restore (currently buggy)
./scripts/restore.sh
# verify
sudo docker compose exec db psql -U postgres -d labdb -c "SELECT * FROM notes;"cp LAB_REPORT_TEMPLATE.md reports/lab-05-report.mdFill report + update LAB_TRACKER.md.
| Lab | Topic | Bug Type | Key Learning |
|---|---|---|---|
| 01 | Compose networking | Wrong DB host in DATABASE_URL |
In Compose, use service name as hostname (db), not DB username (postgres). |
| 02 | Startup readiness | App can start before DB is ready | depends_on order is not enough; use healthchecks + service_healthy. |
| 03 | Persistence/volumes | Wrong DB volume mount target | Persistent DB data only survives when volume is mounted to the actual Postgres data dir. |
| 04 | Backup/restore | Restore script targeted wrong DB | A backup is useless unless restore is tested against the correct target database. |
| 05 | Recovery points | Wrong backup chosen during restore | Recovery depends on selecting the intended backup snapshot. |