Backup
Back Up the Database
Back up the database before running any migration.
pg_dump -h {DB_HOST} -p {DB_PORT} -U {DB_USER} -Fc {DB_NAME} > zstack-api-router-$(date +%F-%H%M).backup
After backup, verify that the backup file is generated and readable.
pg_restore -l zstack-api-router-{TIME}.backup >/tmp/zstack-api-router-restore-list.txt
Back Up Deployment Directory
Back up at least the following files or directories:
- Application configuration file.
- Environment variable file.
- Docker Compose file, systemd unit, or Kubernetes manifest.
- TLS certificate and private key.
- Nginx, Ingress, or load balancer configuration.
- Script files used for offline deployment or local start.
Recommended backup directory:
sudo install -d -m 0750 /var/backups/zstack-api-router
sudo cp -a /etc/zstack-api-router /var/backups/zstack-api-router/etc-$(date +%F-%H%M)
sudo cp -a /opt/zstack-api-router /var/backups/zstack-api-router/app-$(date +%F-%H%M)
Back Up Entry Configuration
Back up Nginx, Ingress, load balancer, domain name, and TLS configuration. The entry configuration is usually the fastest rollback path during grayscale or production upgrade.
Verify Backup
Verify database backup metadata, file size, and read permission. Record the backup path in the upgrade record before any migration is executed.
