Project

azure-docker-swarm-cluster

archived

Auto-scaling Docker Swarm cluster for Azure — ARM template plus Makefile, manager and worker VMSS included.

Overview

azure-docker-swarm-cluster provisions a Docker Swarm cluster on Azure using ARM templates, with 1–5 master VMs plus a worker VM Scale Set. Auto-scaling rules on the worker VMSS respond to CPU load, expanding and shrinking the cluster automatically. A Makefile wraps the Azure CLI for storage and compute deployment. ★47 with 11 forks — a reference template from the pre-Kubernetes container era that still gets cited.

How it works

The ARM template creates master VMs in an availability set, a worker VM Scale Set, shared storage, and the required network resources. Cloud-init on the master nodes initialises the Swarm and runs a small helper service on master0 that hands out join tokens to workers as they boot. A public load balancer fronts the worker nodes for application traffic, and autoscale settings resize the worker VMSS under load.

Features
📈
Auto-scaling workers

Azure VMSS auto-scale rules expand the worker pool under load and shrink it when idle — no manual intervention.

🔑
Swarm helper bootstrap

master0 runs a small helper service that provides join tokens and cleans up departing workers — simple cloud-init driven cluster membership.

🔄
Manager HA

Odd-numbered manager VMSS ensures Raft quorum survives a single node failure without manual recovery.

⚙️
Makefile orchestration

make deploy / make destroy wraps the Azure CLI — no portal clicks, full automation from first principles.

📦
Pre-Kubernetes reference

Documents the Docker Swarm era architecture; useful for comparing operational complexity against modern Kubernetes templates.

Architecture
ARM template cluster.json Shared storage Storage account + Azure Files Masters availability set + NIC/PIP/NSG Workers VM scale set + autoscale Network edge VNet + public LB + inbound NAT Cloud-init helpers swarm init / join / leave Swarm cluster masters + agents actual ARM layout: storage, masters, worker VMSS, load balancer, autoscale, and cloud-init bootstrap scripts