Docker ???? ????? Node.js ????????? ??? ???? NGINX ??? ??????????? ?????
??????? ???? ???? ????????????????? ?????????????? ???????? Docker ?????? ???????????? ?????? ???? ??? ? ?? ???? ????? ?????? Docker ??????? ??? ????? Node.js ???????????? ????????? ??? ???? NGINX ??? ??????????? ????????? ???? ??? ????? ????? load distribution ??? ????
?????? ?? ??? ??????????? ??? ?????
?????? ???? ???? Node.js ??????? ???? ??? ????? NGINX ??????? ??? ???? ???? ??? ??????????? ???? ??? ?? ??? ??????????? ?????? Nodejs ??????? ????? ????? load distribution ???? ?????? ??? ????? ????????? ?????? ??? NGINX ??????????????? Node.js ????????? ????? ??? ??? ?????
Node.js ????????????? ?????? Node.js ?????????????? ???? ?????? ???? ??? ????????? ???????? ???? ???? ???? ??????? ??????? ???? ??? ????????? ???? ????????? ?? ????? ?????? ? ?????? ??????? Node.js ??????? ???? ????? hostname /container ? ??? ??? ??? NGINX ??????? ???? ?????????? ?????? ???, ??? Node.js ????????? ???????????? ????, ???????????? ???? ??? ????????? hostname ??????? ??? ????.
??? ?? nodeJs app ???? ???? ??? container ?????? ?? ???? ?????? ???? ???? ???? ????? ? ????? ???? ???? ???? ???? ?????? ???? ?
???? ?????? ?????? ??? ???? ??? ???? ???? ???? ?????? ????? ??? ???? ???? node-app1 ??? node-app2 ???? ??? container ?????? ??? nginx ???? ???? nginx ?? ????? ???? container ?????? ? container ???? ??? ??????? ???? comunication ???? ???? ?? ???? ???? ?????? ????????? ?????? ?
?????? NGINX ?? container ?? ?? ?????? listen ???? ??? node-app1 ? node-app2 ?? ????? ??? ??? ??? ?????
docker cp ?????? ??????? ??? ???? ?????? NGINX ?????????? ???? ??? ??? ??????????? ????? ?????, ????? NGINX ????????? ?????
????? NGINX ?? config ?????? ???? ???? ???
Algorithm ?????? ??? ????
????? NGINX round-robin ???????? ??????? ???, ?? ??? ???????? ??? ???? ????? ?????? ???? ????? weight ??? ?????, ??? ????? node-app1 ???? ????????? ????? ????????????? ???? NGINX ?????? ???? ????????? ??????, ?????? ???????? (??? ????? ????????? weight ??????? ???????? ???)?
?????????? ?????? ??? ?????
??? ???? ??????????? localhost ?? ?? ????? ?????? GET request ??????, ??? ??? ??????????? ?????? NGINX ?????????? ????? NGINX ??? ????????????? ????????? Node.js ?????????????? ????? ?????? ?????? (????? weight ???????)? NGINX ???? ???? ????????? proxy ?? ??? ????? ??????????? ????????? nodejs container ? ?????????? ?? ?????? NGINX ?? ??????? ?????? ?
??? ??? ????? ???? ???? ????? ????? ????? ???? ?????? Docker ??? NGINX ??????? ??? ?????? Node.js ??????? ??? ??? ??? ??? ????? ????? ??? ????????? ??? ????
???? ??????? ?? ?????? ?????? ????? : https://github.com/Ruhulcse/basic_load_balancer
Thank you
Happy Coding
Software Engineer | NodeJs | Angular | Java(Spring boot) | MongoDB | PostgreSQL | MSc Uni-Bremen
2 周Nice effort
IT consultant customer development
1 个月Nice learning
Software Engineer | NodeJS | Nest.js | Docker | React | Angular | MongoDB | MySQL | Redis | Git
1 个月Create a docker compose file. And just use docker compose up -d
DevOps | CKA | Ansible | AWS | Docker | Kubernetes | Jenkins | MySQL | PostgreSQL
1 个月Great work
Software Developer [ Full Stack ]
1 个月Effective!