2

I created 3 ec2 instances and now I want to create a docker swarm

the ec2 instances have a security group with

TCP 2377    0.0.0.0/0

TCP 7946    0.0.0.0/0

TCP 8501    0.0.0.0/0

UDP 4789    0.0.0.0/0

UDP 7946    0.0.0.0/0

SSH 7946    0.0.0.0/0

HTTPS   443 0.0.0.0/0

HTTP    80  0.0.0.0/0

open

after creating the resources I run the following code

docker swarm init --advertise-addr ManagerIP

and then on the other instance I past the join command

I then create a network and 2 services

docker network create --driver overlay mydrupal

docker service create --name psql --network mydrupal -e POSTGRES_PASSWORD=postgres postgres:11

docker service create --name drupal --network mydrupal -p 80:80 drupal:8

all this at the moment is running either on host1 (the swarm leader) or host1 and host2 (one of the workers)

If I then go to the browser and paste the public ip of the ec2 and trying to configure the postgres database init I get an error or I can get in and then I cannot connect from the other instances...

I am not sure if this is a security group issue or something else.



update

If I remove the workers from the swarm I can configure the database and run drupal

If then I add the workers to the swarm I can't connect using their public ips


update2

opened all traffic, all ports on the security group and still nothing..

bruvio
  • 853
  • 1
  • 9
  • 30
  • 1
    your docker swarm is round-robin the connection, and you lost your session. see https://stackoverflow.com/questions/54403235/sticky-sessions-with-docker-swarm on how to implement sticky session – Sharuzzaman Ahmat Raslan Feb 21 '21 at 16:51
  • 1
    I created an overlay network.. isn't suppose to work on routing mesh lvl 3? – bruvio Feb 21 '21 at 17:46
  • 1
    update3.. I run the same sequence of commands on 3 digital ocean droplets (there I did not have to configure any security group) and there was replication. so it must be an AWS thing. – bruvio Feb 21 '21 at 18:40

0 Answers0