Permalink
Browse files

Merge branch 'master' of github.com:bodepd/stack_builder

  • Loading branch information...
2 parents 2fbe50d + b5268b7 commit 83620986daaebe8b96a5951205538b31bfea947c Dan Bode committed Apr 13, 2012
Showing with 130 additions and 71 deletions.
  1. +86 −30 README.md
  2. +44 −34 lib/puppet/face/stack.rb
  3. +0 −7 script.rb
View
@@ -1,58 +1,114 @@
-# Installation
+# Overview
-create EC2 account.
-create keypair in appropriate EC2 region.
-create the following security groups:
+Stack builder is a tool for building stacks of systems using Puppet Cloud Provisioner tool. This project is an experimental prototype so expect changes.
-* default: 80 open icmp all, tcp 22
-* puppetmaster: open tcp 8140
+# Installation and configuration
-ensure that rubygems are installed (apt-get install rubygems)
+## EC2 Account
-install the latest version of puppet (2.7.12) from apt.puppetlabs.com
+Create EC2 account.
+Create keypair in appropriate EC2 region.
+Create the following security groups:
-install puppet cloud provisioner and add its lib directory to RUBYLIB
+* default: TCP 22, icmp all.
+* puppetmaster: TCP 443, TCP 8140.
- mkdir ~/dev/
- cd ~/dev/
- git clone https://github.com/puppetlabs/puppetlabs-cloud-provisioner
- export RUBYLIB=~/dev/puppetlabs-cloud-provisioner/lib:$RUBYLIB
+## Puppet
-install stack deployer and add its lib directory to RUBYLIB
+Install the latest version of puppet from apt.puppetlabs.com or yum.puppetlabs.com or use envpuppet script to run from source.
- cd ~/dev
- git clone https://github.com/bodepd/stack_builder
- export RUBYLIB=~/stack_builder/lib:$RUBYLIB
+## Puppet Cloud Provisioner
+
+Stack builder requires [Puppet Cloud Provisioner](https://github.com/puppetlabs/puppetlabs-cloud-provisioner). Cloud Provisioner with VMware support can be obtained by installing Puppet Enterprise 2.0+.
+
+The following instructions are for users using cloud provisioner from source. For users of forge.puppetlabs.com module see [getting started documentation](http://docs.puppetlabs.com/guides/cloud_pack_getting_started.html), for Puppet Enterprise users see [cloud provisioning documentation](http://docs.puppetlabs.com/pe/2.0/cloudprovisioner_overview.html).
+
+Install ruby and rubygems:
+
+ apt-get install ruby rubygems
+ yum install ruby rubygems
+
+Install guid and fog ruby gems:
-gem install guid
-gem install fog
-configure fog credentials in ~/.fog:
+ gem install guid
+ gem install fog
+
+Git clone puppet cloud provisioner and add its lib directory to RUBYLIB
+
+ mkdir ~/src/
+ cd ~/src/
+ git clone https://github.com/puppetlabs/puppetlabs-cloud-provisioner
+ export RUBYLIB=~/src/puppetlabs-cloud-provisioner/lib:$RUBYLIB
+
+Configure fog credentials in ~/.fog:
:default:
:aws_access_key_id: ...
:aws_secret_access_key: ...
-verify everything is working:
+Verify cloud provisioner Puppet face is loaded and working:
-* verify cloud provisioner:
+ puppet help node_aws
- puppet help node_aws
+## Install stack builder
+
+Git clone stack deployer and add its lib directory to RUBYLIB
+
+ cd ~/src
+ git clone https://github.com/bodepd/stack_builder
+ export RUBYLIB=~/src/stack_builder/lib:$RUBYLIB
-* verify stack_builder:
+Verify stack_builder Puppet face is loaded and working:
- puppet help stack
+ puppet help stack
-This should build a 4 node swift cluster:
+## Configuration
- puppet stack build --name dans_stack --config config/oneiric_swift_multi --trace
+Stack builder supports default setting in Puppet[:confdir]/stack_builder.yaml (puppet agent --configprint confdir).
-# Working AMI
+ create:
+ options:
+ keyname: stack_keys
+ type: m1.small
+ region: us-west-2
+ image: ami-06c54936
+ group: default
+ install:
+ options:
+ keyfile: ~/.ssh/stack_keys.pem
+ login: ubuntu
+
+# Usage
+
+stack builder supports the following action:
+
+ build Build nodes in stack by performing create, install, test action.
+ connect Establish connection to all nodes in the stack via tmux.
+ create Create a nodes specified in stack configuration.
+ destroy Destroy nodes created by stack builder.
+ install Performs install action for nodes in stack configuration.
+ list List stacks created by stack_builder.
+ test Performs test action for nodes in stack configuration.
+
+## Example
+
+Create a 4 node openstack swift stack:
+
+ puppet stack build --name demo_stack --config config/swift/oneiric_swift_multi
+
+Connect to swift stack:
+
+ puppet stack connect --name demo_stack --config config/swift/oneiric_swift_multi
+
+Destroy swift stack:
+
+ puppet stack destroy --name demo_stack
+
+## Working AMI
us-east-1:
* Ubuntu Oneric: ami-a0ba68c9 (i386), ami-baba68d3 (x86_64)
* Fedora 16: ami-5f16d836 (i386), ami-0316d86a (x86_64)
-
-
- I would like to be able to specify a master from a different file
@@ -4,72 +4,91 @@
Puppet::Face.define(:stack, '0.0.1') do
summary 'Face for building out multi-node deployments'
- action :create do
+ action :build do
Puppet::Stack::Options.add_option_name(self)
Puppet::Stack::Options.add_option_config(self)
- summary 'Create a group of specified nodes to form a stack'
+ summary 'Build nodes in stack config and perform create, install, test action.'
+ description <<-EOT
+Provide a stack config file to build a collection of nodes. This action will
+perform create, install, and test action. Create provisioning process occurs in
+parallel while the rest of the action is done in sequence.
+ EOT
when_invoked do |options|
- Puppet.fail('Create is not yet implemented')
+ Puppet::Stack.build(options)
+ # TODO this should return a hash that represents all of the things that
+ # were built
end
end
- action :install do
+ action :connect do
+ Puppet::Stack::Options.add_option_name(self)
+ Puppet::Stack::Options.add_option_config(self)
+ summary 'Establish connection to all of the nodes in the stack via tmux.'
+ when_invoked do |options|
+ Puppet::Stack.tmux(options)
+ end
+ end
+
+ action :create do
Puppet::Stack::Options.add_option_name(self)
Puppet::Stack::Options.add_option_config(self)
- summary 'runs the specified install actions for a stack'
+ summary 'Create a group of node(s) specified in stack configuration.'
description <<-EOT
- Runs the specified install actions for a nodes.
- Assumes that the stack has already been created.
+Create a group of node(s) as specified in stack configuration. Stack builder
+assume the nodes exist if there are no create action.
EOT
when_invoked do |options|
- Puppet.fail('Install is not yet implemented')
+ Puppet.fail('Create is not yet implemented')
end
end
- action :test do
+ action :destroy do
Puppet::Stack::Options.add_option_name(self)
- Puppet::Stack::Options.add_option_config(self)
- summary 'runs the specified integration tests'
+ summary 'Destroy a group of node(s) created by stack builder.'
description <<-EOT
- Runs the specified test action for a stack.
- Assumes that the stack has already been created.
+Destroy a group of nodes created by stack builder. The stacks are tracked in
+puppet[:confdir]/stack/ as they are created and destroyed. If the nodes are not
+created by stack builder, they will not be destroyed by this action.
EOT
when_invoked do |options|
- Puppet.fail('Test is not yet implemented')
+ Puppet::Stack.destroy(options)
end
end
- action :build do
+ action :install do
Puppet::Stack::Options.add_option_name(self)
Puppet::Stack::Options.add_option_config(self)
+ summary 'Performs install action for a group of node(s) in stack configuration.'
description <<-EOT
- Reads a config file and uses it to build out a collection
- of nodes.
- Build will perform create, install, and test
- It provisions everything in parallel.
+Performs the specified install actions for a nodes. Assumes the nodes have
+already been created and does not need provisioning.
EOT
when_invoked do |options|
- Puppet::Stack.build(options)
- # TODO this should return a hash that represents all of the things that
- # were built
+ Puppet.fail('Install is not yet implemented')
end
when_rendering :console do |value|
value.inspect if value
end
end
- action :destroy do
+ action :test do
Puppet::Stack::Options.add_option_name(self)
+ Puppet::Stack::Options.add_option_config(self)
+ summary 'Perfom test action for a group of node(s) in stack configuration.'
+ description <<-EOT
+Runs the specified test action for a stack. Assumes that the stack has already
+been created.
+ EOT
when_invoked do |options|
- Puppet::Stack.destroy(options)
+ Puppet.fail('Test is not yet implemented')
end
end
action :list do
when_invoked do |options|
Puppet::Stack.list(options)
end
-
+ summary 'List stacks created by stack builder.'
when_rendering :console do |value|
value.collect do |id, status_hash|
"#{id}:\n" + status_hash.collect do |field, val|
@@ -79,13 +98,4 @@
end
end
- action :connect do
- Puppet::Stack::Options.add_option_name(self)
- Puppet::Stack::Options.add_option_config(self)
- summary 'connect to all of the nodes in the stack via tmux'
- when_invoked do |options|
- Puppet::Stack.tmux(options)
- end
- end
-
end
View
@@ -1,7 +0,0 @@
-require 'puppet/face'
-require 'puppet'
-
-Puppet::Face[:stack, :current].build(
- :config => 'config/oneiric_swift_multi',
- :name => Time.now.to_i
-)

0 comments on commit 8362098

Please sign in to comment.