Hey folks,
I am having a hell of a time upgrading my one standalone docker container. So far (up to 4.8.1) I have been using this gem:
version: '2'
services:
rocketchat-nnx:
image: registry.rocket.chat/rocketchat/rocket.chat:4.8.1
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/docker_data/chat.example.com/rocketchat:/var/lib/rocket.chat
environment:
- PORT=3003
- ROOT_URL=https://chat.example.com
- MONGO_URL=mongodb://mongo-nnx:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo-nnx:27017/local
- MAIL_URL=smtp:/mail.example.com
depends_on:
- mongo-nnx
ports:
- 3003:3003
mongo-nnx:
image: mongo:5.0.6
restart: unless-stopped
volumes:
- /var/docker_data/chat.example.com/db:/data/db
command: mongod --oplogSize 128 --replSet rs0
Now with RocketChat 5.x, the compose script got rewamped quite a lot. I tried to adapt it to the best of my abilites:
volumes:
mongo-nnx_data: { driver: local }
services:
rocketchat-nnx:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: on-failure
environment:
PORT: 3003
ROOT_URL: https://chat.example.com
MONGO_URL: mongodb://mongo-nnx:27017/rocketchat
MONGO_OPLOG_URL: mongodb://mongo-nnx:27017/local
MAIL_URL: smtp://mail.example.com
DEPLOY_METHOD: docker
# DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
depends_on:
- mongo-nnx
expose:
- ${PORT:-3000}
ports:
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
volumes:
- /var/docker_data/chat.example.com/rocketchat:/var/lib/rocket.chat
mongo-nnx:
image: mongo:${MONGODB_VERSION:-4.4}
restart: on-failure
volumes:
- /var/docker_data/chat.example.com/db:/data/db
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:-mongo-nnx}
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongo-nnx}
MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}
command: mongod --oplogSize 128 --replSet rs0
With this accomodating .env file:
# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
RELEASE=5.0.5
# MongoDB endpoint (include ?replicaSet= parameter)
MONGO_URL= "mongodb://mongo-nnx:27017/rocketchat?replicaSet=rs0"
# MongoDB endpoint to the local database
MONGO_OPLOG_URL= "mongodb://mongo-nnx:27017/local"
# IP to bind the process to
BIND_IP= "127.0.0.1"
# URL used to access your Rocket.Chat instance
ROOT_URL= "https://chat.example.com"
# Port Rocket.Chat runs on (in-container)
PORT= "3000"
# Port on the host to bind to
HOST_PORT= "3003"
DOMAIN="chat.example.com"
### MongoDB configuration
# MongoDB version/image tag
MONGODB_RELEASE="5.0.6"
MONGODB_VERSION="5.0.6"
Now, mongo boots up and finds its database, but RC fails to connect:
rocketchat-wme-rocketchat-wme-1 | at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/sdam/topology.js:312:38)
rocketchat-wme-rocketchat-wme-1 | at listOnTimeout (internal/timers.js:557:17)
rocketchat-wme-rocketchat-wme-1 | at processTimers (internal/timers.js:500:7) {
rocketchat-wme-rocketchat-wme-1 | reason: TopologyDescription {
rocketchat-wme-rocketchat-wme-1 | type: 'ReplicaSetNoPrimary',
rocketchat-wme-rocketchat-wme-1 | servers: Map(1) {
rocketchat-wme-rocketchat-wme-1 | 'localhost:27017' => ServerDescription {
rocketchat-wme-rocketchat-wme-1 | _hostAddress: HostAddress { isIPv6: false, host: 'localhost', port: 27017 },
rocketchat-wme-rocketchat-wme-1 | address: 'localhost:27017',
rocketchat-wme-rocketchat-wme-1 | type: 'Unknown',
rocketchat-wme-rocketchat-wme-1 | hosts: [],
rocketchat-wme-rocketchat-wme-1 | passives: [],
rocketchat-wme-rocketchat-wme-1 | arbiters: [],
rocketchat-wme-rocketchat-wme-1 | tags: {},
rocketchat-wme-rocketchat-wme-1 | minWireVersion: 0,
rocketchat-wme-rocketchat-wme-1 | maxWireVersion: 0,
rocketchat-wme-rocketchat-wme-1 | roundTripTime: -1,
rocketchat-wme-rocketchat-wme-1 | lastUpdateTime: 448106514,
rocketchat-wme-rocketchat-wme-1 | lastWriteDate: 0,
rocketchat-wme-rocketchat-wme-1 | error: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
rocketchat-wme-rocketchat-wme-1 | at connectionFailureError (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:381:20)
rocketchat-wme-rocketchat-wme-1 | at Socket.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connect.js:301:22)
rocketchat-wme-rocketchat-wme-1 | at Object.onceWrapper (events.js:520:26)
rocketchat-wme-rocketchat-wme-1 | at Socket.emit (events.js:400:28)
rocketchat-wme-rocketchat-wme-1 | at emitErrorNT (internal/streams/destroy.js:106:8)
rocketchat-wme-rocketchat-wme-1 | at emitErrorCloseNT (internal/streams/destroy.js:74:3)
rocketchat-wme-rocketchat-wme-1 | at processTicksAndRejections (internal/process/task_queues.js:82:21)
rocketchat-wme-rocketchat-wme-1 | }
rocketchat-wme-rocketchat-wme-1 | },
rocketchat-wme-rocketchat-wme-1 | stale: false,
rocketchat-wme-rocketchat-wme-1 | compatible: true,
rocketchat-wme-rocketchat-wme-1 | heartbeatFrequencyMS: 10000,
rocketchat-wme-rocketchat-wme-1 | localThresholdMS: 15,
rocketchat-wme-rocketchat-wme-1 | setName: 'rs0',
rocketchat-wme-rocketchat-wme-1 | maxSetVersion: 1,
rocketchat-wme-rocketchat-wme-1 | maxElectionId: ObjectId {
rocketchat-wme-rocketchat-wme-1 | [Symbol(id)]: Buffer(12) [Uint8Array] [
rocketchat-wme-rocketchat-wme-1 | 127, 255, 255, 255, 0,
rocketchat-wme-rocketchat-wme-1 | 0, 0, 0, 0, 0,
rocketchat-wme-rocketchat-wme-1 | 0, 16
rocketchat-wme-rocketchat-wme-1 | ]
rocketchat-wme-rocketchat-wme-1 | },
rocketchat-wme-rocketchat-wme-1 | commonWireVersion: 13,
rocketchat-wme-rocketchat-wme-1 | logicalSessionTimeoutMinutes: undefined
rocketchat-wme-rocketchat-wme-1 | }
rocketchat-wme-rocketchat-wme-1 | }
rocketchat-wme-rocketchat-wme-1 exited with code 1
It tries to connect to 127.0.0.1? Why would it do that?
I set all the urls correctly; or is it due to the repl issue?
I would use the new compose, but I do not know how to migrate from old to the new. The upgrade path is not clear (or documented).
Help please