Migrate to new server

Hello! We currently have a Rocket.Chat running on Ubuntu 20.04 installed via Digital Ocean one-click install. However, we are going to need a different URL for this server soon as we will need to distinguish between two purposes. Since I would actually prefer a snap install over the Digital Ocean one-click install (and Debian over Ubuntu), I was thinking about creating the new server on a separate droplet and migrate the current content/database. What is the smoothest way to do this?

“Carefully”

Lots, of backups, and test, test, test again.

You should move the DB between same Rocket and Mongo versions eg 3.18.1 → 3.18.1

Do NOT try mixing them, particularly the Rocket version. I am not sure what version snaps are but you may need to wait until a matching version is released

You will need to backup the old version, open the backup zip, and rename the DB to ‘parties’ - see elsewhere here about the DB name.

I just completed this myself.
Steps:

  1. On old server, backup the rocketchat database and TAR it into backup.tar:

mongodump -o ~/backup
tar cvf backup.tar ~/backup

  1. Move backup.tar to the new server with snap install of Rocket.chat.

  2. Unzip the tar file. You should do it from the root, because the tar includes all of the directories in it, if you do it from your user directory, the /backup folder will not be where you expect it.

tar xvf backup.tar

  1. Take Rocket.chat offline:

snap stop rocketchat-server.rocketchat-server

  1. Now, the snap install uses a different database name, ‘parties’. You’ll need to drop that database. Go into the Mongo shell, switch to use that database, and drop it.

mongo
show dbs
use parties
db.dropDatabase()
show dbs

You should see that the first show dbs indicates that parties is present, but the second one shows that it is gone.

  1. Restore the database, forcing the name to be parties:

mongorestore -d parties ~/backup/

  1. Restart Rocket.chat server:

snap start rocketchat-server.rocketchat-server

  1. Confirm server status:

snap services rocketchat-server

You should be good to go!