hey all - I have a prefect orion server running in...
# ask-community
a
hey all - I have a prefect orion server running in docker. I’m trying to run hello world flows outside of the orion docker, just a local flow but I want the flow to be connected to the orion server. From what I found I have to set the config variable for prefect with prefect config set PREFECT_API_URL = “” but I can’t figure out what the url is suppose to be.
1
r
Hi Adam, if you are running Orion in Docker locally, are you mapping port 4200 from the container to a port on the host machine by adding a flag like
-p 4200:4200
to the
docker run
command, or adding an
expose:
section to your Docker Compose file? If not, you'll need to do that so local flow runs can report their results to Orion running in Docker. If you're already sharing the port, then PREFECT_API_URL would just be
<http://localhost:4200/api>
.
a
hey @Ryan Peden thanks for the quick reply. My compose file looks like this:
Copy code
version: "3.7"
services:

    orion:
        container_name: orion
        image: prefecthq/prefect:2.0.4-python3.7
        ports:
            - 4200:4200
        environment:
            PREFECT_ORION_API_HOST: 127.0.0.1
            PREFECT_ORION_API_PORT: 4200
            PREFECT_ORION_UI_API_URL: <http://host.example.com:9999/api>
        command: prefect orion start --host 0.0.0.0 --port 4200
I set the prefect api url to localhost:4200/api but getting a 422 error back, unexpected schema
r
Hmm. Here's one that works for me:
Copy code
version: "3.9"
services:

  ### Prefect Orion API
  orion:
    image: prefecthq/prefect:2.4.5-python3.10
    restart: always
    entrypoint: ["prefect", "orion", "start"]
    environment:
      - PREFECT_ORION_API_HOST=0.0.0.0
    ports:
      - 4200:4200
It looks like the error might be happening because you're running a much newer Prefect version locally than you are running in Docker? I don't know for sure, since I don't know what you installed locally - but if you run
pip install prefect
you will get 2.4.5
👍 1
a
yup.. that was totally it. Thank you sir. Question while I have you. Is this nessc anymore in the docker compose file: PREFECT_ORION_UI_API_URL
r
Only if you are running the API on a different hostname. Here you don't need it, because the UI will try to contact at API at http://0.0.0.0:4200/api, which in most cases is the same as http://localhost:4200/api, so it works as expected. If you were using docker compose to run Orion in production and you wanted to access the UI from machines other than the one it is running on, you'd want to set PREFECT_ORION_UI_API_URL to
http://<orion-machine-hostname-or-IP>:<port>/api
. And of course if you are running it on HTTP port 80 or HTTPS port 443, you don't need to include the port in the URL
sorry if that was a longer answer you were looking for - just wanted to be thorough in case your use case expands. When just running locally like this, you don't need PREFECT_ORION_UI_API_URL
a
nope, that was great. appreciate the extra info. thanks Ryan