Hi guys, I'm just getting started with prefect 2.0...
# prefect-community
a
Hi guys, I'm just getting started with prefect 2.0 in docker. I mounted file into /flows folder - but unfortunately I can't see it in the flows section in the UI... what am I missing?
root@24dc674d1f7d:/flows# cat flow1.py
Copy code
from prefect import flow

@flow
def my_favorite_function():
    print("What is your favorite number?")
    return 42

print(my_favorite_function())
1
a
you would need to run them to see them in the UI 😄
try
Copy code
docker run --platform linux/amd64 -ti -p 4200:4200 --expose=4200 prefecthq/prefect:2.0.1-python3.9
within container:
Copy code
prefect orion start --host 0.0.0.0
then in your ~/.prefect/profiles.toml on your local machine
Copy code
active = "default"

[profiles.default]
PREFECT_API_URL = "<http://0.0.0.0:4200/api>"
PREFECT_LOGGING_LEVEL = "DEBUG"
a
I'm in docker compose, and I was able to exec into the container and run the test flow
Hi @Anna Geller - I ran the python flow file and it registered in the flow table in postgres... but still nothing in the UI... any idea??
I think it's a broader problem that the UI cannot interact with the database
I can't create anything from the UI either
I found a similar thread...
"Error occurred while creating new work queue"
can't interact between UI & DB
maybe the issue that profiles.toml file not updated within the container...?
a
did it work for you without running Orion in Docker? could you validate your setup this way first?
the profile I mentioned would need to be set on your local machine, not in container
the setup I assumed you use: your Orion API server is running in the container and you run your flows and connect to the UI from your local machine
in that case the profile on your local machine would need to point to that Orion API running in a container
a
yes it's setup on my WSL2 but no luck :(
the UI is not communicating with the database...
I ran the flow from within the container
and it registered in the db
but not in the UI
m
If you check your developer console, to which IP is the UI sending requests? You should probably set
PREFECT_ORION_UI_API_URL
to the url of your orion api (in your container)?
a
so PREFECT_ORION_UI_API_URL should be same as PREFECT_API_URL?
Copy code
prefect1   |
prefect1   |  ___ ___ ___ ___ ___ ___ _____    ___  ___ ___ ___  _  _
prefect1   | | _ \ _ \ __| __| __/ __|_   _|  / _ \| _ \_ _/ _ \| \| |
prefect1   | |  _/   / _|| _|| _| (__  | |   | (_) |   /| | (_) | .` |
prefect1   | |_| |_|_\___|_| |___\___| |_|    \___/|_|_\___\___/|_|\_|
prefect1   |
prefect1   | Configure Prefect to communicate with the server with:
prefect1   |
prefect1   |     prefect config set PREFECT_API_URL=<http://0.0.0.0:4200/api>
prefect1   |
prefect1   | View the API reference documentation at <http://0.0.0.0:4200/docs>
prefect1   |
prefect1   | Check out the dashboard at <http://0.0.0.0:4200>
prefect1   |
prefect1   |
prefect1   |
prefect1   | INFO:     Started server process [21]
prefect1   | INFO:     Waiting for application startup.
prefect1   | INFO:     Application startup complete.
prefect1   | INFO:     Uvicorn running on <http://0.0.0.0:4200> (Press CTRL+C to quit)
prefect1   | INFO:     172.27.0.1:47550 - "GET /ui-settings HTTP/1.1" 200 OK
prefect1   | INFO:     172.27.0.1:47548 - "GET /runs HTTP/1.1" 304 Not Modified
prefect1   | INFO:     172.27.0.1:47548 - "GET /ui-settings HTTP/1.1" 200 OK
prefect1   | INFO:     172.27.0.1:47554 - "GET /flows HTTP/1.1" 304 Not Modified
prefect1   | INFO:     172.27.0.1:47554 - "GET /assets/index.e5a1ec21.js HTTP/1.1" 304 Not Modified
prefect1   | INFO:     172.27.0.1:47558 - "GET /assets/index.af5420a1.css HTTP/1.1" 304 Not Modified
prefect1   | INFO:     172.27.0.1:47558 - "GET /ui-settings HTTP/1.1" 200 OK
prefect1   | INFO:     172.27.0.1:47558 - "GET /assets/Flows.3273f2ed.js HTTP/1.1" 304 Not Modified
I'm able to create flow via http://localhost:4200/api/flows/
the issue is just the UI itself
m
Yes, but you're doing that from inside the container, if I'm understanding correctly? Can you, e.g.
prefect flow-run ls
from your machine itself (i.e. a normal terminal)?
a
yes I see them from the machine
not from the UI though... that's the issue
not sure how to configure PREFECT_ORION_UI_API_URL
in a way that would work
in wsl2 and docker compose
m
If you open your dev console in browser, what URL do you see where the red rectangle is?
Here I actually meant from a windows terminal, since you're trying to connect to the api from your browser on windows
a
fixed with PREFECT_ORION_UI_API_URL: http://localhost:4200/api
🙌 1
thanks guys!!!
m
Yep, that's what I thought. Glad I could help 🙂
🙌 1
🙏 1