coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: MongoDB "Custom MongoDB Configuration" is not being used by mongo

Open pthorsson opened this issue 8 months ago • 3 comments

Error Message and Logs

I'm trying to pass custom config to my MongoDB, but it does not seems that mongo is using the config at all when starting.

Running ps aux | grep mongod in the terminal of the resource shows that mongo is running with the command "mongod --auth --bind_ip_all", while the expected output would be something like "mongod --config /etc/mongo/mongod.conf".

The config file is being created in the container and can be found at /etc/mongo/mongod.conf with the content:

# cat /etc/mongo/mongod.conf
replication:
  replSetName: "rs0"
security:
  authorization: enabled
  keyFile: /tmp/mongodb/replica.key

When running docker inspect <container id> from the Coolify host, we also get indications that the config is mounted tot the container, but not used in the start command.

[
  ...
  "Binds": [
     "/data/coolify/databases/qsckocw40k44gs40wsgg044o/mongod.conf:/etc/mongo/mongod.conf:ro",
     ...
  ],
  ...
  "Cmd": [ "mongod" ]
]

So it seems that the config is being passed to the container, but not being used by the mongod command.

Steps to Reproduce

  1. Create a new MongoDB using the MongoDB preset under resources
  2. Add some custom config in the "Custom MongoDB Configuration" input, in my example:
replication:
  replSetName: "rs0"
security:
  authorization: enabled
  keyFile: /tmp/mongodb/replica.key
  1. Go into the terminal, start a mongo shell and run rs.initiate() and get the response MongoServerError[NoReplicationEnabled]: This node was not started with replication enabled. which indicates that replication is not enabled, as it should be according to the config.

Example Repository URL

No response

Coolify Version

v4.0.0-beta.400

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Debian GNU/Linux 12 (bookworm)

Additional Information

I discovered this when I was trying to create three MongoDB instances for a replica set.

pthorsson avatar Mar 28 '25 17:03 pthorsson