From e977ba74304a78c668b81a26fc0d4e7112ac7627 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Thu, 12 Jul 2018 13:53:34 +1000 Subject: [PATCH 1/4] Better README --- Makefile | 24 ++++++++++++++++++++++-- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++ conf/example.yaml | 6 +++--- conf/stage.env | 2 +- 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 README.md diff --git a/Makefile b/Makefile index 2d4e471c..0c7918a6 100644 --- a/Makefile +++ b/Makefile @@ -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 pip install stacker_blueprints 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 diff --git a/README.md b/README.md new file mode 100644 index 00000000..92dbd2f9 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +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 `_. + +If you're new to stacker you may use `stacker_cookiecutter `_ to setup your project. + +# Quick start + +>NOTES: it will create aws resources and generate cost on your aws account. `make destroy` them all if not required any more. + +Make sure you have permission to access aws, review below files if you need change anything. + +1) Adjust namespace to a global unique name, the name in example will be used in s3 bucket name, and has been used. +2) I have issue to start with pre_build task, if you get same problem, comment that session. + + config/stage.env + config/example.yaml + +### 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 diff --git a/conf/example.yaml b/conf/example.yaml index d926559f..93230f97 100644 --- a/conf/example.yaml +++ b/conf/example.yaml @@ -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 @@ -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 @@ -93,7 +93,7 @@ stacks: - name: myWeb class_path: stacker_blueprints.asg.AutoscalingGroup enabled: true - parameters: + variables: << : *vpc_parameters InstanceType: m3.medium ImageName: ubuntu1404 diff --git a/conf/stage.env b/conf/stage.env index 8f181313..bde0ca28 100644 --- a/conf/stage.env +++ b/conf/stage.env @@ -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 From 2a57b5d64299e311523ddbf9737a949b8f05c647 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Thu, 12 Jul 2018 17:00:54 +1000 Subject: [PATCH 2/4] Better README --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c7918a6..c7564f22 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: lint test build # run one time only prerequisite: - sudo pip install stacker_blueprints + sudo python setup.py install lint: flake8 stacker_blueprints From 4412bc7c368111c083f53991637547c777a1eefd Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Tue, 24 Jul 2018 11:20:46 +1000 Subject: [PATCH 3/4] Better README --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 92dbd2f9..0a8f5521 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,11 @@ If you're new to stacker you may use `stacker_cookiecutter NOTES: it will create aws resources and generate cost on your aws account. `make destroy` them all if not required any more. -Make sure you have permission to access aws, review below files if you need change anything. +1) Make sure you [set up authentication credentials to access aws](http://boto3.readthedocs.io/en/latest/guide/quickstart.html#configuration) -1) Adjust namespace to a global unique name, the name in example will be used in s3 bucket name, and has been used. -2) I have issue to start with pre_build task, if you get same problem, comment that session. +2) Review files [conf/stage.env](conf/stage.env) and [conf/example.yaml](conf/example.yaml) - config/stage.env - config/example.yaml +3) Adjust namespace in [conf/stage.env](conf/stage.env) to a global unique name ### Build the stacks From 0e4607339f013daaa4ea7bcdf63e75b091cc566f Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Thu, 26 Jul 2018 11:57:38 +1000 Subject: [PATCH 4/4] Better README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a8f5521..02ab16c6 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ 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 `_. - -If you're new to stacker you may use `stacker_cookiecutter `_ to setup your project. +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)