[Bug]: Unable to connect to public MongoDB over SSL
Error Message and Logs
I am unable to connect to my public MongoDB over SSL. It was deployed using the Coolify template and nothing was changed. Without SSL enabled everything works fine and I can connect to the MongoDB with the public connection string. I have already read the documentation but it doesn't state for example what the server.pem cert is needed for (under persistent storage).
Connection String:
mongodb://root:[email protected]:1335/?directConnection=true&tls=true&tlsCAFile=/etc/mongo/certs/ca.pem
Error in MongoCompass:
Proxy Log of the MongoDB container:
2025/04/25 17:35:23 [error] 33#33: *377 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: 0.0.0.0:1335, upstream: "[xxxx:yyyy:zzzz::8]:27017", bytes from/to client:0/0, bytes from/to upstream:0/0
MongoDB log:
{"t":{"$date":"2025-04-25T17:35:23.040+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"10.0.1.9:32988","uuid":{"uuid":{"$uuid":"daf5fbdf-dc69-46b5-93ac-6be77ece6fc5"}},"connectionId":305,"connectionCount":1}}
{"t":{"$date":"2025-04-25T17:35:23.046+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn305","msg":"Connection ended","attr":{"remote":"10.0.1.9:32988","uuid":{"uuid":{"$uuid":"daf5fbdf-dc69-46b5-93ac-6be77ece6fc5"}},"connectionId":305,"connectionCount":0}}
Steps to Reproduce
Installation
- Add a new MongoDB through the one-click installation (Coolify template).
- Enable SSL and set it to 'require'.
- Insert a public port and start the DB.
- Make it publicly available.
Connect to the MongoDB
- Copy the content of
/data/coolify/ssl/coolify-ca.crtand save it toca.pemlocally - Copy the public connection string and insert it into a new connection in MongoDB Compass
- Navigate to the "Advanced Connection Options" and then to "TLS/SSL"
- Select the ca.pem file from step 1
- Click "Save & Connect"
Example Repository URL
No response
Coolify Version
v4.0.0-beta.409
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
Debian 12
Additional Information
No response
I have the exactly same issue with Compass but it works fine using mongosh with the same connection string.
+1
I also have this issue
I have the same issue as well. I have tried different modes on the MongoDB server and MongoDB Compass can not connect when SSL is enabled even though my local server that is using the same exact certificate can connect.
Same issue here (tried with Compass only)
@peaklabs-dev Any chance you could look into this?
Same issue here on (Coolify: v4.0.0-beta.444)
I am facing this error when I am trying to connect mongodb database with a public SSL-enabled (ssl mode: required) URL by MongoDB Compass. Error: Client network socket disconnected before secure TLS connection was established
Same here