Is is possible to manage two separate prefect envi...
# prefect-community
m
Is is possible to manage two separate prefect environments on the same machine? I've been experimenting with profiles, and setting the PREFECT_ORION_DATABASE_CONNECTION_URL to perhaps define a second sqlite db, but no luck. Even in different profiles my prefect commands are aware of deployments from the other environment. Ideally there would be no overlap between prefect environments, different db, etc.
1
Well perhaps I have succeeded:
Copy code
prefect profile create 'personal'
prefect config set \
    PREFECT_ORION_DATABASE_CONNECTION_URL='sqlite+aiosqlite:///${PREFECT_HOME}/orion_personal.db'
prefect config set PREFECT_ORION_API_PORT='4202'
prefect config set PREFECT_API_URL='<http://127.0.0.1:4202/api>'
Then when I start orion service the new db appears and the UI is available:
Copy code
prefect orion start
    # Check out the dashboard at <http://127.0.0.1:4202>

ls -1 ~/.prefect
orion.db
orion_lou.db
profiles.toml
storage
So I have two UI and orion db running simultaneously. Maybe there are other configs to set in order to complete this idea?
r
Hey @merlin!! For Orion specific variables like the database URL, ports, etc you are right that profiles are the way to go (see docs here for all of the configurations you can set). For separation of environments in terms of deployments/flow runs, it would depend on the use case. You could have two separate Prefect workspaces and separate deployments between the two? Then you can set each workspace in your two profiles with a different value for PREFECT_API_URL.
1
m
Yes. In concrete implementation terms: • If you use PREFECT_HOME as a differentiator, your profiles.toml file wont be found in the other environment. So dont use that. • The three env variables i listed above seem sufficient, but are there others I should include? I'd like to establish the complete picture of how to separate PrefectUI/Orion/Deployments using profiles. edit: I should say I'm very noob in python development, so I miss obvious things. But at first I thought it was sufficient to define
PREFECT_API_URL='<http://127.0.0.1>:<something else>/api
, but that didn't work. So the port definition + PREFECT_ORION_DATABASE_CONNECTION_URL was necessary.