RocketChat startup issues

Description

Hello, I am a new user of Rocketchat, I would like to set up this solution for testing on my infrastructure.

I followed the tutorial provided by the rocket chat team, to deploy it https://docs.rocket.chat/docs/deploy-with-docker-docker-compose

The problem is that this is the first time I’m using MongoDB, I keep coming across this error message: 2025-02-06 08:39:36 at Socket. (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/src/cmap/connect.ts:375:38)
2025-02-06 08:39:36 at Object.onceWrapper (node:events:633:26)
2025-02-06 08:39:36 at Socket.emit (node:events:518:28)
2025-02-06 08:39:36 at emitErrorNT (node:internal/streams/destroy:170:8)
2025-02-06 08:39:36 at emitErrorCloseNT (node:internal/streams/destroy:129:3)
2025-02-06 08:39:36 at processTicksAndRejections (node:internal/process/task_queues:90:21) {
2025-02-06 08:39:36 [Symbol(errorLabels)]: Set(1) { ‘ResetPool’ },
2025-02-06 08:39:36 [cause]: Error: getaddrinfo EAI_AGAIN mongo
2025-02-06 08:39:36 at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
2025-02-06 08:39:36 at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-02-06 08:39:36 errno: -3001,
2025-02-06 08:39:36 code: ‘EAI_AGAIN’,
2025-02-06 08:39:36 syscall: ‘getaddrinfo’,
2025-02-06 08:39:36 hostname: ‘mongo’
2025-02-06 08:39:36 }
2025-02-06 08:39:36 }
2025-02-06 08:39:36 }
2025-02-06 08:39:36
2025-02-06 08:39:36 packages/core-runtime.js:189
2025-02-06 08:39:36 throw error;
2025-02-06 08:39:36 ^
2025-02-06 08:39:36 errorClass [Error]: [An error occurred when creating an index for collection "users: Topology is closed]
2025-02-06 08:39:36 at Collection.createIndexAsync (packages/mongo/collection/methods_index.js:64:15)
2025-02-06 08:39:36 at module.wrapAsync.self (packages/accounts-password/password_server.js:1097:1) {
2025-02-06 08:39:36 isClientSafe: true,
2025-02-06 08:39:36 error: ‘An error occurred when creating an index for collection "users: Topology is closed’,
2025-02-06 08:39:36 reason: undefined,
2025-02-06 08:39:36 details: undefined,
2025-02-06 08:39:36 errorType: ‘Meteor.Error’
2025-02-06 08:39:36 }
2025-02-06 08:39:36
2025-02-06 08:39:36 Node.js v22.11.0

I can’t figure out where the problem could come from, how to correct it, I tried to search on several forums, but I couldn’t find the solution.

Thank you for your help

Server Setup Information

  • Version of Rocket.Chat Server: 7.3.0
  • Operating System: Docker Desktop Windows
  • Deployment Method: Docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: ?
  • NodeJS Version: ?
  • MongoDB Version: ?
  • Proxy: No
  • Firewalls involved: No

You will have to show us what you have in your compose and .env file

Operating System: Docker Desktop Windows

Note this is not a recommended operating system.

Good morning,

Sorry for the response time, here is the information for the .env, and the composer

I did the test on an Ubuntu 24.10, I have the same problem

Compose.yml

volumes:
  mongodb_data: { driver: local }

services:
  rocketchat:
    image: ${IMAGE:-registry.rocket.chat/rocketchat/rocket.chat}:${RELEASE:-latest}
    restart: always
    labels:
      traefik.enable: "true"
      traefik.http.routers.rocketchat.rule: Host(`${DOMAIN:-}`)
      traefik.http.routers.rocketchat.tls: "true"
      traefik.http.routers.rocketchat.entrypoints: https
      traefik.http.routers.rocketchat.tls.certresolver: le
    environment:
      MONGO_URL: "mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/${MONGODB_DATABASE:-rocketchat}?authSource=admin&replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}"
      MONGO_OPLOG_URL: "mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/local?authSource=admin&replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}"
      ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3000}}
      PORT: ${PORT:-3000}
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: ${DEPLOY_PLATFORM:-}
      REG_TOKEN: ${REG_TOKEN:-}
    depends_on:
      - mongodb
    expose:
      - ${PORT:-3000}
    ports:
      - "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"

  mongodb:
    image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-6.0}
    restart: always
    volumes:
      - 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_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
      MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
      MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
      ALLOW_EMPTY_PASSWORD: no
      MONGODB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
      MONGODB_USERNAME: ${MONGODB_USERNAME}
      MONGODB_PASSWORD: ${MONGODB_PASSWORD}
      MONGODB_DATABASE: ${MONGODB_DATABASE:-rocketchat}
      MONGODB_REPLICA_SET_KEY: ${MONGODB_REPLICA_SET_KEY}

env :

### Rocket.Chat configuration

# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
RELEASE=7.2.1
# MongoDB endpoint (include ?replicaSet= parameter)
#MONGO_URL=
# MongoDB endpoint to the local database
#MONGO_OPLOG_URL=
# IP to bind the process to
#BIND_IP=
# URL used to access your Rocket.Chat instance
#ROOT_URL=
# Port Rocket.Chat runs on (in-container)
#PORT=
# Port on the host to bind to
#HOST_PORT=

MONGODB_USERNAME=vboxuser
MONGODB_PASSWORD=changeme

### MongoDB configuration
# MongoDB version/image tag
MONGODB_VERSION=8.0.4
MONGO_URL=mongodb://rocketchat:passwd@localhost:27017/rocketchat?replicaSet=rs01&authSource=rocketchat
MONGO_OPLOG_URL=mongodb://rocketchat:passwd@localhost:27017/local?replicaSet=rs01&authSource=rocketchat
# See:- https://hub.docker.com/r/bitnami/mongodb
MONGODB_ROOT_USERNAME=root
MONGODB_ROOT_PASSWORD=changeme

### Traefik config (if enabled)
# Traefik version/image tag
#TRAEFIK_RELEASE=
# Domain for https (change ROOT_URL & BIND_IP accordingly)
#DOMAIN=
# Email for certificate notifications
#LETSENCRYPT_EMAIL=

First obvious thing is use a supported Mongo.

See the release notes.

I have a feeling that this is due to the replicaset not being created on first run but am out & about today.

Does the server actually come up?

Will try & check later.

@reetp

Thank you for your feedback,

according to you it is a problem with the realease that I put in mongodb?

Just to be sure we don’t have a Mongo server downloaded in addition? to tell you the machine I use and blank with nothing in it I simply followed the tutorial

@reetp

Don’t @ people - I don’t work here and you are liable to get muted. I help as and when I can.

according to you it is a problem with the release that I put in mongodb?

Nope I didn’t say that.

If you are trying to debug then don’t go off piste. Stick to known proven settings we know have been tested and work.

Take away what it can’t be and all that is left is the answer.

Just to be sure we don’t have a Mongo server downloaded in addition? to tell you the machine I use and blank with nothing in it I simply followed the tutorial

Why? You are using a docker Mongo. Why would you use another?

The compose file default to Mongo 6

${MONGODB_VERSION:-6.0}

You have this enabled

traefik.enable: "true"

But no Domain set.

### Traefik config (if enabled)
# Domain for https (change ROOT_URL & BIND_IP accordingly)
#DOMAIN=

You have also set these but at a guess you aren’t sure what you are doing.

MONGODB_USERNAME=vboxuser
MONGODB_PASSWORD=changeme

### MongoDB configuration
# MongoDB version/image tag
MONGODB_VERSION=8.0.4
MONGO_URL=mongodb://rocketchat:passwd@localhost:27017/rocketchat?replicaSet=rs01&authSource=rocketchat
MONGO_OPLOG_URL=mongodb://rocketchat:passwd@localhost:27017/local?replicaSet=rs01&authSource=rocketchat
# See:- https://hub.docker.com/r/bitnami/mongodb
MONGODB_ROOT_USERNAME=root
MONGODB_ROOT_PASSWORD=changeme

The Mongo URLS are already set in the compose file here

    environment:
      MONGO_URL: "mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/${MONGODB_DATABASE:-rocketchat}?authSource=admin&replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}"
      MONGO_OPLOG_URL: "mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/local?authSource=admin&replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}"

You only need to add these in the .env.

MONGODB_USERNAME=vboxuser
MONGODB_PASSWORD=changeme

Something like this:

RELEASE=7.2.1
MONGODB_VERSION=7.0
MONGODB_USERNAME=vboxuser
MONGODB_PASSWORD=changeme

Disable traefik in your compose file at least for now until you have a resolvable domain eg chat.myserver.com

Server should run on 127.0.0.1:3000

Well, I figured out the problem.

This looks like MongoDB from v5.0 and on the avx/avx2 requirement which my guest VM (VirtualBox) just wasn’t providing. It seems to have something to do with Microsoft’s Hyper-V (host is Windows 11) which seems to be difficult to turn off.

Sooo, what I did was I specified the MongoDB version 4.4 version in my .env file. The relevant line looks like this:
MONGODB_VERSION=4.4

Just be warned that this will only work until RocketChat version 7 is released which will force MongoDB v5.0 or higher… according to a message I received in the terminal when the Docker containers were first arriving.

Hope this helps someone.

Yup. Mongo 5+ required AVX extensions - that is a Mongo decision not Rocket. Shortly going EOL and minimum will be 6.

Thanks for posting back - I knew I’d seen it somewhere before but forgot :fearful:

On some stuff like Proxmox you can run in host mode to attach to the underlying CPU + extensions if it has AVX.

It is a pain but there is no going back. You’ll have to fix the issue not hack around it.