Documents help, but are thin on details.
What I did (have standalone config, docker, mongo4.0 with rocketchat 3.18.7)
System is started with a single docker-compose.yml file (the original here):
version: '2'
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:3.18.7
container_name: rocketchat
command: >
bash -c
"for i in `seq 1 30`; do
node main.js &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
volumes:
- /var/data/chat/uploads:/app/uploads
environment:
- PORT=3131
- ROOT_URL=http://chat.adapt-ip.com
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
depends_on:
- mongo
ports:
- 3131:3131
mongo:
image: mongo:4.0
restart: unless-stopped
volumes:
- /var/data/chat/db:/data/db
command: mongod --smallfiles --oplogSize 1024 --replSet rs0 --storageEngine=mmapv1
labels:
- "traefik.enable=false"
# this container's job is just run the command to initialize the replica set.
# it will run the command and remove himself (it will not stay running)
mongo-init-replica:
image: mongo:4.0
command: >
bash -c
"for i in `seq 1 30`; do
mongo mongo/rocketchat --eval \"
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
depends_on:
- mongo
Step 1) Stop rocketchat so no new messages are posted
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8ecbeb37c67f registry.rocket.chat/rocketchat/rocket.chat:3.18.7 "docker-entrypoint.s…" 11 minutes ago Up 11 minutes 3000/tcp, 0.0.0.0:3131->3131/tcp rocketchat
f275a439580c mongo:4.0 "docker-entrypoint.s…" 11 minutes ago Up 11 minutes 27017/tcp chat-mongo-1
$docker stop rocketchat
Step 2) back it up
$ docker exec f275a439580c sh -c 'mongodump --archive' > db.dump
Step 3) edit the operational docker compose to reflect wildTiger
version: '2'
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:3.18.7
container_name: rocketchat
command: >
bash -c
"for i in `seq 1 30`; do
node main.js &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
volumes:
- /var/data/chat/uploads:/app/uploads
environment:
- PORT=3131
- ROOT_URL=http://chat.adapt-ip.com
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
depends_on:
- mongo
ports:
- 3131:3131
mongo:
image: mongo:4.0
restart: unless-stopped
volumes:
# - /var/data/chat/db:/data/db
- /var/data/chat/db.wt:/data/db
command: mongod --oplogSize 1024 --replSet rs0 --storageEngine=wiredTiger --bind_ip_all
# command: >
# bash -c
# "mkdir -p /var/data/chat/db.wt; mongod --oplogSize 1024 --replSet rs0 --storageEngine=wiredTiger --dbpath=/var/data/chat/db.wt --bind_ip_all;"
# command: mongod --oplogSize 1024 --storageEngine=wiredTiger --dbpath=/var/data/chat/db.wt
labels:
- "traefik.enable=false"
# this container's job is just run the command to initialize the replica set.
# it will run the command and remove himself (it will not stay running)
mongo-init-replica:
image: mongo:4.0
command: >
bash -c
"for i in `seq 1 30`; do
mongo mongo/rocketchat --eval \"
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
depends_on:
- mongo
Step 4) start just the mongo and its replicate set; asking for mongo-init-replica will start its dependencies:
$ docker compose up -d mongo-init-replica
Step 5) restore the backup:
$ docker exec -i 2c068129eff9 /usr/bin/mongorestore --authenticationDatabase admin --archive < db.dump
Step 6) monitor logs until it appears quiet:
$docker logs chat-mongo-1
...
2023-11-11T21:05:52.815+0000 I NETWORK [conn4] end connection 127.0.0.1:54050 (4 connections now open)
2023-11-11T21:05:52.816+0000 I NETWORK [conn3] end connection 127.0.0.1:35770 (3 connections now open)
2023-11-11T21:05:52.817+0000 I NETWORK [conn5] end connection 127.0.0.1:54056 (2 connections now open)
2023-11-11T21:05:52.819+0000 I NETWORK [conn6] end connection 127.0.0.1:46510 (1 connection now open)
2023-11-11T21:05:52.827+0000 I NETWORK [conn2] end connection 127.0.0.1:35762 (0 connections now open)
Step 7) Now start rocket chat and watch the logs
$ docker compose up rocketchat
[+] Building 0.0s (0/0)
[+] Running 2/0
✔ Container chat-mongo-1 Running 0.0s
✔ Container rocketchat Created 0.0s
Attaching to rocketchat
rocketchat | Setting default file store to GridFS
rocketchat | LocalStore: store created at
rocketchat | LocalStore: store created at
rocketchat | LocalStore: store created at
rocketchat | {"line":"120","file":"migrations.js","message":"Migrations: Not migrating, already at version 232","time":{"$date":1699737099178},"level":"info"}
rocketchat | Loaded the Apps Framework and loaded a total of 0 Apps!
rocketchat | Updating process.env.MAIL_URL
rocketchat | Using GridFS for custom sounds storage
rocketchat | Using GridFS for custom emoji storage
rocketchat | Browserslist: caniuse-lite is outdated. Please run:
rocketchat | npx browserslist@latest --update-db
rocketchat |
rocketchat | Why you should do it regularly:
rocketchat | https://github.com/browserslist/browserslist#browsers-data-updating
rocketchat | ➔ System ➔ startup
rocketchat | ➔ +--------------------------------------------------+
rocketchat | ➔ | SERVER RUNNING |
rocketchat | ➔ +--------------------------------------------------+
rocketchat | ➔ | |
rocketchat | ➔ | Rocket.Chat Version: 3.18.7 |
rocketchat | ➔ | NodeJS Version: 12.22.1 - x64 |
rocketchat | ➔ | MongoDB Version: 4.0.18 |
rocketchat | ➔ | MongoDB Engine: wiredTiger |
rocketchat | ➔ | Platform: linux |
rocketchat | ➔ | Process Port: 3131 |
rocketchat | ➔ | Site URL: ------------- |
rocketchat | ➔ | ReplicaSet OpLog: Enabled |
rocketchat | ➔ | Commit Hash: 660c9f5e89 |
rocketchat | ➔ | Commit Branch: HEAD |
rocketchat | ➔ | |
rocketchat | ➔ +--------------------------------------------------+
Step 8) Stop and restartit to make sure all is well
$ docker stop rocketchat; docker stop chat-mongo-1
$ docker compose up -d
All is good now!