Moving Rocket.Chat (docker) fully to new server

Description

Using the mongodump process, I successfully copied messages and database content to a new installation of Rocket.Chat, but things like settings, layout, assets, etc, are absent and are set to the defaults. Is there a documented process for copying/moving this content for a complete transfer of Rocket.Chat to a new server? Thank you.

Server Setup Information

  • Version of Rocket.Chat Server: 4.1.2
  • Operating System: Alpine Linux
  • Deployment Method: Docker
  • Number of Running Instances: 2
  • DB Replicaset Oplog:
  • NodeJS Version: v12.22.1
  • MongoDB Version: 4.4.10 / wiredTiger (oplog Enabled)
  • Proxy: Nginx
  • Firewalls involved:

Any additional Information

I followed these instructions to back up the database and apply it to a clean installation: How can I move rocket chat to other server? · Issue #4297 · RocketChat/Rocket.Chat · GitHub

Hi! Please, take a look at this:

It would help if you state here the exact steps you did for this backup and restore process.

Thanks!

I deployed a fresh Rocket.Chat instance, did mongodump -o /backup to backup the database, tar cvf backup.tar /backup to compress it for transfer, tar xvf backup.tar to uncompress on the new host, then mongorestore /backup/backup to restore the database. I believe the database has transferred correctly eg messages, user logins, etc, but the Rocket.Chat settings/data are absent.

the configurations are stored at rocketchat_settings:

So it should be included at the dump.

Have you tried with the commands at the aforementioned thread?

does it give any error logs while restoring?

I don’t see a rocketchat_settings directory, or maybe it is a file? I see a rocketchat_settings.bson inside the rocketchat folder.

I’ll follow the thread you suggested, would you recommend it over the steps that I followed?

When I ran the restore command, I got 2015 document(s) failed to restore.

rocketchat_settings should be a collection inside the database. You can use Mongo Compass in order to connect to the database.

according to the error message, a lot of documents were not able to be restored.

I do recommend using the mentioned command.

I don’t believe I’m doing it correctly, it also gives a similar error. Is there any documentation on transferring to a new server where I can start the process from scratch?

I’d suggest you start by giving some background on the previous install. I.e. the deployment method, server version, etc. Then follow that up with what you exactly did on that server and then how you completed your migration process.

Without these bits of information it won’t be possible for us to figure out the root cause of the issue. Even to give you steps for migration we’d need information of your previous (or the existing ‘from’) install.

I installed it fresh about a week ago using docker-compose, it’s on the latest version of Rocket.Chat and MongoDB 4.4.10.
I followed the linked instructions (How can I move rocket chat to other server? · Issue #4297 · RocketChat/Rocket.Chat · GitHub) and this resulted in a partial transfer with some elements not being applied to the new installation (a blank installation of Rocket.Chat using the same docker-compose file)

Hmm the comment is quite old. Please try the backup restore method Duda linked. You’ll find my comment on that particular thread - follow that to back up and then copy over the resultant dump to the new install.

After performing your restore instructions on a fresh install I got the following message 5060 document(s) restored successfully. 2006 document(s) failed to restore. As before, messages and accounts transferred, but Rocket.Chat settings did not.

I attempted the “With Docker Compose” section first, but I got this error:
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

Supported filenames: docker-compose.yml, docker-compose.yaml

It was not able to findo the docker-compose.yml file.

You need to issue this command at the same folder you have your docker-compose.yml at.

I see… Now I get this error :ERROR: No such service: rocket-chat_mongo_1 when running the docker-compose exec -T rocket-chat_mongo_1 sh -c 'mongodump --archive' > db.dump command in the directory with the Rocket.Chat docker-compose.yml.

I tried the container ID and ID listed with docker ps in place of rocket-chat_mongo_1 but resulted in the same error.

You need to run this:

docker-compose exec -T mongo sh -c 'mongodump --archive' > db.dump

when you run:
docker ps

it will show all the containers info.

But when you are using the docker-compose, you must reference the service not the docker name.

The docker name, while using docker-compose, will be a combination of the project name (in your case, rocket-chat) plus the service name, plus the instance number, all of them separated with underscore.

So you end up with the container name rocket-chat_mongo_1

this will probably work too:
docker exec rocket-chat_mongo_1 sh -c 'mongodump --archive' > db.dump

With this change, I get the error ERROR: No container found for mongo_1.

ok, try this steps, run the ones in bold

docker ps | grep mongo

I got this on my machine:
dudanogueira@duda-rocket:/tmp$ docker ps | grep mongo
f3495d774fcc mongo:4.4 “docker-entrypoint.s…” 8 days ago Up 2 hours 0.0.0.0:27017->27017/tcp, :::27017->27017/tcp rocketconnect_mongo_1

now, run this:
docker exec rocketconnect_mongo_1 sh -c ‘mongodump --archive’ > db.dump

of course, you should replace the rocketconnect_mongo_1 with what you have as your mongo docker name

With docker exec rocket-chat_mongo_1 sh -c ‘mongodump --archive’ > db.dump I get --archive’: 1: ‘mongodump: not found. I haven’t done this before, so I don’t know what could be the issue.

Hi, can you try this:

docker exec rocket-chat_mongo_1 mongodump --archive > db.dump

That seems to have worked, I have a 50MB~ db.dump file now.

Now that I have the file, the database can be restored onto a new instance of Rocket.Chat, correct?
I’m unsure of how to proceed with doing it if that is the case.