Backup & Restore

A complete Streamix backup has three parts:

Part Where it lives Why it matters
Database PostgreSQL (Neon) Members, profiles, viewing history, subscriptions and payments, catalogue metadata, merchandising, settings, license, and encrypted integration credentials (including storage and payment keys)
Bucket S3-compatible storage (R2 / S3 / Spaces / GCS) Artwork, uploaded videos, HLS renditions, subtitles, branding, blog and CMS images. The database references them by public URL.
.env Your host DATABASE_URL, JWT_SECRET, SECRET_KEY, CRON_SECRET

SECRET_KEY is part of your backup. Integration credentials in the database are encrypted with a key derived from it. Restore with a different SECRET_KEY and every stored credential (including the storage connection) must be re-entered.

Video is usually by far the largest part. Plan bucket backups separately from database backups.

In-app export

Configuration → Backup & Restore (/admin/settings/backup, needs the settings permission) produces a ZIP on demand:

Part Contents
database-<timestamp>.sql A data-only dump: INSERT statements for every table in the public schema, wrapped in SET session_replication_role = replica so foreign keys don't block the load order. It does not contain the schema; the app recreates tables with its ensure*Schema() functions.
files/<key> Objects from the bucket folders you tick. The folder list comes from the bucket's top-level prefixes (for Streamix mainly ott/, plus branding/, blogs/ and similar).

Use it for small, ad-hoc snapshots. It builds the ZIP in memory, so don't tick video folders; back those up with a bucket sync. There is no in-app restore button.

Database backups

Use the direct (unpooled) Neon endpoint for dumps and restores; the pooler can stall long transactions.

Terminal
pg_dump "$DIRECT_DATABASE_URL" --format=custom --no-owner \
  --file=streamix-$(date +%Y%m%d-%H%M%S).dump

Neon

  • Branching: a copy-on-write snapshot, ideal before an upgrade.

    Terminal
    neonctl branches create --name backup-pre-upgrade --parent main
    
  • Point-in-time restore: roll the database back to a timestamp from the Neon console.

These cover the database only.

Bucket backups

Mirror the bucket to another location with any S3 tool:

Terminal
# Cloudflare R2 example
aws s3 sync s3://streamix ./bucket-backup \
  --endpoint-url https://<accountid>.r2.cloudflarestorage.com

# or rclone to another provider
rclone sync r2:streamix backup:streamix-backup

Tips:

  • HLS renditions (ott/hls/) can be regenerated from the source MP4s with the transcode worker, so you may choose to back up only sources (ott/video/), artwork and subtitles and re-run conversions after a disaster. That saves space but costs CPU time.
  • Keep the same object keys when restoring; the database stores full public URLs.

Restore

Bring back all three parts, then start the app.

1. Database

From a custom-format dump (schema and data):

Terminal
pg_restore --dbname="$DIRECT_DATABASE_URL" --clean --if-exists --no-owner streamix-20260924-020000.dump

From the in-app data-only dump (the schema must exist first):

Terminal
npm run db:init              # core tables
# start the app once (or run the install wizard's database step) so the streaming tables exist
psql "$DIRECT_DATABASE_URL" < database-2026-09-24T02-00-00.sql

Moving a local database to Neon in one go:

Terminal
pg_dump "$LOCAL_URL" --no-owner --no-privileges --no-comments -f dump.sql
psql "$DIRECT_NEON_URL" -v ON_ERROR_STOP=1 --single-transaction -f dump.sql

--single-transaction rolls back cleanly if interrupted. Compare table row counts afterwards.

2. Bucket

Terminal
aws s3 sync ./bucket-backup s3://streamix --endpoint-url https://<accountid>.r2.cloudflarestorage.com

If the bucket's public URL changed (new bucket or domain), update the storage connection in admin; stored media URLs still point at the old host and need a find-and-replace in the database.

3. Environment

Use the same SECRET_KEY (and ideally JWT_SECRET, or members must sign in again). Check DATABASE_URL and CRON_SECRET, then restart the app and the transcode worker.

After restoring

  • Sign in to the admin and check Configuration → Add-ons (storage and payments connected).
  • Play a title as a demo member.
  • Run the cron once (curl -H "Authorization: Bearer $CRON_SECRET" …/api/v1/cron) to refresh Top 10 and recommendations.

Good practice

  • Automate daily database dumps and weekly bucket syncs; keep copies in another region or provider.
  • Test a restore into a throwaway database or Neon branch regularly.
  • Treat dumps as secrets: they contain password hashes, member data and encrypted credentials.
  • Take a fresh backup before every upgrade.

© CreativeCape Solutions · creative-cape.com · support@creative-cape.com