Docker stack configs for our Docker swarm clusters
-
On manager node - Create docker swarm cluster (if needed).
docker swarm init
-
On worker nodes - Join the cluster (if needed).
docker swarm join --token <token> <ip>:<port>
Get the token if needed, by running
docker swarm join-token worker
-
On all nodes - Add labels to the nodes in the cluster.
[!IMPORTANT] Labels are used for placement constraints in the docker stack templates.
Here are some example lables for the nodes. Adjust as needed
-
Get the node ids using
docker node ls
on the manager node. -
On the manager node
docker node update --label-add "portainer=true" <node id>
-
On the worker nodes
JAMStack news
docker node update --label-add "jms.enabled=true" <node id>
docker node update --label-add "jms.variant=dev" <node id> docker node update --label-add "jms.variant=org" <node id>
API
docker node update --label-add "api.enabled=true" <node id>
docker node update --label-add "api.variant=dev" <node id> docker node update --label-add "api.variant=org" <node id>
-
-
Deploy Portainer.
[!WARNING]
Copy the stack defined in portainer.yml to the manager node and deploy it.
docker stack deploy -c portainer.yml portainer
-
Complete the Portainer setup wizard & add the cluster to Portainer.
-
Add the container registry details to Portainer.
-
Deploy all the remaining stacks via Portainer. Note that you should not manage the portainer stack from within Portainer UI.