RocketChat / RocketChat/Rocket.Chat

MongoDB migration to another VM: Rocketchat doesn't detect previous DB data thus asking setup wizard

Open
#25,621 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

I've got a dockerizend environment consisting of two containers:

Rocketchat 3.6.1 - using filesystem storage
MongoDB 4.0.19 - wiredtiger - oplog enabled

I have to move this installation to another machine and then upgrade Mongo and Rocket version. I've done a mongodump on the current machine, ran another mongo of the same version on the destination machine , used mongorestore to restore DB. No error whatsoever.
Ran another rocketchat of the same version on the destination machine, but it fails to load data: In the logs it says "Setting default file store to GridFS" while it was filesystem storage and then asks for setup wizard.

Steps to reproduce:
  1. Have a running Rocketchat 3.6.1 using filesystem storage and MongoDB 4.0.19 - wiredtiger - oplog enabled both on docker
  2. Dump the db on current Rocketchat:
    docker exec db sh -c 'mongodump --archive' > /root/mongo.dump
  3. On the destination machine, start another mongoDB:
    docker run --name db -p 127.0.0.1:27017:27017 -v /wos1/db_data_docker/:/data/db -d mongo:4.0.19 --smallfiles --replSet rs0 --oplogSize 128 ; docker logs --follow db
  4. Initialize the DB:
    docker exec -ti db mongo --eval "printjson(rs.initiate())"
  5. restore the previous dump:
    docker exec -i db sh -c 'mongorestore --archive' < /tmp/mongo.dump
  6. check that mongo rs0 is PRIMARY
  7. run rocket container on the destination machine:
    docker run - --restart unless-stopped --name rocketchat -p 3000:3000 -v /wos1/rocket_fs_docker:/opt/rocket_fs --link db --env ROOT_URL=https://my.domain.it --env MONGO_URL=mongodb://db:27017/rocketchat --env MONGO_OPLOG_URL=mongodb://db:27017/local -d rocketchat/rocket.chat:3.6.1
Expected behavior:

Rocketchat starts and reads DB data and works as on the current machine

Actual behavior:

Rocketchat doesn't read migrated data and starts anew, setting GridFS storage and prompts the setup wizard on the browser

Server Setup Information:
  • Version of Rocket.Chat Server: 3.6.1
  • Operating System: Centos 7
  • Deployment Method: Docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: enabled
  • MongoDB Version: 4.0.19

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Docker commands and MongoDB 4.0.19 dump/restore steps in the report, then inspect the Rocket.Chat 3.6.1 startup logs for the switch to GridFS and the setup wizard. Reproduce the migration and compare the restored database and filesystem storage configuration; done means the migrated instance detects its existing data and retains filesystem storage without showing the setup wizard.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.