Rocket.Chat
Setup Rocket.Chat locally with Docker
For a minimal effort local Rocket.Chat installation follow the steps below.
$ docker pull rocket.chat
$ docker run --name db -d mongo:latest --replSet rs0 --oplogSize 128
$ docker exec -ti db mongosh --eval "printjson(rs.initiate())"
$ docker run --name rocketchat -p 80:3000 --link db --env ROOT_URL=http://chat.mydomain.local --env MONGO_OPLOG_URL=mongodb://db:27017/local -d rocket.chat
## Add 'chat.mydomain.local' to /etc/hosts
$ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' rocketchat
$ vim /etc/hosts
Open your browser and go to http://chat.mydomain.local
, follow the Wizard to create your first Administrator account. One step 4/4 you'll get stuck pending verification, we can bypass this by manually setting Show_Setup_Wizard
to complete
in the database.
$ docker exec -it db /bin/bash
root@44f612268905:/# mongosh
test> show databases
test> use meteor
meteor> db.rocketchat_settings.update({"_id":"Show_Setup_Wizard"}, {$set: {"value" : "completed"} });
Everything is now complete and you should be able to use your Rocket.Chat application.
Setup Rocket.Chat using docker compose
In this example we'll setup Rocket.Chat version 7.3.0 with MongoDB 6.0.13.
Download / copy the latest docker compose file from Rocket.Chat git, edit the compose file to your likings. My file:
volumes:
rocket-data: { driver: local }
rocket-db: { driver: local }
networks:
proxy:
name: proxy_network
backend-db:
services:
rocketchat:
container_name: rocketchat
image: ${IMAGE:-registry.rocket.chat/rocketchat/rocket.chat}:${RELEASE:-latest}
restart: always
volumes:
- rocket-data:/data/rocket
environment:
MONGO_URL: "${MONGO_URL:-\
mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\
-mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
local?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:
- rocket_mongodb
expose:
- ${PORT:-3000}
ports:
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
networks:
- proxy
- backend-db
rocket_mongodb:
container_name: rocket_mongodb
hostname: mongodb
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-6.0}
restart: always
volumes:
- rocket-db:/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: ${ALLOW_EMPTY_PASSWORD:-yes}
networks:
- backend-db
Create a .env
file:
# URL used to access your Rocket.Chat instance
ROOT_URL=http://chat.mydomain.local:3000
Create the stack using portainer and we should be presented with rocket.chat's setup wizard (if npm and firewall configuration is correct).
Bypass installation wizard
On first install going through the installation wizard we'll get stuck on "Awaiting confirmation (Step 4/4)".
We can bypass this by modifying the database that the wizard has been completed.
From portainer open the console to rocket_mongodb
.
I have no name!@mongodb:/$ mongosh
rs0 [direct: primary] config> use rocketchat
rs0 [direct: primary] rocketchat> db.rocketchat_settings.updateOne({"_id":"Show_Setup_Wizard"}, {$set: {"value" : "completed"} });
Other nice-to-have database commands:
-- List users
db.users.find()
-- Change password
DESKTOP-I18EGAL :: ~ » sudo apt install apache2-utils
DESKTOP-I18EGAL :: ~ » htpasswd -bnBC 10 "" 'THIS-IS-A-P@SSW0RD!' | tr -d ':\n' | sed 's/$2y/$2b/'
$2b$10$d7MEraem0zEA6064A0JFKe.XlY95gU/WUpsGE2PZPDLw6P5OiK9Cx
db.users.updateOne( {username:"void"}, { $set: {"services.password.bcrypt" : "$2b$10$d7MEraem0zEA6064A0JFKe.XlY95gU/WUpsGE2PZPDLw6P5OiK9Cx" }})
-- add roles to user
db.users.updateOne( {username:"void"}, { $set: { "roles.1": 'admin'} })
db.users.updateOne( {username:"void"}, { $set: { "roles.2": 'bot'} })
-- delete user
db.users.deleteOne( {username:"void"})
-- disable 2fa
db.users.updateOne( {username:"void"}, { $set: {"services.email2fa.enabled" : false} })
-- verify email
db.users.updateOne({ username: 'void' }, { $set: {"emails.0.verified": false} })
Last updated
Was this helpful?