docker - Correct services hostname configuration in swarm -
i'm having trouble deploying stack local 3-clusters swarm (for now) created docker-machine
.
all services in same network , when working locally running docker-compose run..
have no problem in connecting services using service names hostname, instance:
# docker-compose.yml --- version: '3' services: app: build: . # ... depends_on: - db db: image: postgres:9.6
we talking ruby application , database configuration following;
# database.yml --- default: &default # ... typical stuff username: postgres host: postgres # name of service in docker-compose.yml development: <<: *default production: <<: *default host: <%= env['database_host'] %> database: <%= env['database_name'] %> username: <%= env['database_username'] %> password: <%= env['database_password'] %>
afaik looks pretty standard when developing locally. in fact, app
service connects correctly postgres
service using service name hostname. happens sidekiq
service , rabbitmq
one.
the issue, , i'm 100% sure i'm missing basic, when stack deployed swarm, services not able see each other, when check logs services see connections being refused app
service.
i'm not pretty sure if have configure in manager node or manager able manage routing between hosts names , service names , physical addresses.
i'd appreciate if can put me in right direction on how configure services deploying swarm. mentioned, done in local swarm 3 nodes created using docker-machine create...
, run eval $(docker-machine env manager-node)
.
thanks in advance!
Comments
Post a Comment