https://prefect.io logo
#prefect-getting-started
Title
# prefect-getting-started
t

Tony

12/09/2022, 3:04 PM
Good morning Everyone. It's been a while but I decided to upgrade to Orion. I see that a lot has changed. I am perplexed by a few steps as i'm trying to get Orion started. I am using VENV into which I have installed prefect 2.7.0. I am having a lot of trouble setting the API addresses, using and setting a profile, and just getting things to work. AT first, the prefect config set PREFECT_API_URL command does not seem to be working. I then export PREFECT_API_URL, while showed correctly as I started prefect Orion, but in either case, once browsing to the dashboard, I get an error saying 127.0.0.1:4200/api is not available. So i seek help in ALL the steps necessary to get this working and available. I have scoured the prefect.io docs, but the section that deals with "Running Orion for the First time" seems to be completely missing. I am anxious to explore the new features that are available in 2.0(Orion). Thanks for any help you can provide.
āœ… 1
p

Peyton Runyan

12/09/2022, 3:04 PM
Hey there!
That URL is a bit tricky. If you look at the output when you start Orion, it specifies that the UI is at
127.0.0.1:4200
That's gotten me before too since the
/api
url is the most obvious one. I think it's worth us thinking about adjusting where we place the links. edit - looks like they been adjusted a bit already, but I definitely get the confusion there.
šŸ™ 1
t

Tony

12/09/2022, 3:12 PM
once i executed export PREFECT_API_URL = http://192.10.0.5:7/api, it shows correctly on the ORION startup screen. The problem is when going to the dashboard: It says can't connect to Orion api at http://127.0.0.1/api . I am curious why would the dashboard use localhost as the default address and how/where does the dashbord get that setting?
So I can get Orion to start on 192.10.0.5:7272. Docs, dashboard all seems to respond. However, the /ip show a real fancy 404 ; Page Not Found error, completely in the style of Prefect.
p

Peyton Runyan

12/09/2022, 3:15 PM
can you paste the results of
prefect config view
?
t

Tony

12/09/2022, 3:15 PM
At this point, i gotta say I am completely missing something obvious...
PREFECT_PROFILE='default' PREFECT_API_URL='192.10.0.5:7272' (from env) PREFECT_HOME='.prefect' (from profile)
this is on Ubuntu server
prefect profile ls shows *default however prefect profile inspect shows Profile 'default' is empty
p

Peyton Runyan

12/09/2022, 3:18 PM
hmmmm - give me just a moment
t

Tony

12/09/2022, 3:19 PM
Thank you, Sir.
p

Peyton Runyan

12/09/2022, 3:20 PM
Set your
PREFECT_UI_URL
to the same IP/Port combo, minus the
/api
and then try to restart Orion.
t

Tony

12/09/2022, 3:23 PM
I apologize, my paste did not paste correctly. Once I executed export PREFECT_UI_URL=192.168.0.5:7272 it starts. I have to start it this way: prefect orion start --host 192.10.0.5 --port 7272 Here is my startup screen Configure Prefect to communicate with the server with: prefect config set PREFECT_API_URL=http://192.10.0.5:7272/api View the API reference documentation at http://192.10.0.5:7272/docs Check out the dashboard at http://192.10.0.5:7272
p

Peyton Runyan

12/09/2022, 3:24 PM
Is it working now?
t

Tony

12/09/2022, 3:24 PM
that is weird, it is now working.
šŸ”„ 1
although this is still showing 404: page not found: http://192.10.0.5:7272/api
p

Peyton Runyan

12/09/2022, 3:25 PM
Oh yeah - the API is just an API. No UI associated with the API
t

Tony

12/09/2022, 3:27 PM
I still don't feel very confident that I can get this to work. I feel like there are some initial steps needed with the profile. do you have official instructions on how to get orion started for the first time?
in 1.0, we had to edit a config.toml file which despite its clunky-ness worked really well.
Also, the /setting page is showing straight html, and the text editor has the same html as a single character vertical:
p

Peyton Runyan

12/09/2022, 3:30 PM
Oh interesting - I can't reproduce that one
What's your version number?
Regarding the docs, I think there's possibly a gap on self-hosted UI
t

Tony

12/09/2022, 3:30 PM
and, finally, I am worried that I am trying to do something unconventional running this in a virtual enviornment in python.
2.7.0 on python 3.8 on ubuntu
p

Peyton Runyan

12/09/2022, 3:31 PM
Here are the getting started docs, but I think there's a gap on the UI environment variable pieces: https://docs.prefect.io/getting-started/overview/#get-started-with-prefect-2
running this in a virtual enviornment in python
Running it in a virtual environment is pretty conventional. What's your usecase?
2.7.0
- can you try 2.7.1? I don't keep up with the UI releases, but this may have been a bug. It's not present on my machine on 2.7.1
and you still have a profiles toml
cat ~/.prefect/profiles.toml
t

Tony

12/09/2022, 3:36 PM
thanks again, Peyton. What's odd is I just installed this yesterday: pip install prefect. Why it chose 2.7.0 I don't know. I'll give that a try
p

Peyton Runyan

12/09/2022, 3:36 PM
No worries man! We do releases every Thursday, so you probably just missed it šŸ™‚
t

Tony

12/09/2022, 3:36 PM
oh, ok. that is good to know.
should I do a pip upgrade? to a complete reinstall
p

Peyton Runyan

12/09/2022, 3:37 PM
And keep me posted. The migration from 1 to 2 can have a bit of friction at first, but once you get moving it should feel pretty great
t

Tony

12/09/2022, 3:37 PM
or do a complete re-install
p

Peyton Runyan

12/09/2022, 3:37 PM
Just upgrading will be fine
t

Tony

12/09/2022, 3:37 PM
Thanks again, good sir!
šŸ‘ 1
verified i'm now on 2.7.1 In following your instructions, I run prefect orion start It defaults to 127.0.0.1:4200/api dashboard on 127.0.0.1:4200 even after i ran prefect config set PREFECT_API_URL=http://192.10.0.5:7272/api
it seems the only way to start orion correctly is by adding the --host and --port parameters at the prefect orion start command
p

Peyton Runyan

12/09/2022, 3:47 PM
Oh - I think I may have misunderstood you earlier then. This is expected behavior. It allows you to have profiles that can connect with prefect instances in multiple locations, including cloud, without having the profiles interfere with starting a new Orion instance.
t

Tony

12/09/2022, 3:52 PM
so here is all I am trying to do.
I have a 1.0 flow I want to upgrade. It is currently in production.
So I cannot upgrade the current env. I simply want to start Orion on 192.10.0.5, which has pelias running on port 4200. Then I want my agent to connect to it an run the 2.0 version of my flow.
it seems like you docs expect Orion to be the only thing to be running on the server...
Again, the seems to be the only thing that gets me anywhere: prefect orion start --host 0.0.0.0 --port 7272 But I get an "Unknown Error" when trying to create a work queue and the /settings page is jacked. I still don't understand the validity of defaulting the dashboard to use the loopback IP, this is ubuntu and the server has no gui to run a browser on...
p

Peyton Runyan

12/09/2022, 4:22 PM
where's your agent running?
t

Tony

12/09/2022, 4:57 PM
on a windows machine on a different subnet
the 1,0 agent, that is.
I don't have a 2,0 agent, yet.
p

Peyton Runyan

12/09/2022, 5:25 PM
In the near term I'd run through the getting started tutorials. You'll have a better feel for how each of the pieces interact with each other which will make this process a bit smoother: https://docs.prefect.io/tutorials/first-steps/
If you get started with them on your local machine it'll tighten the learning curve a bit, and it should be pretty easy to move forward from there
t

Tony

12/09/2022, 5:36 PM
thank you Peyton. But I am stuck on paragraph 2: Prerequisites: I can't go further becuause I can
't get Prefect 2 installed
in 1.0 all this was done with a docker setup.
p

Peyton Runyan

12/09/2022, 5:42 PM
even on a local machine?
t

Tony

12/12/2022, 2:51 PM
Still can't get it to work on this (ubuntu) server. Are there any startup logs and if so where are they? And can you add a debug flag to starting orion do send error messages to the putty terminal? Here is what is working: export PREFECT_API_URL=192.10.0.5:7272/api prefect orion start --host=0.0.0.0 --port=7272 Then the UI comes up: In chrome: http://192.10.0.5:7272/flow-runs However, I get a cryptic error when creating a work queue. And the settings page looks like an HTML string...
āœ… 1
r

Ryan Peden

12/12/2022, 3:12 PM
Hi Tony! A couple of things to try: ā€¢ I think
PREFECT_API_URL
needs to be a URL here, not just an IP address. Does setting it to
<http://192.10.0.5:7272/api>
help? ā€¢ If you still run into errors, does setting
PREFECT_ORION_UI_API_URL=<http://192.10.0.5:7272/api>
make a difference?
t

Tony

12/12/2022, 3:19 PM
Yes, setting export PREFECT_ORION_UI_API_URL=http://192.10.0.5:7272/api Allowed me to create my work queue and the settings page looks more like settings. I think that was it. I highly recommend this be added to the manual and move all this to a new topic called "Starting Orion UI for the first time" Thanks for all your help, Peyton and Ryan!
ā¤ļø 1
šŸ”„ 2
r

Ryan Peden

12/12/2022, 3:25 PM
Agreed! I'm adding it to our content tracker. And beyond that, I'll see if we could make some small adjustments
prefect orion
CLI command to make this scenario more straightforward. We sincerely appreciate your feedback! šŸ˜„
Since you mentioned Docker earlier, I just wanted to share this Docker Compose example I made in case it is useful: https://github.com/rpeden/prefect-docker-compose You'd need to add
PREFECT_ORION_UI_API_URL
to the
orion
container but aside from that, it should work for you.
t

Tony

12/12/2022, 4:16 PM
Thanks Ryan. This is definitely the direction I want to go.
r

Ryan Peden

12/12/2022, 4:19 PM
You're welcome! šŸ˜„ I've been planning a follow-up to that repo that shows how to add a production-ready web server like Nginx to make it easy to do things like add an SSL cert. Would that be useful to you as well?
t

Tony

12/12/2022, 4:34 PM
Absolutely. Thank you!
Good new, good news. I now have Orion running on my ubuntu server as a docker stack. I also have a windows agent running and connected. So here is my next question, one i have been asking since Prefect 1.0, what is the engineering intention for Docker Agents running as a service/Daemon? I was told that the best way to do this is to configure/schedule flows to deploy/execute as docker containers. There were 2 consequences to that: One, there were a lot of "dead" containers to clean up. Two, it was difficult for me to make sure the development dependencies were available AFTER the flow containers were spun up. Just picked the engineering team's collective brain...
6 Views