I have a docker swarm cluster where I'm trying to setup mongodb using traefik. Traefik is working with my other services, but I'm having trouble with mongo. I try to connect with mongo compass and I usually get a "connect ECONNREFUSED" error. I'm not sure what I'm missing to get this working.
Traefik docker compose:
"--entrypoints.mongo.address=:27017"
Mongo docker compose:
version: '3.8'
networks:
default:
external: true
name: proxy
services:
mongo:
image: mongo:5.0.6
volumes:
- /data/mongo:/data/db
deploy:
labels:
- 'traefik.enable=true'
- 'traefik.tcp.routers.mongo.rule=HostSNI(`example.com`)'
- 'traefik.tcp.routers.mongo.entrypoints=mongo'
- 'traefik.tcp.routers.mongo.tls=true'
- 'traefik.tcp.services.mongo.loadbalancer.server.port=27017'