Backup & Migration Guide β
This guide describes how to back up your TuneCamp instance and migrate it to a new server while preserving all data, settings, and user sessions.
1. Backup Contents β
A full TuneCamp backup is a gzipped TAR archive (.tar.gz) that contains:
tunecamp.db: The SQLite database (all tracks, artists, users, and settings)..jwt-secret: The server's secret key (required to keep existing user sessions valid).- Config: The config file, included for reference (restore logic relies primarily on the DB).
The restore endpoint also accepts plain
.ziparchives for backward compatibility.
2. Automated Backup β
Admins can trigger a backup via the UI or API:
- Route:
GET /api/admin/backup/full - Output: A downloadable
.tar.gzarchive (Content-Type: application/gzip). - Other routes:
GET /api/admin/backup/audio(audio-only),POST /api/admin/backup/gdrive(back up to Google Drive).
3. Migration (Restore) Flow β
To move TuneCamp to a new server:
- Install TuneCamp: Set up the new server following the Development Guide.
- Transfer Music: Manually copy the
music/directory to the new server. - Restore Data:
- Use the Admin UI to upload the backup archive, or
POST /api/admin/backup/restorewith the archive as thebackupform field (large files can be uploaded in chunks via/chunk+/restore-chunked).
- Verification:
- The system extracts the DB and
.jwt-secret. - It reconnects to the database and verifies integrity.
- Important: Restart the server after a restore to apply the new JWT secret and database.
- The system extracts the DB and
4. Manual Database Backup (CLI) β
If the UI is unavailable, you can copy the database directly. These tools operate on the raw SQLite file only (they do not produce or consume the full .tar.gz archive). Build first with npm run build:
bash
# Backup: copies the DB to <dir>/tunecamp-<timestamp>.db (defaults to ./backups)
node dist/tools/backup.js ./backups
# Restore: copies a .db file over the live database (--force to overwrite)
node dist/tools/restore.js ./backups/tunecamp-2026-01-01.db --force5. Persistence & Safety β
- File Locking: The restore tool handles SQLite file locking by retrying the replacement operation.
- Secret Migration: Unlike many platforms, TuneCamp explicitly migrates the JWT secret to ensure that users don't have to log in again after a migration.