Snap Backup and Restore
This guide shows how you can perform backup and restore of your data.

Backup Rocket.Chat Snap Data

You can enable automatic backup on each snap refresh by executing sudo snap set rocketchat-server backup-on-refresh=enable
To backup the data on your snap installation, follow these steps
  • Stop your rocketchat-server by running
1
sudo service snap.rocketchat-server.rocketchat-server stop
Copied!
Note that while the rocketchat-server service should be stopped, the rocketchat-mongo service should be kept running!
1
sudo service snap.rocketchat-server.rocketchat-mongo status | grep Active
2
Active: active (running) (...)
Copied!
  • Run the backup command
1
sudo snap run rocketchat-server.backupdb
Copied!
  • If all goes well, you get an output like below
1
[+] A backup of your data can be found at /var/snap/rocketchat-server/common/backup/rocketchat_backup_<timestamp>.tar.gz
Copied!
  • Start your rocketchat-server
1
sudo service snap.rocketchat-server.rocketchat-server start
Copied!
Copy your backup to a different system for safekeeping.

Restore Rocket.Chat Snap Data

Follow these steps to restore your previously backed up data.
  • Stop your rocketchat-server by running
1
sudo service snap.rocketchat-server.rocketchat-server stop
Copied!
Note that while the rocketchat-server service should be stopped, the rocketchat-mongo service should be kept running!
1
sudo service snap.rocketchat-server.rocketchat-mongo status | grep Active
2
Active: active (running) (...)
Copied!
  • Copy your backup file to the snap's common folder:
1
sudo cp rocketchat_backup.tgz /var/snap/rocketchat-server/common/
Copied!
  • Run the restore command
1
sudo snap run rocketchat-server.restoredb /var/snap/rocketchat-server/common/rocketchat_backup.tgz
Copied!
If you are replacing an existing database, you get a warning message
ATTENTION
  • Your current database WILL BE DROPPED prior to the restore!
  • Would you like to make a backup of the current database before proceeding?
  • (y/n/Q)>
  • Choose the option you want
    • Press y and Enter to make a backup of the database in its current state.
    • Press n and Enter to continue without a backup of the database in its current state.
    • Press any key and/or Enter to quit the restore process without making any changes.
  • If you choose to proceed and all goes well, you will see an output similar to:
1
[*] Extracting backup file...
2
[*] Restoring data...
3
[*] Preparing database...
4
[+] Restore completed! Please restart the snap.rocketchat services to verify.
Copied!
  • Start your rocketchat-server
1
sudo service snap.rocketchat-server.rocketchat-server start
Copied!