-
|
I was very impressed by this template project, until I tried to deploy it to my single server swarm. 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:
So 3 questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
-
|
I have the same concern as you, so I'll also subscribe to the discussion. BTW, did you follow this Readme.md (Deployment part) during your investigation? |
Beta Was this translation helpful? Give feedback.
-
|
I agree that there could be a section for local development in the doc. Here are a few ideas to help you get started... maybe you could help the project in return with a PR once you get everything running :) The key is the When loading the content of the This will run a version of you backend locally (and that is also what will be used for testing purpose) On my side, I use a Makefile to smoothen the process, I have added a lot of other commands to facilitate my like, like Anyways, here is the foundation : |
Beta Was this translation helpful? Give feedback.
-
|
@ebreton , thank you very much. I've also recently started, but my issue is about using secrets in dotenv files. I cannot commit passwords and secrets to repository, but if I remove it from env files, how should I set up it in deployed docker container? Or maybe I shouldn't commit env files at all? |
Beta Was this translation helpful? Give feedback.
-
|
@ebreton this is a neat Makefile, thanks for sharing! |
Beta Was this translation helpful? Give feedback.
-
Indeed, those files are better out of the repo. That's why I have a .sample.env instead. This one is committed, and copied by the When you install a new stack, you can create your specific .env file on your node |
Beta Was this translation helpful? Give feedback.
-
You are right. I am also relying on the Makefile for this (even though it is getting too fat to my taste). Anyways, I have some It makes use of tiangolo scripts. The trick is to properly override the variable environments, and to understand where + when to run the commands. Here is the section in the Makefile: To summarize:
Next step for you will be to automate this process... I am using docker hub to run the tests automatically and trigger a web hook in portainer (if build + tests successfull), which in turn update the image of a running container |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for these explanations and sharing your code @ebreton!
|
Beta Was this translation helpful? Give feedback.
-
|
Thank you a lot! |
Beta Was this translation helpful? Give feedback.
-
|
@ascherbakhov I guess the question was not aimed at me, but what I usually do is try to follow 12 factor principles. For config like you mention, at least when I deploy from CI, I use the CI's environment variables to pass those values to the CI process which in turn passes them to the deployed instance. For instance in this gitlab-ci.yml line you could replace the right side with an env var that you set in gitlab's CI settings. This allows you to deploy to production without having any secrets (as in, passwords, api keys...) in your code. |
Beta Was this translation helpful? Give feedback.
-
|
@laurentS This has been a useful thread, thanks! I wanted to check with you, did you install GitLab on a machine in your swarm? Or did you use the GitLab image repository (at GitLab.com) to store your images? It's my first time doing this part of deployment. So far I have been building images manually on all swarm nodes so they are available locally (as described in the docs). Finally, have you gotten to the point since your wrote the last post of investigating scaling the backend and frontend services? I wrote issue #264 asking about this. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @danieljfarrell I'm not going to be much help here, but what I can tell you:
|
Beta Was this translation helpful? Give feedback.
-
|
Hi @laurentS , thanks for the answer. I see that your dedicated server is building the image, in my case AWS Lightsail is to weak for this operation. So in theory I can use GitLab to build an image, and the using GitLab runner on my server just pull down and update images? |
Beta Was this translation helpful? Give feedback.
-
@ascherbakhov I hade the same question. It's quite frustrating for a newbie to set up the CI/CD pipeline... The current solution I found for Gitlab CI (source) :
|
Beta Was this translation helpful? Give feedback.
-
|
I hadn't come back to this, but now the project has gonne through several refactors and documentation improvements. The current default deployment option is a simple Docker Compose (not Docker Swarm), and the setup was vastly simplified for local development or deployment to a remote Linux machine with Docker Compose. 🚀 |
Beta Was this translation helpful? Give feedback.
I hadn't come back to this, but now the project has gonne through several refactors and documentation improvements.
The current default deployment option is a simple Docker Compose (not Docker Swarm), and the setup was vastly simplified for local development or deployment to a remote Linux machine with Docker Compose. 🚀