Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 1.5 KB

setup-aws-swarm.md

File metadata and controls

53 lines (40 loc) · 1.5 KB

boilr template use stacks .

  • Allocate Elastic IP
  • Setup security group
docker-machine create \
    -d amazonec2 \
    --engine-label discovery=1 \
    discovery

Setup discovery

cd discovery/consul
eval $(docker-machine env discovery)
docker-machine ssh discovery sudo sh -c 'mkdir -p /host-volume/consul/data && chmod -R 777 /host-volume/consul/data'
docker-compose up -d        

💡 You can use a .env file for Docker Compose to point to the discovery VM by default docker-machine env discovery > .env

⚠️ Setup ACLs or another access control for Consul.

Test consul UI in browser.

⚠️ Double check cluster-advertise interface

AWS is using private IPs (sec. group)

Setup master

docker-machine create \
    -d amazonec2 \
    --swarm-master \
    --swarm \
    --engine-label master=1 \
    --swarm-discovery consul://${ROJ_DISCOVERY_PRIVATE_IP}:8500/${ROJ_SWARM_NAME} \
    --engine-opt=cluster-store=consul://${ROJ_DISCOVERY_PRIVATE_IP}:8500/${ROJ_SWARM_NAME} \
    --engine-opt=cluster-advertise=eth0:2376 \
    ${ROJ_SWARM_NAME}-m1

Setup app (worker) node

docker-machine create \
    -d amazonec2 \
    --swarm \
    --engine-label app=1 \
    --swarm-discovery consul://${ROJ_DISCOVERY_PRIVATE_IP}:8500/${ROJ_SWARM_NAME} \
    --engine-opt=cluster-store=consul://${ROJ_DISCOVERY_PRIVATE_IP}:8500/${ROJ_SWARM_NAME} \
    --engine-opt=cluster-advertise=eth0:2376 \
    ${ROJ_SWARM_NAME}-w10