Docker stack configs for our Docker swarm clusters
-
On manager node - Create docker swarm cluster (if needed).
docker swarm init docker swarm join-token manager
-
On worker nodes - Join the cluster (if needed).
docker swarm join --token <token> <ip>:<port>
-
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
-
On the manager node
# Label for the portainer stack docker node update --label-add "portainer=true" <node id>
-
On the worker nodes
JAMStack news
# Common docker node update --label-add "jms.enabled=true" <node id> # Environment specific docker node update --label-add "jms.variant=dev" <node id> docker node update --label-add "jms.variant=org" <node id>
API
# Common docker node update --label-add "api.enabled=true" <node id> # Environment specific docker node update --label-add "api.variant=dev" <node id> docker node update --label-add "api.variant=org" <node id>
-
-
Deploy Portainer.
[!WARNING]
These instructions may not work. Docker swarm is adding multiple networks to the services for some reason.Use the stack defined in portainer.yml.
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.