0.3.0 • Published 6 years ago
@sofarocean/code-loft v0.3.0
Usage
deploy
npx @sofarocean/code-loft deploy [--pre-apply <script>] [--post-apply <script>]Running this command from your local machine or on a CI/CD server (such as with Github Actions) will:
- Infer the environment (
dev,staging, orprod) frome the current git branch - Load environment variables from the corresponding .env file for your chosen deploy environment
- Initialize Terraform and select a workspace corresponding to the chosen deploy environment.
- Run your pre-apply script if specified
- Run
terraform applywith the.tfvarscorresponding to the chosen deploy environment - Run your post-apply script if specified
The deployment environment can be overridden with the -d or --deploy-env option.
For a full list of options, run:
npx @sofarocean/code-loft deploy -hOn a CI/CD server
When running on a CI/CD server, you can set the -a or --auto-approve option to auto-approve the Terraform changes.
Alias
If you find yourself using code-loft frequently from the command line, you can create an alias by adding an entry to your ~/.profile, ~/.bashrc, or similar:
alias code-loft='npx @sofarocean/code-loft'And then running commands from any directory with:
code-loftTODO
promote
Promote code on dev->staging or staging->prod
init
Initialize a project with the standard deployment setup:
/terraformdirectory with[dev,staging,prod].tfvarsfiles[dev,staging,prod].envfiles for environment variables in each environment- Run
git initif needed - Create a
devandstaginggit branch and checkoutdev - Configure git remote repository with default branch
dev, branch protection, linear history, etc?
test
- Like
deploy, but set up environment variables before running test command - Ability to set up temporary terraform stack?
Other things
- Slack notifications?