Stack Recipes ๐ฑ
A Stack Recipe is a collection of carefully-crafted Terraform modules and resources which, when executed, creates a range of stack components that can be used to run your pipelines. Each recipe is designed to offer a great deal of flexibility in configuring the resources while preserving the ease of application through the use of sensible defaults. Check out the full list of available recipes at the mlops-stacks repository.Deploying a recipe ๐
To use the stack recipe CLI commands, you will have to install some optional dependencies withzenml
. Run pip install "zenml[stacks]"
to get started!
Detailed steps are available in the README of the respective stackโs recipe but hereโs what a simple flow could look like:
-
๐ List the available recipes in the repository.
-
Pull the recipe that you wish to deploy to your local system.
-
๐จ Customize your deployment by editing the default values in the
locals.tf
file. This file holds all the configurable parameters for each of the stack components. -
๐ Add your secret information like keys and passwords into the
values.tfvars.json
file which is not committed and only exists locally. -
๐ Deploy the recipe with this simple command.
If you want to allow ZenML to automatically import the created resources as a ZenML stack, pass the
--import
flag to the command above. By default, the imported stack will have the same name as the stack recipe and you can provide your own custom name with the--stack-name
option. -
Youโll notice that a ZenML stack configuration file gets created after the previous command executes ๐คฏ! This YAML file can be imported as a ZenML stack manually by running the following command.
Deleting resources
-
๐๏ธ Once youโre done running your pipelines, thereโs only a single command you need to execute that will take care of cleaning up all the resources that you had created on your cloud.
-
(Optional) ๐งน You can also remove all the downloaded recipe files from the
pull
execution by using theclean
command.
Further Integration with the ZenML CLI ๐
The ZenML CLI offers a set of commands to make it easy for you to list, pull and deploy recipes from anywhere! In addition to the underlyingterraform
functionality, these commands also offer the following:
- ability to list all the available recipes conveniently before you choose to deploy any one of them.
- checks to ensure that you have all the binaries/tools installed for running a recipe.
- extensive logs and error messages that guide you in case any of the recipes fails or misbehaves.
- option to automatically import a ZenML stack out of the components created after deploying a stack recipe.
Creating your own recipe ๐งโ๐ณ
The number of recipes available right now is finite and there can be combinations of stack components that are not yet covered by any of the existing recipes. If you wish, you can contribute a recipe for any combination that youโd like to see. The CONTRIBUTING.md file on the repository lists the principles that each recipe follows and gives details about the steps you should take when designing your own recipe. Feel free to also reach out to the ZenML community on Slack ๐ if you need help with any part of the process!Manual Recipes with Terraform
You can still use the ZenML stack recipes without needing thezenml stack recipe
CLI commands or even without installing ZenML. Since each recipe is a group of Terraform modules, you can simply use the Terraform CLI to perform apply and destroy operations.
Create the stack
-
๐จ Customize your deployment by editing the default values in the
locals.tf
file. -
๐ Add your secret information like keys and passwords into the
values.tfvars.json
file which is not committed and only exists locally. -
Initialize Terraform modules and download provider definitions.
-
Apply the recipe.