Skip to content

PaaS environment snapshot strategy — frequency, retention, restore drill cadence

What a PaaS environment snapshot actually captures, how to set frequency and retention so it matches your RPO, and the quarterly restore drill that proves the snapshots are usable.

You inherit a PaaS environment from the team that built the product two years ago. The provider’s panel shows “Backups enabled” with a green check. You open the snapshot list and find six snapshots from the same week in January, none more recent. The snapshot policy is on. The retention is set to keep five. The schedule was once-a-week with a five-keep retention, so the rolling window covered five weeks. Then someone manually triggered six snapshots over four days in January for a release window and the auto-prune chewed through every snapshot older than those manual ones. You’ve effectively had no usable point-in-time recovery for the entire year.

What’s happening

A PaaS snapshot at the environment level is a container-image-level capture of the compute nodes plus a filesystem-level capture of any attached persistent storage. It is not the same as a database-aware backup; the database file is captured in whatever state the storage engine left it in (best-effort hot snapshot, possibly inconsistent), which is why most operators run an additional layer (mysqldump, pg_basebackup, JetBackup, etc.) for the data tier.

What goes into a snapshot envelope, in a typical Jelastic-style PaaS:

  • Image hash of each node and its layer customizations.
  • Contents of the writable layer (anything written into the container that’s not on a separate volume).
  • Volume snapshots for mounted persistent storage at snapshot-start time.
  • Environment metadata: env vars, links, scaling triggers, add-on config.

What is not in the snapshot:

  • Persistent data on external services (cloud object storage, an external managed RDS, etc.). The env knows the credentials; the data sits on someone else’s system.
  • The Let’s Encrypt cert (it’s re-issued on restore against the bound hostname).
  • Anything written to the source environment between snapshot-start and snapshot-completion.

The retention question is more subtle than it looks because retention interacts with frequency. “Keep 5” with daily snapshots gives you a 5-day window. “Keep 5” with hourly snapshots gives you a 5-hour window. “Keep 5” with on-demand snapshots gives you whatever fragment of history the on-demand calls produced. Operators routinely set a frequency without checking what the retention actually buys them in calendar terms.

How to verify

Inventory current snapshot policy and the actual snapshots that exist:

# Current policy
jelastic-cli environment Backup GetBackupSchedule \
  --envName acme-prod

# Inventory of stored snapshots
jelastic-cli environment Backup GetBackupList \
  --envName acme-prod

The output gives you snapshot IDs, creation timestamps, and sizes. Two checks against that list:

# Time span actually covered
jelastic-cli environment Backup GetBackupList --envName acme-prod \
  | jq -r '.backups[]|.created' \
  | sort \
  | awk 'NR==1{first=$0} END{print "Oldest:", first, "Newest:", $0}'

# Detect retention pruning artifacts (huge gaps suggest manual-trigger clobbering)
jelastic-cli environment Backup GetBackupList --envName acme-prod \
  | jq -r '.backups[]|.created' \
  | sort \
  | awk 'BEGIN{prev=0} {if(prev>0){print $0, "gap:", systime()-prev"s"} prev=$0}'

A “gap” larger than the configured schedule interval is the symptom — the auto-prune cleared automatic snapshots because manual ones used the retention slots.

For the consistency question, validate that the database snapshots are usable, not just present:

# Restore the most recent snapshot to a throwaway env
jelastic-cli environment Control RestoreEnvBackup \
  --envName acme-prod-restore-test \
  --backupId <id> \
  --srcEnvName acme-prod

# Inside the restored env, run integrity checks on the DB
jelastic-cli environment Control ExecCmdByGroup \
  --envName acme-prod-restore-test --nodeGroup sqldb \
  --commandList '[{"command":"mysqlcheck --all-databases --check"}]'

A snapshot that restores but produces a CHECK error on tables is a snapshot the data team needs to know about before they need it. Pair it with a logical layer (mysqldump, pg_dump) that produces guaranteed-consistent output for the critical schemas.

The fix

A defensible policy has four parts: frequency tied to RPO, retention measured in calendar days not slot counts, separate slots for automatic vs manual, and a recorded restore drill.

#!/usr/bin/env bash
set -euo pipefail

ENV_NAME="acme-prod"

# RPO = 6 hours. Snapshot every 4 hours; retention 21 days.
# 6 snapshots/day * 21 days = 126 slots; size your retention accordingly.
jelastic-cli environment Backup SetBackupSchedule \
  --envName "${ENV_NAME}" \
  --type 'cron' \
  --time '0 */4 * * *' \
  --backupCount 126 \
  --gmtOffset 0

# Manual snapshots before any risky operation, with descriptive labels
jelastic-cli environment Control CreateEnvBackup \
  --envName "${ENV_NAME}" \
  --comment "pre-php-8.3-upgrade-$(date -u +%Y%m%dT%H%M%S)"

# Manual snapshots count against the retention slot count if they share the policy.
# If your provider exposes separate quotas for manual vs scheduled, configure them
# independently. Otherwise, set the retention high enough to absorb manual events.

For the logical-layer backup that complements the env snapshot:

# Daily logical DB dump to external object storage
cat > /opt/scripts/db-dump.sh <<'SCRIPT'
#!/usr/bin/env bash
set -euo pipefail
TS=$(date -u +%Y%m%dT%H%M%S)
mysqldump --single-transaction --quick --routines --triggers --all-databases \
  | gzip -9 \
  | aws --endpoint-url=https://s3.${REGION}.${HOSTER_DOMAIN} \
       s3 cp - "s3://${BACKUP_BUCKET}/db/acme-prod-${TS}.sql.gz"
SCRIPT
chmod +x /opt/scripts/db-dump.sh

# Cron via the PaaS cron add-on, not crontab on the node
jelastic-cli marketplace Installation Install \
  --envName "${ENV_NAME}" --jps cron-addon \
  --settings '{"schedule":"15 3 * * *","command":"/opt/scripts/db-dump.sh"}'

For the restore drill — the part everyone skips:

# Quarterly: pick the snapshot 24h old, restore to throwaway env, run smoke
LATEST_24H=$(jelastic-cli environment Backup GetBackupList --envName "${ENV_NAME}" \
  | jq -r '.backups[]|select(.created<(now-86400))|.backupId' | head -1)

DRILL_ENV="acme-prod-drill-$(date -u +%Y%m%d)"

jelastic-cli environment Control RestoreEnvBackup \
  --envName "${DRILL_ENV}" \
  --backupId "${LATEST_24H}" \
  --srcEnvName "${ENV_NAME}"

# Run smoke against the restored env
./smoke.sh "https://${DRILL_ENV}.${HOSTER_DOMAIN}/"

# Record the outcome — date, snapshot ID, smoke pass/fail, restore duration
cat >> /var/log/restore-drills.log <<EOF
$(date -u +%Y-%m-%dT%H:%M:%SZ) drill snapshot=${LATEST_24H} env=${DRILL_ENV} result=$?
EOF

# Tear down the drill env after recording
jelastic-cli environment Control DeleteEnv --envName "${DRILL_ENV}"

The drill cadence should match the cost-of-being-wrong. Quarterly for typical B2B SaaS; monthly for anything where the data tier is the product (e-commerce, payments, anything regulated). The drill log is what auditors and your own future post-mortems will reach for.

Stack Harbor runs PaaS snapshot policies plus the quarterly restore drill as part of environment management on managed Cloud PaaS, with the drill log delivered as a recurring evidence artifact. To audit an environment whose retention policy hasn’t been reviewed this year, request a snapshot review.