Let us connect to a database instance without specifying the port
Our team runs Mongo in Docker containers. And since we run many Docker containers, which means multiple MongoDB instances on a single machine, we assign random ports to each instance.
Then we put an Nginx reverse proxy in front of each instance. We provide certificates in the Nginx layer through Let's Encrypt and offer subdomains for each instance. So, for example:
https://db.basket.com = port 36150
https://db.cards.info = port 42755
https://db.some-long-domain.tld = port 55490
And so on.
There are two problems here:
1- Those ports are assigned dynamically on any container reload/restart, thus they are truly ephemeral and we can't memorize them or store them somewhere. But Mongo Compass does not support connecting through a domain only, or at least we could not figure out how to do it. Right now, we open the Compass, we have to SSH into the server, find the current port, edit the connection, and then connect, which is a true pain and highly inefficient.
2- When we enable TLS, we get this error:
Client network socket disconnected before secure TLS connection was established
So, right now to connect to our databases, we need to manually fetch and set the port number and connect without TLS, which is not safe.
We're stuck. Can you please make connecting to a host without a port possible? Also, can you provide more info on why TLS does not connect?
