<@ULVA73B9P> self hosting a prefect server - is it...
# ask-marvin
r
@Marvin self hosting a prefect server - is it possible to seperate the backend (or api) from the front end. I want to host my prefect server in a google cloud run instance(s), and was wondering if i could host the backend (or api) with ingress=internal, and the front end such that that is avaliable via ingress=all?
m
thought for 64.7 seconds
Based on my research and the CLI command inspection, here's what I can tell you about separating Prefect's server components: 1. Possible but Not Out-of-the-Box: While Prefect's architecture theoretically allows for separation of the UI and API components, there isn't a built-in configuration specifically designed for this setup. The server is typically run as a single unit with both components. 2. Current Server Architecture: - The server starts with both API and UI components by default - You can disable the UI using the
--no-ui
flag when starting the server - The API component handles all the backend operations and database interactions 3. Potential Approach for Your Use Case: You could potentially achieve your desired setup by: 1. Running two separate Cloud Run instances: - Backend instance: Run
prefect server start --no-ui --host 0.0.0.0
with internal ingress - Frontend instance: Run a separate instance with the UI component that connects to the backend API, with all ingress However, there are some important considerations: - This is not a officially documented setup, so you'd need to do some custom engineering - You'll need to ensure proper communication between the UI and API components - You'll need to handle authentication and security between the components - The UI component expects to connect to an API endpoint, which you'll need to configure correctly 4. Alternative Approach: Consider using a reverse proxy (like Cloud Load Balancer) in front of a single Cloud Run instance running the full Prefect server. This would give you more control over access patterns while keeping the components together as designed. 5. Important Note: Before implementing a split architecture, consider whether the added complexity is worth the benefits. The Prefect server is designed to run as a unified service, and separating the components might introduce unnecessary complexity and potential issues. Would you like me to: 1. Research more specific details about the server's API configuration options? 2. Look into examples of running Prefect behind a reverse proxy? 3. Investigate specific Cloud Run deployment configurations? Please let me know what aspect you'd like to explore further, and I'll be happy to help with more specific guidance.