Developing with Docker - Docker in Practice || Docker Tutorial 8

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024

Комментарии • 125

  • @TechWorldwithNana
    @TechWorldwithNana  4 года назад +28

    The code on gitlab: gitlab.com/nanuchi/techworld-js-docker-demo-app

  • @TimothyHuey
    @TimothyHuey 2 года назад +5

    Not sure if it was mentioned but the Code has changed since the video and the DB Name is now my-db and no longer matches the video DB name of user-account. The code will create the DB my-app even if you manually only created user-account. So if you are following along and want to use Mongo-express to inspect the db just reload the page and select my-db and you can watch the updates. It's well worth it. Such well written and simplistic code is a joy to read. I have no knowledge of Nodejs programming but you don't need to to follow along with this course.

    • @Lea-pe7jy
      @Lea-pe7jy Год назад

      Wow, thank you so much. Timothy. I have played with user-account for a while and am not sure what happened. I have compared the codes and found the difference of the DB name but just cannot figure it out where the data was stored. Thank you!

    • @pavankumard5276
      @pavankumard5276 7 месяцев назад

      Thanks a lot dude

  • @banpet02
    @banpet02 4 года назад +13

    Greetings from Serbia. Thank your for this course. It has simple and very clear explanations for all the concepts (from basic to much more complex) which are sometimes very hard to undestand when we read it from other sources(books, sites et.).

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Yes, with Docker in Practice series I tried to give a more overall picture. I'm glad that it worked, thank you. :)

  • @zuzukouzina-original
    @zuzukouzina-original 3 года назад +17

    Just 1 word: Respect

  • @nikhil4865
    @nikhil4865 11 месяцев назад

    you are that much good in teaching that i got your channel recommendation from chatgpt and yes i found it correct your teaching style is excellent

  • @mizipizi3879
    @mizipizi3879 4 года назад +1

    So being totally new to this stuff, i had my problems figuring out that i have to adjust the "server.js" file with an editor like notepad ++ and adjust the lines 18,26,29,25(where var response should be defined !),48,51.
    I do not know whether it was on purpose to teach me how to figure out myself or by accident either way, Thank you for your great tutorial! managed to get it working.
    PS: Thank you so much :) you really are doing great !!

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      Your compliment is so humbling Mizi. Very happy to share the knowledge and experience. 🙂

  • @brasofilo
    @brasofilo 4 года назад +1

    Thanks a lot for this series, Nana. Everything very well explained and demonstrated. Thanks again and all the best!

  • @godwineffiong5164
    @godwineffiong5164 2 года назад +4

    Thank you so much Nana for putting up this wonderful video. i am a novice with JS. I just need a little clarification form anyone who understands JS and have tried out this video.
    After downloading this souce code, and running all the necessary npm install and node server.js ...am i supposed to get a black screen on the browser page despite seeing "app listening on port 3000!" on my terminal?
    on checking the style written on the html page, i saw
    #container {
    display: none;
    }
    does it mean the content of the index.html should'nt be displayed?

  • @shankureddy4642
    @shankureddy4642 4 года назад +2

    Hi Nana I appreciate you for sharing your knowledge with us, Great job! Coming to the point it would be helpful for us if you can make a video on how to run the JS application . Thank you,

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Thank you Shanku. Will consider this for future content. Please support and share. Stay safe. 👋🙂

  • @garyboriskin5603
    @garyboriskin5603 4 года назад +1

    The stand alone nodejs UI can access the mongodb. When creating nodejs container from my-app image the container starts with 'app listening on port 3000!' terminal message. But localhost:3000 display empty page. Nothing is displayed in logs.

  • @phuongcobra89
    @phuongcobra89 3 года назад +1

    Hello from Vietnam. Great job!

  • @SuvanshGupta-o3r
    @SuvanshGupta-o3r Год назад +3

    Hi, Can anyone tell when I am running this web app on my ide(VS Code) by copying the code in index.html file,server.js file,package.json file,and package-lock.json file and creating these files why I am not able to run the web app on my localhost.There is no error but the screen is blank

    • @WitchelsArtSchool
      @WitchelsArtSchool 7 месяцев назад

      could you please tell me how you fixed that?

  • @dhanunjayreddy800
    @dhanunjayreddy800 4 года назад +1

    Hi , Could you please do a video on how to bring communication on containers running on multiple hosts?

  • @anupamaiyengar2559
    @anupamaiyengar2559 Месяц назад

    awesome

  • @JaykiranSingh-s7o
    @JaykiranSingh-s7o Год назад

    Appreciated . Premium contents for free what should else we expect ?

  • @silentcicada4838
    @silentcicada4838 3 года назад +1

    Hey, thanks for the video! The tutorials are just amazing! Can you tell the customizations you have in your terminal?

  • @letaciogalvao9908
    @letaciogalvao9908 Год назад

    Great as always!

  • @Han-ve8uh
    @Han-ve8uh 3 года назад +1

    At 10:14 what's the shortcut to get all the options on multiple lines. Looks like you only copied the first option and the rest followed along

  • @Sneverwinter
    @Sneverwinter Год назад

    I'm new to Docker, so I'm sorry in advance if it's a dumb question, I ran mongo db's, but what should I do for the node.js file, should I run a new container or install node js on my computer, what exactly should I do?

  • @rktestingtools1937
    @rktestingtools1937 4 года назад +1

    Hi, Nana. Which version of linux are you using? . Could you please tell me the details to setup linux on windows. I am using redhat enterprise linux from aws ec2.getting many issues while doing

  • @carloscoliver9427
    @carloscoliver9427 4 года назад +3

    Hi Nana... I did the steps you mentioned on README section from you Git, and I ran "npm install" before "node server.js" when I apply this last, I got a blank screen and this output:
    app listening on port 3000!
    (node:16257) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
    /home/kobever/MongoDB_LAB/node_modules/mongodb/lib/utils.js:725
    throw error;
    ^
    MongoNetworkError: failed to connect to server [mongodb:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mongodb mongodb:27017]
    at Pool. (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/topologies/server.js:438:11)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at createConnection (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/connection/pool.js:561:14)
    at connect (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/connection/pool.js:994:11)
    at makeConnection (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/connection/connect.js:31:7)
    at callback (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/connection/connect.js:264:5)
    at Socket.err (/home/kobever/MongoDB_LAB/node_modules/mongodb/lib/core/connection/connect.js:294:7)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    Do you know what could be wrong?

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      can you post "docker ps" output? it seems like app can't connect to mongodb container. Maybe the port isn't bound on host.

    • @carloscoliver9427
      @carloscoliver9427 4 года назад

      @@TechWorldwithNana Hi Nana... Here is this:
      kobever@satellite:~$ docker ps
      CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
      524d4cc35351 mongo "docker-entrypoint.s…" 36 hours ago Up 4 minutes 0.0.0.0:27017->27017/tcp mongodb_lab_mongodb_1
      6bc930b68777 mongo-express "tini -- /docker-ent…" 36 hours ago Up 4 minutes 0.0.0.0:8080->8081/tcp mongodb_lab_mongo-express_1

    • @mizipizi3879
      @mizipizi3879 4 года назад +1

      also ran into this problem

    • @mizipizi3879
      @mizipizi3879 4 года назад

      @@carloscoliver9427 why is your mongo-express running on 0.0.0.0:8080->8081/tcp and not 0.0.0.0:8081->8081/tcp instead?

    • @sakisaki158
      @sakisaki158 4 года назад +1

      @@mizipizi3879, because docker-compose.yaml sets up the port this way for mongo-express:
      version: '3'
      services:
      # my-app:
      # image: ${docker-registry}/my-app:1.0
      # ports:
      # - 3000:3000
      mongodb:
      image: mongo
      ports:
      - 27017:27017
      environment:
      - MONGO_INITDB_ROOT_USERNAME=admin
      - MONGO_INITDB_ROOT_PASSWORD=password
      mongo-express:
      image: mongo-express
      ports:
      - 8080:8081
      environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=admin
      - ME_CONFIG_MONGODB_ADMINPASSWORD=password
      - ME_CONFIG_MONGODB_SERVER=mongodb

  • @shrikantagrawal3587
    @shrikantagrawal3587 4 года назад +1

    Amazing Practical Thanks!! One question - How can I save multiple values in mongo DB. As of now I can save only single value in Mongo DB as per your practical.

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      Do you mean saving values from node using Mongoose or generally? At the startup inside the container you can only create the initial values, like the DB, user, PWD. The rest you do programatically, like in this case using mongoose module. You can create a schema and insert values or whole objects. Does that answer your question?

  • @aaseemsayyed2374
    @aaseemsayyed2374 4 года назад +1

    Hello Nana,Nice and very well explained tutorial.I have a doubt , you have not installed or run nodejs as container...does that not require to run your code..and if i want to deliver all three as container image.How i can achieve it..

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Hi, I believe what you are asking I covered in this video where I build the nodejs app using Dockerfile: ruclips.net/video/WmcdMiyqfZs/видео.html and in the later step I deploy it together with the other 2 containers. Let me know if this video helps answer your question.

  • @JoshliteAdeyemi
    @JoshliteAdeyemi 3 месяца назад

    Please i am having issues running mongodb its doesnt connect to my browser

  • @yomajo
    @yomajo Год назад

    Would production database run on database root user, just credentials hidden inside .env file? Probably the only thing I'm missing is how this demo is different from real world operations.

  • @willerpentonposada4284
    @willerpentonposada4284 3 года назад

    awesome video!!!

  • @MichaelSalo
    @MichaelSalo 2 года назад

    If mongodb is included in package.json dependencies, does this mean an extra copy of mongodb will get installed, separate from the one running in the container?

  • @tequilandre
    @tequilandre 4 года назад +1

    super like.

  • @wasimshaikh-ns7pu
    @wasimshaikh-ns7pu 3 года назад

    Hello Nana, can you create some videos on password management for docker helm k8's?

  • @bikashsamal1635
    @bikashsamal1635 4 года назад

    @TechWorld with Nana
    In Mongo Express UI when trying to create User-Account Database, getting this error "Could not Create Collection"

  • @shaikmasihulla7050
    @shaikmasihulla7050 4 года назад

    Hi Nana,
    Your explanation is awesome and I have some doubt about node.js and html that how would you run these two pkgs in this video and how could you links with mango db...

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      You start the nodejs application with node server, that also servers the html in your browser. And in your nodejs code you have to write the correct mongodb endpoint so that nodejs can connect to mongodb which is running in a container. You can check the code in gitlab repository for that. If connection is not working between nodejs and mongodb, check the logs of both to see what the problem is. Does this help?

    • @shaikmasihulla7050
      @shaikmasihulla7050 4 года назад

      @@TechWorldwithNana I clone the git repo into my ec2 instance and I'm able to run both mango applications but unable to run the nodejs app by running the Dockerfile. I want to tell you that i didn't install any package on my laptop and the whole setup is running only on AWS free tier console. so please guide me to run this nodejs app which is cloned from your gitlab.
      Thank You

    • @shaikmasihulla7050
      @shaikmasihulla7050 4 года назад

      if you don't mind can you please send me your mail-id. so, that I will send the attachments of error screenshots once again" if you don't mind". and thank you once again.

  • @wasimshaikh-ns7pu
    @wasimshaikh-ns7pu 3 года назад

    How to secure password while passing as parameter inline?

  • @adityasrivastava9448
    @adityasrivastava9448 7 месяцев назад

    Mongo-express is giving unauthorized access in the logs

  • @rakshitaram
    @rakshitaram 4 года назад

    Hi Nana,
    I followed your tutorial step by step and also tried the steps in the readme. I wasn't able to connect to mongo-express on localhost. Can you please help? I am stuck in that step and unable to move forward.

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      Hi. Sure Rakshitha. can you do "docker ps" and write me the result? there should be "ports" -> 8080:8081 mapping, which makes it accessible on localhost:8080! If it has correct port binding, then also check the logs of the container with "docker logs container-id" and write that also.

    • @rakshitaram
      @rakshitaram 4 года назад

      @@TechWorldwithNana Thank you for your response. This is the logs of the container and the docker ps like you asked
      docker ps:
      CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
      fe4501ceb234 mongo-express "tini -- /docker-ent…" 5 minutes ago Up 5 minutes 0.0.0.0:8081->8081/tcp mongo-express
      346e743938fb mongo "docker-entrypoint.s…" 12 minutes ago Up 12 minutes 27017/tcp, 0.0.0.0:27017->27107/tcp mongodb
      docker logs:
      $ docker logs fe4501ceb234e64c1494cec01c51a298071e9149af9079446c2b3ccced54dff2
      Waiting for mongodb:27017...
      Welcome to mongo-express
      ------------------------
      Mongo Express server listening at 0.0.0.0:8081
      Server is open to allow connections from anyone (0.0.0.0)
      basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!
      Database connected
      Admin Database connected

    • @rakshitaram
      @rakshitaram 4 года назад

      @@TechWorldwithNana I figured it out. I used the docker-machine ip 192.168.99.100:8081 instead of localhost, and it worked.

  • @Nirmal_pm
    @Nirmal_pm 4 года назад

    Thank you for this wonderful teachings!
    When I run both the containers, mongodb and mongo-express as explained, and went to browse localhost:8081 i'm getting "This site can’t be reached" page. What might be the reason. Checked the terminal logs and it shows the express is successfully running in port 8081.

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      Hi, can you post here the results of docker ps, when both containers are running? my doubt is that you haven't binded the container port 8081 to your host port 8081

    • @Nirmal_pm
      @Nirmal_pm 4 года назад

      @@TechWorldwithNana
      $ docker ps
      CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
      06cd8d79a271 mongo-express "tini -- /docker-ent…" 12 seconds ago Up 9 seconds 0.0.0.0:8081->8081/tcp docker_mongo-express_1
      d54c39447b86 mongo "docker-entrypoint.s…" 2 hours ago Up 9 seconds 0.0.0.0:27017->27017/tcp docker_mongodb_1
      FYI... i'm using docker toolbox for windows

    • @krzysiek5806
      @krzysiek5806 4 года назад

      @@Nirmal_pm Hi, I had same issue. Please refer to stackoverflow.com/questions/42866013/docker-toolbox-localhost-not-working . Instead of localhost, please use 192.168.99.100 . So in our case you can find mongo-express at 192.168.99.100:8081/ . Cheers

    • @nikhilvijayan3411
      @nikhilvijayan3411 4 года назад

      @@TechWorldwithNana Hi, I'm facing the same issue. Can you please help?

  • @RaviKumar-ik8qb
    @RaviKumar-ik8qb 4 года назад

    could you please share docker networking videos if you have one,plz

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Hi Ravi, I plan to do a docker networking video

    • @RaviKumar-ik8qb
      @RaviKumar-ik8qb 4 года назад

      @@TechWorldwithNana looking forward to it.and again thanks for making this great videos, do you have any plans to start classes on need basis

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      @@RaviKumar-ik8qb Also thanks again! No I don't have plans to do classes

  • @nusratkhwaja6330
    @nusratkhwaja6330 4 года назад

    Nana: How could I try to try your app on my laptop?

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      Here the gitrepo link, where you can clone my app: gitlab.com/nanuchi/techworld-js-docker-demo-app
      Once you have, you can read the readme file, where I wrote how to start the application. Let me know if something is unclear or you have problems starting it.

  • @himanshujain9933
    @himanshujain9933 2 года назад +2

    First of all Thanks. Just one question have you run node part within same docker network or, or have you run node part in localhost and node automatically connected to mongo?
    Thanks

  • @gokulnair237
    @gokulnair237 4 года назад +2

    if anyone faced mongonetwork error while running the server on windows use the url as mongodb://admin:password@localhost:27017

  • @joeharran3638
    @joeharran3638 4 года назад +2

    Hi Nana, Just saw your tutorial series last week and i think they are great in the way you present, contents and items covered. thank you for this good work.
    on the other hand, since Im new comer, i appreciate if you have little time to assist me in have the applications running, first im facing connection issue when starting Mongo-express, it run only for couple of sec and exit with below error in logs
    Mongo Express server listening at 0.0.0.0:8081
    Server is open to allow connections from anyone (0.0.0.0)
    basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!
    /node_modules/mongodb/lib/server.js:265
    process.nextTick(function() { throw err; })
    ^
    Error [MongoError]: failed to connect to server [mongodb:27017] on first connect
    at Pool. (/node_modules/mongodb-core/lib/topologies/server.js:326:35)
    at Pool.emit (events.js:315:20)
    at Connection. (/node_modules/mongodb-core/lib/connection/pool.js:270:12)
    at Object.onceWrapper (events.js:422:26)
    at Connection.emit (events.js:315:20)
    at Socket. (/node_modules/mongodb-core/lib/connection/connection.js:175:49)
    at Object.onceWrapper (events.js:422:26)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    thanks in advance

  • @TechWorldwithNana
    @TechWorldwithNana  4 года назад +1

    0:14 - Pre-Requisites
    0:55 - what we will do in this video
    1:44 - *1st part:* The JavaScript App (HTML, JavaScript Frontend, Node.js Backend)
    3:30 - *2nd part:* MongoDB and Mongo Express Set-Up with Docker
    5:00 - Docker Network concept and demo (docker-compose uses docker network under the hood, in the next video(s) I will show you how to do it with docker-compose)
    15:33 - *3rd part:* Connect Node Server with MongoDB container
    👉🏼 For any questions/issues/feedback, please leave me a comment and I will get back to you as soon as possible.
    👉🏼 Also please let me know what you want to learn about Docker & Kubernetes.
    Also please don't forget to subscribe and give me a thumbs up if you liked my video 🤓

    • @fbobes
      @fbobes 4 года назад +1

      Great tutorial, thanks for putting this together. Is there any chance to share the exercise files in github for example? That would help.

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Thank you! Yes I will put them on github the next days and put the link in the description

    • @fbobes
      @fbobes 4 года назад +1

      @@TechWorldwithNana wow this is great! Thanks Nana :-)

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      @@fbobes gitlab.com/nanuchi/techworld-js-docker-demo-app

  • @YASHKHANDAL-f5m
    @YASHKHANDAL-f5m 5 дней назад

    I am getting white screen on my local host 3000 how can i solve this problem

  • @VarunVerma13
    @VarunVerma13 Год назад

    I am having trouble running the localhost:3000, it's saying "this site can't be reached" even using live server extension I'm vs code I am not getting anything. Could anyone tell me what should be done here?

  • @pavankumard5276
    @pavankumard5276 7 месяцев назад

    It might take some time for mongo to be ready and accept connections, till then it shows error. Check for "Server is open…"

  • @AndyRodriguezJimenez047
    @AndyRodriguezJimenez047 4 года назад +1

    It was a litter hard to pass to the next video because of "JS ERROR", after install all of this(git, nodejs, npm), the solution was just install NPM INSTALL EXPRESS and the node server.js start successfully. Great Video thank you.

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      Hi, yeah I should've probably emphasized that more. If you have created package.json and copied dependencies inside like I show, you just need to do "npm install" and it will download all the specified dependencies from remote repository and you will have them available locally in node_modules folder. So now your node app can find them.

    • @AndyRodriguezJimenez047
      @AndyRodriguezJimenez047 4 года назад

      @@TechWorldwithNana GreaT Nana, thank youuuuu.

  • @VishuencApp
    @VishuencApp 3 года назад +1

    I am enthusiastic devotee of your videos becoz you show in practice labs what you explain which clarifies most of ours doubts. Thank you so much! Keep continue :)

  • @YL-pl1ek
    @YL-pl1ek 2 года назад +1

    This is a mind-blowing video - in so many levels.
    Earthquake...
    Thank you !!!

  • @cabezademariano185
    @cabezademariano185 2 года назад +1

    Awesome!

  • @tylerfishbone6557
    @tylerfishbone6557 4 года назад

    If you check the logs after doing starting the Mongo-Express container and you get the error
    ```
    unable to list databases
    Error [MongoError]: command listDatabases requires authentication
    ```
    make sure you entered the correct environment variables. I did the ME_CONFIG_BASICAUTH_USERNAME instead of ME_CONFIG_MONGODB_ADMINUSERNAME

  • @MichaelSalo
    @MichaelSalo 2 года назад

    Why wouldn't we install Node itself into a container, like what you've done with Mongodb?

  • @nadunsamarasinghe5592
    @nadunsamarasinghe5592 6 месяцев назад

    Great Simulation indeed! I have fully tested your scenario. It absolutely working fine with no errors. Thank for the great effort made so far and grab the abstract picture of the series.

  • @louisaldorio7251
    @louisaldorio7251 4 года назад

    i got error caleed unauthorized command listdatabses requires authentication, Turn on admin in config.js to view server stats!

  • @akashlodhi8021
    @akashlodhi8021 2 года назад

    Hey Nana,
    I am looking for some content on creating your own Docker file and using it for Docker image. There is so much content on the google to cover, so it will be helpful if you can cover it.

  • @alivecoding4995
    @alivecoding4995 Год назад

    I really like your concise but comprehensive way of presentation.

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 4 года назад +1

    Thanks for ALl, Nana 🎉🎉🎉

  • @ВладиславКоролёв-ц9э

    Incredibly good material

  • @gizmoamp
    @gizmoamp 4 года назад +1

    Thanks for the tutorial - i tried it manually on one ubuntu 20 server and also with composer on another server from your gitlab repo but when im starting the "node server.js" i always get an error Error: Cannot find module 'express'

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +2

      Do npm install, before executing "node server.js". Since repository doesn't contain the node_modules, you have to do npm install so that all your module dependencies, like express get downloaded and made available for your application. Let me know if you succeed.

    • @page0809
      @page0809 3 года назад

      @@TechWorldwithNana I did have same issue.
      I'm using WSL and first I installed the Node Version Manager ( nvm )
      with nvm I installed node LTS
      nvm also installed npm for me
      and then:
      npm install express --save
      the issue was fixed and I was able to complete the tutorial :D
      Thank you!

    • @Folaan
      @Folaan 3 года назад

      @@page0809 I am using WSL also and I still have that exact problem!

  • @gecharo
    @gecharo 3 года назад

    Wow. Amazing! Thanks!

  • @atendimentosuperdivulga3932
    @atendimentosuperdivulga3932 3 года назад

    Great video, helped me a lot! Following your info I managed to create my own docker + react environment, thanks!

  • @marctowersap8018
    @marctowersap8018 4 года назад +1

    hmmm.. I could not get node.js to work with it. I got the mongodb/mongo-express to work together, added the user-account db plus the users collection. getting node.js to work (note the code in your video is different than what's in github, even the db changed (user-account to my-db), the server.js changed too (I paused it, wrote code, paused at the top, then the bottom, and saw in the git repo the order of functions changed, some parts are different within the functions). I installed node.js, did an npm install --save mongodb and express. Ran it (node server.js), blank. So I replaced what I typed in with your server.js from github, modified it a little (replacing my-db with user-account, changed the image path to to images/profile-1.jpg (after creating images subfolder and copying profile-1.jpg to there), and using my own admin username/password. ran node server.js, and got still a blank page on port 3000. I added a head/title section to the index.html, I do see that change in localhost:3000. but I see no image, no nothing. all of this is running in the same subfolder, doing a dir, I have images, images/profile-1.jpg, index.html, server.js, and package.json and package-lock.json. I see my mongodb version is 4.3.1 (as opposed to 3.3.3)...

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +2

      Hi Marc. Yes, the code in github is the final result of this series. you will get a blank page if at least one request to server fails. So in the terminal where you run "node server.js", you must see the error message from node. It could be something like "can't find the image" or "can't connect to the database".
      Try this: if you are running node from terminal (NOT as a docker container), then in your server.js file the DB url must be "mongodb://admin:password@localhost:27017", because you need host:port to access external services, as always.
      If you run your node app in its docker container, then you will have "mongodb://admin:password@mongo", so without host:port, just the container name. Because docker creates a virtual network, where containers can talk to each other using just the name, without needing host:port.
      So try this and let me know what node logs, if you still get an error

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +2

      Also I will update the github code to make it more useful and self-explaining. So thanks for pointing that out!

    • @marctowersap8018
      @marctowersap8018 4 года назад

      @@TechWorldwithNana sadly, I see nothing. if I rename the jpg file, then I see errors about not finding profile-1.jpg. And I re-set my js file back to the code in your video for tutorial8. If I put the name back, then I get no errors, but a blank page. My connection string is like MongoClient.connect('mongodb://mongoadmin:password123@localhost:27017', function (err, client) { (I changed mine to run as mongoadmin with password passsword123). my two mongo docker containers are running (container!), I log into mongoexpress (port 8081), I do see 'user-account' db with 'users' collection.

    • @marctowersap8018
      @marctowersap8018 4 года назад

      and I am using the same index.html as in your git repo. Maybe the newest version is broken for tutorial 8, but is correct for later videos?

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад +1

      @@marctowersap8018 ok I see. can you do "docker logs {mongo-db-container-id}" and see if mongodb logs any errors? If not, the problem must be the index.html file (frontend code). Meaning node backend handles the request fine but the frontend can't render it. To find this out: open the developer tools in your browser, go to the network tab, refresh the page, and see what response you get. Also check the console to see if there are any errors there.
      Let me know what you find!

  • @rajesho9772
    @rajesho9772 2 года назад

    The good thing about ur tutorial is u always make it in terms of start to end :) it’s makes things complete and satisfy one’s search 😇🥰

  • @ahmedjarraya1739
    @ahmedjarraya1739 3 года назад

    AWESOME !

  • @nusratkhwaja6330
    @nusratkhwaja6330 4 года назад

    at 18:05, you are changing data. you had just defined containers for mongodb n mongoexpress. How did you start your application? I created the image but what cmd I should use to make n run its container (what parameters with 'docker run ..' cmd) ?

    • @TechWorldwithNana
      @TechWorldwithNana  4 года назад

      In THIS video, I start my application locally using "node server.js" command, as you can see here: ruclips.net/video/6YisG2GcXaw/видео.html. It doesn't run in a container, because you want to be able to debug and test and make changes fast. Once you are done with development, then you would create an image out of it FOR deployment purpose. Does this answer your question? let me know if something else is unclear.