Bitnami MongoDB images are no longer maintained, leaving deployments without critical security updates or access to newer MongoDB versions. To address this, Rocket.Chat is migrating to the official MongoDB images, starting with MongoDB 8.0 for continued support and security.
This guide explains how to migrate from an existing Bitnami MongoDB 6.0 deployment to the official MongoDB 8.x image required for Rocket.Chat 8.0 and above.
Before you begin
If you’re using an external MongoDB instance (not via Docker Compose), this migration does not apply to you.
Before starting this migration, it’s important to back up your data as it may involve changes to volume paths.
Ensure you have enough disk space for both the backup and the new data.
Communicate at least 30 minutes of downtime window to your users.
After migration, you’ll be running the official MongoDB Community Server image.
Select your current deployment method that uses Bitnami MongoDB setup below and follow the appropriate migration steps:
This section covers migrating a Docker workspace from Bitnami MongoDB 6.0 to the official MongoDB 8.2 image.
This guide assumes you are using the official rocketchat-compose repository, which splits services across multiple compose files (
compose.yml,compose.database.yml,compose.traefik.yml, etc.). If you are using a different setup, your steps may differ slightly.
The latest version of our compose (2.0.0) introduces several important changes:
MongoDB image: Switches from bitnami/mongodb:6.0 to official mongodb/mongodb-community-server:8.2-ubi8.
MongoDB version: Upgrades from MongoDB 6.0.x to 8.2.x
Volume path: Changes from /bitnami/mongodb to /data/db which is the standard MongoDB path.
Initialization: Adds explicit replica set initialization and permission fixing containers.
Healthchecks: Enables proper MongoDB healthchecks for better orchestration.
Moving your Docker workspace from Bitnami to the official MongoDB image
The following
docker composecommands are interchangeable topodman-compose.
Since MongoDB 6.0 and 8.2 have different data formats and the volume paths are changing, the safest approach is to use mongodump and mongorestore.
Step 1: Backup current MongoDB data
Go to your
rocketchat-composedirectory and confirm that your current deployment is running:cd <path/to/rocketchat-compose> docker compose -f compose.database.yml -f compose.yml psReplace <path/to/rocketchat-compose> with the path to your
rocketchat-composedirectory.Create a backup directory:
mkdir -p ./mongodb-backupDump the current database:
docker compose -f compose.database.yml exec -T mongodb mongodump --uri='mongodb://localhost:27017/?directConnection=true' \ --archive --gzip \ --db=rocketchat > mongodb-backup/backup.gzVerify the backup was created:
ls -lh ./mongodb-backup/
Step 2: Stop the current deployment
Run this command to stop all the services:
docker compose -f compose.database.yml -f compose.yml downAvoid using
-vflag, as this would delete your volumes. You have to keep them as a safety backup.
Step 3: Update the rocketchat-compose directory
Pull the latest changes for the rocketchat-compose directory :
git checkout main
git pull origin mainAlternatively, use the specific 2.0.0 tag:
git checkout 2.0.0Step 4: Update enviroment configuration
Configure your .env file:
nano .envAdd or verify these MongoDB settings:
MONGODB_VERSION=8.2 MONGODB_USER_ID=1001 MONGODB_REPLICA_SET_NAME=rs0 MONGODB_ADVERTISED_HOSTNAME=mongodb
Step 5: Rename or archive old volume
To ensure a clean migration, you’ll need a fresh volume for MongoDB 8.2:
List the current volumes:
docker volume ls | grep rocketchat-composeRename the old MongoDB volume as backup
docker volume create rocketchat-compose_mongodb_data_60_backup docker run --rm -v rocketchat-compose_mongodb_data:/from -v rocketchat-compose_mongodb_data_60_backup:/to docker.io/alpine sh -c "cp -av /from/. /to/"Alternatively, if using a local directory path (MONGODB_HOST_PATH):
mv mongodb_vol mongodb_vol_60_backup
Step 6: Start the new MongoDB 8.2
Start only the database services:
docker compose -f compose.database.yml up -dThis will start the permission fixing container, initialize the MongoDB 8.2 replica set, and start MongoDB with proper healthchecks.
Check the logs to ensure everything starts correctly:
docker compose -f compose.database.yml logs -f mongodb docker compose -f compose.database.yml logs mongodb-init-containerWait for MongoDB to be healthy:
docker compose -f compose.database.yml ps
Step 7: Restore data to the new MongoDB 8.2 container
Copy your backup into the new MongoDB container and restore:
cat mongodb-backup/backup.gz | docker compose -f compose.database.yml exec -T mongodb mongorestore --uri='mongodb://localhost:27017/?directConnection=true' --archive --gzipVerify the restore:
docker compose -f compose.database.yml exec mongodb mongosh --eval "use rocketchat; db.stats()"Check that collections were restored:
docker compose -f compose.database.yml exec mongodb mongosh --eval "use rocketchat; db.getCollectionNames()"
Step 8: Start the workspace
Once the database restore is verified, start all other services required for Rocket.Chat:
docker compose -f compose.monitoring.yml -f compose.traefik.yml -f compose.yml -f docker.yml up -dTo check that all services have successfully started, use this command to list all running containers:
docker psAll services should show a status of Up . Some minor MongoDB services may also have a status of Exited (0).
Monitor the Rocket.Chat logs:
docker compose logs -f rocketchatLook for the startup banner showing the Rocket.Chat and MongoDB version:
+----------------------------------------------+ | SERVER RUNNING | +----------------------------------------------+
Step 9: Verify your deployment
To confirm that the migration was succesful,
Visit your workspace URL and login with your admin account.
Verify channels, users, messages, and uploaded files are intact.
Send a test message.
For troubleshooting, rollback, and cleanup, refer to the Docker Compose Moving from Bitnami to Official MongoDB Image forum.
This section covers migrating from a Rocket.Chat Snap installation which bundles its own bitnami MongoDB internally to the Docker Compose deployment running the official MongoDB 8.0 image.
The Snap installation may name its database based on your server configuration (not necessarily
rocketchat), so a key part of this guide is identifying and correctly remapping your database name during restore.
Step 1: Install Docker, Docker Compose, and Git
Docker, Docker Compose (Docker Compose v2) and Git are required for setting up Docker deployments.
If you don't have them installed, you can conveniently set them up in Linux distributions with the command below:
curl -L https://get.docker.com | sh # Install Docker sudo apt install git # Install GitTo run Docker commands without using
sudo, add your current user to the Docker group.Find your current username with this command:
whoamiAdd your user to the docker group, substituting $USER with your username if needed:
sudo usermod -aG docker $USERReboot for the change to take effect:
sudo reboot
With Docker and Git in place, you are ready to proceed with the migration.
Step 2: Back up your Snap workspace
Create the Snap database backup:
sudo snap run rocketchat-server.backupdbThe output will show the backup file location similar to
/var/snap/rocketchat-server/common/backup/rocketchat_backup_YYYYMMDD.HHMM.tar.gz.Copy the backup filename similar to
rocketchat_backup_YYYYMMDD.HHMM.tar.gzand save for later.Stop all the Snap services:
sudo snap stop rocketchat-server
Step 3: Extract the Snap backup
Navigate to the backup directory:
cd /var/snap/rocketchat-server/common/backup/Extract the backup using the exact database backup filename:
sudo tar xzvf rocketchat_backup_YYYYMMDD.HHMM.tar.gzReplace
rocketchat_backup_YYYYMMDD.HHMM.tar.gzwith the exact filename you copied earlier.Verify the dump came out and copy the database folder name inside:
ls dump/The folder name inside
dump/is your actual Snap database name. It may berocketchat,parties, or something else entirely based on your server's configuration.
Step 4: Deploy Rocket.Chat with Docker
To get foundational understanding on Rocket.Chat Docker deployment, visit Deploy with Docker and Docker Compose.
Clone the official rocketchat-compose repository in your preferred working directory using Git and navigate to the cloned directory:
git clone --depth 1 https://github.com/RocketChat/rocketchat-compose.git cd rocketchat-composeCopy the example environment file to
.env:cp .env.example .envConfigure your
.envfile:nano .envUpdate these variables:
Field
Description
Example
RELEASE
The exact version of Rocket.Chat you wish to deploy. A full list of available stable releases is on the Rocket.Chat releases page.
In this migration guide, we are deploying
8.2.0.DOMAIN
Your public domain. Do not include https:// or any trailing slashes.
example.com
ROOT_URL
The complete URL your users will use to access the server, including the secure protocol (https://).
https://example.com
LETSENCRYPT_ENABLED
Set to
trueto enable Traefik to automatically obtain and renew certificates.true
LETSENCRYPT_EMAIL
Your valid email address for certificate renewal and security notifications from Let's Encrypt.
demo@email.com
TRAEFIK_PROTOCOL
Set to
httpsto ensure secure connections are enforced by the proxy.https
For example,
RELEASE=8.2.0 ROOT_URL=https://example.com LETSENCRYPT_ENABLED=true LETSENCRYPT_EMAIL=demo@email.com TRAEFIK_PROTOCOL=httpsAdd or update these MongoDB settings:
MONGODB_VERSION=8.0 MONGODB_USER_ID=1001 MONGODB_REPLICA_SET_NAME=rs0 MONGODB_ADVERTISED_HOSTNAME=mongodb
Step 5: Start MongoDB
Start the database service to run MongoDB 8.0:
docker compose -f compose.database.yml up -dWait until MongoDB is fully healthy before proceeding:
docker compose -f compose.database.yml psCopy the mongodb container name and save for later. You’ll need it in step 6.
All database containers should show healthy or up status before continuing.
Step 6: Copy and restore the Snap backup to Docker
Copy the extracted dump folder into the MongoDB container:
docker cp /var/snap/rocketchat-server/common/backup/dump/<your-db-name>/. \ rocketchat-compose-mongodb-1:/tmp/dbrestore/Replace
<your-db-name>with the database folder name you noted in Step 3.Now restore directly into the rocketchat database:
docker exec -e HOME=/tmp rocketchat-compose-mongodb-1 mongorestore \ --uri='mongodb://localhost:27017/?directConnection=true' \ --dir=/tmp/dbrestore \ --db=rocketchatTo verify the restore, enter mongosh:
docker exec -it <mongodb-container> mongoshReplace
<mongodb-container>with the actual container name.Then once inside the mongosh terminal, run these commands one at a time:
use rocketchat db.users.countDocuments() db.getCollectionNames().lengthYou should see the same number of users previously on your snap workspace. If the numbers don’t look right, re-examine the dump folder contents and retry the restore.
Exit the mongosh container:
exit
Step 7: Start the workspace
Once the database restore is verified, go to the rocketchat-compose directory and start all other services required for Rocket.Chat:
docker compose -f compose.monitoring.yml -f compose.traefik.yml -f compose.yml -f docker.yml up -dTo check that all services have successfully started, use this command to list all running containers:
docker ps -aAll services should show a status of Up . Some minor MongoDB services may also have a status of Exited (0).
Monitor the Rocket.Chat logs:
docker compose logs -f rocketchatLook for the startup banner showing the Rocket.Chat and MongoDB version:
+----------------------------------------------+ | SERVER RUNNING | +----------------------------------------------+ | Rocket.Chat Version: 8.2.0 | | MongoDB Version: 8.0.x | +----------------------------------------------+
Step 8: Verify your deployment
To confirm that the migration was succesful,
Visit your workspace URL and login with your admin account.
Verify channels, users, messages, and uploaded files are intact.
Send a test message.