The Ultimate Guide: Upgrading RocketChat Deployed in Docker and Upgrading MongoDB

After much work, I developed a simple guide to upgrade Docker deployed RocketChat.
I have a step by step guide to upgrade MongoDB from 4.x to 5.0 and get rid of the dreaded deprecated messages.

That’s really nice.

Thanks for sharing!

Thanks for the kudo. I needed to de-mystify this process. I had two buddies that kept asking if I could make this easier. I read several posts where folks were installing new RocketChat and getting Mongo 4.0 with mmap which immediately was marked deprecated. Hopefully this will guide them step by step through the upgrade process prior to RocketChat v5.0.

2 Likes

Nice, thanks! Could you consider making a guide on moving a Rocket.Chat instance to another server? I feel like this and updating the database are the two most confusing issues.

@steve5050 In the first part of this video you will notice where I had my instance loaded in /home/scott and I moved it to /opt/rocketchat which was a prerequisite to performing the database upgrade. The first part of the upgrade also does a dump of the database.

Knowing those two things, moving RocketChat to another server is easy. My Rocketchat guide is designed for RocketChat deployed in Docker and that makes it very “movable”.

In my case, my server instance is a LXD container and so the docker is nested inside that container. I have another video on installing RocketChat and also several videos that address LXD containers. Overall, I think all the pieces to the puzzle for pulling off a move are here. If not, perhaps we can chat sometime. Say hi on my RocketChat server at https://chat.scottibyte.com.

1 Like

Oh, and you are so right about how confusing the mongodb update was. I battled it for a few months and decided it needed to be a video after all my grief.

2 Likes

Thank you for sharing the tutorial.
My actual state is:
±---------------------------------------------------+
| SERVER RUNNING |
±---------------------------------------------------+
| |
| Rocket.Chat Version: 4.7.2 |
| NodeJS Version: 14.18.3 - x64 |
| MongoDB Version: 4.2.20 |
| MongoDB Engine: wiredTiger |
| Platform: linux |
| Process Port: 3000 |
| Site URL: https://myweb.com |
| ReplicaSet OpLog: Enabled |
| Commit Hash: 1688633945 |
| Commit Branch: HEAD |
| |

But I have a problem to upgrade Mongo 4.2 → 4.4
I edited my docker-compose.yml file to image mongo:4.4 and create a new mongo container…
But it is impossible to connect to docker container via command

docker exec -it rocketchat_mongo_1 bash
Error response from daemon: Container 01881fe3bf53af4c72181d88a871cd03b6947e02eaee76e378e9b30631c3f04e is restarting, wait until the container is running

I checked rocketchat_rocketchat_1

/app/bundle/programs/server/node_modules/fibers/future.js:313
						throw(ex);
						^
MongoServerSelectionError: getaddrinfo EAI_AGAIN mongo
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) {
      'mongo:27017' => ServerDescription {
        address: 'mongo:27017',
        error: Error: getaddrinfo EAI_AGAIN mongo
            at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26) {
          name: 'MongoNetworkError'
        },
        roundTripTime: -1,
        lastUpdateTime: 720770100,
        lastWriteDate: null,
        opTime: null,
        type: 'Unknown',
        topologyVersion: undefined,
        minWireVersion: 0,
        maxWireVersion: 0,
        hosts: [],
        passives: [],
        arbiters: [],
        tags: []
      }
    },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: null
  }
}
Tried 1 times. Waiting 5 secs...

What should I do?

@vawaver Tony, Go watch my video to see the steps. Upgrading RocketChat in Docker - MongoDB 4 0 x Deprecated - YouTube The restarting issue is normally caused by not having the Docker-compose file that I mentioned configured exactly as I describe.

@vmsman
Thank you very much for your reply.
I successfully had made the Mongo upgrades from 4.0->4.2.->4.4
But when I tried to make an upgrade 4.4->5.0 there is some problem I cannot identify.
I used the same steps as you showed in your tutorial.
After pulling down of 5.0 image mongo container is created.

docker exec -it rocketchat_mongo_1 bash
Error response from daemon: Container b7e0aecfbaa3d3b53ce467328c89a130a8a84ebf7d9a8dbeb8ba8be076d09f0e is restarting, wait until the container is running

rocketchat_rocketchat_1 - log

Errors like this can cause oplog processing errors.
Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
Future node.js versions will automatically exit the process
=================================
Exception in setInterval callback: MongoServerSelectionError: getaddrinfo EAI_AGAIN mongo
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: 9
  }
}
{"level":50,"time":"2022-05-29T18:33:17.420Z","pid":7,"hostname":"3a92412c3ca2","name":"LivechatEnterprise","section":"Queue","msg":"Error processing queue public","err":{"type":"MongoServerSelectionError","message":"getaddrinfo EAI_AGAIN mongo","stack":"MongoServerSelectionError: getaddrinfo EAI_AGAIN mongo\n    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)\n    at listOnTimeout (internal/timers.js:557:17)\n    at processTimers (internal/timers.js:500:7)\n => awaited here:\n    at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n    at app/models/server/raw/OmnichannelQueue.ts:44:15\n    at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40\n => awaited here:\n    at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n    at ee/app/livechat-enterprise/server/lib/LivechatEnterprise.js:269:4\n    at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","name":"MongoServerSelectionError","reason":{"type":"Single","setName":null,"maxSetVersion":null,"maxElectionId":null,"servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":9}},"msg":"getaddrinfo EAI_AGAIN mongo"}
Exception in setInterval callback: MongoServerSelectionError: getaddrinfo EAI_AGAIN mongo
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: 9
  }
}
Exception in setInterval callback: MongoServerSelectionError: connect ECONNREFUSED 192.168.192.2:27017
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: 9
  }
}
Exception in setInterval callback: MongoServerSelectionError: connect ECONNREFUSED 192.168.192.2:27017
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: 9
  }
}
Exception in setInterval callback: MongoServerSelectionError: connect ECONNREFUSED 192.168.192.2:27017
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/topology.js:437:30)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: 9
  }
}

So I do not know how to move forward.

I found another problem with compatibility of my CPU

WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
  see https://jira.mongodb.org/browse/SERVER-54407
  see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
  see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814