dumbwaiter 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +41 -4
- data/lib/dumbwaiter/cli.rb +17 -10
- data/lib/dumbwaiter/stack.rb +4 -0
- data/lib/dumbwaiter/version.rb +1 -1
- data/spec/lib/dumbwaiter/cli_spec.rb +24 -0
- data/spec/lib/dumbwaiter/stack_spec.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f20eaec8369f54bbc83d62f0ade5f99a735f98
|
4
|
+
data.tar.gz: 1c4eca739c2b72e96ee6908df4ace69fc688f081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc160beefbabeca4bc392e0b75c8c80d5e94a4abf2aadde4c39c10dbad7e0a5cf3d82cc26164a7d182fb23c7864c2a2bf5a87ba5967b929f434c43fbe7d0b9f7
|
7
|
+
data.tar.gz: 2bad21df531df0ea6ec2ba1f4b394a2ebc6528f627d0b72ff440035c248f1fa1b5899e9385fdccba0af9ebd24ed6d8433e6b8485dbf91dadc3d0f950b9974d0c
|
data/README.md
CHANGED
@@ -5,6 +5,39 @@ Dumbwaiter hoists your Rails application up to OpsWorks and ratchets deployment
|
|
5
5
|
information back down.
|
6
6
|
|
7
7
|
|
8
|
+
Origin
|
9
|
+
------
|
10
|
+
|
11
|
+
Before Scalarium became OpsWorks, they maintained a gem that did the sorts of
|
12
|
+
functions described here. Like Heroku Toolbelt, the Scalarium gem offered users
|
13
|
+
a very basic workflow experience: upload and run Chef recipes, execute commands
|
14
|
+
remotely and watch their output.
|
15
|
+
|
16
|
+
|
17
|
+
Goals
|
18
|
+
-----
|
19
|
+
|
20
|
+
Dumbwaiter prescribes a very specific OpsWorks-centric workflow with the same
|
21
|
+
feeling of the Scalarium gem's CLI:
|
22
|
+
|
23
|
+
* Create OpsWorks stacks, layers and instances via YAML files
|
24
|
+
* Collect custom Chef cookbooks via Berkshelf and upload to S3
|
25
|
+
* Create an application corresponding to a GitHub repo
|
26
|
+
* Run versioned deployments, rollbacks and one-off recipes
|
27
|
+
|
28
|
+
|
29
|
+
Non-Goals
|
30
|
+
---------
|
31
|
+
|
32
|
+
Dumbwaiter only deals with OpsWorks workflow, excluding:
|
33
|
+
|
34
|
+
* Standing up VPCs
|
35
|
+
* Running CloudFormation templates
|
36
|
+
* One-off bash-level commands(^) and log tailing
|
37
|
+
|
38
|
+
`^ Making a cookbook to run one-off commands is totally not unheard-of.`
|
39
|
+
|
40
|
+
|
8
41
|
Installation
|
9
42
|
------------
|
10
43
|
|
@@ -28,14 +61,18 @@ Deploy the "cinnamon" branch of the "syrup" application to the "Pancake" stack:
|
|
28
61
|
|
29
62
|
`dumbwaiter deploy Pancake syrup cinnamon`
|
30
63
|
|
31
|
-
Roll back the "Snowman" stack's "dandruff" application:
|
32
|
-
|
33
|
-
`dumbwaiter rollback Snowman dandruff`
|
34
|
-
|
35
64
|
List the deployments on the "Maniacal Checklist" stack:
|
36
65
|
|
37
66
|
`dumbwaiter list "Maniacal Checklist"`
|
38
67
|
|
68
|
+
Upload all the custom cookbooks for the "Sweden" stack:
|
69
|
+
|
70
|
+
`dumbwaiter rechef Sweden`
|
71
|
+
|
72
|
+
Roll back the "Snowman" stack's "dandruff" application:
|
73
|
+
|
74
|
+
`dumbwaiter rollback Snowman dandruff`
|
75
|
+
|
39
76
|
List the stacks and apps in your OpsWorks environment:
|
40
77
|
|
41
78
|
`dumbwaiter stacks`
|
data/lib/dumbwaiter/cli.rb
CHANGED
@@ -14,21 +14,12 @@ module Dumbwaiter
|
|
14
14
|
raise Thor::Error.new(e.message)
|
15
15
|
end
|
16
16
|
|
17
|
-
desc "rollback STACK_NAME APP_NAME", "Roll back an application"
|
18
|
-
def rollback(stack_name, app_name)
|
19
|
-
stack = Stack.find(stack_name)
|
20
|
-
app = App.find(stack, app_name)
|
21
|
-
app.rollback
|
22
|
-
rescue Dumbwaiter::Stack::NotFound, Dumbwaiter::App::NotFound => e
|
23
|
-
raise Thor::Error.new(e.message)
|
24
|
-
end
|
25
|
-
|
26
17
|
desc "list STACK_NAME", "List all the deployments for a stack"
|
27
18
|
def list(stack_name)
|
28
19
|
stack = Stack.find(stack_name)
|
29
20
|
|
30
21
|
deployments = stack.deployments.select do |deployment|
|
31
|
-
%w(rollback deploy).include?(deployment.command_name)
|
22
|
+
%w(rollback deploy update_custom_cookbooks).include?(deployment.command_name)
|
32
23
|
end
|
33
24
|
|
34
25
|
deployments.each do |deployment|
|
@@ -38,6 +29,22 @@ module Dumbwaiter
|
|
38
29
|
raise Thor::Error.new(e.message)
|
39
30
|
end
|
40
31
|
|
32
|
+
desc "rechef STACK", "Upload new cookbooks to a stack"
|
33
|
+
def rechef(stack_name)
|
34
|
+
Stack.find(stack_name).rechef
|
35
|
+
rescue Dumbwaiter::Stack::NotFound => e
|
36
|
+
raise Thor::Error.new(e.message)
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "rollback STACK_NAME APP_NAME", "Roll back an application"
|
40
|
+
def rollback(stack_name, app_name)
|
41
|
+
stack = Stack.find(stack_name)
|
42
|
+
app = App.find(stack, app_name)
|
43
|
+
app.rollback
|
44
|
+
rescue Dumbwaiter::Stack::NotFound, Dumbwaiter::App::NotFound => e
|
45
|
+
raise Thor::Error.new(e.message)
|
46
|
+
end
|
47
|
+
|
41
48
|
desc "stacks", "List all the stacks"
|
42
49
|
def stacks
|
43
50
|
Stack.all.each { |stack| Kernel.puts("#{stack.name}: #{stack.apps.map(&:name).join(', ')}") }
|
data/lib/dumbwaiter/stack.rb
CHANGED
data/lib/dumbwaiter/version.rb
CHANGED
@@ -79,6 +79,15 @@ describe Dumbwaiter::Cli do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
context "when the deployment is a custom cookbook update" do
|
83
|
+
let(:fake_deployment) { double(:deployment, command_name: "update_custom_cookbooks", to_log: "whee!") }
|
84
|
+
|
85
|
+
it "lists the deployment" do
|
86
|
+
Kernel.should_receive(:puts).with("whee!")
|
87
|
+
cli.list("ducks")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
82
91
|
context "when the deployment is something else" do
|
83
92
|
let(:fake_deployment) { double(:deployment, command_name: "gargle", to_log: "brblrgl") }
|
84
93
|
|
@@ -102,4 +111,19 @@ describe Dumbwaiter::Cli do
|
|
102
111
|
cli.stacks
|
103
112
|
end
|
104
113
|
end
|
114
|
+
|
115
|
+
describe "#rechef" do
|
116
|
+
context "when the stack exists" do
|
117
|
+
it "deploys the stack with the resolved id" do
|
118
|
+
fake_stack.should_receive(:rechef)
|
119
|
+
cli.rechef("ducks")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "when the stack does not exist" do
|
124
|
+
it "blows up" do
|
125
|
+
expect { cli.rechef("toques") }.to raise_error(Thor::Error)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
105
129
|
end
|
@@ -7,7 +7,7 @@ describe Dumbwaiter::Stack do
|
|
7
7
|
let(:fake_app) { double(:app) }
|
8
8
|
let(:fake_deployment) { double(:deployment) }
|
9
9
|
|
10
|
-
subject(:stack) { Dumbwaiter::Stack.new(fake_stack) }
|
10
|
+
subject(:stack) { Dumbwaiter::Stack.new(fake_stack, fake_opsworks) }
|
11
11
|
|
12
12
|
before do
|
13
13
|
Dumbwaiter::App.stub(all: [fake_app])
|
@@ -42,4 +42,14 @@ describe Dumbwaiter::Stack do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
describe "#rechef" do
|
47
|
+
it "creates a deployment" do
|
48
|
+
fake_opsworks.should_receive(:create_deployment) do |params|
|
49
|
+
params[:stack_id].should == "cool"
|
50
|
+
params[:command].should == {name: "update_custom_cookbooks"}
|
51
|
+
end
|
52
|
+
stack.rechef
|
53
|
+
end
|
54
|
+
end
|
45
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumbwaiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doc Ritezel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|