.NET 7 💥 -- How to containerise Web API with Docker & use PostgreSQL

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • In this video we will be going to be containerising a .NET 7 API with PostgreSQL and Docker Compose
    Support me on Patreon to access the source code:
    / mohamadlawand
    Let us connect:
    🌍 My website - mohamadlawand.com
    📸 Instagram - / mohamadlawand087
    🐦 Twitter - / moe23
    ♯ Github - github.com/moh...
    🎫 LinkedIn - / mlawand
    💥 LinkTree - linktr.ee/moha...
    Gear I use (affiliate link): amzn.to/3EbT8Jw
    Support my work:
    / mohamadlawand
    www.buymeacoff...
    Hire Me:
    transactions.s...
    WHO AM I:
    I'm Mohamad, a Enterprise Architect working in Manchester, UK. I make videos about web, cloud, desktop and mobile development.
    GET IN TOUCH:
    If you’d like to talk, I’d love to hear from you. Tweeting @moe23 directly will be the quickest way to get a response, but if your question is very long, feel free to email me at hello@mohamadlawand.com.
    #dotnet #postgresql #docker

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

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

    11:48 Connection string
    36:54: Docker compose creation
    41:00 Setting the connection string on docker-compose
    41:10 menitioned that he connections tringwill be auto-injected into app
    50:17 : API testing tool Insomnia (like Postman)
    Remarks: Why the environment variable name in docker compose is not the same as in appsettings

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

    Would be handy if you make a video about the migrations being run automatically

  • @mirkozaper
    @mirkozaper 8 หลายเดือนก่อน +2

    52:03 thanks for video and please do video with first option (migration to run automatically)

    • @afonsocarvalho3124
      @afonsocarvalho3124 4 หลายเดือนก่อน +1

      I need some guidance on running migrations automatically too. If you have a real project with too many tables, doing manually is very time consuming, and the migrations are already there ready to be applied. Thank you for this video.

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

    Awesome video, I will love to see a Dev environment vs stage, and production environment; the database upgrades thru the EF core migration script, and the implications of always getting the latest version of the database. Overall well presented. Mine only advises having all the commands on an editor and copying and pasting.

  • @SingleServingMimic
    @SingleServingMimic 17 วันที่ผ่านมา

    Amazing video! thank you so much for this. An automatic migrations tutorial would also be great, keep it up!

  • @proffnick2405
    @proffnick2405 7 หลายเดือนก่อน +1

    Thank you Lawand. Your lecture is clean, clear and concise

  • @stoic2454
    @stoic2454 3 หลายเดือนก่อน

    Thank you soooooo much, I was stuck on this step, i never realized i'm using production evn and kept on thinking why i'm not getting swagger, lol

  • @100kshooter5
    @100kshooter5 ปีที่แล้ว +2

    Thank you so much Mohamad for such great content, have put notification on!!! Much love from South Africa!

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

    Great video. Do you have a github repo for this tutorial?

  • @adam-xt8te
    @adam-xt8te 4 หลายเดือนก่อน

    35:25 I stuck at this moment and I can't force API to throw those exceptions. In browser I got 404. I'll try later. Effects in the end are worth trying. Thank you for your effort

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

    great stuff, can you create a video about dotnet core clear architecture (onion) with a simple repository pattern and unitofwork? i would love to see your approach

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

    Thank you so much Lawand. It's bcoz of you I was able to learn about docker and execute it. Bigg help

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

    Super nice!!!!!!! Thanks How we can run migrations automatically un docker-compose.yml file?

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

    Thank you so much. It's so useful. Especially the part where database migrations inject in the db container.
    If not you, instead of 1 day I'd spend 1 week or more to containerize my project.

  • @alihamzaansari2012
    @alihamzaansari2012 10 หลายเดือนก่อน

    your explanations are really understandable and with a good pace

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

    Thank you Mohamad, ı made a compose file for my backend api + db + redis service and it's working without a problem. I am learning so many stuff from you. I used Dockerfile and wants to learn a bit about compose. Thanks so much again ^^

  • @Shanks-at-Work
    @Shanks-at-Work 7 หลายเดือนก่อน

    This is so helpful with step by step explanation. Thank you so much.

  • @MegaMaistro123
    @MegaMaistro123 11 หลายเดือนก่อน

    you nailed it bro
    ربنا يجازيك كل الخير يارب

    • @MohamadLawand
      @MohamadLawand  11 หลายเดือนก่อน +1

      أمين مشكور والله

  • @user-xc9zv1cd3z
    @user-xc9zv1cd3z 5 หลายเดือนก่อน

    Best!

  • @obasoroolakunle8421
    @obasoroolakunle8421 2 หลายเดือนก่อน

    Thanks for the video. Is necessary we create Dbcontext in our app if we want connect with postgresql database?

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

    How can he actually create migrations with an empty connectionString?
    When I tried that, I got an error: The string argument 'connectionString' cannot be empty.

  • @rogerstich7603
    @rogerstich7603 10 หลายเดือนก่อน

    very nice Tutorial, thank you for that.
    One question: How to do all the Connection String Magic properly, so i dont have them inside my Dockerfile and finally in my Git Repo?

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

    Did you push this to some repo? Would be nice to browse the code! Thanks

  • @TALHA.FF.8
    @TALHA.FF.8 ปีที่แล้ว +9

    One good practice (always) should be, even in demos, always use real world production code, so that even a beginner can learn the real world code, do a purpose build demo, not just for "simple demo".
    Don't do what 99% of other online tutors are doing (just demo purpose tutorials). There are tutorials for beginners, but not for experienced ones. Don't they need some advance level expertise?
    Also, can you make a demo on calling 500-1000 APIs at the same time and just wait for the ok 200 response.? What would be the best practical approach? I am asking you as you are the enterprise architectect.

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

      His demos are not real world projects but they are more complex than an usual demo. At least his demo in this video has database. It's enough to understand how to create and then to connect services by virtual network interface.

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

      Not everyone would agree with you. I got exactly what I wanted from this video, as did many other viewers. The video is concise and delivers on exactly what the title says.

  • @andresviera-ecuador4984
    @andresviera-ecuador4984 7 หลายเดือนก่อน

    Good afternoon, so I have a problem starting my applicattion is this error "warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect."

  • @99aabbccddeeff
    @99aabbccddeeff 10 หลายเดือนก่อน

    Thank you for such informative videos!

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

    Absolutely fantastic video, very well done!

  • @manssternerbostrom3148
    @manssternerbostrom3148 10 หลายเดือนก่อน

    Beautiful walkthrough!

    • @MohamadLawand
      @MohamadLawand  10 หลายเดือนก่อน

      Thank you! 👍

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

    Thanks for the detailed explanation!

  • @simontouma7924
    @simontouma7924 11 หลายเดือนก่อน

    Great video as usual!

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

    Great tutorial!
    Do you have another video where you demonstrate how to deploy this to production (i.e. Azure or AWS)?
    Also, how would you add your docker-compose file in source control (i.e. GitHub) so that the connection string is secure?

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

    Do i have to create a docker container prior to adding this

  • @patricksantos9309
    @patricksantos9309 8 หลายเดือนก่อน

    Thanks, helped me with the migration

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

    thanks for leaving the code in... wherever it is.

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

    Great tutorial thanks a lot Mohammed

  • @lifeisbeautifu1
    @lifeisbeautifu1 10 หลายเดือนก่อน

    Amazing! Thank you! ❤🔥

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

    hey Mohamad good job.😀
    I found your explanation really good some time I needed some subtitles, but even the automated subtitles were saying that is music. Doesn't matter still get >95%.
    Saludos Cordiales

  • @leleca987
    @leleca987 7 หลายเดือนก่อน

    brabooo

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

    Hi mo, can you make tutorial for .net microservices.

  • @user-tj2by9zp6c
    @user-tj2by9zp6c ปีที่แล้ว

    Thank you very much for intersting and useful information!

  • @user-ky1zu4cl9u
    @user-ky1zu4cl9u ปีที่แล้ว

    Awesome video as always. Should SDK commands be executed inside a Docker container rather than within a directory on the local machine? When I try, I get a message that the SDK is not installed within the container. Thanks

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

    Thank you very much!

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

    Thank you for the great video.

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

    Thank you so Much .

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

    Hi Mohamad,
    Is it possible that you create a video for containerise the same application but running on HTTPS as development environment. I am facing some issues that I haven't found a proper solution. The API doesn't run because of missing certificates.
    After properly setup the certificates using dotnet dev-certs and dotnet user-secrets and mapping the volumes inside docker-compose I still have the problem.
    Thanks!

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

    It's powerful!! Can you say please how can i debug(in vscode) my application when I run using docker compose?? Or somebody knows? Thanks a lot

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

    Any one else getting this error at the end when sending a get request "The ConnectionString property has not been intilaized "?

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

      vaar con = Environment.GetEnvironmentVariable(

  • @williampuma8241
    @williampuma8241 10 หลายเดือนก่อน

    awesome

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

    You're a god

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

    thank you

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

    Thanks

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

    Saved my ass, thank you!!!

    • @MohamadLawand
      @MohamadLawand  6 หลายเดือนก่อน +1

      Thank you for your support

  • @keithcarrillo8238
    @keithcarrillo8238 3 หลายเดือนก่อน

    24:49

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

    i think it would be better if you explain the code while showing the code, I keep moving back to where you show the code after listening to your explanation

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

    v3 :)

  • @Pan_Policjant
    @Pan_Policjant 11 หลายเดือนก่อน +1

    dude, your face is covering most of the things you do

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

    Thank you very much!!!