Documentation contents

Backup and restore

Back up the database and the configuration and keys in /etc/gadka. If file uploads are enabled, back up S3 storage as well.

What to back up

DataLocationNotes
Database/var/lib/gadka/gadka.db (SQLite) or your PostgreSQL or MySQL serverContains all conversations, accounts, and settings
Configuration and keys/etc/gadkaIncludes mfa-key and jwt-signing-key.pem
User filesS3 storageOnly needed if you enabled files

You can leave /var/lib/gadka/nats out of the backup.

Back up a SQLite database

This command creates a consistent copy of the live database. You can keep the server running.

sudo gadka --config /etc/gadka/gadka.yaml admin backup --out /var/lib/gadka/gadka-$(date +%F-%H%M).db

After writing the backup, the server prints the path to the file.

backup written to /var/lib/gadka/gadka-2026-11-19-0200.db

Choose a new destination file each time. The command never overwrites an existing backup.

Encrypt the backup and transfer it to a separate machine. Once the transfer is complete, remove the backup file from /var/lib/gadka.

Back up a PostgreSQL or MySQL database

The gadka admin backup command supports SQLite only. For other databases, use their own tools, such as pg_dump or mysqldump.

Back up the configuration and keys

sudo tar -czf gadka-etc-$(date +%F).tar.gz -C /etc gadka

The archive contains keys. Protect it as you would a password.

Schedule a daily backup

This example entry in root’s crontab (sudo crontab -e) runs daily at 02:00.

0 2 * * * /usr/local/bin/gadka --config /etc/gadka/gadka.yaml admin backup --out /var/lib/gadka/gadka-$(date +\%F).db

This entry only creates the backup. Schedule separate tasks to move backups to another machine and remove old files.

Restore a SQLite database

  1. Stop the services.
sudo systemctl stop gadka-proxy gadka
  1. Replace the database and remove the old database’s auxiliary files.
sudo install -o gadka -g gadka -m 0640 gadka-kopia.db /var/lib/gadka/gadka.db
sudo rm -f /var/lib/gadka/gadka.db-wal /var/lib/gadka/gadka.db-shm
  1. Start the services.
sudo systemctl start gadka gadka-proxy
  1. Run gadka healthcheck && echo OK, then sign in to the app.

Restore on a new machine

  1. Run the Gadka installer on the new machine.
  2. Stop the services, restore /etc/gadka from the archive, and restore the database.
  3. Start the services.

Update and check the server