boucher 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +4 -0
- data/README.md +17 -15
- data/boucher.gemspec +1 -1
- data/boucher.jpg +0 -0
- data/boucher_logo.jpg +0 -0
- data/lib/boucher/compute.rb +6 -0
- data/lib/boucher/tasks/servers.rake +9 -1
- data/spec/boucher/env_spec.rb +1 -0
- data/spec/boucher/snapshots_spec.rb +1 -0
- metadata +5 -2
data/CHANGES.md
ADDED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
<img src="" alt="
|
1
|
+
<img src="https://raw.github.com/8thlight/boucher/master/boucher_logo.jpg" alt="Boucher logo" title="Boucher" align="right"/>
|
2
2
|
# Boucher
|
3
3
|
|
4
4
|
Boucher, pronounced [boo-shay], and meaning Butcher in French, is a suite of Rake tasks that simplfy your AWS
|
5
|
-
deployment strategy. It's built
|
5
|
+
deployment strategy. It's built on top of Chef and Fog giving your fingers the power to create new servers,
|
6
6
|
install required software, and deploy your system all in a single command.
|
7
7
|
|
8
8
|
It also helps manage your system with support for different environments and tasks to:
|
@@ -26,15 +26,16 @@ that'll get you off the ground. We recomend
|
|
26
26
|
git clone git://github.com/8thlight/boucher_template.git infrastructure
|
27
27
|
rm -rf infrastructure/.git
|
28
28
|
|
29
|
-
You'll
|
29
|
+
You'll probably want to create a repository for your own to track the work here.
|
30
30
|
|
31
|
-
Read config/env/shared.rb to get a feel for the configuration options. You'll fill in some of those values as
|
31
|
+
Read config/env/shared.rb to get a feel for the configuration options. You'll fill in some of those values as you continue to get started below.
|
32
32
|
|
33
33
|
### Creating a base image
|
34
34
|
|
35
35
|
1) Launch new instance: Ubuntu Server 12.04.1 LTS
|
36
36
|
|
37
|
-
* Create a new
|
37
|
+
* Create a new keyfile (*.pem) saved in your infrastructure project
|
38
|
+
* `chmod 0600 KEYFILE_NAME.pem` in your infrastructure project
|
38
39
|
* Be sure to add a security group that opens port 22 for SSH
|
39
40
|
|
40
41
|
2) Update config/env/shared.rb
|
@@ -47,11 +48,11 @@ Read config/env/shared.rb to get a feel for the configuration options. You'll f
|
|
47
48
|
|
48
49
|
rake servers:list
|
49
50
|
|
50
|
-
4) SSH into new server. (:username config must be '
|
51
|
+
4) SSH into new server. (:username config must be 'ubuntu' at this point)
|
51
52
|
|
52
53
|
rake servers:ssh[<instance id>]
|
53
54
|
|
54
|
-
5) Create new poweruser (unless you like '
|
55
|
+
5) Create new poweruser (unless you like 'ubuntu' as your poweruser).
|
55
56
|
|
56
57
|
sudo adduser <username>
|
57
58
|
sudo adduser <username> sudo
|
@@ -73,15 +74,16 @@ Read config/env/shared.rb to get a feel for the configuration options. You'll f
|
|
73
74
|
# add the following line at the end of the file:
|
74
75
|
<username> ALL=(ALL) NOPASSWD: ALL
|
75
76
|
|
76
|
-
9) Install required
|
77
|
+
9) Install required packages and gems.
|
77
78
|
|
78
79
|
sudo apt-get update
|
79
80
|
sudo apt-get install ruby1.9.1 ruby1.9.1-dev git gcc make libxml2-dev libxslt1-dev
|
80
81
|
sudo apt-get upgrade
|
81
82
|
sudo gem install bundler chef
|
82
83
|
|
83
|
-
10) Checkout your
|
84
|
-
If you use github, you'll have to generate ssh keys and add them to the github repo.
|
84
|
+
10) Checkout your infrastructure repo. (Yes. You should push your repo even in this early stage.)
|
85
|
+
If you use github, you'll have to generate ssh keys and add them to the github repo. Note: be sure
|
86
|
+
you name the directory "infrastructure" when cloning, since boucher assumes that location.
|
85
87
|
|
86
88
|
cd ~/.ssh
|
87
89
|
ssh-keygen -t rsa -C "your_email@youremail.com"
|
@@ -104,9 +106,9 @@ Run rake to see the list of tasks provided.
|
|
104
106
|
|
105
107
|
### Meals
|
106
108
|
|
107
|
-
We're sticking with the
|
109
|
+
We're sticking with the metaphor here. A Meal is basically a set of recipes for a single server.
|
108
110
|
Boucher will expect meals to exist in the config directory. They are JSON files usable by chef-solo, and Boucher
|
109
|
-
allows you
|
111
|
+
allows you to add extra configuration information under the "Boucher": key. For example:
|
110
112
|
|
111
113
|
{
|
112
114
|
"run_list": [
|
@@ -125,7 +127,7 @@ allows you too add extra configuration information under the "Boucher": key. Fo
|
|
125
127
|
|
126
128
|
### ERB in config
|
127
129
|
|
128
|
-
Meal .json files may contain ERB in the "boucher" section. However, the file
|
130
|
+
Meal .json files may contain ERB in the "boucher" section. However, the file gets parsed by chef-solo so it has to remain a valid JSON file. But you can do things like this:
|
129
131
|
|
130
132
|
{
|
131
133
|
"run_list": ...
|
@@ -170,11 +172,11 @@ Environment configuration is available in your chef recipes. Just require 'bouc
|
|
170
172
|
|
171
173
|
### Recipes
|
172
174
|
|
173
|
-
We'll assume you're familiar with Chef. So you know, there are
|
175
|
+
We'll assume you're familiar with Chef. So you know, there are plenty of open source cookbooks/recipes on the intertubes.
|
174
176
|
Convention is to grab the files, put them in your cookbooks folder and take ownership of them. There's a good chance you'll
|
175
177
|
want to change them.
|
176
178
|
|
177
179
|
## License
|
178
180
|
|
179
181
|
Copyright (c) 2012 8th Light, Inc.
|
180
|
-
MIT License
|
182
|
+
MIT License
|
data/boucher.gemspec
CHANGED
data/boucher.jpg
ADDED
Binary file
|
data/boucher_logo.jpg
ADDED
Binary file
|
data/lib/boucher/compute.rb
CHANGED
@@ -48,6 +48,12 @@ module Boucher
|
|
48
48
|
ssh server, "cd infrastructure && sudo BENV=#{Boucher::Config[:env]} BRANCH=#{Boucher::Config[:branch]} chef-solo -c config/solo.rb -j config/#{meal_name}.json"
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.cook_recipe(server, recipe)
|
52
|
+
update_recipes(server)
|
53
|
+
ssh server, "echo '{\\\"run_list\\\": [\\\"recipe[#{recipe}]\\\"]}' > /tmp/single_recipe.json"
|
54
|
+
ssh server, "cd infrastructure && sudo BENV=#{Boucher::Config[:env]} BRANCH=#{Boucher::Config[:branch]} chef-solo -c config/solo.rb -j /tmp/single_recipe.json"
|
55
|
+
end
|
56
|
+
|
51
57
|
def self.ssh_open?(server)
|
52
58
|
ssh server, "echo 'SSH is open for business!'"
|
53
59
|
true
|
@@ -112,12 +112,20 @@ web console and click Instance Actions -> Change Termination Protection -> Yes."
|
|
112
112
|
end
|
113
113
|
|
114
114
|
desc "Cook the specified meal on the instance(s) specified by the given id or meal"
|
115
|
-
task :
|
115
|
+
task :meal, [:meal, :server_id] do |t, args|
|
116
116
|
Boucher.assert_env!
|
117
117
|
servers = Boucher.resolve_servers(args.server_id || args.meal)
|
118
118
|
servers.each do |server|
|
119
119
|
Boucher.cook_meal(server, args.meal)
|
120
120
|
end
|
121
121
|
end
|
122
|
+
|
123
|
+
desc "Cook the specified recipe on the instance(s) specified by the given id or meal"
|
124
|
+
task :recipe, [:recipe, :id_or_meal] do |t, args|
|
125
|
+
servers = Boucher.resolve_servers(args.id_or_meal || args.meal)
|
126
|
+
servers.each do |server|
|
127
|
+
Boucher.cook_recipe(server, args.recipe)
|
128
|
+
end
|
129
|
+
end
|
122
130
|
end
|
123
131
|
|
data/spec/boucher/env_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boucher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- .gitignore
|
86
86
|
- .gitmodules
|
87
87
|
- .rvmrc
|
88
|
+
- CHANGES.md
|
88
89
|
- Gemfile
|
89
90
|
- Gemfile.lock
|
90
91
|
- LICENSE
|
@@ -92,6 +93,8 @@ files:
|
|
92
93
|
- Rakefile
|
93
94
|
- TODO.md
|
94
95
|
- boucher.gemspec
|
96
|
+
- boucher.jpg
|
97
|
+
- boucher_logo.jpg
|
95
98
|
- lib/boucher/addresses.rb
|
96
99
|
- lib/boucher/compute.rb
|
97
100
|
- lib/boucher/env.rb
|