Hi everyone, I’m new to Prefect and I’m trying to find information about best practices in implementing production and staging deployments. I’m curious to hear would it make sense to handle these as labels for flows & agents or would it make more sense to create separate Prefect projects for each environment? I’m trying to create a CI/CD workflow where push to certain branches in github will register flows to either Prefect staging or production. I have a CI/CD workflow already running for production but would like to be able to expand this approach.
9 months ago
Great question! There is an entire Github discussion about this where many users share how they approached it.There are a couple of ways how to handle it depending on which Cloud plan you are:
• if you are on Enterprise, you could have a separate tenant for prod and staging environments which allow for a full isolation
• otherwise, exactly as you said, many users either use labels to distinguish between environments (imho this is the easiest approach) or leverage projects to do it, or a combination of both.
9 months ago
I recently went through this and use the combination of tags and projects for environment separation.We are in Azure and use Azure DevOps with multi-stage pipelines and things such as variable groups for the different environments for parameterization and deployments into different environments.We use AKS (Kubernetes) for everything and leverage Docker storage with ACR. We have a base “runner” docker image with Prefect, common libraries and packages, and an internal package for common re-use scenarios. This docker image gets pushed to ACR with CI/CD and then can be utilized by Prefect projects that are targeted to a domain area. We use Azure Pipeline Templates to simplify deployment of each individual Prefect project along with some custom code in the runner image for building docker storage and flow registration.
I took the most away from the response on that Github discussion Anna sent from the
. Of course there were some customizations and deviations; however, it has some really good info if you are using Kubernetes (make sure to read their updates/changes comments with some of their own learnings)