Skip to content

hazelops/ize

Repository files navigation

dev build prod build codecov

❯ ize:

Opinionated tool for infrastructure and code.

This tool is designed as a simple wrapper around popular tools, so they can be easily integrated in one infra: terraform, ECS deployment, serverless, and others.

It combines infra, build and deploy workflows in one and is too simple to be considered sophisticated. So let's not do it but rather embrace the simplicity and minimalism.

Quickstart

Installation

MacOS:

Homebrew is used on MacOS. Add a tap and install the latest stable version:

brew tap hazelops/ize
brew install ize

Ubuntu:

Add public apt repository, update the apt cache and install the latest stable version:

echo "deb [trusted=yes] https://apt.fury.io/hazelops/ /" | sudo tee /etc/apt/sources.list.d/fury.list
sudo apt-get update
sudo apt-get install ize

More information on other platforms

Autocomplete:

MacOS & zsh:

Enable autocompletion

echo "autoload -U compinit; compinit" >>  ~/.zshrc

Load autocompletion on every session

ize gen completion zsh > /usr/local/share/zsh/site-functions/_ize

More information on other platforms & shells

Init the project from a template

If starting from scratch, create a git repo and init a new project. Follow the setup

mkdir squirrelcorp-backend
cd squirrelcorp-backend
git init
ize init --template ecs-apps-monorepo

Set your environment config:

_Template in this example has testnut as an example environment. Feel free to rename it.

export ENV=testnut
export AWS_PROFILE=<name of your aws profile>

Deploy your infra

ize up infra

Build & deploy your apps

ize up squibby
ize up goblin

Workflow Example

Let's imagine we're deploying a terraform-based infra and a Go-based app named goblin. The general workflow that ❯ize dictates is the following:

1. Deploy infrastructure

Currently it supports Terraform, for which it generates a minimal backend config for terraform and runs it. Think of it as a minimalistic Terragrunt, but it's always possible switch to a vanilla Terraform. Examples are available.

ize up infra

2. Push goblin app to SSM

It uses Go AWS SDK to push secrets to SSM

ize secrets push goblin

3. Bring up goblin app

It runs a simple logic of updating the task definitions to a new docker image (and rolling back in case ELB/ALB fails). This command includes ize build, ize push and ize deploy, but it's possible to use them separately.

ize up goblin

5. Access private resources via a tunnel

If there is a bastion host used in the infrastructure, it's possible to establish a tunnel to access the private resources, like Postgres or Redis. This feature is using Amazon SSM and SSH tunneling underneath. Simple, yet effective.

ize tunnel up
ize tunnel down

6. Run application inside the ECS container

_To execute a command in the ECS-hosted docker container the following command can be used:

ize exec goblin -- ps aux