Step by Step Basic Microservices System (3 NodeJS + 1 Load Balancer containers) with Docker Compose

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 115

  • @hnasr
    @hnasr  2 ปีที่แล้ว +5

    Get my Fundamentals of Networking for Effective Backends udemy course Head to network.husseinnasser.com for a discount coupon (link redirects to udemy with coupon applied)

    • @lacascadaobregon
      @lacascadaobregon 2 ปีที่แล้ว

      Damn why does this only have one like? You know a lot about backend. I have a Udemy subscription, going to check the course out!

  • @JohnLovell-FTW
    @JohnLovell-FTW 4 ปีที่แล้ว +46

    Now do one with RabbitMQ in the mix.

  • @tdias25
    @tdias25 4 ปีที่แล้ว +14

    Love these "hands on" type of video

  • @benjaminlee9380
    @benjaminlee9380 3 ปีที่แล้ว +7

    Nice! Seem like a fun person to be watching tutorials from :)

  • @haq_se_dkp
    @haq_se_dkp 4 ปีที่แล้ว +4

    Keep getting this ridiculous error - Windows Machine. Any idea why this might be?
    parsing [/usr/local/etc/haproxy/haproxy.cfg:12]: Missing LF on last line, file might have been truncated at position 31.
    lb_1 | [ALERT] 344/180729 (1) : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg

    • @eeebeltran5445
      @eeebeltran5445 3 ปีที่แล้ว +1

      Did you find a solution bro?

    • @haq_se_dkp
      @haq_se_dkp 3 ปีที่แล้ว

      @@eeebeltran5445 unfortunately not, man. Still waiting :(

    • @nutandevjoshi
      @nutandevjoshi 3 ปีที่แล้ว

      same error

    • @ramlalyadav2286
      @ramlalyadav2286 2 ปีที่แล้ว

      use this in docker-compose.yaml
      lb:
      image: haproxy:1.8
      ports:
      - "8080:8080"
      volumes:
      - ./haproxy/:/usr/local/etc/haproxy/

  • @harsiddhdave44
    @harsiddhdave44 9 หลายเดือนก่อน

    I love this guy! He explains it so effectively and with fun!
    You and Arpit Bhayani are the only two guys that I prefer learning from when it comes to Engineering!

  • @harshitjain7673
    @harshitjain7673 4 ปีที่แล้ว +6

    You can click on the bottom empty part of the explorer window and then create a new file or folder it with it on root

  • @arvi8843
    @arvi8843 4 ปีที่แล้ว +5

    I'm so excited about this, a hands-on microservices. I hope you continue this maybe some event sourcing, cqrs, kubernetes, anything related to microservices 🥰🎉 I hope you'll have a course of a project in microservice structure. ♥️ Thanks a lot.

  • @JohnLovell-FTW
    @JohnLovell-FTW 4 ปีที่แล้ว +2

    If you're fancy, use port 80. Love it!

    • @hnasr
      @hnasr  4 ปีที่แล้ว +3

      John Lovell exactly not everyone got what it takes to use 80.. takes guts 😅

  • @wick12298
    @wick12298 ปีที่แล้ว

    Love the practical and your love for code and networking. Respect Sir!

  • @2011201120112013
    @2011201120112013 ปีที่แล้ว

    Cool video!
    You are the real life version of Quagmire!

  • @georgemilev9986
    @georgemilev9986 4 ปีที่แล้ว +3

    6:44 To get back to the the root folder click on the empty space under your files

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Thanks George that works ! 👍

  • @kerolloz
    @kerolloz 4 ปีที่แล้ว +8

    What about another version of the video where you use ngnix instead

    • @hnasr
      @hnasr  4 ปีที่แล้ว +6

      Kerollos Magdy you read my mind! Coming next week

  • @sahadevdahit
    @sahadevdahit 2 ปีที่แล้ว

    but the other API endpoints does not work. like get('/fetch',..

  • @JulianBG
    @JulianBG 4 ปีที่แล้ว +2

    @Hussein Nasser At the end of the video you had to stop and start the docker-compose in order to add a new nodeapp4, but doesn't that defeat the purpose? First issue is that you have to stop all instances (nodeapp* and the lb) instead of doing that dynamically and also adding a new nodeapp will run on the same physical machine, right?

    • @hnasr
      @hnasr  4 ปีที่แล้ว +1

      Julian Lishev thanks Julian you make valid points. Two in facts. How do you update the configuration without down time and how do you split the containers on multiple physical machines.
      I will have to do some research and get back to you on the first one and make a video on it. The second one is probably we need a container orchestrator like k8 or docker swarm.
      Good points

    • @hanzladev
      @hanzladev 4 ปีที่แล้ว

      @@hnasr brother did you created any video regarding this update?

  • @digvijayyamagekar7139
    @digvijayyamagekar7139 2 ปีที่แล้ว

    System Design is really beautiful topic

  • @rehamalbulushi520
    @rehamalbulushi520 2 ปีที่แล้ว

    This one is the cooooooooooooooooolest tutorial I have ever never watched

  • @shivarajbakale6261
    @shivarajbakale6261 4 ปีที่แล้ว +3

    This was excellent. Thanks, keep them coming

  • @danuzonez
    @danuzonez 4 ปีที่แล้ว +3

    One Video on recommendation system please.

  • @basselturky4027
    @basselturky4027 2 ปีที่แล้ว

    You need to close haprocy folder ( click the arrow ) then create a new file, it will be created in the root. I might be late but I'm helping : )
    ,and thank you for all your efforts and the stuff you taught us.

  • @futurelabs3684
    @futurelabs3684 2 ปีที่แล้ว

    i git a problem when i try to use depends_on: - mongo
    it gives me this alert config : Failed to initialize server(s) addr.
    can anyone help please ?

  • @pjbcoetzer
    @pjbcoetzer 3 ปีที่แล้ว

    Any recommendations for a api management gateway tool for usage and user management?

  • @blissweb
    @blissweb 3 ปีที่แล้ว +2

    Great vid. Good info. Quick question, how would I modify this to balance across 2 actual servers with 2 ip addresses ?

  • @eugene1207
    @eugene1207 3 ปีที่แล้ว +1

    THE BEST TUTOR EVER!1!1!111

  • @georgevinueza7249
    @georgevinueza7249 2 ปีที่แล้ว

    You didn't have to flex on us with the singing skills too xD

  • @fxstreamer238
    @fxstreamer238 2 ปีที่แล้ว +1

    I thought I was doing something wrong but I cloned the whole Javascript playground and directly from git bash terminal went on the microservices docker build etc and the error is the same for haproxy. can not find the config file. The whole docker and redis community is a cancer to the society

    • @patrickmojica6558
      @patrickmojica6558 2 ปีที่แล้ว

      I'm Having the same problem I think:
      lb_1 | [ALERT] (1) : config : Cannot open configuration file/directory /usr/local/etc/haproxy/haproxy.cfg : No such file or directory
      nodeapp1_1 | /bin/sh: 1: run: not found
      nodeapp2_1 | /bin/sh: 1: run: not found

  • @JaneDoe-od4ep
    @JaneDoe-od4ep 3 ปีที่แล้ว +2

    Dude this is literally the best channel about coding I've ever met dude

  • @joe_navy_s3
    @joe_navy_s3 4 ปีที่แล้ว +2

    I subscribe and liked , two seconds into the video, you seem fun😂😂😂

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Thanks Joe!!!

  • @rinodipaola761
    @rinodipaola761 2 ปีที่แล้ว

    Hi, I'd like to ask you a question. If I have two microservices, how can I run them at the same port but in different paths? For example I want to config a microservice with the path localhost/microservice1/... and another microservice with the path localhost/microservice2/... Should I use an API Gateway? I have some difficulties to do this. Thanks.

    • @EhSUN37
      @EhSUN37 2 ปีที่แล้ว +1

      I believe you can config it in nginx

    • @rinodipaola761
      @rinodipaola761 2 ปีที่แล้ว

      @@EhSUN37 yes at the end I used Nginx

  • @mechanical-bean
    @mechanical-bean 3 ปีที่แล้ว

    while Nginx provides full web server, HA proxy is only a proxy, and you go with HA proxy. So my question is that do we need a full web server in front of our backend?

  • @jamalallogie
    @jamalallogie 3 ปีที่แล้ว +2

    Great video!

    • @hnasr
      @hnasr  3 ปีที่แล้ว +1

      Done thanks 🙏

  • @nifeneny
    @nifeneny 3 ปีที่แล้ว

    You are the best, man

  • @luqmansen
    @luqmansen 4 ปีที่แล้ว +1

    Cool, been waiting for this, thanks!

  • @vasujain2
    @vasujain2 6 หลายเดือนก่อน

    What a beautiful thumbnail man!

  • @MrStargazer777
    @MrStargazer777 3 ปีที่แล้ว +1

    awesome dude

    • @hnasr
      @hnasr  3 ปีที่แล้ว

      🙏

  • @khayryazzez
    @khayryazzez 4 ปีที่แล้ว

    what is the difference between nodejs and haproxy

  • @eeebeltran5445
    @eeebeltran5445 3 ปีที่แล้ว +1

    Missing LF on last line, file might have been truncated at position

  • @nageshwarreddy4530
    @nageshwarreddy4530 3 ปีที่แล้ว

    In the sidebar, right click and add any folder, remove that folder from sidebar... in this way, you can see folder view in vscode sidebar...

  • @arunteltia7888
    @arunteltia7888 3 ปีที่แล้ว

    Thank you for this video not gonna lie clear my lot of doubts, you are the best BTW where is silver play button 🚀🙌

    • @hnasr
      @hnasr  3 ปีที่แล้ว +1

      Glad it helped!

  • @orhn
    @orhn 3 ปีที่แล้ว

    How to dynamcally scale backends without changing the config everytime

  • @headlinerbeats
    @headlinerbeats 3 ปีที่แล้ว +1

    Enjoyable video, thank you. I thought microservice architectur requires some sort of API Gateway to redirect requests? Is running the same app in multiple containers really considered a microservice, or is this just plain dockerizing a basic node app? Cheers

    • @EhSUN37
      @EhSUN37 2 ปีที่แล้ว

      its micro services in the same server( inside docker composer instance which is running on your server). when you separate each apps and dbs etc into different machines you would need APIs to call them instead of communicating in your localhost you would communicate withing your network

  • @liuchuanyuan4301
    @liuchuanyuan4301 3 ปีที่แล้ว +1

    -t means tag

  • @alxx736
    @alxx736 3 ปีที่แล้ว

    What if each microservice is in separarte repos ? Do i need to have a docker compose on each repo ? Do i need to pull each microservice and run docker compose on each one ?

    • @faridadli5984
      @faridadli5984 ปีที่แล้ว

      hi i know it's been 2 years already. But would you mind sharing how did you do it?

    • @alxx736
      @alxx736 ปีที่แล้ว

      @@faridadli5984 I think i never did it jajaja

    • @faridadli5984
      @faridadli5984 ปีที่แล้ว

      @@alxx736 🤣🤣

  • @AhmadEzzeir
    @AhmadEzzeir 4 ปีที่แล้ว +1

    Good one bro

  • @aminejadid2702
    @aminejadid2702 4 ปีที่แล้ว

    Great effort ! Thank you

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Thanks Amine!!

  • @jassersaanoun9493
    @jassersaanoun9493 4 ปีที่แล้ว

    correct me if i'm wrong. i think this is not microservices, microservices have a proxy and a registry and a load balancer to select the service required for an incoming request (payment, users...) which are not the same, every service has it's own logic and maybe his own database, whereas this is just duplicating the same service to multiple containers that it would scale

    • @hnasr
      @hnasr  4 ปีที่แล้ว +4

      jasser saanoun thanks for your message. This is the simplest minimum basic building block of microservices. The proxies, sidecar pattern, security control plane, service discovery etc are additions to microservices architecture to make it actually manageable and maintainable and the final piece to add is kubernetes to manage all those containers.

    • @evans8245
      @evans8245 4 ปีที่แล้ว +3

      jasser & nasser - make friendship now !

  • @JoãoSantos-r8b
    @JoãoSantos-r8b 11 หลายเดือนก่อน

    thanks my dude

  • @stellusctf6479
    @stellusctf6479 4 ปีที่แล้ว

    Thanks Hussain ('shukran') one more Good video !!
    Quick question, How do you specify in docker-compose.yml an External MongoDB server Name (for an application which runs in container & trying to access?), would be very helpful (I believe it has something to do with docker network type of the docker container , since the DNS server inside Docker it is not aware of the external server (also directly editing /etc/hosts through edit command seems to be bit 'ugly' while starting container/ deployments), ANY Quick HELP greatly Appreciated

  • @vibekdutta6539
    @vibekdutta6539 4 ปีที่แล้ว

    hey hussain i request you to please make some step by step tutorial on building a microservice with node, docker etc please

  • @krishm5116
    @krishm5116 4 ปีที่แล้ว

    Good funny man yet information rich, Keep it up man :-)

  • @binoysarker903
    @binoysarker903 ปีที่แล้ว

    in vscode left side just right click up of OUTLINE to creak a file or folder on the root of the project

  • @fatube3698
    @fatube3698 4 ปีที่แล้ว

    what did you drink || eat before the video, because i need some

  • @adb86
    @adb86 3 ปีที่แล้ว

    Hussein ,
    Awesome explanation on haproxy, can you please tell us how to run haproxy on container with https . Creating certificate on host machine works great wen haproxy is also started on host machine , but wen haproxy is running as a docker container with certificates created on host machine does not work . I did not find a way to create cert from container itself .Your input is valuable , please respond.

  • @diegoramos27
    @diegoramos27 4 ปีที่แล้ว

    could you pls do the same with java ?

  • @Sheerrim
    @Sheerrim 4 ปีที่แล้ว +2

    Dude, I love you

  • @shiva_tharun
    @shiva_tharun 4 ปีที่แล้ว +2

    Are there performance differences between
    -> running haproxy/nginx as a docker container
    vs
    -> running them directly on the host ?
    In terms of both processing performance & network performance.
    thanks Hussein, amazing content! Binge watching them all! Keep going.

    • @hnasr
      @hnasr  4 ปีที่แล้ว +2

      The Scientist none that I am aware of, if the container is assigned adequate memory/cpu it should be just as if running directly on the host.
      That being said it I am assuming the container daemon is running directly on the host not on a VM.

  • @tobykalema8945
    @tobykalema8945 2 ปีที่แล้ว

    What an amazing guy! hahah

  • @SuperVladikk
    @SuperVladikk 3 ปีที่แล้ว

    This video made me subscribe 😆

    • @hnasr
      @hnasr  3 ปีที่แล้ว

      ❤️❤️❤️

  • @magnifico689
    @magnifico689 4 ปีที่แล้ว

    Nodejs microservice series with real app example

  • @hanzladev
    @hanzladev 4 ปีที่แล้ว

    Aslamoalikum brother, great content, Excellent work, do you speak urdu? can you entertain urdu speakers with your skills? it will be great services my friend

  • @stefanosgiannakis7151
    @stefanosgiannakis7151 4 ปีที่แล้ว +2

    you need a load balancer in your voice

  • @vivsh.1999
    @vivsh.1999 3 ปีที่แล้ว +1

    This video is for only load balancers not specifically for microservices. Can you make a video with microservices having different logic instead of just duplicating the same image?

    • @EhSUN37
      @EhSUN37 2 ปีที่แล้ว +1

      the only difference would be how your API calls different services. you can run redis , postgres etc in the docer-composer and your apps will call them when needed. use only one app if you want and eliminate the load balancer

  • @SiriAmarVlogs
    @SiriAmarVlogs 4 ปีที่แล้ว +3

    it is still a monolothic application

  • @noahwilliams8918
    @noahwilliams8918 4 ปีที่แล้ว +1

    “God I hate YAML 🍠”
    Me too, buddy - fortunately, Docker-compose supports JSON as well if you don’t feel like tearing your hair out ;)

    • @hnasr
      @hnasr  4 ปีที่แล้ว +3

      What! I didn’t know that it supports JSON! Thanks Noah 👏👍

    • @noahwilliams8918
      @noahwilliams8918 4 ปีที่แล้ว +1

      Hussein Nasser You’re welcome! Here is the source for that: docs.docker.com/compose/faq/
      YAML is a superset of JSON so (theoretically) any valid JSON is also valid YAML. I bet a lot of other applications support it but just don’t advertise it too!

  • @Muphet
    @Muphet 3 ปีที่แล้ว

    i just right click on folder in tree and create file

  • @Antnix732
    @Antnix732 2 ปีที่แล้ว +1

    this vid acc funny af lmfao.

  • @abdirahmann
    @abdirahmann 2 ปีที่แล้ว

    you were on a ton of coffee! hahahaa 🤣🤣

  • @kosm4308
    @kosm4308 3 ปีที่แล้ว

    Zoom further please.. Is it 4444 or something else? 😂😂😂
    Nice work man..

  • @simomed5002
    @simomed5002 ปีที่แล้ว

    are you sure you know what microservices are?

  • @morhaham6609
    @morhaham6609 ปีที่แล้ว

    It’s not microservices, it’s a monolith at horizontal scale.

  • @gngn2973
    @gngn2973 4 ปีที่แล้ว

    zoom MOAR need closer!

  • @jivanmainali1742
    @jivanmainali1742 3 ปีที่แล้ว

    its not a microservice ,i find it more like a monolithic with loadbalancing

  • @yuxiangzhang2343
    @yuxiangzhang2343 4 ปีที่แล้ว

    Hi Hussein, do you also have a tutorial on load-balancing remote containers ( containers located on different hosts )? That would be also helpful!

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Yuxiang Zhang hello , it is the same concept just update the config to point to the right host. Of course you will need to orchestrate those hosts and containers if they got out of control

    • @yuxiangzhang2343
      @yuxiangzhang2343 4 ปีที่แล้ว +1

      @@hnasr Thank you, this is already helpful! Looking forwards to your orchestration tutorials :D

  • @KabooM1067
    @KabooM1067 3 ปีที่แล้ว

    lol what a fun tutorial

  • @ahmetbcakici
    @ahmetbcakici 4 ปีที่แล้ว +1

    please dude, behave as you want on your personal videos but it is gonna be perfect for you if you be little serious on your tutorial videos

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Ahmet Buğra Çakıcı Thanks Ahmet 🙏

    • @ahmetbcakici
      @ahmetbcakici 4 ปีที่แล้ว

      @@hnasr you are welcome my friend, you have really good knowledge thanks for videos

    • @hanzladev
      @hanzladev 4 ปีที่แล้ว

      @@hnasr i like your funny stuff, but don't do them too much :D

  • @chaitanyasharma6270
    @chaitanyasharma6270 6 หลายเดือนก่อน

    you are hilarious

  • @abhishekamin3090
    @abhishekamin3090 2 ปีที่แล้ว

    I wish the tone was slightly more serious. Sadly, I stopped watching 2 mins into the video. You seem to have great knowledge of the subject though.

  • @samarthsaxena3998
    @samarthsaxena3998 3 ปีที่แล้ว

    For people getting 502 ,just update nginx.conf to use
    upstream all {
    server host.docker.internal:portnumber;
    }