HitKeep keeps its operational story simple, but every 2.13 installation has an explicit storage boundary:
HITKEEP_DB_PATHis the shared DuckDB control-plane database- every tenant, including the default tenant, stores analytics in its own DuckDB file under one
data-path
That means your backup strategy must follow the real storage boundary, not an older “copy one hitkeep.db file” assumption.
The Backup Boundary
Section titled “The Backup Boundary”Single-tenant or default-tenant only
Section titled “Single-tenant or default-tenant only”If you only use the default tenant, your live data is:
- the control-plane database at
HITKEEP_DB_PATH(commonly{data-path}/hitkeep.db) - the default tenant analytics database at
{data-path}/tenants/{default_team_id}/hitkeep.db - your archive directory if retention archiving is enabled
Multiteam installs
Section titled “Multiteam installs”Once you use non-default teams, the live data footprint becomes:
- the control-plane database at
HITKEEP_DB_PATH - one analytics database per tenant at
{data-path}/tenants/{team_id}/hitkeep.db, including the default tenant - your archive directory if retention archiving is enabled
That is why the safe rule is:
Back up the whole
data-pathtree, not onlyhitkeep.db, even when you use only the default tenant.
Include the control database and archives separately if their configured paths are outside that tree.
Built-in Backups
Section titled “Built-in Backups”HitKeep uses DuckDB EXPORT DATABASE with Parquet output for the shared control database and each tenant analytics catalog.
export HITKEEP_DATA_PATH=/var/lib/hitkeep/dataexport HITKEEP_BACKUP_PATH=/var/lib/hitkeep/backupsexport HITKEEP_BACKUP_INTERVAL=60export HITKEEP_BACKUP_RETENTION=24
./hitkeepBuilt-in backups include:
- the shared control export under
shared/{timestamp}/ - each tenant snapshot, including the default tenant, under
tenants/{team_id}/{timestamp}/
Use this when you want consistent application-level snapshots without relying on filesystem-level tooling.
HitKeep runs a required DuckDB checkpoint before each database export. A failed checkpoint fails that export.
A tenant export failure marks the run as failed even if other exports completed. Snapshots are written per database, without a cycle-wide completion marker. Check the backup status and verify that the selected timestamp contains the shared export and every expected tenant export before restoring. Incomplete local exports are removed when their export fails; interrupted runs or S3 failures can leave partial output. Use your object-storage lifecycle policy for S3 retention.
Instance operators can inspect the configured backup path, interval, retention, next backup, last backup, and recent failures from Administration → System Status → Operations.
Restore Semantics
Section titled “Restore Semantics”Restore is an offline operation:
./hitkeep recover restore-backup \ -from /var/lib/hitkeep/backups \ -snapshot 2026-03-08T120000Z \ -db /var/lib/hitkeep/data/hitkeep.db \ -data-path /var/lib/hitkeep/data \ -yesFor S3-backed snapshots:
./hitkeep recover restore-backup \ -from s3://my-bucket/hitkeep/backups \ -snapshot 2026-03-08T120000Z \ -yesThe restore flow imports each database separately:
- The shared export is imported into a temporary DuckDB file, checkpointed, and closed.
- The existing target database and WAL are moved aside as
.pre-restore.{timestamp}safety copies before the restored file is activated. - The same procedure restores each discovered tenant export. A restored file must not depend on a leftover
.wal. - Files are activated individually, not as one atomic replacement of the whole instance. If any catalog fails, keep HitKeep stopped, correct the backup set, and rerun restore before startup.
Local restore discovers tenant directories with the selected timestamp; missing tenant exports are not proof that those teams had no data. Compare the backup set with your expected teams. S3 restore discovers the teams from the restored control database and requires an explicit -snapshot timestamp.
That means hitkeep recover restore-backup itself should not leave your restored database dependent on replaying a leftover WAL.
The .pre-restore.{timestamp} database and WAL safety copies are retained after a successful restore. Validate the restored instance first, then remove those copies according to your storage and data-retention policy; HitKeep does not rotate them automatically.
Automatic-recovery bundles under HITKEEP_DB_RECOVERY_PATH are different from backup snapshots. They preserve the exact pre-repair database and WAL for rollback or forensic work, are retained locally, and are not rotated by the backup retention setting.
Local vs External Backup Tooling
Section titled “Local vs External Backup Tooling”Built-in backups are the easiest supported option, but external tooling is still valid.
Recommended external strategy
Section titled “Recommended external strategy”Stop HitKeep before copying live DuckDB files, or use storage-level snapshots that quiesce the volume consistently. Do not copy an active database and WAL as unrelated files.
# HitKeep is stopped for this copy.# Copy the full live data treersync -az /var/lib/hitkeep/data/ backup-host:/backups/hitkeep/data/
# Copy retention archives if you use themrsync -az /var/lib/hitkeep/archive/ backup-host:/backups/hitkeep/archive/Or with object storage:
# HitKeep is stopped for this copy.rclone sync /var/lib/hitkeep/data/ remote:my-bucket/hitkeep/data/rclone sync /var/lib/hitkeep/archive/ remote:my-bucket/hitkeep/archive/For every 2.13 installation, do not back up only:
cp /var/lib/hitkeep/data/hitkeep.db /backups/That copies only the shared control plane and misses tenant-local analytics databases.
2.13 Migration and Downgrades
Section titled “2.13 Migration and Downgrades”Production startup migrates default-tenant analytics out of the shared hitkeep.db into its tenant database when needed. The control database remains DuckDB. A physical storage format that an older engine can read is not a supported application or schema downgrade path. To return to an older release, retain the complete pre-upgrade control-and-tenant backup and the matching configuration; test that restore separately before relying on it.
New DuckDB database files and compaction outputs retain a pre-2.0 storage format. Existing files already using DuckDB 2.0’s storage format are not automatically converted. Engine-level file compatibility does not guarantee that an older HitKeep release supports the current application data or database schemas; keep a complete pre-upgrade backup.
After a Restore
Section titled “After a Restore”After recover restore-backup finishes:
- Start HitKeep normally.
- Confirm login works.
- Open the dashboard for a site in the default tenant.
- Open at least one site from a non-default team if you use teams.
- Check that goals, funnels, ecommerce, and team-specific analytics still render.
The next normal startup may create a new, valid DuckDB .wal during runtime. That is expected. The thing to avoid is a restore that only works if an old or partial WAL is replayed.
Recovering Without a Backup
Section titled “Recovering Without a Backup”If the default tenant’s analytics database at {data-path}/tenants/{default_tenant_id}/hitkeep.db is lost and no backup exists — for example because the data path was not on persistent storage — HitKeep refuses to start and names the missing file. Two offline commands get you running again. Stop HitKeep before using either one.
Rebuild the missing database as an empty, schema-migrated file:
./hitkeep recover rebuild-default-tenantThe command requires explicit confirmation because analytics history is not restored. It refuses to overwrite a database that still opens, and it sets an unreadable leftover file aside instead of deleting it.
If retention archiving was active, your aged-out analytics still exist as Parquet exports under the archive path. Import them back after the rebuild:
./hitkeep recover import-archivesThe import is idempotent: rows that already exist are kept once, and rows that reference a deleted site, goal, or funnel are skipped rather than imported inconsistently. Data newer than your last archive run cannot be recovered this way — only a real backup holds it.
Both commands read HITKEEP_DB_PATH, HITKEEP_DATA_PATH, and HITKEEP_ARCHIVE_PATH from the environment and accept explicit -db, -data-path, and -archive-path flags. When started as hitkeep --config FILE recover …, they also read the selected configuration file, with the same precedence as the server.