It seems that rocket is connected to mongo, but it keeps loading when opening the website, so there is something wrong with my configuration.
I use the officially recommended docker configuration
The website is at this location
https://docs.rocket.chat/deploy/deploy-rocket.chat/deploy-with-docker-and-docker-compose First of all, I was confused when I first saw it. His description seemed to be that I only need to modify MONGO_URL and ROOT_URL. The problem lies in this MONGO_URL. I thought that user and pass were filled in casually, and then the env help would be automatically passed. I went to generate it in mongo, but I soon discovered that the rocket could not be connected. I found the reason for this was the host, because I asked Bing chat, and then after connecting, it prompted that the authentication information failed, and then I tried again. After searching many ways, I entered the mongo container and finally created a user and password. The final status was that it didn't seem to report an error, and then it kept loading when I opened the website.
[root@tom chat]# tree -a .
.
├── compose.yml
└── .env
0 directories, 2 files
[root@tom chat]#
[root@tom chat]# cat compose.yml
volumes:
mongodb_data: { driver: local }
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: always
labels:
traefik.enable: "true"
traefik.http.routers.rocketchat.rule: Host(`${DOMAIN:-}`)
traefik.http.routers.rocketchat.tls: "true"
traefik.http.routers.rocketchat.entrypoints: https
traefik.http.routers.rocketchat.tls.certresolver: le
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:
- mongodb
expose:
- ${PORT:-3000}
ports:
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
mongodb:
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-5.0}
restart: always
volumes:
- mongodb_data:/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}
[root@tom chat]#
[root@tom chat]# cat .env
### Rocket.Chat configuration
# Rocket.Chat version
# see:- https://github.com/RocketChat/Rocket.Chat/releases
#RELEASE=
# MongoDB endpoint (include ?replicaSet= parameter)
MONGO_URL=mongodb://rocketchat:admin123@mongodb:27017/rocketchat?authSource=admin
ROOT_URL=http://localhost:3000
# MongoDB endpoint to the local database
#MONGO_OPLOG_URL=
# IP to bind the process to
#BIND_IP=
# URL used to access your Rocket.Chat instance
ROOT_URL=http://localhost:3000
# Port Rocket.Chat runs on (in-container)
#PORT=
# Port on the host to bind to
#HOST_PORT=
### MongoDB configuration
# MongoDB version/image tag
#MONGODB_VERSION=
# See:- https://hub.docker.com/r/bitnami/mongodb
### Traefik config (if enabled)
# Traefik version/image tag
#TRAEFIK_RELEASE=
# Domain for https (change ROOT_URL & BIND_IP accordingly)
#DOMAIN=
# Email for certificate notifications
#LETSENCRYPT_EMAIL=
[root@tom chat]#
[root@mx ~]# docker exec -it MongoDB bash
root@mongodatabase:/#
root@mongodatabase:/# mongo
mongodatabase:SECONDARY> rs.initiate()
{
"ok" : 0,
"errmsg" : "already initialized",
"code" : 23,
"codeName" : "AlreadyInitialized",
"$clusterTime" : {
"clusterTime" : Timestamp(1635072585, 2),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1635072585, 2)
}
mongodatabase:PRIMARY> use admin
switched to db admin
mongodatabase:PRIMARY>
db.createUser({user: "root",pwd: "admin123",roles: [{ role: "root", db: "admin"}]})
db.createUser({user: "rocketchat",pwd: "admin123",roles: [{role: "readWrite", db: "local" }]})
use rocketchat
db.createUser({user: "rocketchat",pwd: "admin123",roles: [{role: "dbOwner",db: "rocketchat" }]})