Only one host for production environment. What to use: docker-compose or single node swarm? #146
-
|
We have recently moved all our corporative services to run ONE DigitalOcean server having all services in a docker environment: redmine, dokuwiki, opends, mattermost, a docker registry, portainer,... The way we did it, was creating all the needed docker-compose files (one by service, and having all the needed containers in each one: RoR+postgresql, Node+Mongo+redis,...), add all the needed mountpoints for the volumes (and almost all containers must be persistent), and include the option in all of them with "restart: always". All this apps were started with 'docker-compose -d up", and in this way this only ONE server is able to run all services (and all of them get started with server startup). We don't need a cluster right now. We don't know if this approach is a good one or it shouldn't be used for production (and why in this case). We want to have one server to pay the less as possible, and taking into account that it can manage all our apps. Should we create a swarm, move all containers to be swarm services, but only have one manager and no workers? I would be that approach a better option? If this is true, what should we use to replace the use of jwilder/nginx-proxy (and docker-letsencrypt-nginx-proxy-companion) to manage http redirections and automatic generation of letsencrypt certificates. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 1 reply
-
|
I always recommend single-node Swarm with the assumptions you know the risks of a single node of anything, and you're backing up persistent data, keys/secrets, etc. My top reasons for a single-node Swarm over docker-compose:
There's more, but that's my big-ticket heavy hitters!
I like focusing on the above positives of Swarm, but take that list and turn it into negatives of "why not docker-compose on servers":
|
Beta Was this translation helpful? Give feedback.
-
|
Go for a one swarm master node, for all @BretFisher says For your second point, go give a try to https://github.com/containous/traefik |
Beta Was this translation helpful? Give feedback.
-
|
Many thanks for your answers. We are giving a try to a swarm approach (but I think a good point will be enroll the Docker Swarm Mastery course before) :-) Best regards! |
Beta Was this translation helpful? Give feedback.
-
|
How about those downsides:
Thanks |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @augnustin. I might agree with the first point if you haven't taken my Swarm course, but the for the second:
I think maybe you're referring to |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @BretFisher for giving more insight of Swarm. I am working on a migration project where we have 3 different nodejs applications running with pm2, one MySQL dB and a few legacy software on the one on-prem box with one backup box in production (Please do not ask why we have only two boxes in production as it is driven by the Business). Thanks in Advance. |
Beta Was this translation helpful? Give feedback.
-
|
Follow all my recommendations from my Docker Node.js course , so throw out pm2 and only use swarm. You resources won't change much from pre-docker. |
Beta Was this translation helpful? Give feedback.
-
|
With the relatively recent Mirantis acquisition of Docker Enterprise, what is expected for the long-term future of Swarm? It seems that it might be ignored and eventually deprecated in favor of Kubernetes. |
Beta Was this translation helpful? Give feedback.
-
|
@nate-benton90 Mirantis has repeated at least 3 times this year they are investing in Swarm, and Enterprises want its simplicity. We're simply waiting on new versions with their expected features (jobs, CSI, Swarm on Kubernetes). See my live show about Swarm and Mirantis from Spring 2020: https://youtu.be/L5N43aQQArw Or come today to my live show in 10 minutes and ask questions: https://bret.live |
Beta Was this translation helpful? Give feedback.
-
|
By the way, that BoxBoat piece is marketing hype and not everyone at that company was a fan of posting it. Oh, and there's also https://www.nomadproject.io |
Beta Was this translation helpful? Give feedback.
-
|
Cool, we love Swarm ;) It even has a cool name |
Beta Was this translation helpful? Give feedback.
-
|
@BretFisher what a relief! I'm certainly still a rookie in this environment but still wanted a sanity check. Thanks for the insight. Indeed, the article kinda had a click-bait feel to it. Cheers. |
Beta Was this translation helpful? Give feedback.
-
|
If we have one server are there any advantages in creating several swarm nodes on this server with docker-machine command instead of using only one swarm node? |
Beta Was this translation helpful? Give feedback.
-
|
no |
Beta Was this translation helpful? Give feedback.
-
|
@BretFisher, I am taking your course Docker Mastery on Udemy currently (which is FANTASTIC by the way), and could not even formulate the question that you so brilliantly answered. |
Beta Was this translation helpful? Give feedback.
-
|
@ivanduka thanks! Some Pro Tips:
|
Beta Was this translation helpful? Give feedback.
-
|
@BretFisher , I have taken your course Docker Mastery on Udemy it was nice but I am not getting yaml file for voteapp to deploy with stack |
Beta Was this translation helpful? Give feedback.
-
|
Hey @bipin332, for a simple example-voting-app example, see the official repo https://github.com/dockersamples/example-voting-app |
Beta Was this translation helpful? Give feedback.
-
|
@BretFisher what do you think of same server running both production and staging app? currently it is running on docker compose. Since you recommend swarm for production would it be good idea to run both staging and production as swarm in the same server or would you recommend separate servers for staging and production? To give more context about the app it's a laravel 12 backend, React frontend, MYSQL db, redis, PHYMyadmin rdbms. |
Beta Was this translation helpful? Give feedback.
I always recommend single-node Swarm with the assumptions you know the risks of a single node of anything, and you're backing up persistent data, keys/secrets, etc.
My top reasons for a single-node Swarm over docker-compose:
docker swarm init.