Alex M
04/23/2024, 2:17 AMgcloud 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.Gregory Hunt
05/13/2024, 9:15 PM