Run your React app on Google Cloud

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

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

  • @googlecloudtech
    @googlecloudtech  10 месяцев назад

    Subscribe so you never miss an episode of Serverless Expeditions! → goo.gle/GoogleCloudTech

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

    Thank you, Martin, I thought it was an excellent introduction to how to deploy a React app to Google Cloud for someone who had never done it, it really helped to get me started. However, I want to bring everyone's attention to 13:57 where it is said the Load Balancer integration incurs a min monthly cost of $20. I personally needed only to connect a domain to my WIP app so I immediately followed the steps first, and if I didn't listen carefully later I would end up paying that extra $20 to Google without even knowing it. In my opinion, such important information should be presented upfront, as clearly as possible, rather than just being mentioned passingly. Otherwise, great video!

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

      You can also use Firebase Hosting to point your custom domain to your Cloud Run service. It does not incur a fixed monthly cost. Search for "firebase hosting cloud run" and you will find the right docs.

  • @harshkumar7686
    @harshkumar7686 8 месяцев назад +7

    I was literally dying to see someone let me go through this process. Thanks a lot

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

      Happy to hear it was useful!

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

    Such a great intro to cloud run. I worked with GCP on my last project, but I wasn't part of devops so I only know a little bit about it. We would deploy from Github to Cloud Run and had different environments. This helps me understand a bit more about the process. Thank you, your videos are really good.

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

      Happy to hear the video was useful to you!

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

    Absolutely amazing video for anyone to get started with how to build and deploy an app on google cloud

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

      Happy to hear you found it useful! You may also want to check out our video "Run your Next.js app on Cloud Run".

  • @eduardocoronado5145
    @eduardocoronado5145 10 месяцев назад +3

    Thanks, Martin really appreciate the practical example! The info about pricing and the extra 3 optional steps were really helpful. I'd like to see a similar tutorial with pub/sub in future videos.

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

      Thank you for the suggestion! Happy to hear you found the video useful.

  • @MostafaMohamedRawash
    @MostafaMohamedRawash 6 месяцев назад +2

    thank you Mr.Martin Omander for this helpful video

  • @user-um6vj9jf8d
    @user-um6vj9jf8d 10 дней назад +1

    Is there a difference between deploying to Google's Cloud Run service and Google's App Engine service? When should you use one or the other?

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

      Either App Engine or Cloud Run would work. If you are familiar with one of the two, use that one! If you are equally familiar with both, or you haven't tried either yet, I would go with Cloud Run. Cloud Run is more modern, it is container-based, and it gives you more freedom, for example to include binary libraries.

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

    Thanks Martin. What about the pros and cons of deploying separate Cloud Run services (For React and Server side Express) versus your approach of packaging both frontend and backend in a single image? With a single service it is a very simple architecture and perhaps lower costs but regardless of changes with only Frontend aka FE (React) only Backend aka BE (Express) entire app still needs to deployed. The advantage of using separate Cloud Run services is that it provides individual scaling of FE and BE plus the flexibility of deploying only FE or only BE with increased security by having the option to make the BE service internal ONLY but yes complex architecture in setting up service to service communication.

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

      Good points! I think you summarized the pros and cons very well. Three more thoughts:
      1. CI/CD and rollbacks become easy if your application is a single container. In many web apps, the front-end and back-end are tightly coupled with each other, so deploying one without the other may not be a strong need, and it may make automated testing difficult.
      2. On the other hand, I have heard from some teams that want to let web designers deploy new graphics without being part of the CI/CD pipeline. In that case it may be useful to store the graphics outside the container, like in a Storage bucket. That bucket can be used by multiple web apps, making it easy to update a logo for all apps at once.
      3. Independent scaling of backend vs frontend is useful if you are managing virtual machines, less so in serverless where scaling is automatic.

    • @rakeshb2010
      @rakeshb2010 10 месяцев назад +3

      ​@@TheMomanderThanks for the video. Can you please make a video on React/Postgres security on GCP like DDoS, Firewall, https, encryption etc.

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

      @@rakeshb2010 Thank you for the suggestion!

    • @dheer211
      @dheer211 9 месяцев назад +1

      @@TheMomander Thanks so much Martin appreciate your reply. One other question I have is whether it is possible to use the googel-auth client library on client side more specifically in a React JS CR service deployed as a public front end service or is it supposed to work server side?

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

      @@dheer211 Firebase Authentication is meant to be deployed on the client and works well with React. If you prefer more enterprise features (and don't mind paying a little more) you should check out Google Cloud Identity Platform. Both products use the same client-side libraries, so it's easy to switch between them.

  • @kumarnatarajan3132
    @kumarnatarajan3132 9 месяцев назад +3

    great tutorial . thanks

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

    why did you switch the locaiton of index.js from being i the pirate-app directory to react-app/src at 3:50?

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

      Looks like I made a mistake when editing this video. The index.js file should be in the pirate-app directory and it should not be moved. Sorry about that.

  • @davidspiess2047
    @davidspiess2047 10 месяцев назад

    Great video! The new load balancer integration is nice, but even if Cloud Run creates all the necessary resource types for you, it doesn't solve the problem that understanding and configuring a load balancer is still a very complex task.

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

      I agree that configuring a load balancer from scratch is complicated, and I personally avoid it. But if you click the "Integrations" tab like I did in the video at 13:13, all you have to do is fill out a single form. Google Cloud does complicated parts for you.

  • @yansongguo8354
    @yansongguo8354 5 месяцев назад +1

    Hi! Martin, really like the videos. How about create a terraform version with github action for this template integration:)

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

      Thank you for the suggestion!

  • @boonlertchin
    @boonlertchin 2 месяца назад +1

    I love this solution.

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

      Happy to hear you found it useful!

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

    Please give tut on database integration with gcp both sql & no sql

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

      Thank you for the suggestion. If you search for "Hosting a REST API with a Cloud Firestore backend" and "Cloud Run + Cloud SQL, setup" here on RUclips you will find two videos that address those scenarios. Hope you'll find them helpful!

  • @Universal7135
    @Universal7135 9 месяцев назад +1

    Hi Martin! Thank you so much for the great video. I run into an error at around the 11:00 minute mark. I get the error that the user-provided container failed to start and listen to the correct port. What can I do to ensure the container starts? Does GCP build a container for me when I follow the instructions in this video?

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

      Yes, Google builds the container for you. You can go to the Cloud Console and check the logs (hamburger menu in the upper left, then Logging, then Log Explorer). Most of the time when I get the error you described it's one of these two causes:
      1. I forgot to include *"start": "node index.js"* in the scripts section of package.json of the Express app. Google is looking for that script and will run it to start your container. See 5:54 in the video.
      2. I used *import* in my code (instead of require) and I forgot to add *"type": "module"* in package.json of the Express app.
      Hope this helps!

  • @babyai24
    @babyai24 6 месяцев назад +1

    This is great! Could you please make text-music or text-text or text-image ai apps with react native and then publish on gcp? Thank you, sir.

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

      We just released such a video. Do a RUclips search for "Serverless Generative AI" and you will find it!

  • @tanmayupadhyay7750
    @tanmayupadhyay7750 10 месяцев назад +1

    @googlecloudtech - I had a question ... I built a react website with no backend(no server code) and simply hosted it on cloud run with a domain I had purchased. Is there any downside in this type of deployment? What I am wondering is security? How should I do a user authentication within FE? If I have to create another service on cloud run for authentication, How would i secure the communication between the 2 services (react app FE and user authentication service).

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

      Your deployment sounds good. For authentication, I propose you implement Firebase Authentication. Once that is done, whenever your front-end code is sending a request to your backend code, attach a token from Firebase Authentication to that request. In your backend code you'd validate the token, which would give you the ID of the user. Do a web search for "firebase authentication verify id tokens" and you will find sample code. Best of luck with your project!

  • @STEMMadeSimple2023
    @STEMMadeSimple2023 2 месяца назад +1

    Is it possible to deploy this application on Google Cloud Run with the Continuous Deployment button and GitHub?

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

      Yes, it is. I shot another video titled "Run your Next.js app on Cloud Run" which shows how to set up continuous deployment for React apps on Cloud Run. Do a RUclips search for it and have a look. Best of luck with your project!

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

      @@TheMomander Thank you so much for making a video about this topic! I am looking forward to watching the video and following the steps.

  • @JCDovemail
    @JCDovemail 5 месяцев назад +1

    Nice!

  •  8 месяцев назад +1

    11:48 after deploying and folowing the link I get a 404 instead of the react app, but the API works fine. It looks like google cloud did not use the dist folder. Any ides?

    • @jjfattz
      @jjfattz 6 месяцев назад +2

      This is most likely because you don't have a .gcloudignore file in your root project folder. When that file doesn't exist, gcloud will default to your .gitignore file. Your .gitignore file most likely has the "dist" folder in it to exclude. So that is why the folder does not exist. You can basically just copy paste your .gitignore file into a .gcloudignore file, but remove the "dist" folder from it.

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

      @@jjfattzthanks a bunch!

  • @codevalley9511
    @codevalley9511 10 месяцев назад +1

    Great, thanks

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

    We face difficulty to host out react js website built on vs code...

  • @drose91
    @drose91 5 месяцев назад

    google cloud says [Error: ENOENT: no such file or directory, open './dist/client/index.html'] {

  • @JavierGopar
    @JavierGopar 10 месяцев назад +1

    And to do it with React and NextJS ?

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

      That's a great idea. I will add it to my list of upcoming episodes. Thanks for the suggestion!

  • @Christina-fg4jp
    @Christina-fg4jp 2 месяца назад

    How do you deploy a react application with a python server all with google cloud run?

    • @Christina-fg4jp
      @Christina-fg4jp 2 месяца назад

      actually I figured it out

    • @MartinOmander
      @MartinOmander 2 месяца назад +1

      @@Christina-fg4jp That's good to hear -- well done!

  • @deindedawodu1563
    @deindedawodu1563 9 месяцев назад

    Awesome!

  • @MrGudmestad
    @MrGudmestad 10 месяцев назад

    I'm able to get the front and backend working together on localhost, but the landing page of the React app isn't hit when deployed to Google Cloud with "error": "Sorry couldn't find /". The error is looking for my home route which was never set. Should I create a home route and send the index file? I wouldn't think so since it's working nicely together on localhost. Maybe a Google Cloud setting?

    • @MrGudmestad
      @MrGudmestad 10 месяцев назад

      When I navigate to /index.html, it returns "error": "Sorry couldn't find /index.html" - It just seems that Google Cloud doesn't see my React App

    • @MrGudmestad
      @MrGudmestad 10 месяцев назад

      If I create a home route and res.send('hello world") and the browser will receive that instead of my React App 😑

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

      @@MrGudmestad Here are the two things I would check in this situation:
      1. Did you include the express.static("react-app/dist") call at 3:53 of the video?
      2. Seen from the Node.js app's directory, does "react-app/dist" point to a directory that includes an index.html file?

    • @MrGudmestad
      @MrGudmestad 10 месяцев назад

      @@TheMomander Thank you for the reply! Yes, I absolutely completed item #1 on your checklist and without that line of code, the React App doesn't work on localhost. I am confused a little by #2 though. Yes, there is an index.html file inside of my dist folder. Again, the weirdest part in my view is that the React App does work on Localhost but not on Google Cloud.

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

      @@MrGudmestad Have you had a chance to check the server-side log in the Google Cloud Console? There may be clues in that log.

  • @msj5297
    @msj5297 10 месяцев назад

    1 cmd

  • @frugalcode
    @frugalcode 10 месяцев назад

    Astro + Vercel.

  • @serbrad6426
    @serbrad6426 28 дней назад

    BS

  • @mrequency
    @mrequency 8 месяцев назад

    Hi, I am having problem deploying the App. Deployment failed
    ERROR: (gcloud.run.deploy) FAILED_PRECONDITION: failed precondition: due to quota restrictions, cannot run builds in this region. Please contact support. When I check it seems I have quota, I am not sure why this happening

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

      Not sure what is happening. I propose you post your question in the Google Cloud sub-reddit.