Hi, Prefect community! I successfully created my f...
# prefect-server
Hi, Prefect community! I successfully created my first flow and was able to see it in the UI. But I have some questions. 1). At the moment I am connecting to the remote machine via ssh. When Prefect is running, I can access the UI through both localhost and the ip of my remote machine, for example xxx.xx.xxx.xxx:8080 or localhost:8080. But I cannot view my flows from my phone, other computer, etc. What confuses me is that the UI is visible on all devices, but flows are displayed only on my laptop at the specified addresses. What could be the problem? 2). How to start agent in detached mode? Now I am running
prefect agent local start
every time.
Hi @Vladislav Bogucharov - it sounds like you may have Prefect Server running on both the remote machine and your local host; if your remote machine's
is set to
, it'll communicate with your local Server API, with which you're likely registering your flows. However, when you visit the UI on your phone or another computer, it doesn't have access to the Server API on your other machine (since
is a different location on those devices) and you won't be able to see those flows. Check that you've correctly set the
on your remote machine (this'll be in
) and that whatever machine you're using to register your flows has the
set in its
to the address of your remote machine as well. To start an agent in detached mode, you can use any normal utility, like
. You can read more about those here and here.
@nicholas, Am I correct in understanding that appolo_url needs to be changed to apollo_url = "<;ip_of_remote_machine&gt;:4200/graphql>"? After that, do I just need to run
prefect server start
for the changes to take effect?
Yes, that’s correct.
@nicholas thanks for the answer, but unfortunately, this method did not help me. I found
in the following path -
@nicholas These are screenshots of different stages. Is there something wrong?
UPDATE: if I specify ip in this window, then everything opens without errors on any device. But changes to apollo_url in config.toml don't seem to affect how the UI works. If I do not explicitly register ip via UI, then the device will try to connect to localhost anyway.
I finally figured it out. It works magically! thanks @nicholas and sorry for the many messages :)
What did you change to not need to set the host via the UI like that?
If you update the config on your server (not your local config) then it should work!
For example, in the compose.yml produced, I have this under the ui block:
PREFECT_SERVER__APOLLO_URL: <http://hostname:4200/graphql>
but I still needed to manually enter the same url in the UI
That key appears to be wrong. I think you want
Let me take a look at the server config though..
Ah I think I'm wrong... you are matching what the docker compose file defaults to
I'll get back to you in a few minutes
I'll reach out to our UI team about how this is handled right now -- I know that the caching of this setting was recently changed.
What I meant originally was that you'd want to set that key in your
or via environment variable when you run
prefect server start
and it will be set in the docker-compose file for you, but it looks like you are hardcoding that line in your compose file and starting it yourself?
Yeah, I wrote out the compose file & start it on my own so we can run with a standalone server (rather than a localhost dev deploy)
We run a lot of stuff containerized (though not k8s), so the required host python install was something of an outlier
Getting agents running was similarly odd since I had a blocking ssh session for local, and the docker agent required some diving through the github issues to find someone who had setup that could run the prefect backend server & the agent start command without breaking the CMD & script launch
Could you open a shell in the UI container and echo that variable to make sure it's being set as you intend? Still looking into if the UI changes would be affecting you here but it seems like it should just work
Copy code
❯ docker exec -it t_ui_1 /bin/bash   
root@2e5ec71597c7:/# echo $PREFECT_SERVER__APOLLO_URL
root@2e5ec71597c7:/# cat /var/www/settings.json
  "server_url": "<http://localhost:4200/graphql>"
Yep, it's updated.
@Joe both of those outputs have your host name correctly specified?
I haven't tried a tear-down & repeat as of yet since it'd disrupt some other folks
Hm, try this in your local browser with your UI open: 1. Open the JS developer console 2. In the console type:
3. Hit enter and refresh the window
Also you can confirm the settings by going to:
Well, it does presently appear happy after resetting the storage - the graphql endpoint box in getting started is set to the appropriate hostname and the dashboard has stuff in it
Ok so what may have happened is that during deployment and before you had modified those variables, local storage was set with the original server url, which is persisted in the same way as setting it through the input field in the UI; fresh opens of the UI should get the updated endpoint 👍
Ahh, ok, fantastic
Yeah I definitely did not have all the env vars setup correctly the first time around >_>
Oh wow, that's also what broke Brave
That is tremendously helpful, thank you.
Glad we could help you sort it :)