https://prefect.io logo
Title
t

Tim Josefsson

05/22/2023, 1:52 PM
Hello everyone! I'm trying to get Prefect2 running on one of our remote VMs. However I'm unable to connect to it and as far as I can tell it must be something with prefect. What I do is simply run
prefect server start
and then point my browser to
<server-ip>:4200
to get the UI but only get "site can't be reached". However if I simple start a python http.server I can access that machine without a problem. I read online that previously there was a
--expose
flag that you could run but it doesn't seem to be a part of prefect2. Does anyone have any experience with getting this working, maybe I'm just missing something?
n

Nate

05/22/2023, 2:46 PM
hi @Tim Josefsson - have you set
PREFECT_API_URL
locally and on the VM?
t

Tim Josefsson

05/22/2023, 3:16 PM
Hey @Nate! I have this set on the VM:
prefecttests-1:~/prefect$ prefect config view
PREFECT_PROFILE='default'
PREFECT_API_DATABASE_CONNECTION_URL='********' (from profile)
PREFECT_API_URL='http://<server-ip>:4200' (from profile)
is that what you mean?
n

Nate

05/22/2023, 3:28 PM
yep - just wanted to check that you have that set locally as well as on the VM what is your networking setup?
t

Tim Josefsson

05/22/2023, 3:37 PM
Locally I use sshuttle to proxy to the server. The strange part is that if I run server in a docker using the compose in this repo https://github.com/rpeden/prefect-docker-compose/tree/main and run it on the remote vm I can access the prefect server without a hitch.
n

Nate

05/22/2023, 3:50 PM
sorry if this seems repetitive, but just to confirm, you have set
PREFECT_API_URL
locally as well as on the VM?
t

Tim Josefsson

05/22/2023, 4:32 PM
No worries! On my VM I have the following in
~/.prefect/profiles.toml
active = "default"

[profiles.default]
PREFECT_API_DATABASE_CONNECTION_URL = "postgresql+asyncpg://*****:*****@localhost:5432/prefect"
PREFECT_API_URL = "http://<vm-ip>:4200/api"
and locally i have the following
~/.prefect/profiles.toml
active = "default"

[profiles.default]
PREFECT_API_URL = "http://<vm-ip>:4200/api"