Run your Next.js app on Cloud Run

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

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

  • @LeonBlade
    @LeonBlade 3 месяца назад +2

    This video is great for showing just how easy it is to get an app up and running in no time at all.

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

      Happy to hear that the video was useful to you!

  • @rgcottrell
    @rgcottrell 4 месяца назад +7

    I actually just got a dockerized Next.js starter app deployed to Cloud Run yesterday. It took me a lot longer than the four minutes needed in this video. :-)

    • @TheMomander
      @TheMomander 4 месяца назад

      Congratulations on deploying your app, even if it took longer than in the video. I'm sure it will be quicker next time 🙂

  • @jorgedominguez3972
    @jorgedominguez3972 3 месяца назад +2

    Thank you, Martin! @TheMomander This video perfectly captured everything you described to me at the Firebase booth at Google Cloud Next. It's truly amazing. I never expected the deployment of a Next.js App to be this smooth.

    • @TheMomander
      @TheMomander 3 месяца назад +1

      Happy to hear that, Jorge! It was very nice meeting you at the Cloud Next conference. I can't wait to see what cool apps you build!

  • @prashant-evolver
    @prashant-evolver 13 дней назад +2

    Great video Martin and Luke. As you mentioned docker is not required and cloud build refers to buildpacks internally for same. Is there any way we can achieve webserver hardening practices using this method ?
    Also do you have any plan for another video using nginx with next.js, not sure if it’s still recommended approach after seeing this 😊

    • @GoogleLuke
      @GoogleLuke 5 дней назад +1

      It depends what you're looking to accomplish with webserver hardening. If you're interested in a solution tailored specifically to optimize hosting a Next application, you might want to check out Firebase App Hosting. That will give you some nice scalability by default.
      If you're looking to take advantage of what Google Cloud has to offer, I would recommend using Cloud Run or Firebase App Hosting instead of a custom nginx deployment. Nginx would likely deploy static files, which removes the ability to take advantage of Server Side Rendering.

  • @obtr7419
    @obtr7419 4 месяца назад +1

    Martin, I've seen a video of the installation with “Vite” before. But I definitely needed NextJS. I've been experimenting with it for a few days, but I had problems with most of them and couldn't make any progress for the project. Thank you both very much for this video. Also, we are waiting for the repo :)

    • @TheMomander
      @TheMomander 4 месяца назад +1

      Sorry, I forgot to include the link to the repo! I asked our publishing team to add it to the video description.

    • @obtr7419
      @obtr7419 4 месяца назад

      @@TheMomander That's great. Thanks for the feedback.

    • @TheMomander
      @TheMomander 4 месяца назад +1

      The link to the repo has been added to the description. Thank you for letting me know it was missing!

    • @obtr7419
      @obtr7419 4 месяца назад

      @@TheMomander You're welcome and thank you very much.

  • @maureljulien
    @maureljulien 3 месяца назад +2

    Hey many thanks :)
    I've been able to deploy my NextJs webapp super fast following your video ;)
    I am now wondering if I can follow the same steps to deploy a React (TS+Vite) web application ?

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

      Yes, you can! I shot a video about this last year. Search for "Run your React app on Google Cloud" here in RUclips and you will find it. Best of luck with your project!

  • @PinguinoRodriguez-hd8bw
    @PinguinoRodriguez-hd8bw 4 месяца назад +3

    I couldn't tell from the video, does this support app router routing?

    • @TheMomander
      @TheMomander 4 месяца назад

      It does! In fact, the example in the video is using the app router. Check out the GitHub repository to see how it's done.

  • @paests
    @paests 29 дней назад +1

    Hi Martin! If I leave the service port at default (8080) then I get build error "revision XXXXX is not ready and cannot serve traffic." If I change it to match the next.js port (3001) then the deployed website says "Service Unavailable" . Any advice pls? I'm using Yarn jfyi. thanks :)

    • @TheMomander
      @TheMomander 29 дней назад

      Sorry, I'm not able to troubleshoot without seeing your computer and your code. I propose you start by using the code in the repo (see video description), make sure that works for you, and then modify that code to do what you need in small steps. Best of luck with your project!

  • @ShootingUtah
    @ShootingUtah 4 месяца назад +1

    So I'm a bit of a noob with deploying websites, my nextjs app builds just fine on my machine but fails on cloud run. I assumed I had messed up something with environment variables but I've tried everything I can think of and still no luck! Any tips on digging through the logs or some other way to see exactly what's failing?

    • @TheMomander
      @TheMomander 4 месяца назад

      The log may contain error messages. In the Cloud Console, click the hamburger menu in the upper left corner, then click Logging. Best of luck with your project!

  • @monkeydluffy2063
    @monkeydluffy2063 4 месяца назад +1

    What kind of server-side apps can cloud-run handle?
    If I were to containerize a Backend API and upload to cloud-run - any scenario in which this would be a bad idea?

    • @TheMomander
      @TheMomander 4 месяца назад

      Good question! Cloud Run provides availability and scalability by taking down and spinning up instances as needed. For that reason, software packages that assume they have full control over a persistent server tend not to run well on Cloud Run. Examples include stateful and heavy applications like databases. The solution is to run your database on a separate tier that's optimized for it, like CloudSQL or Firestore.

  • @Mendez_84
    @Mendez_84 4 месяца назад +2

    It'd be great if we could add min/max instances schedules. Like, keep one min instance during office hours and zero min instances the rest of the time. Maybe even throw some ai at it to detect traffic patterns and suggest/apply those schedules

    • @TheMomander
      @TheMomander 4 месяца назад

      That's a great idea!

  • @RicardonesM
    @RicardonesM 4 месяца назад +1

    Exactly what I was looking for! Thank you!
    Would you know what terraform modules one should use to make the CI/CD integration work via IaaC?

    • @TheMomander
      @TheMomander 4 месяца назад

      Happy to hear the video was useful! The Terraform module "GoogleCloudPlatform/cloud-run" helps with Cloud Run setup.

  • @khaledmaarouf4757
    @khaledmaarouf4757 Месяц назад +1

    What's about static files? Is Cloud Run handling static files like app hosting through CDN? 🤔

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

      You have a few options for static files. You can either let Cloud Run handle them for you, and optionally add a load balancer and Cloud CDN in front of it. Another option is to put your static files in a public bucket on Cloud Storage. Or you can put your static files on Firebase Hosting, which includes a CDN. I usually use Firebase Hosting, because there is less configuration needed.

  • @mohamedkarim-p7j
    @mohamedkarim-p7j Месяц назад +2

    Thank for sharing👍

  • @svaponi
    @svaponi 4 месяца назад +1

    I would love to hear something about a GCloud alternative to the Edge Network the Vercel (author of the framework) provides.

    • @MartinOmander
      @MartinOmander 4 месяца назад

      You may find our video "Speed up your Cloud Run service by hosting it closer to your users" useful. We published it a few years ago, so the load balancer setup is easier now than shown in the video. Just click "Integrations" in your Cloud Run service and add the integration for "Custom domains -- Google Cloud Load". That automates the tedious parts of setting up a load balancer.

  • @Ivo-bq2nv
    @Ivo-bq2nv 4 месяца назад +1

    Thank you 😊

  • @Maverick_7821
    @Maverick_7821 4 месяца назад

    Thank You For Showing This Google

  • @ActiveAndReactive
    @ActiveAndReactive 4 месяца назад

    Missing the links that you promised to put in the description!

    • @TheMomander
      @TheMomander 4 месяца назад

      The links have been added to the description. Thank you for letting me know they were missing!

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

    the cloud run can't access environment variables and the logs showed undefined

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

      Happy to help! This should be doable in Cloud Run (I have it working on my own project and just tested this morning to confirm). Environment variables can be added to Cloud Run through the console.
      Cloud Run -> [Click Your service Name] -> EDIT & DEPLOY NEW REVISION -> VARIABLES & SECRETS
      Example:
      MY_SECRET_VARIABLE 93f8jaiofjaiwfjpi8awj3f9
      Then you can use process.env.MY_SECRET_VARIABLE to reference it in the code.
      If this is these are client-side variables, they will need the prefix NEXT_PUBLIC_ in front of them.
      It this doesn't solve your problem, can you share more information?

  • @dheer211
    @dheer211 4 месяца назад +2

    How do you decide between Firebase hosting and Cloud Run? Pros and Cons of each

    • @TheMomander
      @TheMomander 4 месяца назад +1

      Good question! I think it boils down to two things:
      1. If you are used to either one, continue using that.
      2. If you prefer to deploy source code, use Firebase. If you prefer to deploy containers, go with Cloud Run. Containers give you more flexibility, but not everyone needs that. For example you can include binary executables or data files your containers.

    • @brandonwinston
      @brandonwinston 4 месяца назад +1

      @@TheMomander I had this same question. Thank you for answering. I think this needs to be addressed more prominently!

  • @julioconradomarinardila3269
    @julioconradomarinardila3269 4 месяца назад

    Next js es una excelente app

  • @LukasScheucher
    @LukasScheucher 2 месяца назад

    I dont really understand why they need to make these tutorial so cringy.

  • @putujojo1968
    @putujojo1968 2 месяца назад

    NEXT_PUBLIC_ENV doesn't work on the client side. But, on the server side it works. Nice try google

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

      It should! Can you share a repository or an example where it’s not working?