Error in starting Rocket chat Vis docker compose file

Description

The docker image keeps restarting when started from docker compose. only modification that I did in .env file was to define the release for rocket chat to 6.5.0

Server Setup Information

  • Version of Rocket.Chat Server: 6.5.0
  • Operating System: Debian Linux
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: not sure based on docker
  • MongoDB Version: 5.0
  • Proxy: None
  • Firewalls involved: None

Any additional Information

MongoRuntimeError: Unable to parse ${MONGODB_ADVERTISED_HOSTNAME:-mongodb:27017 with URL
at new HostAddress (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:848:34)
at fromString (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:890:16)
at Array.map ()
at parseOptions (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/connection_string.js:197:45)
at new MongoClient (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongo_client.js:46:63)
at new MongoConnection (packages/mongo/mongo_driver.js:191:17)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:9:16)
at Object. (packages/mongo/remote_collection_driver.js:66:18)
at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
at new Collection (packages/mongo/collection.js:127:40)
at AccountsServer._initializeCollection (packages/accounts-base/accounts_common.js:98:20)
at new AccountsCommon (packages/accounts-base/accounts_common.js:46:23)
at new AccountsServer (packages/accounts-base/accounts_server.js:30:5)
at packages/accounts-base/server_main.js:7:12
at module (packages/accounts-base/server_main.js:19:31)
at fileEvaluate (packages/modules-runtime.js:336:7) {
cause: TypeError [ERR_INVALID_URL] [ERR_INVALID_URL]: Invalid URL: iLoveJS://${MONGODB_ADVERTISED_HOSTNAME:-mongodb:27017
at new NodeError (internal/errors.js:322:7)
at onParseError (internal/url.js:270:9)
at new URL (internal/url.js:346:5)
at new HostAddress (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:845:19)
at fromString (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:890:16)
at Array.map ()
at parseOptions (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/connection_string.js:197:45)
at new MongoClient (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongo_client.js:46:63)
at new MongoConnection (packages/mongo/mongo_driver.js:191:17)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:9:16)
at Object. (packages/mongo/remote_collection_driver.js:66:18)
at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
at new Collection (packages/mongo/collection.js:127:40)
at AccountsServer._initializeCollection (packages/accounts-base/accounts_common.js:98:20)
at new AccountsCommon (packages/accounts-base/accounts_common.js:46:23)
at new AccountsServer (packages/accounts-base/accounts_server.js:30:5) {
input: ‘iLoveJS://${MONGODB_ADVERTISED_HOSTNAME:-mongodb:27017’,
code: ‘ERR_INVALID_URL’
},
[Symbol(errorLabels)]: Set(0) {}
}

Log From mongodb docker container:
hot count: 0, oldest timestamp: (1703522542, 1) , meta checkpoint timestamp: (1703522842, 1) base write gen: 324"}}
{“t”:{“$date”:“2023-12-25T16:48:24.846+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703522904:846731][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 171, snapshot max: 171 snapshot count: 0, oldest timestamp: (1703522602, 1) , meta checkpoint timestamp: (1703522902, 1) base write gen: 324”}}
{“t”:{“$date”:“2023-12-25T16:49:25.056+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703522965:56225][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 186, snapshot max: 186 snapshot count: 0, oldest timestamp: (1703522662, 1) , meta checkpoint timestamp: (1703522962, 1) base write gen: 324”}}
{“t”:{“$date”:“2023-12-25T16:50:25.226+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703523025:226257][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 201, snapshot max: 201 snapshot count: 0, oldest timestamp: (1703522722, 1) , meta checkpoint timestamp: (1703523022, 1) base write gen: 324”}}
{“t”:{“$date”:“2023-12-25T16:51:25.487+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703523085:487601][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 216, snapshot max: 216 snapshot count: 0, oldest timestamp: (1703522782, 1) , meta checkpoint timestamp: (1703523082, 1) base write gen: 324”}}
{“t”:{“$date”:“2023-12-25T16:52:25.831+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703523145:831747][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 231, snapshot max: 231 snapshot count: 0, oldest timestamp: (1703522842, 1) , meta checkpoint timestamp: (1703523142, 1) base write gen: 324”}}
{“t”:{“$date”:“2023-12-25T16:53:26.068+00:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1703523206:68543][1:0x7f83c111b700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 246, snapshot max: 246 snapshot count: 0, oldest timestamp: (1703522902, 1) , meta checkpoint timestamp: (1703523202, 1) base write gen: 324”}}

Did you ever get an answer on this? Having the same problem sadly.

The answer is in the first line.

Pretty sure yours is different so please give some proper debug info.

Long logs on pastebin etc please.

Sorry, not sure what you mean by the answer is in the first line. Without any modifications to a docker compose file why would this error show up? A default installation should not break in this way, no?

Just to let you know, as I do believe I had the same problem, I managed to temporarily fix this by manually setting the MONGO_URL field in services->rocketchat->environment section on compose.yml to the following:

MONGO_URL: mongodb://mongodb:27017/rocketchat?replicaSet=rs0

This is simply the fallback defaults provided by the environment file without the variables. The default line is this:

MONGO_URL: “${MONGO_URL:-
mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/
${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}”

Does this not mean that there is an issue with the variables in the MONGO_URL field of compose.yml that is resulting in the string not being properly parsed for deployment? Please let me know what debug information you require and I can provide that today, thanks very much for the response.

Because it is.

Before stating such things bear in mind that these files are used by many people. There would be a truck load of issues if they were wrong. If you check github, here, open.rocket there aren’t.

However, there are a plethora of people not understand ing what they are doing, not reading the docs, making mistakes etc.

If you read the docs carefully it clearly says:

download the example compose.yml file

Edit environment variables

Note ‘example’ and Edit.

https://docs.rocket.chat/docs/deploy-with-docker-docker-compose

So that means that whatever the OP, and you , have done is incorrect.

If you read the files you will see that

MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}

In other words use the .env variable MONGODB_ADVERTISED_HOSTNAME or if not default to mongodb which is the name of the container, as you said.

Which is what you have shortened it too here:

manually setting the MONGO_URL field in services->rocketchat->environment section on compose.yml to the following:

MONGO_URL: mongodb://mongodb:27017/rocketchat?replicaSet=rs0

So somewhere, somehow you have got something wrong syntactically.

As you haven’t provided details of your logs or your setup it’s hard to guess. I can only go on what someone posted a year ago.

The compose file was completely unmodified when I downloaded it and tried to run. If the defaults are in place, and there is no change by me, it should work. Formatting issue when running curl? No idea. I’m not arguing that something may have happened but I can assure you no changes were made to the yaml.

The steps from the links you sent (that, yes, I had already looked at):

-Go to your preferred directory and create a compose.yml file and copy the content from [our example](https:// github .com/RocketChat/Docker.Official.Image/blob/master/compose.yml).

Alternatively, you can use the curl command to download the example compose.yml file by executing this command:

curl -L https:// raw.githubusercontent .com/RocketChat/Docker.Official.Image/master/compose.yml -O

-Set the RELEASE variable in the .env to your desired Rocket.Chat version. See our [releases page] and [available docker images]. Keeping the default release as latest is not recommended.

Both of these steps were done and I changed release as needed. The guide doesn’t say to set anything else unless you want to do something different like a standalone MongoDB server.

Logs: user@rocketchat:/home/rocketchat# docker logs -f rocketchat_rocketchat_1(node: - Pastebin.com

compose.yml: user@rocketchat:/home/rocketchat# cat compose.yml volumes: mongodb_data: - Pastebin.com

I provided whatever details were requested from the setup on my own post for this, but here you go:

Server Setup Information

Version of Rocket.Chat Server: 7.0.3 (prev tried 6.13.0/6.13.1)
Operating System: Debian 12.5
Deployment Method: docker
Number of Running Instances: 1
DB Replicaset Oplog:
NodeJS Version: Appears to be 20.17.0
MongoDB Version: 6.0
Proxy: Proxy used to download the images, nothing else running locally
Firewalls involved: None

I can only put 2 links in a post so the env and oplog status are here:

oplog: rs0 [direct: primary] test> rs.printReplicationInfo()actual oplog size'990 M - Pastebin.com

.env: user@rocketchat:/home/rocketchat# cat .env### Rocket.Chat configuration # - Pastebin.com

Also, if it helps at all, this is a Debian VM like I said before, but it is running on Proxmox.

Once more, please let me know if there is any additional info needed.

Edit: one thing I will try is verifying docker version and seeing if the parsing error is due to a version problem.

Best,
Krish

I said before. It is an EXAMPLE. It is a ‘representation’. That does NOT mean it is guaranteed to work.

The same with the .env file.

Note the very first error which you seem to have ignored:

The URL http://localhost:${HOST_PORT:-3000} is invalid

You need to fill in the settings correctly for YOUR environment. No one can set those for you, and that is why everything is an example.