What are Stackfiles?**
Stackfiles are bundles, a set of predefined Templates and Plugins from a Stack, and you can use them in the
stk create app) command.
When you use a Stackfile, you can apply a set of Plugins with a single
STK CLI command when creating an
When to use Stackfiles?**
- In scenarios where a Template/Plugin bundle is often used in a Stack.
- Stackfiles are useful to avoid using multiple commands to create a project. You can create a bundle of predefined Templates and Plugins and place them within the context of a project.
How to create Stackfiles?
Follow the steps below:
Step 1. Create a folder named 'stackfiles' in your Stack repository
Step 2. Execute the command
Inside the Stackfiles folder, run the command below and choose a name for your Stackfile:
stk create stackfile <stackfile-name>
Step 3. Edit and define the
yaml file name is the one you defined in the previous step.
Browse for the folder and open the file. You will see something like the structure below:
description: Just an example
- plugin: <stack-name>/<plugin-name>
You need to edit and define the items below:
- The Template you want to use.
- The Plugins you want to apply.
The sequence of applying Plugins is defined in the file.
|type||Indicates that the Stackfile will be used in a |
|description||Stackfile description will be on the |
|template||Template to be used to create the app in the format |
|inputs||Objects with the input values that will be passed to the Template. It is not mandatory and if some input value defined in the Template is not informed, the question is asked to the user.|
|plugins||List of objects that indicate the Plugins that will be applied. The Plugin must be informed in the format |
See an example of a Stackfile structure already filled out:
description: Python Rest API using flask
- plugin: stack-python/flask-api-plugin
- plugin: stack-python/zappa-deploy-plugin
If you update the Template and/or Plugin used in the Stackfile, it is not necessary to delete and create the Stackfile again. The updates are loaded automatically, as long as you keep the Template/Plugins'name the same name as before.
Step 4. Add the file in Git
Follow the steps below:
yamlfile from the Stackfile into Git and push the Stack;
After this, your Stackfile will be published.
See an example below of a repository's layout with Stackfiles:
How to use Stackfiles?
You can use Stackfiles with the command:
For Stackfiles included in the Stack itself use the syntax:
stk create app name-app --stackfile <name-stack>/<name-stackfile>
- When you use the Stackfile, Template, and Plugin already defined, the app will be applied with the same settings.
The Stackfile name is optional and can be omitted. In this case, the default Stackfile is used, represented by the
Apply a default Stackfile example:
stk create app name-app --stackfile <name-stack>
You can use a customized Stackfile, that is, one that is not in the Stackfiles folder of a Stack. Enter the path to the
yaml file from the specification.
Apply a customized Stackfile example:
stk create app name-app --stackfile /home/user/custom-stackfile.yaml
Was this page helpful?