Rocket.Chat Documentation - Guide to install Rocket.Chat as HA with mongodb replicaset as backend


Guide to install Rocket.Chat as HA with mongodb replicaset as backend

Install MongoDB Replicaset

Create docker container

  • Use example docker-compose.yaml in repo
  • Fill the INSTANCE_IP env with the local ip of the docker-host (in a 3 node setup this is unique on every host)
  • Fill the passwords from rocket and oplogger
  • Change the IP of every host in the example docker-compose.yaml -> extra_hosts inserts host entries so each rocketchat-container could resolve the others by the name
  • Be sure that the instances could communicate on port 3000 with each other, this is important to see messages on other hosts directly
    image: rocketchat/
        - PORT=3000
        - ROOT_URL=
        - MONGO_URL=mongodb://rocket:password@rocket-1:27017,rocket-2:27017,rocket-3:27017/rocketchat?authSource=admin&replicaSet=rs0&readPreference=nearest&w=majority
        - MONGO_OPLOG_URL=mongodb://oploguser:password@rocket-1:27017,rocket-2:27017,rocket-3:27017/local?authSource=admin&replicaSet=rs0
        - INSTANCE_IP=<ip of the local instance>
        - 3000:3000
        - "rocket-1:"
        - "rocket-2:"
        - "rocket-3:"

Create Loadbalancer

  • Now setup up a reverse proxy on each host to terminate ssl on each node or terminate ssl on the loadbalancer, this is up to you.
  • Setup a loadbalancer to reach each instance on 443 or 3000 (depends on the choice above)

This is a companion discussion topic for the original entry at