https://prefect.io logo
Title
a

Anze Kravanja

12/01/2022, 10:04 PM
Hello! Any resources out there if it’s possible to run Prefect UI on GCP Cloud Run? I know jobs can be ran, but specifically interested in hosting UI part in Cloud Run.
1
r

Ryan Peden

12/01/2022, 10:26 PM
I don't think we have any resources specifically about this. It should work, but you'd need to keep a few things in mind: • You'll need to keep at least one instance running if you want the scheduler service to be able to schedule flow runs properly - letting it scale down to 0 would probably cause issues • If you want to use autoscaling to scale up, you'd need to make sure that your additional instances don't start up extra copies of the scheduler service (there's a command line flag for that) • You'll want to set up Prefect to use PostgreSQL as its database (maybe using Cloud SQL for Postgres) instead of its default of SQLite, because even if you set min and max instances to 1, I believe GCP may arbitrarily restart that once instance, which would wipe the SQLite database on the filesystem • Running
prefect orion start --host 0.0.0.0
in a container with Prefect installed will start up a copy of the should be able to accept incoming connections on port 4200 • Before you start the UI, you'll need to set the
PREFECT_ORION_UI_API_URL
to match the externally-visible URL of your Cloud Run service with
/api
added to the end of it Disclaimer: I haven't done this myself yet, but I've . But in general, running the UI/API in containerized environments works well as long as you set
PREFECT_ORION_UI_API_URL
correctly. I have run the UI and agents successfully using Azure Container Instances, which is fairly similar to Cloud Run
a

Anze Kravanja

12/01/2022, 10:29 PM
Nice! Thank you, those are all great points and some of them I didn’t know about. I’ll test it out next week hopefully and see what happens.
r

Ryan Peden

12/01/2022, 10:29 PM
Sounds good! Feel free to ask questions here on Slack if you run into any issues 😄
👍 1