engineyard-serverside 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -158,6 +158,41 @@ module EY
|
|
158
158
|
EY::Deploy.new(config).cached_deploy
|
159
159
|
end
|
160
160
|
|
161
|
+
method_option :app, :type => :string,
|
162
|
+
:required => true,
|
163
|
+
:desc => "Application to deploy",
|
164
|
+
:aliases => ["-a"]
|
165
|
+
|
166
|
+
method_option :stack, :type => :string,
|
167
|
+
:desc => "Web stack (so we can restart it correctly)"
|
168
|
+
|
169
|
+
method_option :instances, :type => :array,
|
170
|
+
:desc => "Hostnames of instances to deploy to, e.g. --instances localhost app1 app2"
|
171
|
+
|
172
|
+
method_option :instance_roles, :type => :hash,
|
173
|
+
:default => {},
|
174
|
+
:desc => "Roles of instances, keyed on hostname, comma-separated. e.g. instance1:app_master,etc instance2:db,memcached ..."
|
175
|
+
|
176
|
+
method_option :instance_names, :type => :hash,
|
177
|
+
:default => {},
|
178
|
+
:desc => "Instance names, keyed on hostname. e.g. instance1:name1 instance2:name2"
|
179
|
+
|
180
|
+
method_option :verbose, :type => :boolean,
|
181
|
+
:default => false,
|
182
|
+
:desc => "Verbose output",
|
183
|
+
:aliases => ["-v"]
|
184
|
+
desc "restart", "Restart app servers, conditionally enabling maintenance page"
|
185
|
+
def restart
|
186
|
+
EY::LoggedOutput.verbose = options[:verbose]
|
187
|
+
EY::LoggedOutput.logfile = File.join(ENV['HOME'], "#{options[:app]}-restart.log")
|
188
|
+
|
189
|
+
config = EY::Deploy::Configuration.new(options)
|
190
|
+
EY::Server.load_all_from_array(assemble_instance_hashes(config))
|
191
|
+
|
192
|
+
invoke :propagate
|
193
|
+
|
194
|
+
EY::Deploy.new(config).restart_with_maintenance_page
|
195
|
+
end
|
161
196
|
|
162
197
|
desc "install_bundler [VERSION]", "Make sure VERSION of bundler is installed (in system ruby)"
|
163
198
|
def install_bundler(version)
|
@@ -44,6 +44,13 @@ module EY
|
|
44
44
|
raise
|
45
45
|
end
|
46
46
|
|
47
|
+
def restart_with_maintenance_page
|
48
|
+
require_custom_tasks
|
49
|
+
conditionally_enable_maintenance_page
|
50
|
+
restart
|
51
|
+
disable_maintenance_page
|
52
|
+
end
|
53
|
+
|
47
54
|
def enable_maintenance_page
|
48
55
|
maintenance_page_candidates = [
|
49
56
|
"public/maintenance.html.custom",
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe "EY::Deploy#restart_with_maintenance_page" do
|
4
|
+
|
5
|
+
class TestRestartWithMaintenancePage < EY::Deploy
|
6
|
+
attr_reader :call_order
|
7
|
+
def initialize(*a)
|
8
|
+
super
|
9
|
+
@call_order = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def require_custom_tasks() @call_order << 'require_custom_tasks' end
|
13
|
+
def restart() @call_order << 'restart' end
|
14
|
+
def conditionally_enable_maintenance_page() @call_order << 'conditionally_enable_maintenance_page' end
|
15
|
+
def disable_maintenance_page() @call_order << 'disable_maintenance_page' end
|
16
|
+
end
|
17
|
+
|
18
|
+
it "puts up the maintenance page if necessary, restarts, and takes down the maintenance page" do
|
19
|
+
deployer = TestRestartWithMaintenancePage.new(EY::Deploy::Configuration.new)
|
20
|
+
deployer.restart_with_maintenance_page
|
21
|
+
deployer.call_order.should == %w(
|
22
|
+
require_custom_tasks
|
23
|
+
conditionally_enable_maintenance_page
|
24
|
+
restart
|
25
|
+
disable_maintenance_page
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 3
|
10
|
+
version: 1.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- EY Cloud Team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-16 00:00:00 -07:00
|
19
19
|
default_executable: engineyard-serverside
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -235,7 +235,6 @@ files:
|
|
235
235
|
- LICENSE
|
236
236
|
- spec/custom_deploy_spec.rb
|
237
237
|
- spec/deploy_hook_spec.rb
|
238
|
-
- spec/fixtures/gitrepo/bar
|
239
238
|
- spec/fixtures/gitrepo/foo
|
240
239
|
- spec/fixtures/gitrepo.tar.gz
|
241
240
|
- spec/fixtures/invalid_hook.rb
|
@@ -243,6 +242,7 @@ files:
|
|
243
242
|
- spec/git_strategy_spec.rb
|
244
243
|
- spec/lockfile_parser_spec.rb
|
245
244
|
- spec/real_deploy_spec.rb
|
245
|
+
- spec/restart_spec.rb
|
246
246
|
- spec/server_spec.rb
|
247
247
|
- spec/spec_helper.rb
|
248
248
|
- spec/support/lockfiles/0.9-no-bundler
|
@@ -287,7 +287,6 @@ summary: A gem that deploys ruby applications on EY Cloud instances
|
|
287
287
|
test_files:
|
288
288
|
- spec/custom_deploy_spec.rb
|
289
289
|
- spec/deploy_hook_spec.rb
|
290
|
-
- spec/fixtures/gitrepo/bar
|
291
290
|
- spec/fixtures/gitrepo/foo
|
292
291
|
- spec/fixtures/gitrepo.tar.gz
|
293
292
|
- spec/fixtures/invalid_hook.rb
|
@@ -295,6 +294,7 @@ test_files:
|
|
295
294
|
- spec/git_strategy_spec.rb
|
296
295
|
- spec/lockfile_parser_spec.rb
|
297
296
|
- spec/real_deploy_spec.rb
|
297
|
+
- spec/restart_spec.rb
|
298
298
|
- spec/server_spec.rb
|
299
299
|
- spec/spec_helper.rb
|
300
300
|
- spec/support/lockfiles/0.9-no-bundler
|
data/spec/fixtures/gitrepo/bar
DELETED
File without changes
|