Code Monkey home page Code Monkey logo

docker_swarm's Introduction

Docker Swarm

A deployment method and collection of basic docker swarm stacks.

tl;dr

sudo groupadd docker && sudo usermod -aG docker $USER && newgrp docker
curl -fsSL https://raw.githubusercontent.com/suodrazah/docker_swarm/main/deploy.sh -o deploy.sh && sh deploy.sh

Prerequisites:

  • Tested on Ubuntu Server 20.04 LTS and Debian 10 Local or VPS.
  • SSH Access as sudo user (if no user available - create one, add to sudo group, login as user)
  • Firewall configured to allow 80/tcp, 443/tcp, 22/tcp
  • Public, static IP
  • Domain pointing to servers public IP address

Notes:

  • Designed to be executed on a fresh platform
  • All updates are handled
  • Wait a minute or so for Traefik to come up after the script finishes

Deployment:

  • This will bring up Traefik and Portainer on a manager Docker Swarm node
sudo groupadd docker && sudo usermod -aG docker $USER && newgrp docker
curl -fsSL https://raw.githubusercontent.com/suodrazah/docker_swarm/main/deploy.sh -o deploy.sh && sh deploy.sh

Add Nodes

  • Domain shall be configured to point at the new node public IP. Note this domain for entry as the node domain when requested upon execution of the script.

  • Additional configuration of your firewalls is required for swarm communication

  • To add a manager node run this on an existing manager node and copy the output:

docker swarm join-token manager
  • To add a worker node run this on a manager node and copy the output:
docker swarm join-token worker
  • On the node to be added (not as root):
sudo groupadd docker && sudo usermod -aG docker $USER && newgrp docker
curl -fsSL https://raw.githubusercontent.com/suodrazah/docker_swarm/main/add_worker.sh -o add_worker.sh && sh add_worker.sh
  • Output you copied earlier from join-token command above
docker swarm join --token KEY IP:2377
  • Add a label to the new node
    • Portainer
    • Swarm
    • <node>
    • +Label
    • Name - e.g. worker1
    • Value - "True"

Extension:

  • Read the comments at the top of the stack you wish to deploy
  • Create a new stack
    • Portainer
    • Stacks
    • Add Stack
    • Name - e.g. client1-ignition
    • Web editor - copy contents of stack.yml file
    • Environment variables - as described by the stack comments

To Do

  • Fix Traefik headers

docker_swarm's People

Contributors

suodrazah avatar

Stargazers

 avatar

Watchers

 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.