Backup and restore
Backup
A backup is a dump of the database, taken by the PostgreSQL container while everything runs:
docker compose exec -T postgres pg_dump -U postgres --format=custom runsten > runsten-$(date +%F).dumpSchedule it with the host's cron or the NAS scheduler, and copy the dumps off the server. The update script takes one too, into backups/, before each update. They contain VINs and locations: protect them.
The ZIP archives of the accounts' data are not in it: they are kept a week in the exports volume (or a bucket, RUNSTEN_EXPORT_S3_* in .env), and built again on demand.
The tokens in them are encrypted with RUNSTEN_TOKEN_KEY: a dump restored without the key keeps all the data but loses the Volvo connection, the Polestar credentials and the Tesla refresh tokens, which are then connected and given again.
Restore
On the same server or a new one, with the same .env, key included:
docker compose up -d postgres # on a new server, initializes an empty volume
docker compose stop api collector
docker compose exec -T postgres pg_restore -U postgres --dbname=runsten \
--clean --if-exists --single-transaction --exit-on-error < runsten-2026-09-25.dump
docker compose up -dRebuild
Trips and charges are worked out from the stored responses of the car. To work them out again, after a restore or an update that improves how they are found:
docker compose stop collector
docker compose run --rm collector rebuild
docker compose start collectorThe costs entered for charges are not worked out: a rebuild keeps them.