RC v7.x to v8.0.1 needing to upgrade MongoDB to v8.2

What version are you coming from? 7.13.1

What version are you going to? 8.0.1

What deployment method did you use to deploy? Docker

Did you follow a particular doc? Which one?

What issues are you running into upgrading? Bitnami/MongoDB v6 no longer supported. MongoDB v8.2 required, but not being pulled.

1 Like

I have tried to pull the latest MongoDB community server image and use that but get an error in the manifest.

Tried a fresh Docker installation (as our RC deployment is currently a Proof of Concept only), and that seems to install ok, but is still pulling bitnami/mongodb v6.0 and the RC Docker logs are reporting the following:

±----------------------------------------------------------------+
| SERVER ERROR |
±----------------------------------------------------------------+
| |
| Rocket.Chat Version: 8.0.1 |
| NodeJS Version: 22.16.0 - x64 |
| MongoDB Version: 6.0.13 |
| MongoDB Engine: wiredTiger |
| Platform: linux |
| Process Port: 3000 |
| Site URL: http://localhost |
| Commit Hash: 7137ec80f3 |
| Commit Branch: HEAD |
| |
| YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED BY ROCKET.CHAT, |
| PLEASE UPGRADE TO VERSION 7.0 OR LATER |
| |
±----------------------------------------------------------------+

Always search first.

Follow the docs properly and use a .env file

And

Following the official doc and using the RocketChat/rocketchat-compose repo you can’t install the minimum required verson of MongoDB (8.2), because it uses the bitnamilegacy and the last version available is 8.0

1 Like

Hello and thanks for the reply.

I had read the link about the Bitnami Image and as I was using ver 7.13.x, this didn’t seem to cause me any issues. However moving to v8.x, there is the need to use MongoDB v8.2, and I couldn’t see details in the ā€˜Deploy using Docker’ about the correct MongoDB image to pull.

My fresh install, using the docker.compose file, automatically pulled bitnamilegacy/mongoDB v6.0.

Just a bit confused which MongoDB image should be pulled via the docker.compose (for RC v8.x) and why it isn’t using the instructions provided.

Thanks

Hi @kionez

So the compose.database.yml needs to be modified to point to a different repo.

I have found the official mongo repo and edited line 29 in my compose.database.yml:

image: docker.io/mongo:${MONGODB_VERSION:-8.2}

This worked (in terms of pulling the v8.2 Mongo image:

REPOSITORY TAG IMAGE ID CREATED SIZE
mongo 8.2 ac3eefab8be5 10 hours ago 916MB
registry.rocket.chat/rocketchat/rocket.chat latest a7ffcd32a37f 3 days ago 1.22GB
alpine latest e7b39c54cdec 4 weeks ago 8.44MB
nats 2.11-alpine ed6a2ea86996 4 weeks ago 26.2MB
traefik v3.4 aa215d9f973d 5 months ago 226MB
prom/prometheus v3.4.2 9e24e9a9806c 6 months ago 304MB
grafana/grafana 12.0.2 4f2ba943b1de 7 months ago 681MB
natsio/prometheus-nats-exporter 0.17.3 303cae1cf80e 8 months ago 18.3MB
prom/node-exporter v1.9.1 255ec253085f 9 months ago 25MB
percona/mongodb_exporter 0.44.0 e61acbf934e9 9 months ago 20.8MB
bitnamilegacy/mongodb 6.0 7ffa7118a17b 23 months ago 585MB

and the image is running:

37868b69fb27 mongo:8.2 ā€œdocker-entrypoint.sā€¦ā€ 8 minutes ago Up 8 minutes 127.0.0.1:27017->27017/tcp

Looking at the logs for Mongo there are errors:

{ā€œtā€:{ā€œ$dateā€:ā€œ2026-01-16T08:53:00.322+00:00ā€},ā€œsā€:ā€œIā€, ā€œcā€:ā€œEXECUTORā€, ā€œidā€:22988, ā€œctxā€:ā€œconn61ā€,ā€œmsgā€:ā€œError receiving request from client. Ending connection from remoteā€,ā€œattrā€:{ā€œerrorā€:{ā€œcodeā€:141,ā€œcodeNameā€:ā€œSSLHandshakeFailedā€,ā€œerrmsgā€:ā€œSSL handshake received but server is started without SSL supportā€},ā€œremoteā€:ā€œ172.25.0.4:54762ā€,ā€œconnectionIdā€:61}}

And the logs for the rocket.chat container are showing:

MongoServerSelectionError: Server selection timed out after 30000 ms
at Topology.selectServer (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/sdam/topology.ts:628:30)
at Topology._connect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/sdam/topology.ts:468:22)
at Topology.connect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/sdam/topology.ts:405:7)
at topologyConnect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/mongo_client.ts:620:9)
at MongoClient._connect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/mongo_client.ts:632:7)
at MongoClient.connect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/mongo_client.ts:544:7)
at autoConnect (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/operations/execute_operation.ts:139:7)
at abortable (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/utils.ts:1492:12)
at executeOperation (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/operations/execute_operation.ts:69:9)
at Collection.createIndex (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/collection.ts:609:21)
at MongoConnection.createIndexAsync (packages/mongo/mongo_connection.js:507:3)
at Collection.createIndexAsync (packages/mongo/collection/methods_index.js:49:7)
at setupUsersCollection (packages/accounts-base/accounts_server.js:1844:3)
at AccountsServer.init (packages/accounts-base/accounts_server.js:134:5) {
errorLabelSet: Set(0) {},
reason: TopologyDescription {
type: ā€˜ReplicaSetNoPrimary’,
servers: Map(0) {},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: ā€˜rs0’,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}

packages/core-runtime.js:189
throw error;
^
errorClass [Error]: [An error occurred when creating an index for collection "users: Topology is closed]
at Collection.createIndexAsync (packages/mongo/collection/methods_index.js:62:15)
at module.wrapAsync.self (packages/accounts-password/password_server.js:1311:1) {
isClientSafe: true,
error: ā€˜An error occurred when creating an index for collection "users: Topology is closed’,
reason: undefined,
details: undefined,
errorType: ā€˜Meteor.Error’
}

Node.js v22.16.0

I wonder if we should use `mongodb/mongodb-community-server:8.2-ubi8` instead, but I’m not keen on trying it out.

Unfortunately, the rocketchat-compose repo seems to be outdated and still contains the reference to MongoDB v6.

So, I will postpone upgrading until further notice …

Yes, that is what I have thought now!

I worked through this over the last 24 hours with a succesful upgrade from RC v7 and MongoDB v7 to RC v8.0.1 and MongoDB v8.2.3 for test docker environment.

Found here (RC develop compose.yml) line 133:

mongo:
image: mongodb/mongodb-community-server:8.2-ubi8

Upgrade notes:


## Take backup of existing database for restoration post MongoDB version upgrade ##


# Confirm correct DB name. Make backup of the correct database...
$ docker exec -it rocketchat-mongodb-1 mongosh --eval "show dbs"
admin       128.00 KiB
config      268.00 KiB
local         2.17 GiB
rocketchat    1.38 GiB


# Confirm stats match those shown in Rocketchat-GUI > admin > workspace
docker exec -it rocketchat-mongodb-1 mongosh rocketchat --eval "db.users.countDocuments()"              # number of users
docker exec -it rocketchat-mongodb-1 mongosh rocketchat --eval "db.rocketchat_room.countDocuments()"    # number of rooms
docker exec -it rocketchat-mongodb-1 mongosh rocketchat --eval "db.rocketchat_message.countDocuments()" # number of messages


# Take backup of DB
$ docker exec -it rocketchat-mongodb-1 mongodump \
  --db rocketchat \
  --archive \
  --verbose \
  > ~/backup/rocketchat-v7-$(date +%Y%m%d).raw


# Verify backup
$ docker cp ~/backup/rocketchat-v7-20260118.raw rocketchat-mongodb-1:/tmp/full.raw	# copy into container
$ docker exec rocketchat-mongodb-1 mongorestore --archive=/tmp/full.raw --dryRun --verbose | tail -20
...
2026-01-17T23:49:57.837+0000	dry run completed
2026-01-17T23:49:57.838+0000	0 document(s) restored successfully. 0 document(s) failed to restore.
# success, no unexpected end of file or other error
# if errors, try replacing the date expression from the backup file name creation with just the word "full" and take backup again


# Cleanup backup dump from the container
$ docker exec -u 0 -it rocketchat-mongodb-1 rm /tmp/full.raw  #	execute as user 0(root) within container (permissions req'd).


# Duplicate backup to remote server/file system
$ cp rocketchat-v7-20260118.raw <remote destination>/rocketchat-v7-20260118.raw


# Is the "local" DB to be backed up also? No — the "local" database is MongoDB's internal system database storing replica set oplog, config, and metadata. Backing it up will corrupt replication (rs0 state, elections), and restores do not merge properly across versions.​



## Upgrade container images and new requirements ##


# Alter Compose.yml and .env with changes from bitnami image to mongodb community server image.
# Note changed DB volume mapping (different container internal mount point). See also change of permissions for external (host) volume.

# v7 compose.yml

volumes:
  mongodb_data: { driver: local }

services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE}
    restart: unless-stopped
    environment:
      MONGO_URL: ${MONGO_URL}
      MONGO_OPLOG_URL: ${MONGO_OPLOG_URL}
      ROOT_URL: <your URL>
      PORT: ${PORT}
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
    depends_on:
      - mongodb
    expose:
      - ${PORT}
    ports:
      - "${BIND_IP}:${HOST_PORT}:${PORT}"

  mongodb:
    image: docker.io/bitnami/mongodb:${MONGODB_VERSION}
    restart: unless-stopped
    volumes:
      - /<host dir>/mongodb_data:/bitnami/mongodb
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
      MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
      MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
      MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
      ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}


# v8 compose.yml

volumes:
  mongodb_data: { driver: local }

services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE}
    restart: unless-stopped
    environment:
      MONGO_URL: ${MONGO_URL}
      MONGO_OPLOG_URL: ${MONGO_OPLOG_URL}
      ROOT_URL: <your URL>
      PORT: ${PORT}
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
    depends_on:
      - mongodb
    expose:
      - ${PORT}
    ports:
      - "${BIND_IP}:${HOST_PORT}:${PORT}"

  mongodb:
    image: mongodb/mongodb-community-server:${MONGODB_VERSION}    # changed image source
    restart: unless-stopped
    user: "999:992"   # UID:GID defined as per mongodb community server requirement (normally 999:999, we have custom requirement)
    volumes:
      - /<host dir>/mongodb_data:/data/db     # changed container directory as per mongodb community server
  # chown -R 999:999 /<host dir>mongodb_data/
    command: mongod --replSet rs0 --bind_ip_all   # new requirement
    environment:
  #      MONGODB_INITDB_ROOT_USERNAME: root     # optoinal for community edition
  #      MONGODB_INITDB_ROOT_PASSWORD: secret   # optional
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
      MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
      MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
      MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
      ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}


# v7 environment file

# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
RELEASE=7.8.0
# MongoDB endpoint (include ?replicaSet= parameter)
MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
# MongoDB endpoint to the local database
MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
# IP to bind the process to
BIND_IP=<your IP>
# URL used to access your Rocket.Chat instance
ROOT_URL=<your URL>
# Port Rocket.Chat runs on (in-container)
PORT=3000
# Port on the host to bind to
HOST_PORT=3000
# Added this in response to the warning of variable not set
DEPLOY_PLATFORM=selfhosted

### MongoDB configuration
# MongoDB version/image tag
MONGODB_RELEASE=7.0
# See:- https://hub.docker.com/r/bitnami/mongodb
MONGODB_VERSION=7.0


# v8 environment file

# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
RELEASE=8.0.1
# MongoDB endpoint (include ?replicaSet= parameter)
MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
# MongoDB endpoint to the local database
MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
# IP to bind the process to
BIND_IP=<your IP>
# URL used to access your Rocket.Chat instance
ROOT_URL=<your URL>
# Port Rocket.Chat runs on (in-container)
PORT=3000
# Port on the host to bind to
HOST_PORT=3000
# Added this in response to the warning of variable not set
DEPLOY_PLATFORM=selfhosted

### MongoDB configuration
# MongoDB version/image tag
MONGODB_RELEASE=8.2-ubi8
# See:- https://hub.docker.com/r/mongodb/mongodb-community-server
MONGODB_VERSION=8.2-ubi8


# Pull images.
$ cd <compose dir>
$ docker compose pull


# Stop (not down). Stop preserves networks and volumes.
$ cd <compose dir>
$ docker compose stop


# remove old Rocketchat container only (part of regular Rocketchat upgrade procedure, not part of mongoDB upgrade)
$ docker rm rocketchat-rocketchat-1
rocketchat-rocketchat-1


# Set file permissions for Mongodb community server.
$ ls -lhn /<host dir>/rocketchat/
drwxrwxr-x+ 3 1001   0 4.0K Nov 12  2022 mongodb_data
$ sudo chown -R 999:992 /<host dir>/mongodb_data/
$ sudo chmod -R 755 /<host dir>>/mongodb_data/



## Configure v8.x mongodb community server ##


# Up. (note RC container will fail to connect to DB. continue with following steps to configure DB.
$ cd <compose dir>
$ docker compose up -d


# Check replica set status (should be not enable at this stage)
$ docker exec -it rocketchat-mongodb-1 mongosh --eval 'rs.status()'
MongoServerError: no replset config has been received


# enable replica and verify
$ docker exec -it rocketchat-mongodb-1 mongosh --eval 'rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "mongodb:27017" }] })'
"mongodb:27017" }] })'
{
  ok: 1,
  ...
$ docker exec -it rocketchat-mongodb-1 mongosh --eval 'rs.status()'
...
  members: [
  ...
      stateStr: 'PRIMARY',
...
  ok: 1,


# stop and re-up.
$ docker compose up -d


# confirm compatibilty version set to 8.x
$ docker exec -i rocketchat-mongodb-1 mongosh --eval "db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )"
...
  featureCompatibilityVersion: { version: '8.2' },
  ok: 1,
...



## Restore DB from backup ##

# Stop Rocketchat container to avoid DB conflicts/corruption.
$ docker compose stop rocketchat-rocketchat-1


# Copy DB backup dump into container and dry run restore
$ docker cp ~/backup/rocketchat-v7-20260118.raw rocketchat-mongodb-1:/tmp/full.raw      # copy into container
$ docker exec rocketchat-mongodb-1 mongorestore --archive=/tmp/full.raw --dryRun --verbose | tail -20     # dry run


# Restore database
$ docker exec rocketchat-mongodb-1 mongorestore --archive=/tmp/full.raw --nsInclude=rocketchat.* --drop
...
2026-01-18T00:21:33.981+0000	19613 document(s) restored successfully. 0 document(s) failed to restore.


# Restart Rocketchat & mongoDB
$ docker compose up -d


# Confirm versions
Rocketchat GUI > admin > workspace	*refresh*
Verify expected Rocketchat and MongoDB versions.


# Cleanup backup dump from within mongodb container
$ docker exec -u 0 -it rocketchat-mongodb-1 rm /tmp/full.raw


Same issue here with a docker deployment. If you update MongoDB to latest, the database container fails to start. Update Mongo to 7.x (I don’t remember the exact version right now) solves the problem for now.

Seems like the docker.compose file has be ā€˜fixed’! Deployed a fresh installation and it has pulled MongoDB v8.x