Deploy Using Git

Shaun edited this page Jun 7, 2017 · 3 revisions

With the release of version 0.52-beta Qaz now supports deployments directly from Git Repositories....!

So, What does this mean exactly?

Traditionally, one would write templates, store the them in a Repo, then clone or pull then down from said Repo for each deployment. With the git-deploy command, Qaz will clone the repo into memory, read all the files and deploy to AWS without writing a single file to disk. This works without git being installed locally and is handy for simply deploying known good builds directly from there respective repos to AWS. It also increases re-usability by allowing templates to be shared simply by sharing a Git Repository link.

Configuration

When git-deploy is used, the target repo is cloned in to memory, as such the file system structure is retained. A config file can be specified using the -c or --config flag, Qaz will first check the repo for the config file specified, if it does not exist in the repo, then the local filesystem is checked. If the config is being sourced via Lambda, S3 or HTTP(s) then the repo and file system checks are skipped.

The config file does not need to sourced from the repo being deployed from, this allows flexibility in that templates being pulled from a repo can be dynamically updated based on external configuration files.

Click Here for a sample repo.

Templates

When using git-deply templates must be specified in the config source. For example:

# AWS Region
region: eu-west-1

# Project Name
project: qaz-project


# Stacks
stacks:
  vpc:
    source: vpc.yaml
    cf:
      cidr: 10.10.0.0/16

Note the source for the vpc stack. When a repo is pulled into memory the relative file system created in memory is that of the repo.

For example the file system for the Sample Repo is:

.
├── config.yaml
└── vpc.yaml

When Qaz reads the config file, it will use vpc.yaml as the explicit path for the template for that stack. As this matches the relative path in the repo, the file will be sourced there. If the file cannot be found in the repo the same path is applied to the local file system. If the template is sourced via Lambda, S3 or HTTP(s), the repo will not be checked.

Usage

qaz git-deploy --help
Deploy project from Git repository

Usage:
  qaz git-deploy [git-repo] [flags]

Examples:
qaz git-deploy https://github.com/cfn-deployable/simplevpc.git --user me

Flags:
  -A, --all                deploy all stacks with defined Sources in config
  -c, --config string      path to config file (default "config.yml")
      --disable-rollback   Set Stack to rollback on deployment failures
  -h, --help               help for git-deploy
      --password string    git password
      --ssh-rsa string     path to git SSH id_rsa (default "/Users/<username>/.ssh/id_rsa")
  -u, --user string        git username

Global Flags:
      --debug            Run in debug mode...
      --no-colors        disable colors in outputs
  -p, --profile string   configured aws profile (default "default")

Try it out!

The following is a simple VPC deployment via a public git repo.

$ qaz git-deploy https://github.com/cfn-deployable/simplevpc.git

--

This feature is fairly alpha within this beta, please report any bugs or issues.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.