| Volume | Path | Contents | On loss |
|---|---|---|---|
toki-data |
/data |
SQLite (users, devices, cursors) + Fjall event store | Re-login + full re-sync required |
clickhouse-data |
/var/lib/clickhouse |
ClickHouse event data (only with --profile clickhouse) |
Recoverable via client re-sync |
caddy-data |
/data |
Let's Encrypt certificates | Auto-reissue (rate limit: 5/week) |
With the default Fjall backend, toki-data contains both metadata and events. If lost, clients will perform a full re-sync from their local history on reconnect. With ClickHouse, event data is stored separately in clickhouse-data.
For easier backup access, use bind mounts instead of named volumes in docker-compose.yml:
volumes:
- ./data/toki:/dataFjall stores data as files in a directory. To back up:
# Stop containers to ensure consistency
docker compose down
# Archive the data directory
tar czf toki-sync-backup-$(date +%Y%m%d).tar.gz ./data/
# Restart
docker compose --profile caddy up -dAlternatively, for a hot backup (server running), copy the Fjall directory. Fjall uses an LSM-tree structure that is safe to copy while running, though stopping the server ensures full consistency.
If using ClickHouse as the event store:
# Use clickhouse-backup tool
docker exec toki-clickhouse clickhouse-backup create backup_$(date +%Y%m%d)
# Or use clickhouse-client to export
docker exec toki-clickhouse clickhouse-client --query "SELECT * FROM events FORMAT Native" > events_backup.binSee ClickHouse backup documentation for full details.
The simplest approach for small deployments:
- Stop containers:
docker compose down - Snapshot the entire VM/VPS disk via your cloud provider's console
- Restart:
docker compose --profile caddy up -d
This captures everything -- database, event store, and certificates.
If using bind mounts:
# Stop containers to ensure consistency
docker compose down
# Archive data
tar czf toki-sync-backup-$(date +%Y%m%d).tar.gz ./data/
# Restart
docker compose --profile caddy up -d- Stop containers:
docker compose down - Replace the data directories with your backup
- Restart:
docker compose --profile caddy up -d - Clients will reconnect automatically (toki daemon retries with exponential backoff)