How to scale docker containers using Nginx as reverse proxy and load balancer

  Рет қаралды 34,347

Mafia Codes

Mafia Codes

2 жыл бұрын

In this video we will learn how to #scale #docker container using #Nginx as reverse proxy, this nginx reverse proxy would also act as a load balancer at the very same time.
For example I have used a very basic Nodejs Express application to demonstrate the same.
--------------------------------------------------------------------------
📦FREE $100 credit @Digital Ocean: m.do.co/c/3208f08b3324
--------------------------------------------------------------------------
Subscribe: kzbin.info...
--------------------------------------------------------------------------
💵Support the channel:
Paypal: www.paypal.me/trulymittal
Patreon: / trulymittal
--------------------------------------------------------------------------
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! www.kite.com/get-kite/?...
--------------------------------------------------------------------------
======================
✔ Other useful Playlists
======================
RestAPI (#NodeJS and MongoDB): • REST API using NodeJS ...
API Authentication using #JWT: • NodeJS API Authenticat...
Firebase: • Firebase | Build a Not...
Docker: • Docker
MongoDB: • Learn MongoDB in 50 mi...
Html/Css/Js: • HTML / CSS / JS
Android: • Android
Challenges: • Challenges
#yoursTRULY #tutorial #howto #nodejs

Пікірлер: 75
@suman6327
@suman6327 Жыл бұрын
Such crisp & clear explanation. Thanks a lot.
@aspirinemaga
@aspirinemaga Жыл бұрын
Man what a perfect and straight explanation. thank you so much for your efforts! you are a legend
@someonenotlikeyou
@someonenotlikeyou 6 күн бұрын
I have been scratching my head the whole day trying to figure out why my nginx wasn't working. I wasn't using docker-compose.yml; instead, I was creating separate containers for each server instance. On top of that, I was editing the main nginx configuration file (/etc/nginx/nginx.conf) instead of changing the virtual host configuration file (/etc/nginx/conf.d/default.conf) as you did. After watching your video, I figured out two issues. First, my containers were not communicating with each other because I hadn't created a custom network for them. After doing that, everything worked fine with reverse proxy and load balancing. Second, I still don't understand what the issue was with using the same upstream to specify the servers and the location with the proxy_pass directive to send them to the servers in round-robin. Maybe it's not a good practice to update the main nginx configuration file directly, but I'm not sure. Can you provide me with some resources to read more about nginx configurations? Thanks a lot; this video was a great help! 💕💕
@abhijeetshikharvlog1444
@abhijeetshikharvlog1444 2 жыл бұрын
Your docker series is awosme .Beacuse u covered almost all tpoics in crash code mode .Thanks
@namcaohai2221
@namcaohai2221 Жыл бұрын
thank you so much. All you guys are brilliant!!
@audiodrocher
@audiodrocher 2 жыл бұрын
Please accept my gratitude for your content it's definitely helpful ☺️
@mirzaleka9319
@mirzaleka9319 2 жыл бұрын
Well explained. Thank you!
@teetanrobotics5363
@teetanrobotics5363 2 жыл бұрын
Please include this in the "Production ready server" playlist. As horizontal auto-scaling is also a very useful feature in the production ready server. Amazing content. Thanks.
@mhavock
@mhavock 2 жыл бұрын
Still waiting to see the 1000 container version as promised in the thumbnail .... :)
@digvijayyamagekar4300
@digvijayyamagekar4300 Жыл бұрын
this is some production level content 😂 thanks man
@mafiacodes
@mafiacodes Жыл бұрын
Subscribe like share 👍
@eddwinnas
@eddwinnas Жыл бұрын
I couldnt figure it out and you saved me hours of work thanks!!!
@mafiacodes
@mafiacodes Жыл бұрын
Subscribe like share 👍
@ilyaslabukarov5959
@ilyaslabukarov5959 Жыл бұрын
Thank you very much! This video helped me a lot.
@leamon9024
@leamon9024 Жыл бұрын
Awesome explanation. Thank you.
@georgestatefield
@georgestatefield 2 жыл бұрын
What a nice lesson!
@yasser.dev7
@yasser.dev7 Жыл бұрын
Pure Gold 🪙, Thank you man!
@mehmetbilentr
@mehmetbilentr 5 ай бұрын
Simple and quite usefull explanation, thank you.
@ashutosh887_
@ashutosh887_ Жыл бұрын
Truly a Gem! ✨✨✨
@sathithyayogi99
@sathithyayogi99 Жыл бұрын
man thanks for great content
@mimahmed95
@mimahmed95 Жыл бұрын
Superb. Thanks for your hardwork.
@SamyarBorder
@SamyarBorder Жыл бұрын
Wow that was awesome 👌 thank you
@eL3M3nT4LisT
@eL3M3nT4LisT 7 ай бұрын
Thank you man you are the best
@riteshthakur9250
@riteshthakur9250 2 жыл бұрын
Great tutorial sir as always you make really good tutorials.
@mafiacodes
@mafiacodes 2 жыл бұрын
Thank you very much!
@Anubis10110
@Anubis10110 Жыл бұрын
Thank you so much amazing video
@ronaldfungss
@ronaldfungss Жыл бұрын
great content! thanks a lot!
@Mysterious_debris_1111
@Mysterious_debris_1111 2 жыл бұрын
Great content. Do upload similar content so that we as developers can get advanced.
@mafiacodes
@mafiacodes 2 жыл бұрын
Subscribe like share
@mukuljain8383
@mukuljain8383 2 жыл бұрын
great tutorial, bring more videos on how to work with nodejs and if possible react and aws
@mafiacodes
@mafiacodes 2 жыл бұрын
Thanks, will do!
@silverskull4140
@silverskull4140 5 ай бұрын
In npm ci, ci stands for clean install.
@usama57926
@usama57926 2 жыл бұрын
good video
@mr_ehmed
@mr_ehmed Жыл бұрын
Best
@digvijaysinghthakur2903
@digvijaysinghthakur2903 2 жыл бұрын
So clear and precise tutorial please make tutorials on kubernetes for beginners also.
@mafiacodes
@mafiacodes 2 жыл бұрын
Subscribe like share
@AadiManchekar
@AadiManchekar Жыл бұрын
Thankyou
@kks2105
@kks2105 3 ай бұрын
Great explanation, thank you. I was just wondering, if we are running in same machine we can use cluster module as well right? The nginx with auto-scaling may become prominent when using multiple standalone servers, isn't that right?
@LexPrimost
@LexPrimost Жыл бұрын
Hi ! great video as usual !, is that a normal behavior that you can access the api container by its port without exposing the 3000 port in its Dockerfile?
@vishaldharmawat
@vishaldharmawat 8 ай бұрын
Amazing Video :) Really helped, just one correction, I believe CI stands for Clean Install. Please correct me if I am wrong.
@13odman
@13odman 6 ай бұрын
Correct
@AbdulAlim-zg8vt
@AbdulAlim-zg8vt 2 жыл бұрын
I really liked your command prompt theme. Can you please tell me the theme name?
@Bengali4
@Bengali4 Жыл бұрын
Great video, is it possible to configure de reverse proxy to request server from another machine with different IP? Like configure an upstream cluster in nginx
@Xaero324
@Xaero324 Жыл бұрын
Since there's no upstream definition in the nginx conf, we're pretty much stuck to a round-robin type of configuration with this setup right?
@samansaeedi102
@samansaeedi102 8 ай бұрын
awesome. but you didnt say about load balancer!! is it in another video?
@arthurmelo88
@arthurmelo88 2 жыл бұрын
there is a way to create a rule for nginx to fire up more docker containers based on requests demand?
@10cu7u5
@10cu7u5 3 ай бұрын
Does this also work with JWT Auth containers? Or will this mess up the JWT auth?
@shitinsideyou
@shitinsideyou 10 ай бұрын
Nice video but scaling horizontally means using different computers, and not a single one. Am I missing something here? Do you need to use Kubernetes to scale it horizontally across multiple computers?
@sajjadmazhar1666
@sajjadmazhar1666 Жыл бұрын
what theme are you using?
@barcasnerd
@barcasnerd 2 жыл бұрын
How can I configure this nginx to add a new distinct service with a different server location, for example /new
@StMarc-ow4wz
@StMarc-ow4wz Жыл бұрын
How we scale up the Nginx container so that there are two replica of Nginx?
@thianesh9097
@thianesh9097 Жыл бұрын
Great! Tank you ❤ Hey Bro, I'm scaling a Chatbot where the user's history is preserved. After scaling up I want the users second or forthcoming request to point to the First request Host. I can send the hostname to user and send it back as you shown. Can U guide how to map request to particular host?
@samatzhussipov1139
@samatzhussipov1139 Жыл бұрын
Worker conrainers limited by server thread? Example: server - 4 core 8 thread 4 ram --> I can create only 7 worker container + 1 for nginx ?
@carvalho1990
@carvalho1990 Жыл бұрын
Great tutorial, but scaling all those app in the same machine, even with different containers, won`t make so much difference, right?
@gupta05
@gupta05 5 ай бұрын
I am getting error while running docker compose up --scale api-2 - curl localhost:3000 does not round robin between 2 containers alternativly although both containers are created as seen in docker ps. what could be the issue. please help. thank you
@amansarma417
@amansarma417 2 жыл бұрын
Sir lets say i have three vps each of dual core processor and each vps will have two docker container running(of same image). How can we load balance and proxy using docker. Since the vps are different they will have different ip and container id how do we link all of them? Do we need to have another vps only for nginx to load balance or just puting nginx in vps1 it will do the job?
@mohamedsulaimaansheriff9787
@mohamedsulaimaansheriff9787 Жыл бұрын
This is not possible
@milon27
@milon27 2 жыл бұрын
thank you. how to scale my MySQL database? i am using 1vcpu,2gb ram digital ocean droplet, which contains a node js API and MySQL server, it works fine, but after 10-12 days MySQL queries become slower. how to scale MySQL? i have 50% ram free and only 3-4 % cpu is using most of the time.
@Mysterious_debris_1111
@Mysterious_debris_1111 2 жыл бұрын
Try using cockroach db... It is fun.
@sathithyayogi99
@sathithyayogi99 Жыл бұрын
may i know what terminal you are using, i am also want suggestion like that
@mafiacodes
@mafiacodes Жыл бұрын
oh-my-zsh + spaceship prompt + autocomplete plugin
@sathithyayogi99
@sathithyayogi99 Жыл бұрын
@@mafiacodes thanks a lot
@naturevibezz
@naturevibezz 2 жыл бұрын
Can we use this in a production environment??
@mafiacodes
@mafiacodes 2 жыл бұрын
Yup
@himanshulal97
@himanshulal97 2 жыл бұрын
I love ❤ you
@SavagePlay
@SavagePlay 11 ай бұрын
can someone give his zsh theme
@MrCray678
@MrCray678 2 жыл бұрын
Bro AWS having less tutorial in KZbin so working with Aws is too hard for who never know about it can we have tutorial about it
@mafiacodes
@mafiacodes 2 жыл бұрын
I’ll try to make it Subscribe like share
@medievalogic
@medievalogic 2 ай бұрын
You're not using nginx here to load balance. You're using docker to load balancer. Tge nginx container is just a proxy in this setup.
@gopikiller
@gopikiller 2 жыл бұрын
npm ci = clear & install
@mafiacodes
@mafiacodes 2 жыл бұрын
Imo continuous integration
@azlk_playz8669
@azlk_playz8669 Жыл бұрын
why u didnt use any orchestration tool? why you made things this complicated??? @yoursTRULY
@mafiacodes
@mafiacodes Жыл бұрын
You can do that
@ghostkee5031
@ghostkee5031 11 ай бұрын
the only non well explained! part is specifying api on proxy_pass and not saying where its coming from or how nginx detect it cuz its a service name not a loadbalancer upstream name
Automatic SSL using Caddy Server: Nodejs reverse proxy
18:59
Mafia Codes
Рет қаралды 12 М.
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 51 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 2,8 МЛН
Khóa ly biệt
01:00
Đào Nguyễn Ánh - Hữu Hưng
Рет қаралды 20 МЛН
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 6 МЛН
Load Balancing with NGINX
30:03
NGINX
Рет қаралды 61 М.
Using docker in unusual ways
12:58
Dreams of Code
Рет қаралды 408 М.
Here's why you need Nginx as a Reverse Proxy for your Node.js app
10:17
Software Developer Diaries
Рет қаралды 17 М.
100+ Docker Concepts you Need to Know
8:28
Fireship
Рет қаралды 827 М.
Flask Load Balancing Using Nginx and Docker
18:39
DevGuyAhnaf
Рет қаралды 32 М.
How to scale NodeJs applications using the cluster module.
13:37
Mafia Codes
Рет қаралды 49 М.
Become a Docker Swarm Expert in just 20 minutes
20:51
Akash Kumar
Рет қаралды 15 М.
Expose Your Docker Containers With Traefik
19:33
Techdox
Рет қаралды 10 М.
Complete GIT in 1 video
3:43:17
Hitesh Choudhary
Рет қаралды 69 М.
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 51 МЛН