Docker - separate nginx container for every separate my service container











up vote
1
down vote

favorite












Following Docker best practices - a container should be created with a "single responsibility" principle in mind - it makes a good idea to have nginx and some-my-custom service in separate docker containers. But the question is - if i run in an autoscaled/loadbalanced environment where i have at least 2-3 running copies of the same container - should I have a separate nginx container cluster for my every custom services cluster or should I have one nginx containers cluster for the whole infrastructure (but simply more instances). Please find an illustrated example.
enter image description here



Does it even make any difference?










share|improve this question


























    up vote
    1
    down vote

    favorite












    Following Docker best practices - a container should be created with a "single responsibility" principle in mind - it makes a good idea to have nginx and some-my-custom service in separate docker containers. But the question is - if i run in an autoscaled/loadbalanced environment where i have at least 2-3 running copies of the same container - should I have a separate nginx container cluster for my every custom services cluster or should I have one nginx containers cluster for the whole infrastructure (but simply more instances). Please find an illustrated example.
    enter image description here



    Does it even make any difference?










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Following Docker best practices - a container should be created with a "single responsibility" principle in mind - it makes a good idea to have nginx and some-my-custom service in separate docker containers. But the question is - if i run in an autoscaled/loadbalanced environment where i have at least 2-3 running copies of the same container - should I have a separate nginx container cluster for my every custom services cluster or should I have one nginx containers cluster for the whole infrastructure (but simply more instances). Please find an illustrated example.
      enter image description here



      Does it even make any difference?










      share|improve this question













      Following Docker best practices - a container should be created with a "single responsibility" principle in mind - it makes a good idea to have nginx and some-my-custom service in separate docker containers. But the question is - if i run in an autoscaled/loadbalanced environment where i have at least 2-3 running copies of the same container - should I have a separate nginx container cluster for my every custom services cluster or should I have one nginx containers cluster for the whole infrastructure (but simply more instances). Please find an illustrated example.
      enter image description here



      Does it even make any difference?







      docker nginx containers






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 13:25









      Laimonas Sutkus

      378110




      378110
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          I don't think there is an absolute answer to this question, so I'm just throwing my current (random) thoughts.



          First, it depends on what you use nginx for. If it's used to host webpacked web site, then sure you need one nginx for each of your frontend service, combined with worker_processes in nginx.conf, you have an easy load balancing solution for the frontend. If you want to use it a reverse proxy for load balancing, one instance is enough for a small cluster (when it grows bigger, you can add more to form a multi-tier load balancer).



          Second swarm actually has a native load balancer that sort of works out of the box.



          Third, the complexity of setting up nginx is also to be considered. Personally I don't think nginx is easy enough to setup and debug. Modern solutions like traefik.io are easier to use and built with clustering in mind, and come with extra features like automatic https configuration via lets'encrypt.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226575%2fdocker-separate-nginx-container-for-every-separate-my-service-container%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            I don't think there is an absolute answer to this question, so I'm just throwing my current (random) thoughts.



            First, it depends on what you use nginx for. If it's used to host webpacked web site, then sure you need one nginx for each of your frontend service, combined with worker_processes in nginx.conf, you have an easy load balancing solution for the frontend. If you want to use it a reverse proxy for load balancing, one instance is enough for a small cluster (when it grows bigger, you can add more to form a multi-tier load balancer).



            Second swarm actually has a native load balancer that sort of works out of the box.



            Third, the complexity of setting up nginx is also to be considered. Personally I don't think nginx is easy enough to setup and debug. Modern solutions like traefik.io are easier to use and built with clustering in mind, and come with extra features like automatic https configuration via lets'encrypt.






            share|improve this answer

























              up vote
              1
              down vote













              I don't think there is an absolute answer to this question, so I'm just throwing my current (random) thoughts.



              First, it depends on what you use nginx for. If it's used to host webpacked web site, then sure you need one nginx for each of your frontend service, combined with worker_processes in nginx.conf, you have an easy load balancing solution for the frontend. If you want to use it a reverse proxy for load balancing, one instance is enough for a small cluster (when it grows bigger, you can add more to form a multi-tier load balancer).



              Second swarm actually has a native load balancer that sort of works out of the box.



              Third, the complexity of setting up nginx is also to be considered. Personally I don't think nginx is easy enough to setup and debug. Modern solutions like traefik.io are easier to use and built with clustering in mind, and come with extra features like automatic https configuration via lets'encrypt.






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                I don't think there is an absolute answer to this question, so I'm just throwing my current (random) thoughts.



                First, it depends on what you use nginx for. If it's used to host webpacked web site, then sure you need one nginx for each of your frontend service, combined with worker_processes in nginx.conf, you have an easy load balancing solution for the frontend. If you want to use it a reverse proxy for load balancing, one instance is enough for a small cluster (when it grows bigger, you can add more to form a multi-tier load balancer).



                Second swarm actually has a native load balancer that sort of works out of the box.



                Third, the complexity of setting up nginx is also to be considered. Personally I don't think nginx is easy enough to setup and debug. Modern solutions like traefik.io are easier to use and built with clustering in mind, and come with extra features like automatic https configuration via lets'encrypt.






                share|improve this answer












                I don't think there is an absolute answer to this question, so I'm just throwing my current (random) thoughts.



                First, it depends on what you use nginx for. If it's used to host webpacked web site, then sure you need one nginx for each of your frontend service, combined with worker_processes in nginx.conf, you have an easy load balancing solution for the frontend. If you want to use it a reverse proxy for load balancing, one instance is enough for a small cluster (when it grows bigger, you can add more to form a multi-tier load balancer).



                Second swarm actually has a native load balancer that sort of works out of the box.



                Third, the complexity of setting up nginx is also to be considered. Personally I don't think nginx is easy enough to setup and debug. Modern solutions like traefik.io are easier to use and built with clustering in mind, and come with extra features like automatic https configuration via lets'encrypt.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 9 at 15:46









                Siyu

                1,041617




                1,041617






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226575%2fdocker-separate-nginx-container-for-every-separate-my-service-container%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Schultheiß

                    Verwaltungsgliederung Dänemarks

                    Liste der Kulturdenkmale in Wilsdruff