Anyone works with Cloud Run and CloudSQL often? I'...
# ask-community
a
Anyone works with Cloud Run and CloudSQL often? I'm trying to get Prefect to execute workloads on Cloud Run. I deployed a Cloud Run Worker with:
Copy code
gcloud run deploy my-worker \
  --image=prefecthq/prefect:2-latest \
  --set-env-vars PREFECT_API_URL=<PREFECT_API_URL> \
  --service-account <MY_SERVICE_ACCOUNT> \
  --no-cpu-throttling \
  --min-instances 1 \
  --args "prefect","worker","start","--install-policy","always","--with-healthcheck","-p","my-cloud-run-pool","-t","cloud-run" \
  --region us-central1 \
  --platform managed \
  --add-cloudsql-instances <DB_CONNECTION_NAME> \
  --update-secrets=DB_CONNECTION_NAME=<SECRET_NAME__VERSION>
however, it seems like both
add-cloudsql-instances
and
update-secrets
are not picked up when a flow is executed on cloud run. I don't see any of the Cloud Run's environment variable and I get a database connection error. 1. Is there a best practice for accessing CloudSQL from a flow running on Cloud Run? 2. How do I access Cloud Run's variables from a flow? I tried navigating Prefect's documentation on the topic, but it's rather confusing and seems to be more geared for cloud users. I'm on the OSS version for now.
g
just add them into your deployment, or you cloudrun template, I don't think it is going to pick up the envs from you worker if the flow is executed in another container