DEV Community

Cover image for Scaling Out With Docker and Nginx

Scaling Out With Docker and Nginx

Usama Ashraf on March 28, 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 doin...
Collapse
 
faizanbashir profile image
Faizan Bashir

Great article brother.

A simple suggestion from my end, instead of using backend1, backend2, backend3 in the Dockerfile we can define a single service as backend. We can rather scale out using "docker-compose up -d --scale backend=n", where n is the number of replicas. In nginx.conf, we simply need to define the server config as "server foldername_backend_1:3000 max_fails=3 fail_timeout=10s weight=1;".

Collapse
 
rhymes profile image
rhymes

Wow, super interesting! Thank you Usama!

I've been spoiled by years on Heroku and haven't given containers the attention they deserve. This is a great use case :)