A production app’s infrastructure consists of many different resources. As those resources grow, managing and deploying them requires more thought and effort. We tend to look at managing resources as we do with code - split them into smaller manageable pieces (env0 Environments) where each piece is cohesive and loosely coupled. In theory, this textbook solution sounds great because each environment is independent and can be deployed at any time, but in the real world, we have dependencies - deploying all those env0 Environments simultaneously is impractical.
Basic Dependency Example
Environment "Network and VPC" manages all necessary network configuration.
Environment "DB" manages a database that multiple services use.
Environment "EKS" manages the Elastic Kubernetes Service onto which pods of services will be deployed.
Environments "Billing Service"", "Configuration Service" and "Notification Service" all manage the deployments of services on EKS. Those services need access to the database.
For this use case:
Environment "DB" depends on the VPC from the "Network and VPC" IaC stack.
Environment "EKS" also depends on the VPC from the "Network and VPC" IaC stack.
All service environments depend on DB, and EKS
As can be seen, the dependencies make it impossible for all the Environments to be deployed simultaneously.
And of course, as the resources and environments grow the complexity of the dependencies will increase.
env0 Workflows allow deploying many env0 Environments with complex dependencies between them as a single unit.
env0 Workflow benefits
- Manage your entire infrastructure with complex dependencies between Environments
- Visual presentation of the complex deployment
- Each environment can use a different IaC tool - one environment can be managed by Terraform while another is managed by Kubernetes
- Enhanced experience from all surrounding env0 features such as Policies, Custom flows, Drift Detection and Continuous Deployment
To set up an env0 Workflow follow this simple guide:
env0 relies on a file named env0.workflow.yml which describes the dependencies and configuration of the sub environments in your workflow, create this file with your specific definitions, each environment should define:
- name: Will be displayed in the workflow graph
- templateName: A name of a pre-defined Template to deploy
- needs (optional): An array of sub environments which all must be successfully deployed before this sub environment can start deploying
environments: vpc: name: 'VPC and Network' templateName: 'VPC' db: name: DB templateName: 'DB' needs: - vpc eks: name: EKS templateName: 'EKS' needs: - vpc service1: name: 'Billing Service' templateName: 'Billing Service' needs: - db - eks service2: name: 'Configuration Service' templateName: 'Configuration Service' needs: - db - eks service3: name: 'Notification Service' templateName: 'Notification Service' needs: - db - eks
- Create a new Template and select env0 Workflow as the Template Type
In the VCS step fill in your VCS details and fill in the directory that contains your env0.workflow.yml file
- Create an Environment based on the Workflow template
You can view your Workflow progress in the GRAPH tab.