Google Cloud GCP - Running background jobs in Cloud Run with Cloud SQL Postgres setup

Hello - I’m looking for help, maybe an example, on setting up a webapp in cloud run (cpu always, minscale 1 - I need background jobs to run) that talks to a cloud sql postgres. I guess first question - Is this even a good approach on GCP?

It seems like a simple enough use case, but I’ve run into problems every step of the way :disappointed:

Hi, One question, what do you mean about background jobs?

Is the web app running jobs?

The web app runs jobs, yes. it is a phoenix app using oban for job processing

So, that may be an important data point in the is-this-a-good-idea question :slightly_smiling_face:

Yeah its ok as long as you configure cloud run to use always on CPU as you mentioned

For the connection to sql its pretty straight forwards, I would use Cloud SQL Proxy: https://cloud.google.com/sql/docs/postgres/connect-run

But it is also possible to connect to the private IP of the instance by using a VPC connector