Trying to get our first prefect deployment set up....
# prefect-getting-started
a
Trying to get our first prefect deployment set up. We have a single parent flow that is bundled with some other code we want to host on an EC2 instance. In deploying via GitHub Action, I am wondering the best way to handle different processes that are required - i.e. I have a python file with
my_flow.serve(...)
and then I also need to make sure the prefect agent is running
prefect agent start -q default
and that the server is running
prefect server start
. Is there a simple way to accomplish this in a deployment script? Should I set these up as separate actions? Or should I look at how to accomplish them with something like
multiprocessing
?
k
if you are serving your flow, you don't need an agent - serving makes the flow runnable straight from the UI
my recommendation to cut down on complexity is to make a cloud account and then just serve your flow from a place where there's a prefect profile/api key & api url env vars available. that's the shortest route to making your code runnable remotely
a
thanks. Tried this, I can get my flow to deploy to my EC2 instance, and I can now see the deployment in the cloud UI. But the
my_flow.serve(...)
command is holding the GitHub Action open. What's the best way to send a deployment to long-lived infrastructure without keeping the deployment action open?
k
serve
is similar to starting a worker/agent but specific to the flows you're serving. for deploying to somewhere there's a worker running, then you'll want to use
deploy
so if you're serving flows,
serve
would be the thing you want to run directly on your EC2, not in GHA. if you're deploying flows, then
deploy
which has many of the same arguments as
serve
will just create the deployment
a
Trying that, seems that using
deploy
requires a worker to be started, which is a long running process. Looking at starting the worker on EC2 startup - is there a better way to do this?
k
we typically see people starting their worker with the helm chart in k8s, or using one of our docker images with the
prefect worker start --pool <your-work-pool-name>
as the startup command on whichever computer service they're using