#!/usr/bin/env bash # Restore the committed demo-state dumps (backups/*.dump) into the running # stack (Linux/macOS/Git Bash). REPLACES all data in the `procurement` and # `casdoor` databases. # # bash backups/restore.sh set -euo pipefail cd "$(dirname "$0")/.." echo "Stopping api + casdoor (they hold DB connections)..." docker compose stop api casdoor echo "Restoring procurement DB..." docker cp backups/procurement.dump procurement-postgres:/tmp/procurement.dump docker exec procurement-postgres pg_restore -U postgres -d procurement --clean --if-exists --single-transaction /tmp/procurement.dump echo "Restoring casdoor DB..." docker cp backups/casdoor.dump procurement-postgres:/tmp/casdoor.dump docker exec procurement-postgres pg_restore -U postgres -d casdoor --clean --if-exists --single-transaction /tmp/casdoor.dump echo "Starting services..." docker compose start casdoor api echo "" echo "Restore complete." echo "App : http://localhost" echo "Casdoor : http://localhost:8080 (admin / 123)"