The Poolside deployment bundle includesDocumentation Index
Fetch the complete documentation index at: https://docs.poolside.ai/llms.txt
Use this file to discover all available pages before exploring further.
db-snapshot.sh for database backup and restore operations. Use this script before upgrading your deployment or to recover from data loss or accidental deletion.
Prerequisites
Before runningdb-snapshot.sh, ensure you have:
kubectlconfigured with access to your Poolside namespaceskopeoandjqinstalled on your system (required for image discovery)- A running
core-apideployment in your namespace - Access to the
poolside-database-clientcontainer image in your registry. The Poolside deployment bundle includes this image, so your installation process should have already uploaded it to your registry.
Location
The script’s location depends on your deployment type.cd into the relevant directory before running the examples below:
- Cloud
- On-prem
How it works
The script creates an ephemeral “jump pod” using thepoolside-database-client image, which includes psql and pg_dump utilities. This pod:
- Reads database connection configuration from the running
core-apideployment - Mounts the PostgreSQL password from the existing secret (without exposing it)
- Executes the backup or restore operation
- Deletes itself after completion
Image discovery
The script determines which image to use in the following order. Use--image or --registry to override the default discovery behavior:
- If you provide
--image=<full-reference>, the script uses that exact image. - If you provide
--registry=<host>, the script finds the latestpoolside-database-clienttag in that registry. - Otherwise, the script reads the registry from
FORGE_API_IMAGE_REPOSITORYin thecore-apideployment, then finds the latest tag there.
If the registry is unreachable, the script falls back to tag
v0.0.3. In air-gapped environments where this tag does not exist, use --image=<registry>/poolside-database-client:<tag> to specify the image directly.Create a backup
The script saves snapshots to~/.poolside/snapshots/ by default, with file names of the form db-snapshot-<version>-<timestamp>.tar.
What gets backed up
The script usespg_dump with --format=tar to create a logical backup of the database. The backup includes:
- All table data and schema definitions
- The
schema_migrationstable (used to determine schema version compatibility during restore) - All application data, but no ownership or privilege information
Backup location
By default, backups are saved to~/.poolside/snapshots/. You should copy these files to a secure, persistent storage location after creation. Each backup includes the schema version in the filename, so you can identify the right snapshot quickly.
Restore from a backup
The restore process includes safety checks to prevent data loss. The script compares the live database’s schema version against the snapshot’s schema version and chooses one of three paths:- Use data-only restore when: Schema versions match. The schema stays in place and only table data is replaced.
- Use drop-and-restore when: Live database is newer than the snapshot. The script prompts to confirm, then scales
core-apito 0 replicas, drops database objects, runspg_restore, and scalescore-apiback. - Abort and upgrade first when: Live database is older than the snapshot. This prevents data loss.
Interactive workflow
When you run./db-snapshot.sh restore without specifying a file, the script:
- Lists all available
.tarfiles in the backup directory - Prompts you to select a snapshot by number
- Compares schema versions between the live database and the selected backup
- If versions differ, prompts for confirmation before proceeding
- If dropping is required, warns that
core-apiwill be temporarily unavailable - Prompts for final confirmation before starting the restore
Restore operations require downtime. The
core-api deployment is scaled to 0 replicas during a drop-and-restore operation.Log files
Log files are saved to~/.poolside/logs/ with filenames like db-snapshot-restore-<timestamp>.log. Check these logs when a backup or restore operation fails.
Additional commands
List snapshots
Thelist command displays all .tar files in your backup directory with their sizes and modification dates. This helps you identify which snapshot to restore when you have multiple backups.
Extract schema version
Useextract-version to check a snapshot’s schema version without starting a restore. This is useful when you need to verify backup compatibility before planning a restore operation.
Advanced usage
Debug with an interactive jump pod
For troubleshooting or manual database operations, you can create a jump pod withjump-create. This leaves a pod running until you delete it, so you can exec into it for interactive psql sessions.
Command reference
| Flag | Description |
|---|---|
--dir=<path> | Backup directory path. Default: ~/.poolside/snapshots/ |
--file=<filename> | Specific snapshot filename to use |
--drop | Force drop-and-restore regardless of schema version |
-n, --namespace=<namespace> | Kubernetes namespace. Default: poolside |
--registry=<host> | Container registry for the jump pod image |
--image=<image> | Full image reference for the jump pod (overrides --registry) |
--force-insecure | Disable TLS verification. Use only for HTTP-only registries in air-gapped environments |
Troubleshooting
Image pull failures
If the script fails with an image pull error, thepoolside-database-client image may be missing from your registry. To resolve:
Optional: Additional backup types
Depending on your organization’s backup and compliance requirements, you may also want to back up other Poolside components beyond the database. These backups are not required for standard upgrades but may be part of your disaster recovery or compliance procedures.S3-compatible storage
Poolside stores usage data, telemetry, and model checkpoints in S3-compatible storage. Use this backup when your organization requires archiving usage data or model checkpoints. You can back up this storage using your preferred backup or replication method, such as an S3-compatible client, storage replication, orrsync against a mounted storage path. Configure S3-compatible tools to use the SeaweedFS endpoint in your deployment.
Kubernetes objects
Use this backup when you need to preserve deployment configuration for disaster recovery. Kubernetes object backups are typically part of cluster-level backup procedures. You can back up these objects by exporting YAML manifests directly, or by using Velero or another Kubernetes backup solution. Export Deployments, ConfigMaps, Secrets, and Ingresses from the Poolside namespace to preserve your deployment configuration.Kubernetes object backups are not compatible across schema versions. Do not restore these objects after upgrading Poolside. Use this backup when you need configuration recovery before any version changes.
Related resources
- Upgrade on-premises: Database backup is a prerequisite step before upgrading a Poolside deployment.