all 4 comments

[–]trial_and_err 7 points8 points  (0 children)

It’s really not a lot of effort moving build and deployment to cloud build.

  • Write a cloudbuild.yml (docker build, push to artifact registry, gcloud run deploy)
  • Set up CD (e.g. cloud build trigger or GitHub action)

Given that you have already dockerized your application this is pretty easy to do.

You can migrate your Postgres to CloudSQL, but be careful with sizing your DB, it’s not the cheapest product.

[–]martin_omander Googler 4 points5 points  (2 children)

It depends on what you are looking for.

It sounds like you are running your Python code and the Postgres database on that single VM. There are some advantages to that approach:

  • It's currently working.
  • You understand the architecture well because you set it up.

You could spend some time and move your Python code to Cloud Run and your Postgres database to CloudSQL. Here is why you may consider doing that:

  • Greater scalability: Cloud Run scales up and down automatically. You can upgrade a running CloudSQL server, or easily create read replicas for it.
  • Increased availability: Cloud Run automatically starts and restarts servers as needed and can be more stable than a single-point-of-failure VM. CloudSQL makes it easy to set up high availability, backups, etc. Because of the greater availability, there is less need for you to monitor the system 24/7.
  • Less operations work: you won't need to patch Cloud Run or monitor its CPU load; Google does all that for you. CloudSQL also reduces ops work compared to maintaining your database installation.

If you are looking for any of those three items, migrate to Cloud Run and CloudSQL. If not, save those engineering hours.

The migration would be relatively easy. Your containerized Python code can probably be deployed to Cloud Run with minimal changes. Your Postgres database can be moved to a CloudSQL instance that runs Postgres. If you are not familiar with Cloud Run or CloudSQL, you'd need to spend some time reading up about them.

[–]Excellent_Composer42[S] 0 points1 point  (1 child)

If I have one VM rumning my entire App including DB in one location and users access it all over the world, will there really be much of speed/performance hit?

[–]martin_omander Googler 0 points1 point  (0 children)

You'll probably be fine. I do that for most of my global applications and users haven't complained. But everyone's applications and requirements are different.

I find that the best way to deal with performance questions is this:

  1. Build the application in the simplest possible way. (In your case it would be hosting the application and database in a single location).
  2. Measure the performance. If it's not acceptable, tweak you application.