Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better README #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
.PHONY: all lint test
REGION ?= us-west-2
ENV ?= stage
ARGS ?= --interactive

all: lint test
.PHONY: all lint test build

all: lint test build

# run one time only
prerequisite:
sudo python setup.py install

lint:
flake8 stacker_blueprints

test:
python setup.py test

build:
stacker build --region ${REGION} ${ARGS} conf/${ENV}.env conf/example.yaml

diff:
stacker diff --region ${REGION} ${ARGS} conf/${ENV}.env conf/example.yaml

info:
stacker info --region ${REGION} ${ARGS} conf/${ENV}.env conf/example.yaml

destroy:
stacker destroy --region ${REGION} ${ARGS} conf/${ENV}.env conf/example.yaml
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
stacker_blueprints
==================

[![circleci](https://circleci.com/gh/cloudtools/stacker_blueprints.svg?style=shield)](https://circleci.com/gh/cloudtools/stacker_blueprints)
[![pypi package](https://badge.fury.io/py/stacker_blueprints.svg)](https://badge.fury.io/py/stacker_blueprints)
[![slack](https://empire-slack.herokuapp.com/badge.svg)](https://empire-slack.herokuapp.com)

An attempt at a common Blueprint library for use with [stacker](https://github.com/cloudtools/stacker).

# Quick start

>NOTES: it will create aws resources and generate cost on your aws account. `make destroy` them all if not required any more.

If you're new to stacker you may use [stacker_cookiecutter](https://github.com/cloudtools/stacker_cookiecutter) to setup your project.

1) Make sure you [set up authentication credentials to access aws](http://boto3.readthedocs.io/en/latest/guide/quickstart.html#configuration)

2) Review files [conf/stage.env](conf/stage.env) and [conf/example.yaml](conf/example.yaml)

3) Adjust namespace in [conf/stage.env](conf/stage.env) to a global unique name

### Build the stacks

Build full stacks (vpc, bastion, myDB, myWeb)

$ git clone https://github.com/cloudtools/stacker_blueprints.git
$ cd stacker_blueprints
$ make build

# If you have other environment files, such as prod.env
$ make build ENV=prod

# If you want to create stacks in other region
$ make build REGION=ap-southeast-2

### Other commands

$ make info
$ make diff
$ make destroy

### Try other examples

There are examples under folder `conf`, for example, you want to run test on rds stack, you can easily play with below command

stacker build --region us-west-2 conf/rds/mysql.env conf/rds/mysql.yaml
6 changes: 3 additions & 3 deletions conf/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ stacks:
- name: bastion
class_path: stacker_blueprints.bastion.Bastion
enabled: true
parameters:
variables:
# Extends the parameters dict with the contents of the vpc_parameters
# anchor. Basically we're including all VPC Outputs in the parameters
# of the bastion stack. Note: Stacker figures out, automatically, which
Expand All @@ -77,7 +77,7 @@ stacks:
# stack name "myDB" on the command line with --force
locked: true
enabled: true
parameters:
variables:
<< : *vpc_parameters
InstanceType: db.m3.medium
AllocatedStorage: 10
Expand All @@ -93,7 +93,7 @@ stacks:
- name: myWeb
class_path: stacker_blueprints.asg.AutoscalingGroup
enabled: true
parameters:
variables:
<< : *vpc_parameters
InstanceType: m3.medium
ImageName: ubuntu1404
Expand Down
2 changes: 1 addition & 1 deletion conf/stage.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# will be used to prefix the CloudFormation stack names as well as the s3
# bucket that contains revisions of the stacker templates. This is the only
# required environment variable.
namespace:
namespace: stacker_blueprints
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is left blank, what error happens if you run this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this error

stacker.exceptions.InvalidConfig: {'namespace': ConversionError([ErrorMessage(u'This field is required.', None)])}