Introduction
This section contains the required yaml files and the deployment procedure to create the services in a docker swarm cluster.
GitHub Repository
Reference
Every article contains the following sections:
Volumes --> the volumes needed to store the configuration and data files for each stack (it is deployed on a shared NAS storage)
Deployment --> the steps required to deploy the stack
Docker swarm file --> the yaml file that is fed to swarmpit to deploy the stack
Notes --> additional notes
First you need to deploy the Swarmpit stack (management service in this case) and Traefik stack (proxy service), then you can go further with deploying whatever service you desire.
Diagrams (Graphviz)
Built using Graphviz as container from this project pmsipilot/docker-compose-viz .
The script will create a list of all the stacks and generate graphs and copy these images to the relative path to be desplayed in this section.
#!/bin/bash
cd /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp
ls /nfs-nas-swarm/github-repos/portainer-compose/stacks > list.txt
for stack_name in $( sed 's/\.[^.]*$//' list.txt)
do
echo $stack_name
cd /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp
cp /nfs-nas-swarm/github-repos/portainer-compose/stacks/$stack_name .yml /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.yml
chmod 777 /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.yml
docker run --rm -it -d --name dcv -v $( pwd ) :/input pmsipilot/docker-compose-viz render -m image -r docker-compose.yml
# wait for container execution
sleep 5
chmod 777 /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.png
sleep 1
mv /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.png /nfs-nas-swarm/github-repos/portainer-compose/diagrams/$stack_name .png
sleep 1
done
# rm /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.yml
# rm /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/docker-compose.png
rm /nfs-nas-swarm/github-repos/portainer-compose/diagrams/temp/0template.png
cp -r /nfs-nas-swarm/github-repos/portainer-compose/diagrams /nfs-nas-swarm/config/docs/docs/assets
Description (ChatGPT)
The introduction for each section was written using ChatGPT using this simple request:
write a short introduction about {} in markdown language
Configurations (GitHub repo)
Built using a github repository that is connected to each file in this section to publish the yaml files directly (even if they are updated 😉 ).