-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
I was very impressed by this template project, until I tried to deploy it to my single server swarm.
This was my first time playing with docker swarm, and I had not realised that all deployment commands are meant to be run on a node of the swarm (I only saw this confirmed in a random stackoverflow post, did I miss it in some obvious doc?).
I think the generated gitlab-ci.yml file further misled me in that it gave me the impression I could just push it to gitlab and be happy 😄
I easily setup the swarm following the great tutorial at https://dockerswarm.rocks/ but then was a bit at a loss with how to connect the dots between my generated project and the swarm.
My setup is super basic: I'm trying to deploy to a single node swarm from a gitlab.com CI script (running on their shared ci runners). It would have helped me to see these extra bits of info:
- the
docker stack deploycommand must be run from a node inside the swarm - what options I have to deploy if the machine running the
deploy.shscript is not part of the swarm:- temporarily join the swarm? I wasn't excited to do this, since my ci is running on shared machines.
- setup docker to listen on HTTP to run
docker stack deployfrom outside the swarm? I tried this but it left me with traefik not being able to connect to the docker daemon (Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?in the service's logs), and I could see how this would cascade into a series of problems as the project template is probably not designed for it. scpthe required files onto one of the swarm nodes thensshinto it and rundeploy.sh? I ended up going for this solution, which is probably not the cleanest, but has the advantage that you can then deploy from any machine that can ssh into your swarm.
So 3 questions:
- did I miss something in the docs that would have explained this?
- if not, did I miss any easier/better option to deploy?
- if not, would you be interested in a small PR explaining what I did? I feel like the whole tutorial between here and dockerswarm.rocks is super well written and helpful, but this particular part left me completely at a loss (but I did learn a lot from reading around, on the plus side 😉 )