https://prefect.io logo
Title
c

Chris Gunderson

12/30/2022, 7:55 PM
Hi Prefect Team - Can we have Prefect 1 and Prefect 2 on the same Linux box? Are we able to just update the name of the systemd service? It doesn't need to be prefect-agent.service, right? It could be prefect2-agent.service, right?
1
n

Nate

12/30/2022, 8:01 PM
Hi @Chris Gunderson
Can we have Prefect 1 and Prefect 2 on the same Linux box?
yep! you'd just need to make sure the python env / interpreter you're using to start each agent is appropriate for the version
It doesn't need to be prefect-agent.service, right? It could be prefect2-agent.service, right?
right! afaik there's nothing special about the name of your systemd config file, most important things are that each one has its own
Environment
variables and that the
ExecStart
command uses the appropriate
prefect agent start
command for the version
c

Chris Gunderson

12/30/2022, 8:02 PM
Thanks for confirming that Nate. Happy New Year!
n

Nate

12/30/2022, 8:02 PM
Happy New Year to you too! actually, let me confirm the first point - don't want to accidentally lead you astray
yep okay, as long as you have isolated python environments for running each
prefect agent start
command you should be fine you'll have a
~/.prefect
folder where config files from each version are present, but there shouldn't be any filename overlaps there and on that second point, you could change the `PREFECT_HOME` setting to avoid any possibility of overlap
👍 1
c

Chris Gunderson

12/30/2022, 8:11 PM
Thanks Nate
n

Nate

12/30/2022, 8:12 PM
sure thing!
c

Chris Gunderson

12/30/2022, 9:12 PM
@Nate In prefect 2, can we use a docker image as an agent when creating the service above? Prefect1 had something like this: prefect agent docker start --key "" --label "xyz" --volume "abc"
n

Nate

12/30/2022, 9:52 PM
In prefect 1 you could mount volumes to all flow run containers submitted by the docker agent during the
prefect agent start
cmd but now in prefect 2 that's something you would specify in your `DockerContainer` infrastructure block (there's a volumes attr) and then attach to a deployment, which the agent would submit. Prefect 2 agents are more general, and are capable of submitting flow runs on any type of infrastructure (as long as the host machine supports it)
c

Chris Gunderson

12/30/2022, 9:55 PM
Right, I was more concerned with installing prefect on the linux server in the venv. I'll need to understand that well. I might spin up a new environment to test this out.
n

Nate

12/30/2022, 9:59 PM
Right, I was more concerned with installing prefect on the linux server in the venv.
ahh apologies if I misunderstood, feel free to ask more questions here if you have trouble doing so
c

Chris Gunderson

12/30/2022, 10:00 PM
Will do. Thanks Nate. This is probably a Tuesday issue since most people are out of the office now. Have a good weekend and thanks for getting back to me.
n

Nate

12/30/2022, 10:00 PM
:marvin: same to you - anytime!