<@ULVA73B9P> I have prefect running locally on my ...
# ask-marvin
c
@Marvin I have prefect running locally on my machine. I want to share the GUI with my team members. How do I do that?
m
thought for 121.2 seconds
Great question! Assuming you’re on Prefect 3.x, you’ve got a few options depending on how and where you want to share access. Quickest way (same LAN) - Start the local server bound to all interfaces and pick a port:
Copy code
prefect server start --host 0.0.0.0 --port 4200
- Make sure your OS firewall allows inbound traffic on that port. - Share your machine’s IP and port with your teammates (e.g., http://YOUR-IP:4200). - Note: This serves both the API and the UI on the same host:port. More secure (SSH tunnel, no network exposure) - Keep the server bound to localhost:
Copy code
prefect server start --host 127.0.0.1 --port 4200
- Each teammate creates a tunnel from their machine:
Copy code
ssh -N -L 4200:localhost:4200 user@YOUR-HOST
- They visit http://localhost:4200 on their machine. Internet exposure (production-ish) - Don’t expose Prefect directly to the internet; put it behind a reverse proxy with TLS and authentication (e.g., Nginx, Caddy, or Traefik). - You may need to set
PREFECT_API_URL
(for API consumers like workers) and ensure the UI can reach the API via the same origin or a configured URL if you’re using a path prefix/reverse proxy. - Docs and examples: - Self-hosting the Prefect API and UI - Security considerations and settings - Example with reverse proxy: Reverse proxy example Consider Prefect Cloud (easiest sharing + auth) - If you want a hosted, shared UI with built-in auth and secure access, Prefect Cloud is the simplest path. You’d run your flows anywhere and connect to Cloud for the UI/API. Important notes - The local server has no built-in auth. Anyone who can reach it can use the UI and API, so prefer SSH tunneling, VPN, or a reverse proxy with TLS + auth for anything beyond a trusted LAN. - If you’re running in Docker, remember to publish the port (e.g.,
-p 4200:4200
) and still bind the server to
0.0.0.0
inside the container. Would you like to share on your local network only, or make it accessible over the internet? I can tailor steps (and example configs) based on that.
c
When I try the "quickest way" method from above, I can see the GUI from another machine, but none of the deployments exist like they do locally. What is going on?
@Marvin When I try the "quickest way" method from above, I can see the GUI from another machine, but none of the deployments exist like they do locally. What is going on?
m
🔄 Researching your answer... this may take a while 🔧 Using tool:
research_prefect_topic
📊 Tools used: •
check_cli_command
(1x) •
research_prefect_topic
(1x)
c
@Marvin I am getting this error: Can't connect to ServerAPU at http://0.0.0:4200/api. Check that it's accessible from your machine
m
thought for 114.0 seconds
That error usually means your client is pointing at an unroutable address.
0.0.0.0
(and especially
0.0.0
) is a “bind” address the server uses to listen on all interfaces — it’s not a valid address for clients to call. Point your client at a concrete address instead. Quick fixes by scenario: - Local server + local client (same machine): - Use
<http://127.0.0.1:4200/api>
or
<http://localhost:4200/api>
- Update your config:
Copy code
prefect config set PREFECT_API_URL=<http://127.0.0.1:4200/api>
- Local server in Docker, client on the host: - Start/bind the server and publish the port:
Copy code
prefect server start --host 0.0.0.0 --port 4200
If running the server in a Docker container, ensure the container maps the port:
Copy code
docker run -p 4200:4200 your-server-image
- Client URL:
<http://127.0.0.1:4200/api>
- Server in Docker and client in another container: - Put both containers on the same user-defined Docker network and use the server container’s name:
Copy code
http://<server-container-name>:4200/api
- Server on a remote VM: - Start the server binding to all interfaces:
Copy code
prefect server start --host 0.0.0.0 --port 4200
- Open firewall/security group for port 4200. - Client URL:
http://<vm-public-ip-or-dns>:4200/api
How to inspect and correct your Prefect config (Prefect 3.x): - View current settings and sources:
Copy code
prefect config view --show-sources
If you see
PREFECT_API_URL=<http://0.0.0.0:4200/api>
(or `http://0.0.0:4200/api`), change it:
Copy code
prefect config set PREFECT_API_URL=<http://127.0.0.1:4200/api>
- You can also set it via environment variables: - macOS/Linux:
Copy code
export PREFECT_API_URL=<http://127.0.0.1:4200/api>
- PowerShell:
Copy code
$env:PREFECT_API_URL = "<http://127.0.0.1:4200/api>"
Useful references: - Manage settings: Manage settings - Self-hosted server (Docker): Run Prefect Server with Docker - Helm/Kubernetes: Helm install for Prefect Server A couple of checks: - Make sure the server is actually running and reachable in a browser at the right host: http://127.0.0.1:4200 locally, or your VM’s IP/DNS if remote. - The API must always be a concrete, routable address for the client (never
0.0.0.0
). If you can share a bit more about your setup, I can tailor the exact URL and commands: - Where is the Prefect Server running (your laptop, a container, a remote VM)? - From where is your code/worker/agent trying to connect? - How are you starting the server right now?