Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose yml still uses Mongo DB 4.0 #24160

Closed
dyfet opened this issue Jan 13, 2022 · 3 comments · Fixed by #23426
Closed

Docker compose yml still uses Mongo DB 4.0 #24160

dyfet opened this issue Jan 13, 2022 · 3 comments · Fixed by #23426

Comments

@dyfet
Copy link

dyfet commented Jan 13, 2022

Description:

docker-compose.yml still defaults to both mongodb 4.0 and the mmapv1 storage engine. This is true in both master and the develop branch. Currently mongodb is deprecated in RocketChat, and will be unsupported when 5.0 is released.

While in theory the compose can be updated to mongodb 4.2 or later, in fact if you already have a running rocketchat based on the current compose, to do so you now have a ?manual? backend db migration issue to use the new storage engine.

Steps to reproduce:

use the existing docker-compose.yml:
docker-compose up

let it create a site...

login to your new site...you will be notified your mongodb version is deprecated and will be dropped in 5.0...

Expected behavior:

have the official compose already use the current/more current mongodb with correct command line options for that so I don't get an unsupportable site...

Actual behavior:

This compose will kill 5.0 installs.

Server Setup Information:

  • Version of Rocket.Chat Server: 4.3.1
  • Operating System: ububtu
  • Deployment Method: docker-compose
  • Number of Running Instances: 1
  • DB Replicaset Oplog: -oplogSize 128 --replSet rs0
  • NodeJS Version: 12.22.8
  • MongoDB Version: 4.0

Client Setup Information

  • Desktop App or Browser Version:
  • Operating System:

Additional context

The purpose of this issue is to update the docker-compose.yml to a more valid mongodb version for those who blindly use it like I did...

Relevant logs:

rocketchat_1 | +----------------------------------------------------------------------+
rocketchat_1 | | DEPRECATION |
rocketchat_1 | +----------------------------------------------------------------------+
rocketchat_1 | | |
rocketchat_1 | | YOUR CURRENT MONGODB VERSION (4.0.27) IS DEPRECATED. |
rocketchat_1 | | IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER, |
rocketchat_1 | | PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER

@JLammering
Copy link

If you try to docker-compose rocket.chat with mongo 5.0. you have to exchange the mongo related part with this:

mongo:
    image: mongo:5.0
    restart: unless-stopped
    volumes:
     - ./data/db:/data/db
     #- ./data/dump:/dump
    command: mongod --oplogSize 128 --replSet rs0
    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:5.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

Essentially I stated the new version in mongo and mongo-init-replica and removed the smallfiles and storageEngine option in the mongo command.

@dyfet
Copy link
Author

dyfet commented Feb 8, 2022

Thanks, this worked, I never had to work with mongo before...

@StarWhiz
Copy link

StarWhiz commented Feb 22, 2022

Just wanted to add that this does not work if you already have an existing data/db folder that was on 4.0 (mmapv1). So deleting the data folder and running docker-compose up -d will work.

If you want to keep your old data instead of deleting.

You will need to migrate the database from mmapv1 to WiredTiger as documented here: https://docs.mongodb.com/manual/tutorial/change-standalone-wiredtiger/

In my case I did

docker exec <CONTAINER_NAME> mongodump --out /dump
to export the database
docker cp <CONTAINER_NAME>:/dump ~/docker/rocketchat/dump
to copy the database from the container to my host in one of my home folders.

After that on the new instance of rocket.chat mongodb ...
docker cp ~/docker/rocketchat/dump rocketchat-db:/dump
to copy the database from host to new container
docker exec -i rocketchat-db /usr/bin/mongorestore /dump
to restore the database

Finally I enter in the new container with
docker exec -it <container_name> /bin/bash
and delete the copied dump inside the container with
rm -rf /dump

@kodiakhq kodiakhq bot closed this as completed in #23426 Jun 10, 2022
kodiakhq bot pushed a commit that referenced this issue Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants