Ansible automation to create highly-available Docker Swarm clusters on AWS ecosystem (via AWS CloudFormation).
Shell Makefile
Pull request Compare This branch is 71 commits ahead of ulucaydin:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
group_vars/all
roles
.gitignore
LICENSE
Makefile
README.md
ansible.cfg
aws_create_swarm_cluster.yml
aws_destroy_swarm_cluster.yml
hosts
topology.png

README.md

License

Ansible & Cloud Formation automation for creating Highly-Available Docker Swarm clusters on AWS

Scalable Docker Swarm cluster deployment using the combination of AWS CloudFormation to create resources (such as EC2, VPC, AutoScaling etc..) and Ansible to automate the process with a single command. Deployment EC2 instances use CoreOS as it's ideal for this scenario.

If a Stack already exist with the given stack name, it will update. Otherwise creates a new stack from scratch.

Topology of Deployment

Topology

Highlights

  • CoreOS as the host OS for all instances.
  • Self provisioning of instances using cloud-config of CoreOS
  • Two launch configurations, auto scaling groups and elastic load balancers are created: Masters and Minions
  • Minions auto scaling group depends on the creation of the Master auto scaling group to prevent race condition.
  • Etcd enabled for Masters and disabled for minions.
  • Etcds run on master nodes which automatically create a ring cluster by using the discovery url, hence highly-available.
  • Docker Swarm managers on master nodes join the Swarm cluster by using their local Etcd configuration.
  • Docker Swarm minions join the cluster using Master ELB DNS to ensure high-availability.

Quickstart Guide:

  1. Install Docker and Ansible on your local and clone this repo.

  2. Edit group_vars/all/credentials.yml.example and change it as group_vars/all/credentials.yml

  3. Edit group_vars/all/common.yml as it fits your needs.

  4. Make sure to create a keypair in AWS IAM.

  5. Create the CloudFront Stack using Ansible

make create_docker_swarm"
  1. Once the Stack creation is complete, Ansible will out provide the output of Swarm Master as related information and swarm node http load balancer

  2. From your local, connecto Swarm Master and see info: docker -H tcp://<MasterElbDns>:4000 info

  3. An example deployment to all nodes from your local: docker -H tcp://<MasterElbDns>:4000 run -d -p 80:80 nginx