Git Product home page Git Product logo

aws-swarm-init's Introduction

aws-swarm-init

Docker image responsible for automatic initialization (setup) of docker swarm cluster. Most of the logic lives in the script entry.sh.

In order to setup a swarm cluster,

  1. swarm init must be run on one of the managers
  2. swarm join on remaining nodes (both managers and workers) with appropriate tokens

To perform the same steps automatically, dynamodb's locking feature would be used. Due to locks, only one manager is capable of querying/inserting data into dynamodb and a manager which is successfully queries/inserts into dynamodb would perform swarm init and other utilize the data in the dynamodb for joining the cluster.

This docker image needs following environment variables

  • NODE_TYPE: Should be either manager or worker
  • DYNAMODB_TABLE: Name of the dynamodb table to be used for locking and passing cluster information
  • REGION: AWS region in which dynamodb table was created (if not provided will default to region of the instance)

docker-compose:

version: "2"
services:
    init-aws:
      image: "srikalyan/aws-swarm-init:<version>"
      container_name: "aws-swarm-init"
      restart: "no"
      environment:
        NODE_TYPE: "<manager|worker>"
        DYNAMODB_TABLE: "<dynamodb_table>"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        -  /usr/bin/docker:/usr/bin/docker
        - /var/log:/var/log

Note 1: entry.sh is mostly taken from the docker for aws with few modifications

Note 2: This image needs a docker client but does not install one as this would create unnecessary versions which we could easily skip by mount the docker binary from host ubuntu machine.

Note 3: If you need to delete all the manager nodes then clear out your dynamodb table before destroying your manager nodes.

aws-swarm-init's People

Contributors

srikalyan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.