Docker Compose Tutorial with PostgreSQL and Node.js

Поделиться
HTML-код
  • Опубликовано: 23 окт 2018
  • A Docker Compose tutorial where we create a PostgreSQL and Node.js container.
    Code: github.com/benawad/graphql-ty...
    ----
    If you like cooking, checkout my side project: www.mysaffronapp.com/
    ----
    Join the Discord: / discord
    ----
    Patreon: / benawad
    ----
    Follow Me Online Here:
    GitHub: github.com/benawad
    LinkedIn: / benawad
    Instagram: / benawad97
    Twitter: / benawad
    #benawad
    TikTok: / benawad ​

    ----
    Follow me online: voidpet.com/benawad
    #benawad
  • НаукаНаука

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

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

    This was a great tutorial, one thing I wish that was mentioned was using named volumes. I was under the assumption that mounts and named volumes were declared the same way in a compose file and that had me stuck for a lot longer that I'd like to admit. Solution is to state all named volumes used at the end of your docker file on a service level.

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

    Awesome tutorial, thanks Ben!

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

    Thank you very much, very clear explanation!

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

    this has been a life saver thank you so much

  • @user-fh4xo2pc2d
    @user-fh4xo2pc2d 5 лет назад +4

    Thanks! I hope you cover how to deploy multi docker app to aws later~

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

    Thanks! Hopefully I'll be able to use Postgres with my new Angular app 👌

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

    thanks man. this was to the point

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

    Thank you....! Great content. that video helped me to save lots of my time.

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

    Thank you so much for this :)

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

    viejo Ben usted un capo. gracias

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

    THANK YOU SOOO MUCHH FOR THIS VIDEO

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

    Thanks bro... Appreciated

  • @xadasol8692
    @xadasol8692 5 лет назад

    I wonder who this 1 person is that didn't find this tutorial useful!!!
    Anyways, great tutorial, thank you so much, founded really easy to follow and grasp the basic commands
    Cheers

    • @bawad
      @bawad  5 лет назад

      Thanks :)

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

    Thanks mate. Took me hours to find out how to connect...

    • @RK-gm4pd
      @RK-gm4pd 4 года назад

      What was a problem? I can't connect to the DB with compose now but without it works perfect.

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

    good job yo!

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

    Great content thanks!
    How to add my .pgpass to the docker-compose yml?

  • @themarksmith
    @themarksmith 5 лет назад

    Excellent video! - Having real problems wrapping my head around using Git - tried from command line and using SourceTree... with bitbucket and github... I am using Windows 10 pro, not sure if that's the issue and really need to spend more time learning it as I have been a bit half assed with it... may be an idea for a video... but then again I dont want to spoil your thunder as you seem to be on a role at the moment!

    • @bawad
      @bawad  5 лет назад

      Keep at it with Git, it's an important tool. I may do a video on it at some point

  • @HendraSadewa
    @HendraSadewa 5 лет назад

    THAAANKS !

  • @grimmersnee
    @grimmersnee 5 лет назад +1

    great series Ben! I'm interested in your experiences running a db in a container, in terms of data storage constraints etc also deploying this example into Digital Ocean or others?

    • @bawad
      @bawad  5 лет назад +2

      So far I haven't had any problems running Postgres in docker. I'll be showing how to deploy soon

    • @andresmontoya7852
      @andresmontoya7852 5 лет назад

      @@bawad you'll show it with heroku?

    • @bawad
      @bawad  5 лет назад +1

      No, on Heroku, I would use the Postgresql addon

  • @sumanshu.nankana
    @sumanshu.nankana 2 года назад

    In docker-compose.yml, line 6,7,8 hyphen(-) is missing. Not sure how it works without array.

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

    How are you using the top level await?

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

    Muito obrigado!

  • @andresmontoya7852
    @andresmontoya7852 5 лет назад +4

    Thanks! I prefer to use wait for it because the connection code keeps easy, like:
    await createConnection();
    And that's it! And also with the flag -t 0, the script can wait until the database is already loaded!

    • @bawad
      @bawad  5 лет назад

      cool

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

      @@bawad man really one worded someone who’s grateful for his video 😂 big egos in compsci or just bad mannered I guess

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

      @@fabrzy3784 or, could just be you looking too far into it 😳

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

      @@keemkorn you don’t just one word your viewers , no sign of respect or acknowledgment.

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

      @@fabrzy3784 is brobro supposed to respond meaningfully to every comment? The fact that he replied at all should be good enough, no? There are a lot of comments with no response at all. Would not commenting be better than replying at all??

  • @mohamedbenighil1026
    @mohamedbenighil1026 5 лет назад

    How if would like change the source code of "web" service? in other words how can i add volume ?

    • @bawad
      @bawad  5 лет назад

      you want to put the source code in the volume and change it?
      I think you should be creating a new image instead

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

    Where to parse ormconfig.docker.json?

    • @MeMe-nm7jr
      @MeMe-nm7jr 3 года назад

      3 months later, but for you or anybody else still wondering, the TL;DR is that he likely explains in earlier videos where he creates the individual docker images that he's referencing from compose in this video.
      Longer answer is that ORM here likely refers to an Object Relational Mapper -- a tool that allows you to map objects in your code to relational database tables (similar tools for other types of databases too). Then your code can work with data in the database from objects in your code once connections are made properly.
      He doesn't describe the ORM in this video because this video is about docker compose, which is about composing different docker images that have already been created using docker (before this video). So he likely explains in a video before this how he created each of the docket images, including how he image for the app uses an ORM. If he doesn't, don't trip, just use whatever tool you use in your app to connect to your database. If that doesn't make sense there are plenty of tutorials for frameworks and tools to use in your language of choice that will have details on DB connections.

  • @Leo-vt1fg
    @Leo-vt1fg 4 года назад

    It's cool but we don't see how to connect to postgre in node ...

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

    Thanks for your video. Could you tell how do you delete a word ("PASSWORD" in 2:05 ) so fast? That's amazing.

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

      benawad.com/fast

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

      no special shells or gimmicks needed, you can simply use in VSCode, for example, from where cursor was placed ctrl + shit + right arrow, then quickly tap delete. I also use ctrl + right/left arrow to jump over words and add shift into that combo and you got an select as well

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

      @@dejo095 it also okay, thanks

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

    You did not show how you set up the connection to Postgres in node

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

      I did with typeorm

  • @kwii22789
    @kwii22789 5 лет назад

    whats the best way to store the environment variables for the database secretly?

    • @bawad
      @bawad  5 лет назад +2

      You can use a .env file stackoverflow.com/questions/46917831/can-you-use-a-env-file-for-a-stand-alone-dockerfile

    • @kwii22789
      @kwii22789 5 лет назад

      @@bawad Thank you :)

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

    it works but i my database still empty, i dont know how to do it to make a build and get all the databases and tables and rows... :(

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

      you need to create a migration on your dev-database and then run it inside the index file of the server-container. this will migrate the production database.

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

      @@kozie928 mmm any link to read and learn about? thanks!

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

      @@luppo2007 If youre using an ORM like typeorm/mikroorm, ben featured this in his course:
      ruclips.net/video/I6ypD7qv3Z8/видео.html
      If you want to do it without migrations, you can also create a sql file and then pass it as a volume (entry point) to your database docker container like this: gist.github.com/vrulevskyi/307b08abddc9568cf8f9c1b429c1ab56
      this will initialize the db with the sql inside the file.