Juan David Lozano
02/11/2023, 8:21 PMcd prefect && python3 -m pip install .
I get an error that prefect needs python 3.7, I try to upgrade to python 3.7 but I think (the repo was made with a lower version of python? I could be wrong just starting to understand docker) is there a more updated version of this article? or somebody can point me on how to install prefect on google cloud?Ryan Peden
02/12/2023, 1:50 PMvenv
or conda
.
◦ If Prefect is the only Python application you plan to run on this server, you can get by without a venv. I like to use them regardless to keep things neatly contained, but it's not required.
• Install Prefect by running pip install prefect
. This should install the newest version of Prefect (2.8.0).
◦ If/when you need to install a newer release of Prefect, you can do so by running pip install -U prefect
.
• Run prefect orion start
to start up Prefect Server.
◦ By default it runs at <http://127.0.0.1:4200>
.
◦ You can make it accessible from other machines, but before doing so, keeping mind this means that anyone who can reach the VM you're running Prefect on will be able to load your Prefect UI. If you're running on a private network, this is probably not a problem. Avoid running Prefect Server on an internet-visible VM unless you're sure you want to. To do it, you'll need to do one of:
▪︎ Run prefect orion start --host 0.0.0.0
▪︎ Run prefect config set PREFECT_ORION_API_HOST=0.0.0.0
▪︎ Then, regardless of which way you set the host, run PREFECT_UI_URL=<https://my-awesome-server:4200/api>
• Note: update the UI URL to match the external hostname/IP of the VM. It should match whatever you'd enter in a web browser to load the Prefect UI, with /api
added to the end. So if your server is running at <https://my-awesome-server:4200>
, you'd set PREFECT_UI_URL
to PREFECT_UI_URL=<https://my-awesome-server:4200/api>
like I showed above.
• That's it! Your Prefect server is set up and ready to use.
• If you want it to run Prefect Server automatically when the VM starts, and automatically restart if it crashes, I recommend running Prefect Server as a Systemd service.
◦ I wrote a tutorial on how to do this for a Prefect agent, and doing it for Prefect server would be nearly identical. You can follow the instructions in that tutorial and just set your Prefect Server from above settings instead of the agent settings in the tutorial. Then, you can replace the ExecStart
command with prefect orion start
(or prefect orion start --host 0.0.0.0
if you used that instead.)Juan David Lozano
02/12/2023, 9:02 PMRyan Peden
02/12/2023, 9:20 PMJuan David Lozano
02/13/2023, 12:14 AMprefect orion start --host 0.0.0.0
, in the end I am trying to connect to the prefect UI in that VM that you showed me how to create it, the error I get is thisRyan Peden
02/13/2023, 12:23 AMprefect orion start
or prefect orion start --host 0.0.0.0
. If you run it on with the default setting (127.0.0.1:4200) and then try to run with the host arg without shutting down the other copy of the server, you'll get the error message you saw because port 4200 is already in use.
If that's not what happened that I'm not sure what's wrong, but we will figure it out. 🙂Juan David Lozano
02/13/2023, 12:35 AMprefect orion start
and then I ran the other line prefect orion start --host 0.0.0.0
, is there a command to shut down the servers?Ryan Peden
02/13/2023, 12:36 AMlsof -t -i:4200