fezzik 0.8.0 → 0.8.1
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 +7 -0
- data/README.md +59 -70
- data/fezzik.gemspec +1 -2
- data/lib/fezzik/host_task.rb +4 -4
- data/lib/fezzik/version.rb +1 -1
- metadata +11 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 46f03aaa7fe191aeba95f63afef24ca9f2bec9d6
|
4
|
+
data.tar.gz: 237458033bb4d72fe30414e97213aba3a420f025
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a569eaeaa834041ea0273c71e7485a47be4e4e64c3145f9b2fddaaf66c39f75149a3c29cc7f5851dbc0ddc724b8d85ee0a030bee8ff2054f91465989c1b3bce
|
7
|
+
data.tar.gz: d4096d2c482a9d763f1883ca172fc3848b5e4fa35b8c245416e51b348a68425e9e5749183ed4e378c13c8812837ddf40766ae67bce92149c62ceed8947ec60df
|
data/README.md
CHANGED
@@ -19,10 +19,11 @@ Require Fezzik in your project Rakefile and define a destination:
|
|
19
19
|
|
20
20
|
```ruby
|
21
21
|
require "fezzik"
|
22
|
+
include Fezzik::DSL
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
destination :prod do
|
25
|
+
set :user, "root"
|
26
|
+
set :domain, "myapp.com"
|
26
27
|
end
|
27
28
|
```
|
28
29
|
|
@@ -38,7 +39,7 @@ Write some host tasks that will execute on the specified destination:
|
|
38
39
|
|
39
40
|
```ruby
|
40
41
|
namespace :fezzik do
|
41
|
-
|
42
|
+
host_task :echo do
|
42
43
|
run "echo 'Running on #{host}'"
|
43
44
|
end
|
44
45
|
end
|
@@ -68,8 +69,8 @@ end
|
|
68
69
|
would look like this as a host task:
|
69
70
|
|
70
71
|
```ruby
|
71
|
-
|
72
|
-
|
72
|
+
host_task :echo, :args => [:arg1, :arg2],
|
73
|
+
:deps => [:dep1, :dep2] do |t, args|
|
73
74
|
...
|
74
75
|
end
|
75
76
|
```
|
@@ -81,24 +82,25 @@ One of the more useful things you can use Fezzik for is handling deployments.
|
|
81
82
|
|
82
83
|
```ruby
|
83
84
|
require "fezzik"
|
85
|
+
include Fezzik::DSL
|
84
86
|
|
85
87
|
# Fezzik will automatically load any .rake files it finds in this directory.
|
86
88
|
Fezzik.init(:tasks => "config/tasks")
|
87
89
|
|
88
90
|
# The only special settings are `:domain` and `:user`. The rest are purely convention. All settings can be
|
89
|
-
# retrieved in your tasks with `get` (e.g., `
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
91
|
+
# retrieved in your tasks with `get` (e.g., `get :current_path`).
|
92
|
+
set :app, "myapp"
|
93
|
+
set :user, "root"
|
94
|
+
set :deploy_to, "/opt/#{get :app}"
|
95
|
+
set :release_path, "#{get :deploy_to}/releases/#{Time.now.strftime("%Y%m%d%H%M")}"
|
96
|
+
set :current_path, "#{get :deploy_to}/current"
|
97
|
+
|
98
|
+
destination :staging do
|
99
|
+
set :domain, "myapp-staging.com"
|
98
100
|
end
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
+
destination :prod do
|
103
|
+
set :domain, "myapp.com"
|
102
104
|
end
|
103
105
|
```
|
104
106
|
|
@@ -111,7 +113,7 @@ $ fez get deploy
|
|
111
113
|
[new] deploy.rake
|
112
114
|
```
|
113
115
|
|
114
|
-
You'll need to edit the fezzik:start and fezzik:stop tasks in deploy.rake since those are specific to your
|
116
|
+
You'll need to edit the `fezzik:start` and `fezzik:stop` tasks in deploy.rake since those are specific to your
|
115
117
|
project.
|
116
118
|
|
117
119
|
```ruby
|
@@ -119,12 +121,12 @@ namespace :fezzik do
|
|
119
121
|
...
|
120
122
|
desc "runs the executable in project/bin"
|
121
123
|
host_task :start do
|
122
|
-
puts "starting from #{(run "readlink #{
|
123
|
-
run "cd #{
|
124
|
+
puts "starting from #{(run "readlink #{get :current_path}", :output => capture)[:stdout] }}"
|
125
|
+
run "cd #{get :current_path} && ./bin/run_app.sh"
|
124
126
|
end
|
125
127
|
|
126
128
|
desc "kills the application by searching for the specified process name"
|
127
|
-
host_task :stop do
|
129
|
+
Fezzik.host_task :stop do
|
128
130
|
puts "stopping app"
|
129
131
|
run "(kill `ps aux | grep 'myapp' | grep -v grep | awk '{print $2}'` || true)"
|
130
132
|
end
|
@@ -152,9 +154,9 @@ $ fez get deploy
|
|
152
154
|
```
|
153
155
|
|
154
156
|
```ruby
|
155
|
-
|
156
|
-
|
157
|
-
|
157
|
+
destination :prod do
|
158
|
+
set :domain, "myapp.com"
|
159
|
+
env :rack_env, "production"
|
158
160
|
end
|
159
161
|
```
|
160
162
|
|
@@ -164,27 +166,27 @@ project directly.
|
|
164
166
|
|
165
167
|
```ruby
|
166
168
|
desc "runs the executable in project/bin"
|
167
|
-
|
168
|
-
run "cd #{
|
169
|
+
host_task :start do
|
170
|
+
run "cd #{get :current_path} && (source environment.sh || true) && ./bin/run_app.sh"
|
169
171
|
end
|
170
172
|
```
|
171
173
|
|
172
174
|
You can assign different environments to subsets of hosts:
|
173
175
|
|
174
176
|
```ruby
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
177
|
+
destination :prod do
|
178
|
+
set :domain, ["myapp1.com", "myapp2.com"]
|
179
|
+
env :rack_env, "production"
|
180
|
+
env :is_canary, "true", :hosts => ["myapp1.com"]
|
179
181
|
end
|
180
182
|
```
|
181
183
|
|
182
|
-
Fezzik accepts multiple destinations in the call to `
|
184
|
+
Fezzik accepts multiple destinations in the call to `destination`.
|
183
185
|
This can be useful if you have common environment variables shared across destinations.
|
184
186
|
|
185
187
|
```ruby
|
186
|
-
|
187
|
-
|
188
|
+
destination :staging, :prod do
|
189
|
+
env :unicorn_workers, 4
|
188
190
|
end
|
189
191
|
```
|
190
192
|
|
@@ -199,8 +201,8 @@ end
|
|
199
201
|
To access the environment for the currently targeted host:
|
200
202
|
|
201
203
|
```ruby
|
202
|
-
|
203
|
-
puts Fezzik.
|
204
|
+
host_task :inspect_environment do
|
205
|
+
puts Fezzik.environments[host].inspect
|
204
206
|
end
|
205
207
|
```
|
206
208
|
|
@@ -212,17 +214,17 @@ to their purpose. For example, you might want to perform your initial package in
|
|
212
214
|
your app as an unprivileged user.
|
213
215
|
|
214
216
|
```ruby
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
217
|
+
destination :prod do
|
218
|
+
set :domain, "myapp.com"
|
219
|
+
role :root_user, :user => "root"
|
220
|
+
role :run_user, :user => "app"
|
219
221
|
end
|
220
222
|
|
221
|
-
|
223
|
+
host_task :install, :roles => :root_user
|
222
224
|
# Install all the things.
|
223
225
|
end
|
224
226
|
|
225
|
-
|
227
|
+
host_task :run, :roles => :run_user
|
226
228
|
# Run all the things.
|
227
229
|
end
|
228
230
|
```
|
@@ -230,24 +232,24 @@ end
|
|
230
232
|
Or, you might have different domains for database deployment and app deployment.
|
231
233
|
|
232
234
|
```ruby
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
235
|
+
destination :prod do
|
236
|
+
set :user, "root"
|
237
|
+
role :db, :domain => "db.myapp.com"
|
238
|
+
role :app, :domain => "myapp.com"
|
237
239
|
end
|
238
240
|
```
|
239
241
|
|
240
242
|
Roles in destination blocks can override global role settings.
|
241
243
|
|
242
244
|
```ruby
|
243
|
-
|
245
|
+
role :app, :domain => "localhost"
|
244
246
|
|
245
|
-
|
246
|
-
|
247
|
+
destination :prod do
|
248
|
+
role :app, :domain => "myapp.com"
|
247
249
|
end
|
248
250
|
```
|
249
251
|
|
250
|
-
The `
|
252
|
+
The `role` method accepts a role name and a hash of values that you want assigned with the
|
251
253
|
`set :var, value` syntax. These will override the global or destination settings when a host task is
|
252
254
|
run.
|
253
255
|
|
@@ -293,8 +295,8 @@ As a helper, any `puts` used from within a host task will call an overridden thr
|
|
293
295
|
|
294
296
|
## DSL
|
295
297
|
|
296
|
-
Fezzik comes with a DSL module that you can optionally include in the top level of your Rakefiles
|
297
|
-
the following functions:
|
298
|
+
Fezzik comes with a DSL module that you can optionally include in the top level of your Rakefiles with
|
299
|
+
`include Fezzik::DSL`. It exposes the following functions:
|
298
300
|
|
299
301
|
```
|
300
302
|
destination
|
@@ -306,22 +308,8 @@ role
|
|
306
308
|
capture_output
|
307
309
|
```
|
308
310
|
|
309
|
-
|
310
|
-
|
311
|
-
```ruby
|
312
|
-
include Fezzik::DSL
|
313
|
-
|
314
|
-
destination :prod do
|
315
|
-
set :domain "myapp.com"
|
316
|
-
env :rack_env, "production"
|
317
|
-
role :root_user, :user => "root"
|
318
|
-
end
|
319
|
-
|
320
|
-
host_task :echo do
|
321
|
-
run "echo 'Running on #{host}'"
|
322
|
-
end
|
323
|
-
```
|
324
|
-
|
311
|
+
If you don't want to include these functions in your top-level namespace they can all be called directly on
|
312
|
+
the Fezzik module, e.g., `Fezzik.destination`.
|
325
313
|
|
326
314
|
## Included Tasks
|
327
315
|
|
@@ -407,16 +395,17 @@ connection pool, but necessarily introduces a few breaking changes. These are de
|
|
407
395
|
it manually:
|
408
396
|
|
409
397
|
```ruby
|
410
|
-
|
398
|
+
set :current_path, "#{get :deploy_to}/current`.
|
411
399
|
```
|
412
400
|
|
413
401
|
- The helper method `rsync` no longer exists. Instead of `rsync "..."` use `system("rsync -az ...")`
|
402
|
+
- The helper method `sudo` no longer exists. Instead of `sudo "..."` use `run "sudo ..."`
|
414
403
|
|
415
404
|
### Deprecations
|
416
405
|
|
417
406
|
- The `remote_task` method is deprecated. Use `host_task` instead.
|
418
|
-
- Using settings defined by `
|
419
|
-
`
|
407
|
+
- Using settings defined by `set` as top-level method calls is deprecated. For example, use
|
408
|
+
`get :domain` instead of `domain`.
|
420
409
|
- Fezzik::Util.capture_output is deprecated. Pass options directly to `run` instead:
|
421
410
|
|
422
411
|
```ruby
|
data/fezzik.gemspec
CHANGED
@@ -24,8 +24,7 @@ EOS
|
|
24
24
|
s.files = `git ls-files`.split("\n")
|
25
25
|
|
26
26
|
s.add_dependency "rake"
|
27
|
-
s.add_dependency "weave", "=0.
|
27
|
+
s.add_dependency "weave", "=0.2.0"
|
28
28
|
|
29
29
|
s.add_development_dependency("scope", "~>0.2.3")
|
30
|
-
s.add_development_dependency("vagrant", "~>1.0.5")
|
31
30
|
end
|
data/lib/fezzik/host_task.rb
CHANGED
@@ -18,10 +18,10 @@ module Fezzik
|
|
18
18
|
|
19
19
|
if @roles.empty?
|
20
20
|
hosts = Fezzik.get(:domain).map { |domain| "#{Fezzik.get(:user)}@#{domain}" }
|
21
|
-
@@connection_pool ||= Weave.
|
21
|
+
@@connection_pool ||= Weave::ConnectionPool.new
|
22
22
|
@host_actions.each do |action|
|
23
23
|
begin
|
24
|
-
@@connection_pool.
|
24
|
+
@@connection_pool.execute_with(hosts, :args => [self, args], &action)
|
25
25
|
rescue Weave::Error => e
|
26
26
|
STDERR.puts "Error running command in HostTask '#{@name}':"
|
27
27
|
abort e.message
|
@@ -32,10 +32,10 @@ module Fezzik
|
|
32
32
|
Fezzik.with_role(role) do
|
33
33
|
hosts = Fezzik.get(:domain).map { |domain| "#{Fezzik.get(:user)}@#{domain}" }
|
34
34
|
@@role_connection_pools ||= {}
|
35
|
-
@@role_connection_pools[role] ||= Weave.
|
35
|
+
@@role_connection_pools[role] ||= Weave::ConnectionPool.new
|
36
36
|
@host_actions.each do |action|
|
37
37
|
begin
|
38
|
-
@@role_connection_pools[role].
|
38
|
+
@@role_connection_pools[role].execute_with(hosts, :args => [self, args], &action)
|
39
39
|
rescue Weave::Error => e
|
40
40
|
STDERR.puts "Error running command in HostTask '#{@name}' with role '#{role}':"
|
41
41
|
abort e.message
|
data/lib/fezzik/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fezzik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel MacDougall
|
@@ -10,44 +9,39 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rake
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: weave
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - '='
|
37
33
|
- !ruby/object:Gem::Version
|
38
|
-
version: 0.
|
34
|
+
version: 0.2.0
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - '='
|
45
40
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
41
|
+
version: 0.2.0
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: scope
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,27 +49,10 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: 0.2.3
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: vagrant
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ~>
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 1.0.5
|
71
|
-
type: :development
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.0.5
|
79
56
|
description: A light deployment system that gets out of your way
|
80
57
|
email: dmacdougall@gmail.com
|
81
58
|
executables:
|
@@ -111,31 +88,28 @@ files:
|
|
111
88
|
- test/integration_test_helper.rb
|
112
89
|
homepage: http://github.com/dmacdougall/fezzik
|
113
90
|
licenses: []
|
91
|
+
metadata: {}
|
114
92
|
post_install_message:
|
115
93
|
rdoc_options: []
|
116
94
|
require_paths:
|
117
95
|
- lib
|
118
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
97
|
requirements:
|
121
|
-
- -
|
98
|
+
- - '>='
|
122
99
|
- !ruby/object:Gem::Version
|
123
100
|
version: '0'
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
hash: 2107637702954244595
|
127
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
102
|
requirements:
|
130
|
-
- -
|
103
|
+
- - '>='
|
131
104
|
- !ruby/object:Gem::Version
|
132
105
|
version: '0'
|
133
106
|
requirements: []
|
134
107
|
rubyforge_project: fezzik
|
135
|
-
rubygems_version:
|
108
|
+
rubygems_version: 2.0.0
|
136
109
|
signing_key:
|
137
110
|
specification_version: 2
|
138
111
|
summary: Fezzik adds remote ssh capabilities to Rake. It simplifies running commands
|
139
112
|
on remote servers and can be used for anything from deploying code to installing
|
140
113
|
libraries remotely.
|
141
114
|
test_files: []
|
115
|
+
has_rdoc:
|