Connecting to a postgresql database

Hi community,

This is part of my dspace db service configuration.

deploy:
      labels:	
          - "traefik.enable=true"        
          - "traefik.tcp.routers.dspacedb.entrypoints=postgres"      
          - "traefik.tcp.routers.dspacedb.rule=HostSNI(`*`)"                             
          - "traefik.tcp.routers.dspacedb.tls=false"     
          - "traefik.tcp.routers.dspacedb.service=dspacedb"  
          - "traefik.tcp.services.dspacedb.loadbalancer.server.port=5432

Now I want to establish a jdbc connection using an environment variable as in this example:

# This is an example of use in a configuration without traefik.
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'

How should I modify my url so that the connection is made if I use traefik?
Should I use the ip address of my dspace db service provided by traefik-net instead of the container name?
Thanks for your help.

Traefik will listen on entrypoint postgres on the port you have assigned to it (and on the IP or domain of the Traefik host), and forward the traffic to the target service port 5432.

This probably does not work, as HostSNI() is a feature of TLS, but you disable TLS/SSL:

Share your full Traefik static and dynamic config, and docker-compose.yml if used.