Coder Social home page Coder Social logo

docker_swarm's Introduction

Docker Swarm

A deployment method and collection of basic docker swarm stacks.

tl;dr

  • Fresh Debian 10 Server + 80 and 443 forwarded + DNS configured
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:

  • Fresh Debian 10 or Ubuntu Server 20.04 LTS
  • SSH Access as sudo user (not root)
  • Firewall configured to allow 80/tcp, 443/tcp, 22/tcp
  • Public, static IP
  • Domain pointing to servers public IP address
    • Google Domains
      • $18+/year
    • No-IP
      • free
        Wildcards are not free so you will have to configure subdomains manually
        e.g. traefik.example.ddns.net, portainer.example.ddns.net, etc

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

Extension (i.e. add stacks):

  • Check the stack Readme.md or header comments
  • Create a new stack in Portainer:
    • Portainer
    • Stacks
    • Add Stack
    • Name - e.g. site1-ignition
    • Web editor - copy contents of stack.yml file
    • Environment variables - as described by the stack Readme.md

Add Nodes

  • Specific subdomain (e.g. worker1.example.com) shall be configured to point at the new node public IP. Note this subdomain for entry as the node domain when requested upon execution of the script. You can use private IPs instead if so desired.

  • Additional configuration of your firewalls is required for swarm communication

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

docker swarm join-token worker
  • On the node to be added (again, as a sudo user and not 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"

To Do

  • Fix Traefik headers

docker_swarm's People

Contributors

suodrazah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  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.