Description
Please assist with my Docker Rocket Chat Upgrade from V4.8.2 to V5.0.3
Rocket Chat is working 100% in Docker with MongoDB 4.4.14 and RocketChat v4.8.2.
When changing the docker-compose.yml
file to use image: registry.rocket.chat/rocketchat/rocket.chat:5.0.3
, I get error’s connecting to the MongoDB.
The MONGO_URL
is defined as environment in the docker-compose.yml file as MONGO_URL=mongodb://mongo:27017/rocketchat
and is working with RocketChat 4.8.2.
Even with this environment set, it seems RocketChat is still looking for MongoDB at 127.0.0.1 when is is not there.
Docker Compose file and RockerChat Error Log added below under Additional Information
Server Setup Information
- Version of Rocket.Chat Server: 4.8.2
- Operating System: CentOS Linux 7 (Core)
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: 14.18.3 - x64
- MongoDB Version: 4.4.14 wiredTiger
- Proxy: nginx
- Firewalls involved: n/a
Any additional Information
docker-compose.yml
version: '2'
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:4.8.2
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:
- ./uploads:/app/uploads
environment:
- PORT=3000
- ROOT_URL=https://chat.dev.jennyme.co.za
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
- REG_TOKEN=${REG_TOKEN}
- CREATE_TOKENS_FOR_USERS=true
depends_on:
- mongo
ports:
- 3000:3000
labels:
- "traefik.backend=rocketchat"
- "traefik.frontend.rule=Host: your.domain.tld"
mongo:
image: mongo:4.4
restart: unless-stopped
volumes:
- ./data/db:/data/db
- ./data/dump:/dump
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
labels:
- "traefik.enable=false"
mongo-init-replica:
image: mongo:4.4
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
nginx:
image: nginx
ports:
- 80:80
- 443:443
restart: unless-stopped
volumes:
- ./nginx/rocketchat.conf:/etc/nginx/conf.d/default.conf
- ./nginx/cert/:/etc/nginx/ssl/
RocketChat Error Log
rocketchat_1 | /app/bundle/programs/server/node_modules/fibers/future.js:313
rocketchat_1 | throw(ex);
rocketchat_1 | ^
rocketchat_1 |
rocketchat_1 | MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
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: 'ReplicaSetNoPrimary',
rocketchat_1 | servers: Map(1) {
rocketchat_1 | 'localhost:27017' => ServerDescription {
rocketchat_1 | _hostAddress: HostAddress { isIPv6: false, host: 'localhost', port: 27017 },
rocketchat_1 | address: 'localhost: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: 4257002544,
rocketchat_1 | lastWriteDate: 0,
rocketchat_1 | error: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
rocketchat_1 | at connectionFailureError (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:381:20)
rocketchat_1 | at Socket.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:301:22)
rocketchat_1 | at Object.onceWrapper (events.js:520:26)
rocketchat_1 | at Socket.emit (events.js:400:28)
rocketchat_1 | at emitErrorNT (internal/streams/destroy.js:106:8)
rocketchat_1 | at emitErrorCloseNT (internal/streams/destroy.js:74:3)
rocketchat_1 | at processTicksAndRejections (internal/process/task_queues.js:82:21)
rocketchat_1 | }
rocketchat_1 | },
rocketchat_1 | stale: false,
rocketchat_1 | compatible: true,
rocketchat_1 | heartbeatFrequencyMS: 10000,
rocketchat_1 | localThresholdMS: 15,
rocketchat_1 | setName: 'rs0',
rocketchat_1 | maxSetVersion: 1,
rocketchat_1 | maxElectionId: ObjectId {
rocketchat_1 | [Symbol(id)]: Buffer(12) [Uint8Array] [
rocketchat_1 | 127, 255, 255, 255, 0,
rocketchat_1 | 0, 0, 0, 0, 0,
rocketchat_1 | 0, 16
rocketchat_1 | ]
rocketchat_1 | },
rocketchat_1 | commonWireVersion: 9,
rocketchat_1 | logicalSessionTimeoutMinutes: undefined
rocketchat_1 | }
rocketchat_1 | }