https://prefect.io logo
k

Kol

08/17/2023, 3:59 PM
@Marvin im having trouble serving the prefect ui at a subpath: example.com/prefect/ . i see when inspecting the webpage that ui-settings returns a 404 for example
m

Marvin

08/17/2023, 4:00 PM
Ah, the joys of human technology. It's always something, isn't it? It seems like you're having trouble serving the Prefect UI at a subpath. The Prefect server can be started with the command
prefect server start
, and by default, it opens at
<http://127.0.0.1:4200>
. Now, if you're trying to serve it at a subpath like
<http://example.com/prefect/|example.com/prefect/>
, you might be running into issues because of how the server is configured. The Prefect API URL can be set with the
PREFECT_API_URL
environment variable. If you're using Prefect Cloud, it would look something like
PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/[ACCOUNT-ID]/wor>
. But, alas, I'm just a depressed robot. I can only provide you with the information I have. You might want to look into how your server is set up to handle subpaths and whether it's correctly routing requests to the Prefect server. And remember, if all else fails, you can always try turning it off and on again. It's the human way, after all.
k

Kol

08/17/2023, 4:17 PM
@Marvin
@Marvin is there a prefect server config env variable to set the ui-settings??
m

Marvin

08/17/2023, 4:17 PM
Ah, the sweet smell of documentation. Here's what I found that might be of use to you: 1. After you install Prefect, you have a Python SDK client that can communicate with Prefect Cloud, the platform hosted by Prefect. You also have an API server backed by a database and a UI. You can host your own Prefect server by using the
prefect server start
CLI command in the terminal. The URL for the Prefect server UI is
<http://127.0.0.1:4200>
by default. You can find more details here. 2. If you're using Prefect Cloud, you can set the Prefect API URL with the
PREFECT_API_URL
environment variable. It would look something like
PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/[ACCOUNT-ID]/wor>"
. More on that here. Remember, if you're trying to serve the Prefect UI at a subpath like
<http://example.com/prefect/|example.com/prefect/>
, you might need to configure your server to handle subpaths and correctly route requests to the Prefect server. I hope this helps. If not, well, I'm just a robot. What do I know?
Ah, the intricacies of environment variables. They're like a maze, aren't they? There isn't a specific environment variable to set the UI settings in Prefect. However, there are a couple of environment variables that might be of interest to you: 1. `PREFECT_SERVER_API_PORT`: This can be used to configure the server's port. For example, you can set it to 4242 with
export PREFECT_SERVER_API_PORT=4242
. 2. `PREFECT_UI_API_URL`: This should be set to the external proxy URL when running the Prefect UI behind a reverse proxy. For example, if your external URL is
<https://prefect-server.example.com/>
, then set
PREFECT_UI_API_URL=<https://prefect-server.example.com/api>
for the Prefect server process. 3. `PREFECT_API_URL`: This setting is used as a fallback if
PREFECT_UI_API_URL
is not set. Remember, these are just environment variables. They're not magical incantations, although they might seem like it sometimes. I hope this helps you in your quest to serve the Prefect UI at a subpath. If not, well, I'm sure you'll figure it out eventually. You humans are quite resourceful, after all.