Hey folks,
I had this sort of issue in the past already. I am running a docker image with a 3-way real-life (non-docker) mongo cluster. The cluster is alive, online, replicated etc. This setup does work with RocketChat in Docker 4.8.1. Upgrading to 5.x fails with
[root@rc01:~/new-docker] # docker-compose up
WARNING: The DEPLOY_PLATFORM variable is not set. Defaulting to a blank string.
Creating network "new-docker_default" with the default driver
Creating new-docker_rocketchat_1 ... done
Attaching to new-docker_rocketchat_1
rocketchat_1 | /app/bundle/programs/server/node_modules/fibers/future.js:313
rocketchat_1 | throw(ex);
rocketchat_1 | ^
rocketchat_1 |
rocketchat_1 | MongoServerSelectionError: Server selection timed out after 30000 ms
rocketchat_1 | at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/sdam/topology.js:312:38)
rocketchat_1 | at listOnTimeout (internal/timers.js:557:17)
rocketchat_1 | at processTimers (internal/timers.js:500:7) {
rocketchat_1 | reason: TopologyDescription {
rocketchat_1 | type: 'Single',
rocketchat_1 | servers: Map(3) {
rocketchat_1 | 'rc01.example.com:27017' => ServerDescription {
rocketchat_1 | _hostAddress: HostAddress {
rocketchat_1 | isIPv6: false,
rocketchat_1 | host: 'rc01.example.com',
rocketchat_1 | port: 27017
rocketchat_1 | },
rocketchat_1 | address: 'rc01.example.com:27017',
rocketchat_1 | type: 'Unknown',
rocketchat_1 | hosts: [],
rocketchat_1 | passives: [],
rocketchat_1 | arbiters: [],
rocketchat_1 | tags: {},
rocketchat_1 | minWireVersion: 0,
rocketchat_1 | maxWireVersion: 0,
rocketchat_1 | roundTripTime: -1,
rocketchat_1 | lastUpdateTime: 1166882,
rocketchat_1 | lastWriteDate: 0
rocketchat_1 | },
rocketchat_1 | 'rc02.example.com:27017' => ServerDescription {
rocketchat_1 | _hostAddress: HostAddress {
rocketchat_1 | isIPv6: false,
rocketchat_1 | host: 'rc02.example.com',
rocketchat_1 | port: 27017
rocketchat_1 | },
rocketchat_1 | address: 'rc02.example.com:27017',
rocketchat_1 | type: 'Unknown',
rocketchat_1 | hosts: [],
rocketchat_1 | passives: [],
rocketchat_1 | arbiters: [],
rocketchat_1 | tags: {},
rocketchat_1 | minWireVersion: 0,
rocketchat_1 | maxWireVersion: 0,
rocketchat_1 | roundTripTime: -1,
rocketchat_1 | lastUpdateTime: 1166881,
rocketchat_1 | lastWriteDate: 0
rocketchat_1 | },
rocketchat_1 | 'rc03.example.com:27017' => ServerDescription {
rocketchat_1 | _hostAddress: HostAddress {
rocketchat_1 | isIPv6: false,
rocketchat_1 | host: 'rc03.example.com',
rocketchat_1 | port: 27017
rocketchat_1 | },
rocketchat_1 | address: 'rc03.example.com:27017',
rocketchat_1 | type: 'Unknown',
rocketchat_1 | hosts: [],
rocketchat_1 | passives: [],
rocketchat_1 | arbiters: [],
rocketchat_1 | tags: {},
rocketchat_1 | minWireVersion: 0,
rocketchat_1 | maxWireVersion: 0,
rocketchat_1 | roundTripTime: -1,
rocketchat_1 | lastUpdateTime: 1166886,
rocketchat_1 | lastWriteDate: 0
rocketchat_1 | }
rocketchat_1 | },
rocketchat_1 | stale: false,
rocketchat_1 | compatible: true,
rocketchat_1 | heartbeatFrequencyMS: 10000,
rocketchat_1 | localThresholdMS: 15,
rocketchat_1 | setName: 'rc010',
rocketchat_1 | logicalSessionTimeoutMinutes: undefined
rocketchat_1 | }
rocketchat_1 | }
As I am using a real-life mongo cluster, this is my compose.yml:
volumes:
rocketchat:
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: unless-stopped
environment:
MONGO_URL: mongodb://rc01.example.com:27017,rc02.example.com:27017,rc03.example.com:27017/rocketchat?authSource=admin&replicaSet=rc010&w=majority&directConnection=true
MONGO_OPLOG_URL: mongodb://rc01.example.com:27017,rc02.example.com:27017,rc03.example.com:27017/local?authSource=admin&replicaSet=rc01&directConnection=true
ROOT_URL: https://chat.example.com
PORT: ${PORT:-3000}
DEPLOY_METHOD: docker
DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
expose:
- ${PORT:-3000}
ports:
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
volumes:
- /var/rocketchat:/uploads
The mongo_url worked before; I just added &directConnection=true
to the url, to no avail. My .env file:
RELEASE=5.1.2
DOMAIN=chat.example.com
I can confirm Mongo is up an in the version:
mongodb-org-database-tools-extra-5.0.12-1.el8.x86_64
mongodb-org-tools-5.0.12-1.el8.x86_64
mongodb-org-mongos-5.0.12-1.el8.x86_64
mongodb-org-database-5.0.12-1.el8.x86_64
mongodb-mongosh-1.5.4-1.el8.x86_64
mongodb-database-tools-100.6.0-1.x86_64
mongodb-org-server-5.0.12-1.el8.x86_64
mongodb-org-shell-5.0.12-1.el8.x86_64
mongodb-org-5.0.12-1.el8.x86_64
The 3-node cluster of rc01, rc02 and rc03 are both running one instance of rocketchat and one instance of mongo. There are no firewalls between the nodes. Like it said, it does work with 4.8.1, not with 5.x. Switching docker to 4.x makes it work, upgrading to 5.x breaks it.
It must be something trivial. Any help?
-Chris.