i’m able to setup replicated/global service. i want my application connects only to database running on the local node. fe:
node1: app.1 db.1
node2: app.2 db.2
when i use network overlay, there is a round robin, so i cannot force app.1 connect to db.1.
when i use network host (and bind node hostname into app), i can connect app.1 to node1, but db is exposed externally, which is not secure.
services: app: image: tomcat:8.5 ports: - target: 8443 published: 8443 depends_on: - postgres deploy: mode: global db: image: postgres:9.6 ports: - target: 5432 published: 5432 protocol: tcp mode: host deploy: mode: global
is there any setup which accomplishes this?
maybe something similar to network_mode: service:app.