Explita InfraExplita Infra
Deploy

Databases & S3 Backups

Managed PostgreSQL, Redis, automated snapshot scheduling, and off-site S3 replication

Managed Databases, Backups & S3 Storage

Explita Deploy includes a native database manager that allows you to provision dedicated PostgreSQL databases and Redis instances directly on your host server without paying monthly database hosting markups.


1. Managed PostgreSQL

Provisioning a Database

Create a dedicated database and user role for your application:

eda db create

This command:

  1. Connects to the host's internal PostgreSQL container.
  2. Creates an isolated database (e.g. app_prod_db).
  3. Generates a secure random password and user role with full grants.
  4. Stores the generated DATABASE_URL encrypted in the application's environment configuration.
  5. Injects DATABASE_URL into your container automatically at runtime.

Custom Database Names & Keys

If your application uses multiple databases (e.g. primary and analytics):

eda db create -k analytics -n my_analytics_db

This automatically registers and injects DATABASE_ANALYTICS_URL.

Viewing Connection Strings

To inspect your connection string for external GUI clients (TablePlus, DBeaver, psql):

eda db url
# or for a secondary key:
eda db url -k analytics

Exporting & Restoring SQL Dumps

# Export full SQL dump to a file
eda db dump -f backup.sql

# Stream SQL dump to stdout or pipe into gzip
eda db dump | gzip > backup.sql.gz

# Restore database from a SQL file
eda db restore -f backup.sql

# Seed database from a local script
eda db seed seeds/initial_data.sql

2. Managed Redis Instances

For caching, session stores, or background queue systems (like BullMQ):

# Provision an isolated Redis database index
eda redis create

# Retrieve connection URL (e.g. redis://:pass@host:6379/1)
eda redis url

# Drop Redis database index
eda redis rm -a my-app

3. Automated Database Backups (eda db backup)

Explita Deploy provides automated snapshot scheduling with automatic pruning and retention policies.

Configuring Automated Schedules

Schedule automated snapshot backups to run daily or hourly:

# Schedule daily backups, keeping the last 7 snapshots
eda db backup schedule --daily --keep 7

# Schedule hourly backups, keeping the last 24 snapshots
eda db backup schedule --hourly --keep 24

# Custom cron expression (e.g. every Sunday at 3:00 AM)
eda db backup schedule --cron "0 3 * * 0" --keep 4

Listing & Managing Snapshots

# List all snapshots stored on the server
eda db backup ls

# Trigger an immediate manual snapshot
eda db backup create

# Restore a specific snapshot
eda db backup restore <backupId>

# Delete a snapshot
eda db backup rm <backupId>

4. Off-Site S3 / Cloudflare R2 Replication

Never rely solely on local disk storage. Explita Deploy can automatically replicate every backup snapshot to AWS S3, Cloudflare R2, MinIO, Wasabi, or Backblaze B2.

Server-Wide S3 Configuration (Environment Variables)

To establish an automatic off-site backup destination for the entire server—without having to configure each application individually—set GLOBAL_S3_* environment variables in your server's .env file (e.g. /opt/explita/deploy/.env):

# Enable server-wide S3 fallback for all backups and dumps
GLOBAL_S3_ENABLED=true
GLOBAL_S3_BUCKET=my-backup-bucket

# Custom endpoint (required for Cloudflare R2, MinIO, Wasabi, etc.; omit for AWS S3)
GLOBAL_S3_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com

GLOBAL_S3_ACCESS_KEY_ID=your-s3-access-key-id
GLOBAL_S3_SECRET_ACCESS_KEY=your-s3-secret-access-key
GLOBAL_S3_REGION=auto
GLOBAL_S3_PREFIX=backups
GLOBAL_S3_FORCE_PATH_STYLE=false

[!TIP] When GLOBAL_S3_* is defined, any application running eda db backup --s3 or eda dump --s3 automatically replicates to this bucket. Cluster-wide dumps (eda dump --all --s3) also leverage this global destination.

Per-Application S3 Overrides (eda s3 set)

Individual applications can override the server default anytime to store snapshots in a dedicated bucket, AWS account, or isolated prefix:

# Example: Cloudflare R2 for a specific application
eda s3 set -a my-app \
  --bucket my-backups \
  --access-key <r2-access-key-id> \
  --secret-key <r2-secret-access-key> \
  --endpoint https://<account-id>.r2.cloudflarestorage.com \
  --region auto \
  --prefix explita-backups

# Example: AWS S3
eda s3 set -a my-app \
  --bucket my-production-backups \
  --access-key <aws-access-key-id> \
  --secret-key <aws-secret-access-key> \
  --region us-east-1

To remove an app-level override and revert back to the server default:

eda s3 rm -a my-app

Verifying Permissions (eda s3 test)

Run eda s3 test to execute a complete round-trip write, read, and delete verification test against your bucket:

# Test server-wide global S3 target
eda s3 test

# Test application-specific S3 target
eda s3 test -a my-app

Enabling S3 on Backup Schedules

Once S3 is configured, append --s3 to your backup schedule so every snapshot is mirrored off-site automatically:

eda db backup schedule --daily --keep 14 --s3

5. Full System & Application Dumps (eda dump)

While database backups capture PostgreSQL data, eda dump creates complete application snapshots containing database data, source files, and environment variables:

# Dump application database and source to a local tarball
eda dump -a my-app -d -f -o full-backup.tar.gz

# Include unredacted environment secrets
eda dump -a my-app -s -o complete-archive.tar.gz

# Upload dump directly to S3 without saving locally
eda dump -a my-app --s3

# Dump all applications across the entire server to S3
eda dump --all --s3

On this page