codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

Member-only story

Scaling Out With Docker and Nginx

Usama Ashraf
codeburst
Published in
6 min readMar 27, 2018

Number 10 of the 12 Commandments states that our development environment should be as similar as possible to what we have in production. Not doing so can lead to many predicaments when debugging critical, live issues.

One important step in this regard would be to mimic a standard distributed production setup: a load-balancer sitting in front of multiple backend server instances, dividing incoming HTTP traffic among them.

This article is not an introduction to Docker, Compose or Nginx. But rather a guide to setting up the distributed system described above, assuming we’ve installed Docker and are familiar with images, containers etc. I’ll try to provide enough information about Compose and Nginx so we can get our hands dirty without succumbing to the noise that normally goes with them.

Each of our backend server instances (simple Node.js servers) and the Nginx load-balancer will be hosted inside Docker-based Linux containers. If we stick to 3 backend servers and 1 load-balancer we’ll need to manage/provision 4 Docker containers, for which Compose is a great tool.

What We Want

Source: http://anandmanisankar.com

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Written by Usama Ashraf

Node.js, Rails, Python, C++, React enthusiast. Databases, architecture.

Responses (10)

Write a response

Hi Ashraf, very nice tutorial.
Btw, i have followed your steps in this tutorial but there is some problem i get from my nginx load balancer (502 Bad Gateway) and here is i get from my log connect() failed (111: Connection refused) while connecting to…

--

Very usefull article, im doing something quite similar.
I suggest you to use a proccess manager called pm2 for starting and keep runing your node apps without any human intervention, its very easy to implement
Best regards

--