engineyard-serverside 2.0.0.rc1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/deploy.rb +3 -1
- data/lib/engineyard-serverside/deploy_hook.rb +8 -0
- data/lib/engineyard-serverside/lockfile_parser.rb +1 -1
- data/lib/engineyard-serverside/maintenance.rb +2 -2
- data/lib/engineyard-serverside/servers.rb +1 -1
- data/lib/engineyard-serverside/shell.rb +2 -24
- data/lib/engineyard-serverside/shell/command_result.rb +20 -0
- data/lib/engineyard-serverside/shell/yieldio.rb +14 -0
- data/lib/engineyard-serverside/task.rb +0 -5
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/custom_deploy_spec.rb +3 -3
- data/spec/deploy_hook_spec.rb +24 -0
- data/spec/lockfile_parser_spec.rb +2 -2
- metadata +102 -97
@@ -118,6 +118,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
118
118
|
|
119
119
|
def restart_with_maintenance_page
|
120
120
|
require_custom_tasks
|
121
|
+
load_ey_yml
|
121
122
|
enable_maintenance_page
|
122
123
|
restart
|
123
124
|
disable_maintenance_page
|
@@ -387,7 +388,7 @@ WRAP
|
|
387
388
|
# Rollback doesn't know about the repository location (nor
|
388
389
|
# should it need to), but it would like to use #short_log_message.
|
389
390
|
def strategy
|
390
|
-
ENV['GIT_SSH'] = ssh_executable
|
391
|
+
ENV['GIT_SSH'] = ssh_executable.to_s
|
391
392
|
@strategy ||= config.strategy_class.new(
|
392
393
|
shell,
|
393
394
|
:repository_cache => config.paths.repository_cache.to_s,
|
@@ -447,6 +448,7 @@ WRAP
|
|
447
448
|
rescue Exception
|
448
449
|
shell.status "Release #{config.paths.active_release} failed, saving release to #{config.paths.releases_failed}."
|
449
450
|
sudo "mv #{config.paths.active_release} #{config.paths.releases_failed}"
|
451
|
+
clean_release_directory(config.paths.releases_failed)
|
450
452
|
raise
|
451
453
|
end
|
452
454
|
|
@@ -87,10 +87,18 @@ Please fix this error before retrying.
|
|
87
87
|
shell.logged_system(Escape.shell_command(["sh", "-l", "-c", cmd])).success?
|
88
88
|
end
|
89
89
|
|
90
|
+
def run!(cmd)
|
91
|
+
run(cmd) or raise("run!: Command failed. #{cmd}")
|
92
|
+
end
|
93
|
+
|
90
94
|
def sudo(cmd)
|
91
95
|
shell.logged_system(Escape.shell_command(["sudo", "sh", "-l", "-c", cmd])).success?
|
92
96
|
end
|
93
97
|
|
98
|
+
def sudo!(cmd)
|
99
|
+
sudo(cmd) or raise("sudo!: Command failed. #{cmd}")
|
100
|
+
end
|
101
|
+
|
94
102
|
# convenience functions for running on certain instance types
|
95
103
|
def on_app_master(&blk) on_roles(%w[solo app_master], &blk) end
|
96
104
|
def on_app_servers(&blk) on_roles(%w[solo app_master app], &blk) end
|
@@ -17,7 +17,7 @@ module EY
|
|
17
17
|
def manually_enable
|
18
18
|
if paths.deployed?
|
19
19
|
enable
|
20
|
-
shell.
|
20
|
+
shell.status "Maintenance page enabled"
|
21
21
|
else
|
22
22
|
shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
|
23
23
|
false
|
@@ -27,7 +27,7 @@ module EY
|
|
27
27
|
def manually_disable
|
28
28
|
if paths.deployed?
|
29
29
|
disable
|
30
|
-
shell.
|
30
|
+
shell.status "Maintenance page disabled"
|
31
31
|
else
|
32
32
|
shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
|
33
33
|
false
|
@@ -51,7 +51,7 @@ module EY
|
|
51
51
|
# method and it doesn't yield and it's better than raising)
|
52
52
|
def roles(*select_roles, &block)
|
53
53
|
if block_given?
|
54
|
-
return yield
|
54
|
+
return yield(roles(*select_roles))
|
55
55
|
end
|
56
56
|
|
57
57
|
roles_set = Set.new select_roles.flatten.compact.map{|r| r.to_sym}
|
@@ -2,34 +2,12 @@ require 'logger'
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'systemu'
|
4
4
|
require 'engineyard-serverside/shell/formatter'
|
5
|
+
require 'engineyard-serverside/shell/command_result'
|
6
|
+
require 'engineyard-serverside/shell/yieldio'
|
5
7
|
|
6
8
|
module EY
|
7
9
|
module Serverside
|
8
10
|
class Shell
|
9
|
-
class YieldIO
|
10
|
-
def initialize(&block)
|
11
|
-
@block = block
|
12
|
-
end
|
13
|
-
def <<(str)
|
14
|
-
@block.call str
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class CommandResult < Struct.new(:command, :exitstatus, :output)
|
19
|
-
def success?
|
20
|
-
exitstatus.zero?
|
21
|
-
end
|
22
|
-
|
23
|
-
def inspect
|
24
|
-
<<-EOM
|
25
|
-
$ #{command}
|
26
|
-
#{output}
|
27
|
-
|
28
|
-
# => #{exitstatus}
|
29
|
-
EOM
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
11
|
attr_reader :logger
|
34
12
|
|
35
13
|
def initialize(options)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EY
|
2
|
+
module Serverside
|
3
|
+
class Shell
|
4
|
+
class CommandResult < Struct.new(:command, :exitstatus, :output)
|
5
|
+
def success?
|
6
|
+
exitstatus.zero?
|
7
|
+
end
|
8
|
+
|
9
|
+
def inspect
|
10
|
+
<<-EOM
|
11
|
+
$ #{command}
|
12
|
+
#{output}
|
13
|
+
|
14
|
+
($?: #{exitstatus})
|
15
|
+
EOM
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -28,9 +28,6 @@ module EY
|
|
28
28
|
if deploy_file
|
29
29
|
shell.status "Loading deployment task overrides from #{deploy_file}"
|
30
30
|
instance_eval(deploy_file.read)
|
31
|
-
true
|
32
|
-
else
|
33
|
-
false
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
@@ -45,8 +42,6 @@ module EY
|
|
45
42
|
shell.status "Loading deploy configuration in #{ey_yml}"
|
46
43
|
data = YAML.load_file(ey_yml.to_s)
|
47
44
|
config.load_ey_yml_data(data, shell)
|
48
|
-
else
|
49
|
-
false
|
50
45
|
end
|
51
46
|
rescue Exception
|
52
47
|
shell.error "Error loading YAML in #{ey_yml}"
|
data/spec/custom_deploy_spec.rb
CHANGED
@@ -90,13 +90,13 @@ describe "the EY::Serverside::Deploy API" do
|
|
90
90
|
|
91
91
|
it "requires 'eydeploy.rb' and adds any defined methods to the deploy" do
|
92
92
|
write_eydeploy 'eydeploy.rb'
|
93
|
-
@deploy.require_custom_tasks
|
93
|
+
@deploy.require_custom_tasks
|
94
94
|
@deploy.got_new_methods.should == 'from the file on disk'
|
95
95
|
end
|
96
96
|
|
97
97
|
it "falls back to 'config/eydeploy.rb'" do
|
98
98
|
write_eydeploy 'config/eydeploy.rb'
|
99
|
-
@deploy.require_custom_tasks
|
99
|
+
@deploy.require_custom_tasks
|
100
100
|
@deploy.got_new_methods.should == 'from the file on disk'
|
101
101
|
end
|
102
102
|
|
@@ -108,7 +108,7 @@ describe "the EY::Serverside::Deploy API" do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
deploy = TestDeploySuper.new(test_servers, @config, test_shell)
|
111
|
-
deploy.require_custom_tasks
|
111
|
+
deploy.require_custom_tasks
|
112
112
|
deploy.value.should == "base + derived"
|
113
113
|
end
|
114
114
|
end
|
data/spec/deploy_hook_spec.rb
CHANGED
@@ -63,6 +63,16 @@ describe "deploy hooks" do
|
|
63
63
|
deploy_hook.eval_hook('run("true")').should be_true
|
64
64
|
deploy_hook.eval_hook('run("false")').should be_false
|
65
65
|
end
|
66
|
+
|
67
|
+
it "raises when the bang method alternative is used" do
|
68
|
+
lambda {
|
69
|
+
deploy_hook.eval_hook('run!("false")')
|
70
|
+
}.should raise_error(RuntimeError)
|
71
|
+
out = read_output
|
72
|
+
out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
|
73
|
+
out.should =~ %r|RuntimeError: .*run!.*Command failed. false|
|
74
|
+
out.should =~ %r|Please fix this error before retrying.|
|
75
|
+
end
|
66
76
|
end
|
67
77
|
|
68
78
|
context "#sudo" do
|
@@ -77,6 +87,20 @@ describe "deploy hooks" do
|
|
77
87
|
hook.callback_context.shell.should_receive(:logged_system).with(cmd).and_return(result)
|
78
88
|
hook.eval_hook('sudo("do it as root") || raise("failed")')
|
79
89
|
end
|
90
|
+
|
91
|
+
it "raises when the bang method alternative is used" do
|
92
|
+
hook = deploy_hook
|
93
|
+
cmd = "sudo sh -l -c false"
|
94
|
+
result = EY::Serverside::Shell::CommandResult.new(cmd, 1, "fail")
|
95
|
+
hook.callback_context.shell.should_receive(:logged_system).with(cmd).and_return(result)
|
96
|
+
lambda {
|
97
|
+
hook.eval_hook('sudo!("false")')
|
98
|
+
}.should raise_error(RuntimeError)
|
99
|
+
out = read_output
|
100
|
+
out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
|
101
|
+
out.should =~ %r|RuntimeError: .*sudo!.*Command failed. false|
|
102
|
+
out.should =~ %r|Please fix this error before retrying.|
|
103
|
+
end
|
80
104
|
end
|
81
105
|
|
82
106
|
context "capistrano-ish methods" do
|
@@ -19,8 +19,8 @@ describe "the bundler version retrieved from the lockfile" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "has a default version" do
|
22
|
-
EY::Serverside::LockfileParser.default_version.should == "1.1.
|
23
|
-
EY::Serverside::LockfileParser::DEFAULT.should == "1.1.
|
22
|
+
EY::Serverside::LockfileParser.default_version.should == "1.1.5"
|
23
|
+
EY::Serverside::LockfileParser::DEFAULT.should == "1.1.5"
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns the default version for a 1.0 lockfile without a bundler dependency" do
|
metadata
CHANGED
@@ -1,108 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
- 1
|
12
|
-
version: 2.0.0.rc1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- EY Cloud Team
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: rspec
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
26
17
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 31
|
31
|
-
segments:
|
32
|
-
- 1
|
33
|
-
- 3
|
34
|
-
- 2
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
35
21
|
version: 1.3.2
|
36
22
|
type: :development
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rake
|
40
23
|
prerelease: false
|
41
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
42
33
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 11
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 9
|
50
|
-
- 2
|
51
|
-
- 2
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
52
37
|
version: 0.9.2.2
|
53
38
|
type: :development
|
54
|
-
version_requirements: *id002
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rdoc
|
57
39
|
prerelease: false
|
58
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
41
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
67
54
|
type: :development
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: timecop
|
71
55
|
prerelease: false
|
72
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: timecop
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
81
70
|
type: :development
|
82
|
-
|
83
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
84
79
|
name: simplecov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
85
87
|
prerelease: false
|
86
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: engineyard-cloud-client
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
87
97
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
version: "0"
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.0.5
|
95
102
|
type: :development
|
96
|
-
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.5
|
97
110
|
description:
|
98
111
|
email: cloud@engineyard.com
|
99
|
-
executables:
|
112
|
+
executables:
|
100
113
|
- engineyard-serverside
|
101
114
|
extensions: []
|
102
|
-
|
103
115
|
extra_rdoc_files: []
|
104
|
-
|
105
|
-
files:
|
116
|
+
files:
|
106
117
|
- bin/engineyard-serverside
|
107
118
|
- lib/engineyard-serverside/cli.rb
|
108
119
|
- lib/engineyard-serverside/cli_helpers.rb
|
@@ -120,8 +131,10 @@ files:
|
|
120
131
|
- lib/engineyard-serverside/rails_asset_support.rb
|
121
132
|
- lib/engineyard-serverside/server.rb
|
122
133
|
- lib/engineyard-serverside/servers.rb
|
134
|
+
- lib/engineyard-serverside/shell/command_result.rb
|
123
135
|
- lib/engineyard-serverside/shell/formatter.rb
|
124
136
|
- lib/engineyard-serverside/shell/helpers.rb
|
137
|
+
- lib/engineyard-serverside/shell/yieldio.rb
|
125
138
|
- lib/engineyard-serverside/shell.rb
|
126
139
|
- lib/engineyard-serverside/strategies/git.rb
|
127
140
|
- lib/engineyard-serverside/task.rb
|
@@ -451,40 +464,32 @@ files:
|
|
451
464
|
- spec/support/integration.rb
|
452
465
|
homepage: http://github.com/engineyard/engineyard-serverside
|
453
466
|
licenses: []
|
454
|
-
|
455
467
|
post_install_message:
|
456
468
|
rdoc_options: []
|
457
|
-
|
458
|
-
require_paths:
|
469
|
+
require_paths:
|
459
470
|
- lib
|
460
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
471
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
461
472
|
none: false
|
462
|
-
requirements:
|
463
|
-
- -
|
464
|
-
- !ruby/object:Gem::Version
|
465
|
-
|
466
|
-
segments:
|
473
|
+
requirements:
|
474
|
+
- - ! '>='
|
475
|
+
- !ruby/object:Gem::Version
|
476
|
+
version: '0'
|
477
|
+
segments:
|
467
478
|
- 0
|
468
|
-
|
469
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
479
|
+
hash: -2659746554228302927
|
480
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
470
481
|
none: false
|
471
|
-
requirements:
|
472
|
-
- -
|
473
|
-
- !ruby/object:Gem::Version
|
474
|
-
hash: 23
|
475
|
-
segments:
|
476
|
-
- 1
|
477
|
-
- 3
|
478
|
-
- 6
|
482
|
+
requirements:
|
483
|
+
- - ! '>='
|
484
|
+
- !ruby/object:Gem::Version
|
479
485
|
version: 1.3.6
|
480
486
|
requirements: []
|
481
|
-
|
482
487
|
rubyforge_project:
|
483
488
|
rubygems_version: 1.8.24
|
484
489
|
signing_key:
|
485
490
|
specification_version: 3
|
486
491
|
summary: A gem that deploys ruby applications on EY Cloud instances
|
487
|
-
test_files:
|
492
|
+
test_files:
|
488
493
|
- spec/basic_deploy_spec.rb
|
489
494
|
- spec/bundler_deploy_spec.rb
|
490
495
|
- spec/configuration_spec.rb
|