swarm / companies/starter/work/project/scripts/rollback_v2.3.sh

raw file 577 bytes
#!/bin/bash
set -e

# Verify environment
if [ -z "$FERRITE_ENV" ]; then
  echo "ERROR: FERRITE_ENV is not set."
  exit 1
fi

echo "Starting rollback for v2.3..."

# 1. Stop services
echo "Stopping sync engine and console..."
systemctl stop ferrite-sync
systemctl stop ferrite-console

# 2. Restore database
echo "Restoring Postgres snapshot..."
pg_restore --dbname=ferrite_prod --clean --if-exists /backups/ferrite_prod_v2.2.1.dump

# 3. Revert binaries
echo "Reverting to v2.2.1 binaries..."
cp /artifacts/sync_v2.2.1 /usr/local/bin/ferrite-sync
cp /artifacts/console_v2.2.1 /