The Best Way To Deploy In 2024 (feat. Docker, Rust, and Language Models)

Поділитися
Вставка
  • Опубліковано 27 вер 2023
  • One approach that can be used for scaling a web application. We walk through how to create a Docker image with your project in it such that it can be deployed to any cloud platform. The example project in the video is a chatbot webapp built using the Rust Leptos framework. For a walkthrough of how that was created, check out this video • Build A Full Stack Cha...
    We also take a look at the Docker init feature for kickstarting the process of creating a Docker image build.
    Camera: Canon EOS R5 amzn.to/3CCrxzl
    Monitor: Dell U4914DW 49in amzn.to/3MJV1jx
    SSD for Video Editing: VectoTech Rapid 8TB amzn.to/3hXz9TM
    Microphone 1: Rode NT1-A amzn.to/3vWM4gL
    Microphone 2: Seinheiser 416 amzn.to/3Fkti60
    Microphone Interface: Focusrite Clarett+ 2Pre amzn.to/3J5dy7S
    Tripod: JOBY GorillaPod 5K amzn.to/3JaPxMA
    Mouse: Razer DeathAdder amzn.to/3J9fYCf
    Computer: 2021 Macbook Pro amzn.to/3J7FXtW
    Lens 1: Canon RF50mm F 1.2L USM amzn.to/3qeJrX6
    Lens 2: Canon RF24mm F1.8 Macro is STM Lens amzn.to/3UUs1bB
    Caffeine: High Brew Cold Brew Coffee amzn.to/3hXyx0q
    More Caffeine: Monster Energy Juice, Pipeline Punch amzn.to/3Czmfox
    Building A Second Brain book: amzn.to/3cIShWf
    Keyboards
    Redragon K552 - amzn.to/3oNtpD7
    Keychron Q1 - amzn.to/3YkJNrB
    Keebio Iris - keeb.io/collections/iris-spli...
    Purple Gradient Keycaps on Iris - amzn.to/3UZq93f
    Corne v3 - shop.beekeeb.com/product/pre-...
    Apollo themed keycaps on Corne - amzn.to/3IXKPUc
    Chocofi - shop.beekeeb.com/product/pres...
    Piantor - shop.beekeeb.com/product/pre-...
    Kinesis Advantage360 Professional - amzn.to/3Ce5zUf
    Glove80 - www.moergo.com/collections/gl...
  • Наука та технологія

КОМЕНТАРІ • 71

  • @bobfearnley5724
    @bobfearnley5724 8 місяців тому +7

    I am so proud of your channel. I have been following since you started and I can see the massive progress! :D

    • @codetothemoon
      @codetothemoon  8 місяців тому +1

      thank you so much! it's great to hear things like this, it motivates me so much 😎

  • @bayoneta10
    @bayoneta10 8 місяців тому +16

    Great video! I noticed that the entire src directory and the package.json file are being copied over before executing npm install. A possible improvement could be to first copy only the package.json file, run npm install, and then copy the rest of the source code. This way, the installation step would be cached, making the build process more efficient, especially when changes are made to the src directory but the dependencies remain the same. After that, something similar could be done with npx tailwindcss, but I have to say that I am not sure about that

    • @crasite
      @crasite 8 місяців тому +1

      This should be pinned.

    • @codetothemoon
      @codetothemoon  8 місяців тому

      whoa thanks for pointing this out! sounds like a fantastic optimization - will give it a try!

  • @rafaelgomes3054
    @rafaelgomes3054 8 місяців тому +3

    Loved the video. I know we don't often need scaling but it is good to see how to get it working.

    • @codetothemoon
      @codetothemoon  8 місяців тому +4

      thanks, glad you got something out of it! i think it makes sense to make a habit of building for scale, even when you don't think you'll need it. because it actually doesn't cost any extra - just a few extra things to consider

  • @flwi
    @flwi 2 місяці тому

    Nice video. Clever approach of using a specialized build image just for the tailwind stuff. Haven't thought about it and will use that for sure!
    I'm currently learning rust and having a good time. Due to the interactive rustlings tutorial I get the same joy and flow as back in the days where I was learning scala with the official coursera course that had automated grading of the excercises

  • @johnapple3471
    @johnapple3471 7 місяців тому +1

    I DIDNT KNOW YOU COULD DO docker init and the Dockerfile is made for you. I WAS BANGING MY HEAD TRYNG TO FIGURE OUT WHY MY DOCKERFILE WASNT WORKING. THANKS SO MUYCN

  • @sachaw100
    @sachaw100 8 місяців тому +6

    Good video, but I think you should have intruduced it from the standpoint of using OCI containers and that docker is just one runtime, not that it is the tooling of choice. Containerising your applications so they can be run under any OCI runtime (kubernetes, podman, etc) is where the real value lies, not vendor lock-in to one platform.

    • @codetothemoon
      @codetothemoon  8 місяців тому +3

      thanks for the feedback! I definitely made a point to emphasize that although I used AWS ECS as an example, once you have an image you're free to use pretty much any cloud platform. But to your point, instead of saying "any platform that supports Docker images" I probably should have said "any platform that supports OCI images".

  • @northicewind
    @northicewind 8 місяців тому +1

    Great content, as always! Thank you.

  • @a314
    @a314 8 місяців тому +9

    You can use alpine images to both speed up your build, runtime and as well as patch any CVE that gets published. Combined with Rust, the resulting docker image size will be 20+MB which is 7x smaller than the Debian based image.
    Fwiw, Debian is pronounced Deb-Ian, not Dib-Ian. Ian Murdock created Debian in1993. The word "Debian" was formed as a portmanteau of the first name of his then-girlfriend (later ex-wife) Debra Lynn and his own first name.

    • @codetothemoon
      @codetothemoon  8 місяців тому +3

      thanks for pointing both of these things out! I stuck with Debian for the video mostly because that's what docker init gives you by default - probably not the best reason

    • @maximotejedapozo9335
      @maximotejedapozo9335 7 місяців тому +2

      Docker stick to debian due to c lib compatibility issues, I think by default Alpine use musl which bite me in the past

  • @jembishop3509
    @jembishop3509 2 місяці тому

    Great video!

  • @aazzrwadrf
    @aazzrwadrf 8 місяців тому +1

    loved it! ty

  • @IcarusSparry
    @IcarusSparry 8 місяців тому +6

    01:20 "docker init" requires docker desktop. Whilst it is free for many people you need to look at the license and make sure that you are not requiring your company to subscribe to professional license fees.

    • @codetothemoon
      @codetothemoon  8 місяців тому +2

      ahh yes thanks for pointing this out, I should have mentioned it!

  • @malibuiconic3466
    @malibuiconic3466 8 місяців тому +1

    Great video. I had just did the same thing recently on AWS with my Rust Docker. Would really liked to had know that 'Docker init' lol. As I struggled with my Mac M1 compiling to AMD64 and dealing with the AWS exec error I got haha. Its always a video after the fact. ;) But I have followed you for a while. Thanks for this new addition really helpful. Cheers.

    • @codetothemoon
      @codetothemoon  8 місяців тому

      thanks! Docker init is indeed pretty useful, I didn't know about it either until very recently. really happy to hear you're getting something out of the videos!

  • @josecarloscirqueirajunior2914
    @josecarloscirqueirajunior2914 8 місяців тому +1

    great video .. thanks

  • @CodingWithLewis
    @CodingWithLewis 8 місяців тому +3

    15:55 You said it's not blazingly fast but that looks pretty damn fast to me! Any recommendations what VM type you would run this on?

    • @codetothemoon
      @codetothemoon  8 місяців тому +1

      Yeah I should have left the clip at normal speed, at least for a few seconds 😎 you can sort of see the actual speed in the few seconds where I'm speaking as the text is coming through. Also I'm really stoked to see that you watched this, I really enjoy your content!!

    • @codetothemoon
      @codetothemoon  8 місяців тому +1

      As for recommendations for VM to run this on, I'd probably start with one of the g* instances like a g5. I think the inf instances may be even more ideal from a hardware perspective, but I'm not sure if there is software support for this type of stack on those

  • @renancidale9210
    @renancidale9210 3 місяці тому +1

    love it.

  • @alidadgar445
    @alidadgar445 7 місяців тому

    Does rust backend app need crate or anything else for deployment?(some thing like gunicorn for python)

    • @flwi
      @flwi 2 місяці тому

      No, rust binaries bring everything they need (afaik). The don't need any runtime/vm. That's one of the big benefits of rust imo.
      Not an expert, since I only learned coding in rust last week.

  • @bryanmora4996
    @bryanmora4996 8 місяців тому +1

    Pretty good content

  • @twenty-fifth420
    @twenty-fifth420 8 місяців тому +1

    Woah hold on there moon boy! Now I may be super high, but I have enough on my plate coding and speedrunning ruby with my personal project and website. 😂 But I will watch your video because I love you❤
    Take it easy, I just like the whale. I do not want to ride the whale yet. 😂 _I admit though deploying to docker is my preferred solution of choice_
    (But after Ruby is Nim and Haxe, I know strange order but I rolled 20 languages in 3 ‘random’ lists. I picked 20 and thought they looked pretty and plucked them randomly and going with it.)
    Go was on the first list. But I have it fourth. And I am in ‘no’ rush until I hit week 4. I am scripting high after all 👌

    • @codetothemoon
      @codetothemoon  8 місяців тому

      this is one of my favorite comments of all time lol

  • @SR-zi1pw
    @SR-zi1pw 8 місяців тому +1

    Nice video

  • @L0wPressure
    @L0wPressure 8 місяців тому +2

    Wait your split keyboard is totally wireless. It looks awesome, do you have a review of it?

    • @codetothemoon
      @codetothemoon  8 місяців тому +1

      yep, I do! it's actually the video immediately preceding this one: ua-cam.com/video/PFFa3h7eLWM/v-deo.html

    • @kai-.-man
      @kai-.-man 8 місяців тому

      He made a recent video (9 days ago)

  • @Danielo515
    @Danielo515 8 місяців тому +1

    Wait, wait, do you have a glove 80 gathering dust in a shelf??? Why?

    • @codetothemoon
      @codetothemoon  8 місяців тому

      that's actually one of the boards MoErgo sent me to compare the different switches. I have to send it back but I'm waiting on the shipping info, so I decided to make it part of the set in the meantime 🙃

    • @Danielo515
      @Danielo515 8 місяців тому

      @@codetothemoon , that was a speede response. After the initial shock I saw you were using a glove 80 during the video, so everything is fine 😄

  • @nicklam3594
    @nicklam3594 8 місяців тому +1

    Great video as always . it seems u updated doom emacs and did not run nerd font install (thats why your modeline looks like crap) . Love u!

    • @codetothemoon
      @codetothemoon  8 місяців тому +1

      haha thanks for pointing this out, I didn't even notice! lol

  • @Sahil-a-vim-user
    @Sahil-a-vim-user 7 місяців тому +1

    It's not d-bian it's flipping DEB-IAN 😭😭
    great vid btw

    • @codetothemoon
      @codetothemoon  7 місяців тому

      So I’ve learned :) you can’t imagine the comments about my pronunciation of “enum” 😆

  • @nonnnth
    @nonnnth 8 місяців тому +1

    Oi, you docker init?

    • @codetothemoon
      @codetothemoon  8 місяців тому

      Sorry what’s the question? 🙃

  • @Hacking-Kitten
    @Hacking-Kitten 8 місяців тому +2

    ecs does not scale to zero, right? Adds up for lots of side projects.. From the title of the video I expected a deployment guide, not docker..

    • @codetothemoon
      @codetothemoon  8 місяців тому

      Thanks for the feedback! I believe it can if you use 1 free tier ec2 instance. You could probably deploy multiple projects to it, thought I'm not sure what the best approach for that would be. Re: deployment guide, you mean more details on the building and deploying on a platform like ECS?

  • @imichael.
    @imichael. 6 місяців тому

    Appreciate the multi-stage builds, but your Dockerfile seems like a junk drawer to me. This is a "God" image that is completely unfocused and not easy to maintain. Consider breaking these up into separate Dockerfiles instead.

  • @ostrava_
    @ostrava_ 6 місяців тому

    Seriously docker sucks. It's great that containerization was popularized, but docker sucks.

  • @wgolyoko
    @wgolyoko 8 місяців тому +21

    I hate these types of video. 99% of use cases do not need any scaling, and a single AWS instance will be able to handle everything. If your app somehow ends up actually needing scaling, you'll be making well enough money to do so at that time.

    • @leifelliott1500
      @leifelliott1500 8 місяців тому +6

      Never hurts to understand containerized scaling. But yeah I mean I deploy my projects in a single DigitalOcean Droplet lol.

    • @codetothemoon
      @codetothemoon  8 місяців тому +22

      thanks for the feedback! would the "money you'll be making" lend itself to an approach different than the one described in the video?

    • @georgehelyar
      @georgehelyar 8 місяців тому +13

      Even if you don't need scaling, containers are amazing for any kind of deployment.
      You build it once then you can run it on any OS, in dev or in production, and can be confident that it will work the same in all of them, and because they are so ubiquitous, a lot of cloud services will let you just use a docker image for a really easy deployment.
      Each line also adds a layer so you get incremental builds for free. If it doesn't change, it can just use the cached layer. Just make sure to put the slow things that rarely change at the top.
      Kubernetes is often overkill though, until you actually need the scale.
      Depending on how you host it, you can also scale down to 0 so that it doesn't cost anything when it isn't being used.

    • @thanatosjamie7663
      @thanatosjamie7663 8 місяців тому +2

      @@georgehelyar That's another issue with this approach specifically. Even when it's scaled down to zero, AWS ECS and ECR are not free.
      The load balancer he created has a fixed cost even if you have zero instances running.

    • @georgehelyar
      @georgehelyar 8 місяців тому

      ​​​​​@@thanatosjamie7663yea like I said it depends how you host it.
      My point was really just that containers are useful for any kind of deployment, not just for high scale, and that scaling can also mean scaling between 0 and 1, when you're talking about low scale.
      This can be cheaper than running a VM that sits idle most of the time, but again it depends how you host it, and there are a lot of options for that on both sides.
      The main reason to use containers is not cost or scaling, it's reproducable deployment. Cloud does the scaling (and this costs the money), containers make it portable and easy to deploy and know that it will work the same no matter how you host it.

  • @haliszekeriyaozkok4851
    @haliszekeriyaozkok4851 8 місяців тому +1

    Your deployment is not the ideal case for deploying rust apps. Aws instances are so expensive and docker also slows down rust applications. So your video isn't helpful for actual rust developers. A usually serious rust developer would want to create his own remote server and probably want to use nginx kinda server to run his server, because if you don't want to absolute best performance you don't write a web server with rust.
    So because of that reasons your video is abstract from reality. If you want to deploy that website to more realistic environment i would really appreciate it.

    • @codetothemoon
      @codetothemoon  8 місяців тому

      Thanks for the feedback! Where would you create this remote server and how would you scale horizontally? Also how would you use nginx to serve a Rust application? Always looking for solutions cheaper than AWS!

  • @eli1882
    @eli1882 2 дні тому

    Who tf says deebian?