There 3 main options that you can use to deploy a web app on google cloud. You can either use serverless, compute engine or break it down into microservices. For serverless you can use Cloudrun for compute you can use preconfigured click to deploy options like WordPress or for more control use managed GKE.
Each option has its advantages and disadvantages let’s say you want to build a small blog it won’t make cost building it on GKE because of the complexity and cost implication but if it were a heavy ecommerce site it would make perfect sense.
you can either deploy this solution on the cloud console or through terraform.with terraform the G cloud CLI will clone a GitHub repository that contains the code and dependencies on this lab.
there are also need some IAM permissions to run this lab if you are using the admin account then
roles/owner permissions are enough but if your not an admin then contact your admin to enable the following permissions for your account.
The site web client frontend is hosted on Firebase hosting where you can build, monitor, analyze, and engage any type of web app, android or iOS app.
The backend runs on cloud run using Django a Python framework that is light and easy to use. A huge difference is that cloud run is serverless as compared to GKE.all you need to do is to set the minimum instances which are required for your app to run and set maximum instances that help you serve exceptionally high traffic.
With cloud run, you can also set concurrency which specifies the number of requests that can proceed simultaneously by a given container instance.
On this app configuration, the max instances have been set to 3 with 2 health checks.
The static content which includes photos is stored in a regional cloud storage bucket
The app also uses a PostgreSQL database to store cart and shopping information that is linked to cloud run. the SQL instance has 2 Vcpus 4GB of RAM and 10GB SSD storage.
The database however doesn’t not have a backup or read replicas as this is a sample site and not a production site. In a production environment having read replicas and backups in different regions is important to avoid downtimes.
With cloud trace, you can view the latency details of the API requests which report millisecond latency which is actually pretty good.
the deployment costs a minimum of $84 a month so make sure you delete it after trying and testing it to avoid attracting unnecessary charges.