TLS with letsencrypt for TCP to Mongo?


Can anyone help, I have traefik working for HTTP and HTTPS traffic - no problems. I have placed a mongodb in a container - i know its working as I am port mapping 27017 > 27028 and i connect on 27028.

The only thing I did with traefik was added the extra endpoint, here they are


and then setting up the following labels on the container - but i just cant connect

    - traefik.enable=true
    - traefik.port=27017
    - traefik.tcp.routers.mongo.entrypoints=mongo
    - traefik.tcp.routers.mongo.service=mongo
    - traefik.tcp.routers.mongo.tls=true
    - traefik.tcp.routers.mongo.tls.certresolver=le
    - traefik.tcp.routers.mongo.rule=HostSNI(``)

Does anyone have a dummy guide of getting mongodb (or tcp) working ?

As far as I know letsencrypt is supposed to work with tcp also.

I am doing something wrong but I have been scratching my head for hours :frowning:

Any help or ideas anyone can offer would be really appreciated


hi @iangregsondev

Did you figure this one out?


No afraid not. I opened a port :frowning: and connecting via a open port. Not great but I couldn't figure it out.
I spend quite a few days on it.

If you managed it - would you let me know :slight_smile:

You could have a look over here: Cant get the HTTP out of træfik
It might be the same problem.
We managed to dig a little and unearthed that at least the MQTT tools I am using are not SNI compatible. Might be the same with your mongo.

Thanks @mogul, I will take a look.

I did get REDIS working :slight_smile:

I need to give Mongo another try.