TLS with letsencrypt for TCP to Mongo?

Hi,

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

    --entryPoints.http.address=:80,
    --entryPoints.https.address=:443,
    --entryPoints.mongo.address=:27017,

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.services.mongo.loadbalancer.server.port=27017
    - traefik.tcp.routers.mongo.rule=HostSNI(`mongo.xxxx.dev`)

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

Thanks

hi @iangregsondev

Did you figure this one out?

/mogul

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 - Traefik v2 (latest) - Traefik Labs Community Forum
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.

Your setup for mongo worked fine for me, I've removed line

    - traefik.tcp.routers.mongo.service=mongo

And set up "networks:" section for mongo container to specify explicitly traefik and mongo to be on the same network