I have stack with 2 services: Spring boot application and mongo database.
I want to deploy this stack to Docker Swarm (1 node in Germany, 1 in Finland and 1 in Estonia).
Currently Swarm schedules application to Germany cluster and Database to Finland, which means that every request goes from Germany to Finland.
Is this way how to force Swarm place all pieces of stack to single node ?
P.S. sticking to hostname is not a solution, because if node dies service is down.
My Stack.yml is:
version: '3.3'
services:
app:
image: kyberorg/boot-mongo
networks:
- net
ports:
- "8080:8080"
depends_on:
- mongo
labels:
- ee.yadev.bootmongoapp
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
mongo:
image: mongo
networks:
- net
volumes:
- example-mongo:/data/db
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
networks:
net:
driver: overlay
volumes:
example-mongo:
external: true