Mono-Repo Apps in Stackery
By default, new Stackery stacks are defined by a single template.yaml
file in the root directory of the project repository. However, users adding existing projects may have architected monolithic repositories ("mono-repos"), or repositories that include multiple stacks defined in multiple template.yaml
or serverless.yml
files, all stored in a single directory, like so:
|- frontend/
|- scripts/
|- services/
|--- api-service/
|----- src/
|----- template.yaml
|--- email-service/
|----- src/
|----- template.yaml
|--- file-service/
|----- src/
|----- template.yaml
|- package.json
As of version 2.4.0, the Stackery CLI allows users to add multiple stacks in the same repo.
Adding a Mono-Repo in the CLI
In the Stackery CLI, each stack has an associated "templatePath", which is the path of the template in the repo, relative to the root of the repo.
Below are example commands to add an existing repository with two serverless.yml
configuration files structured in the following way:
my-mono-repo/
|- stacks/
|--- stack1/
|----- src/
|----- serverless.yml
|--- stack2/
|----- src/
|----- serverless.yml
|- package.json
To add both stacks, you would run:
stackery create -n stack1 --use-existing --blueprint-git-url https://github.com/<git-user>/my-mono-repo && stackery settings -n stack1 --key templatePath --value stacks/stack1/serverless.yml
stackery create -n stack2 --use-existing --blueprint-git-url https://github.com/<git-user>/my-mono-repo && stackery settings -n stack2 --key templatePath --value stacks/stack2/serverless.yml
To set the template path for an existing stack, run:
stackery settings -n my-stack-name --key templatePath --value someRepoDir/template.yaml
This allows for editing each stack separately in the Stackery Dashboard and deploying each stack independently.