Skip to content

Backups and Data Management

Glassy provides automatic and on-demand backup options so your second brain is always safe.

Automatic daily backups

Glassy creates a plain SQLite backup of your database every day at 02:00 (server time). Backups are stored in /app/data/backups inside the glassy-data Docker volume, and approximately 7 days of backups are retained automatically. No configuration is required.

On-demand backups (CLI)

For encrypted off-machine copies, use the backup CLI. The runtime image has no npm, so call node directly:

# Create a backup
docker compose exec glassy node server/utils/backup.js

# List available backups
docker compose exec glassy ls -1 /app/data/backups

# Restore from a backup
docker compose exec glassy node server/utils/backup.js --restore <backup-file>

Encryption

Set BACKUP_ENCRYPTION_KEY in .env to encrypt on-demand CLI backups (AES-256-GCM). Backups are saved as .db.enc files; the plain .db is removed after encryption.

# Generate a key (run once, save the output in a safe place OFF the machine):
openssl rand -hex 32

When BACKUP_ENCRYPTION_KEY is set, the automatic daily backup scheduler also encrypts its output using the same key and format.

Important: Store BACKUP_ENCRYPTION_KEY somewhere safe outside the machine. Without it, encrypted backups cannot be restored.

Full volume snapshot

To capture everything — the database, uploads, logs, and generated backups — in a single archive:

docker run --rm -v glassy-data:/data -v $(pwd):/backup alpine \
  tar czf /backup/glassy-backup.tar.gz -C /data .

Restore

The restore command auto-detects .db.enc (encrypted) and .db (plain) files, takes a pre-restore safety copy, and waits 5 seconds before overwriting the live database (press Ctrl+C to abort):

docker compose exec glassy node server/utils/backup.js --restore <backup-file>

For a volume restore from a snapshot:

docker compose down
docker volume rm glassy-selfhost_glassy-data
docker volume create glassy-selfhost_glassy-data
docker run --rm \
  -v glassy-selfhost_glassy-data:/data \
  -v $(pwd):/backup \
  alpine tar xzf /backup/glassy-backup.tar.gz -C /data
docker compose up -d

Database migrations run automatically on start after a restore.

Storage caps

Storage limits are configurable per tier via environment variables:

Variable Default
FREE_STORAGE_MB 10
PRO_STORAGE_MB 200
CLEAR_STORAGE_MB 200
ENTERPRISE_STORAGE_MB 51200

Learn more