Hi When using prefect 2, I assume we still need th...
# ask-community
y
Hi When using prefect 2, I assume we still need the agent to run in the background all the time. do we still need to run something like
nohup prefect agent start -q …  > ~/tmp/prefect_agent.log &
or is there a different way to keep the agent running? is there best practice around this in the docs? I did not find it so far Thanks
1
r
A systemd service is often a good choice for this. I did a short writeup on how to set it up: https://discourse.prefect.io/t/how-to-run-a-prefect-2-agent-as-a-systemd-service-on-linux/1450
🙌 1
🙏 1
I find systemd a bit easier to work with, but both are good options depending on your needs/preferences.
m
This is great, thanks for sharing! Its handy to have a local testing environment with just a little bit of configuration like this. For an actual service deployed to ECS or K8s, I assume the agent start and etc. would be part of the preconfigured launch which will run again if a pod dies for example.
r
Thanks @Ryan Peden, can i apply the systemd service on multiple virtual environment with one service?