engineyard-serverside 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/configuration.rb +9 -2
- data/lib/engineyard-serverside/deploy.rb +19 -13
- data/lib/engineyard-serverside/lockfile_parser.rb +1 -1
- data/lib/engineyard-serverside/task.rb +1 -1
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/real_deploy_spec.rb +146 -0
- metadata +6 -5
- data/lib/engineyard-serverside/version_flymake.rb +0 -3
@@ -73,9 +73,12 @@ module EY
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def user
|
76
|
-
ENV['USER']
|
76
|
+
configuration['user'] || ENV['USER']
|
77
|
+
end
|
78
|
+
|
79
|
+
def group
|
80
|
+
configuration['group'] || user
|
77
81
|
end
|
78
|
-
alias :group :user
|
79
82
|
|
80
83
|
def role
|
81
84
|
node['instance_role']
|
@@ -106,6 +109,10 @@ module EY
|
|
106
109
|
Dir.glob("#{release_dir}/*").sort
|
107
110
|
end
|
108
111
|
|
112
|
+
def binstubs_path
|
113
|
+
release_path + '/ey_bundler_binstubs'
|
114
|
+
end
|
115
|
+
|
109
116
|
def framework_envs
|
110
117
|
"RAILS_ENV=#{environment} RACK_ENV=#{environment} MERB_ENV=#{environment}"
|
111
118
|
end
|
@@ -62,8 +62,10 @@ module EY
|
|
62
62
|
|
63
63
|
@maintenance_up = true
|
64
64
|
roles :app_master, :app, :solo do
|
65
|
-
|
66
|
-
|
65
|
+
maint_page_dir = File.join(c.shared_path, "system")
|
66
|
+
visible_maint_page = File.join(maint_page_dir, "maintenance.html")
|
67
|
+
run Escape.shell_command(['mkdir', '-p', maint_page_dir])
|
68
|
+
run Escape.shell_command(['cp', maintenance_file, visible_maint_page])
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
@@ -126,7 +128,7 @@ module EY
|
|
126
128
|
get_bundler_installer(lockfile)
|
127
129
|
else
|
128
130
|
warn_about_missing_lockfile
|
129
|
-
|
131
|
+
bundler_09_installer(default_09_bundler)
|
130
132
|
end
|
131
133
|
|
132
134
|
sudo "#{$0} _#{VERSION}_ install_bundler #{bundler_installer.version}"
|
@@ -167,7 +169,7 @@ module EY
|
|
167
169
|
return unless c.migrate?
|
168
170
|
@migrations_reached = true
|
169
171
|
roles :app_master, :solo do
|
170
|
-
cmd = "cd #{c.release_path} && #{c.framework_envs} #{c.migration_command}"
|
172
|
+
cmd = "cd #{c.release_path} && PATH=#{c.binstubs_path}:$PATH #{c.framework_envs} #{c.migration_command}"
|
171
173
|
info "~> Migrating: #{cmd}"
|
172
174
|
run(cmd)
|
173
175
|
end
|
@@ -292,22 +294,26 @@ module EY
|
|
292
294
|
parser = LockfileParser.new(File.read(lockfile))
|
293
295
|
case parser.lockfile_version
|
294
296
|
when :bundler09
|
295
|
-
|
296
|
-
parser.bundler_version || default_09_bundler,
|
297
|
-
"--without=development --without=test")
|
297
|
+
bundler_09_installer(parser.bundler_version || default_09_bundler)
|
298
298
|
when :bundler10
|
299
|
-
|
300
|
-
parser.bundler_version || default_10_bundler,
|
301
|
-
"--deployment --path #{c.shared_path}/bundled_gems --without development test"
|
302
|
-
)
|
299
|
+
bundler_10_installer(parser.bundler_version || default_10_bundler)
|
303
300
|
else
|
304
301
|
raise "Unknown lockfile version #{parser.lockfile_version}"
|
305
302
|
end
|
306
303
|
end
|
307
304
|
public :get_bundler_installer
|
308
305
|
|
309
|
-
def
|
310
|
-
|
306
|
+
def bundler_09_installer(version)
|
307
|
+
BundleInstaller.new(version, '--without=development --without=test')
|
308
|
+
end
|
309
|
+
|
310
|
+
def bundler_10_installer(version)
|
311
|
+
BundleInstaller.new(version,
|
312
|
+
"--deployment --path #{c.shared_path}/bundled_gems --binstubs #{c.binstubs_path} --without development test")
|
313
|
+
end
|
314
|
+
|
315
|
+
def default_09_bundler() "0.9.26" end
|
316
|
+
def default_10_bundler() "1.0.0" end
|
311
317
|
|
312
318
|
end # DeployBase
|
313
319
|
|
@@ -56,7 +56,7 @@ module EY
|
|
56
56
|
# MRI's truthiness check is an internal C thing that does not call
|
57
57
|
# any methods... so Dataflow cannot proxy it & we must "x == true"
|
58
58
|
# Rubinius, wherefore art thou!?
|
59
|
-
results.all?{|x| x == true } || raise(EY::RemoteFailure)
|
59
|
+
results.all?{|x| x == true } || raise(EY::RemoteFailure.new(cmd))
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
module EY::Strategies::IntegrationSpec
|
4
|
+
module Helpers
|
5
|
+
|
6
|
+
def update_repository_cache
|
7
|
+
cached_copy = File.join(c.shared_path, 'cached-copy')
|
8
|
+
|
9
|
+
FileUtils.mkdir_p(cached_copy)
|
10
|
+
Dir.chdir(cached_copy) do
|
11
|
+
`echo "this is my file; there are many like it, but this one is mine" > file`
|
12
|
+
File.open('Gemfile', 'w') do |f|
|
13
|
+
f.write <<-EOF
|
14
|
+
source :gemcutter
|
15
|
+
|
16
|
+
gem "bundler", "~> 1.0.0.rc.6"
|
17
|
+
gem "rake"
|
18
|
+
EOF
|
19
|
+
end
|
20
|
+
|
21
|
+
File.open("Gemfile.lock", "w") do |f|
|
22
|
+
f.write <<-EOF
|
23
|
+
GEM
|
24
|
+
remote: http://rubygems.org/
|
25
|
+
specs:
|
26
|
+
rake (0.8.7)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
bundler (~> 1.0.0.rc.6)
|
33
|
+
rake
|
34
|
+
EOF
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_revision_file_command
|
40
|
+
"echo 'revision, yo' > #{c.release_path}/REVISION"
|
41
|
+
end
|
42
|
+
|
43
|
+
def short_log_message(revision)
|
44
|
+
"FONDLED THE CODE"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "deploying an application" do
|
51
|
+
class FullTestDeploy < EY::Deploy
|
52
|
+
attr_reader :infos, :debugs, :commands
|
53
|
+
|
54
|
+
def initialize(*)
|
55
|
+
super
|
56
|
+
@infos = []
|
57
|
+
@debugs = []
|
58
|
+
@commands = []
|
59
|
+
end
|
60
|
+
|
61
|
+
# stfu
|
62
|
+
def info(msg)
|
63
|
+
@infos << msg
|
64
|
+
end
|
65
|
+
|
66
|
+
# no really, stfu
|
67
|
+
def debug(msg)
|
68
|
+
@debugs << msg
|
69
|
+
end
|
70
|
+
|
71
|
+
# passwordless sudo is neither guaranteed nor desired
|
72
|
+
def sudo(cmd)
|
73
|
+
run(cmd)
|
74
|
+
end
|
75
|
+
|
76
|
+
def run(cmd)
|
77
|
+
# $stderr.puts(cmd)
|
78
|
+
@commands << cmd
|
79
|
+
super
|
80
|
+
end
|
81
|
+
|
82
|
+
# we're probably running this spec under bundler, but a real
|
83
|
+
# deploy does not
|
84
|
+
def bundle
|
85
|
+
my_env = ENV.to_hash
|
86
|
+
|
87
|
+
ENV.delete("BUNDLE_GEMFILE")
|
88
|
+
ENV.delete("BUNDLE_BIN_PATH")
|
89
|
+
|
90
|
+
result = super
|
91
|
+
|
92
|
+
ENV.replace(my_env)
|
93
|
+
result
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_bundler_installer(lockfile)
|
97
|
+
installer = super
|
98
|
+
installer.options << ' --quiet' # stfu already!
|
99
|
+
installer
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
before(:all) do
|
105
|
+
@deploy_dir = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
|
106
|
+
|
107
|
+
# set up EY::Server like we're on a solo
|
108
|
+
EY::Server.all = [{:hostname => 'dontcare', :role => 'solo'}]
|
109
|
+
|
110
|
+
# run a deploy
|
111
|
+
config = EY::Deploy::Configuration.new({
|
112
|
+
"strategy" => "IntegrationSpec",
|
113
|
+
"deploy_to" => @deploy_dir,
|
114
|
+
"group" => `id -gn`.strip,
|
115
|
+
"stack" => 'nginx_passenger',
|
116
|
+
"migrate" => "ruby -e 'puts ENV[\"PATH\"]' > #{@deploy_dir}/path-when-migrating"
|
117
|
+
})
|
118
|
+
|
119
|
+
$0 = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
|
120
|
+
@deployer = FullTestDeploy.new(config)
|
121
|
+
@deployer.deploy
|
122
|
+
end
|
123
|
+
|
124
|
+
it "creates a REVISION file" do
|
125
|
+
File.exist?(File.join(@deploy_dir, 'current', 'REVISION')).should be_true
|
126
|
+
end
|
127
|
+
|
128
|
+
it "restarts the app servers" do
|
129
|
+
File.exist?(File.join(@deploy_dir, 'current', 'tmp', 'restart.txt')).should be_true
|
130
|
+
end
|
131
|
+
|
132
|
+
it "runs 'bundle install' with --deployment" do
|
133
|
+
bundle_install_cmd = @deployer.commands.grep(/bundle _\S+_ install/).first
|
134
|
+
bundle_install_cmd.should_not be_nil
|
135
|
+
bundle_install_cmd.should include('--deployment')
|
136
|
+
end
|
137
|
+
|
138
|
+
it "creates binstubs somewhere out of the way" do
|
139
|
+
File.exist?(File.join(@deploy_dir, 'current', 'ey_bundler_binstubs', 'rake')).should be_true
|
140
|
+
end
|
141
|
+
|
142
|
+
it "has the binstubs in the path when migrating" do
|
143
|
+
File.read(File.join(@deploy_dir, 'path-when-migrating')).should include('ey_bundler_binstubs')
|
144
|
+
end
|
145
|
+
|
146
|
+
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: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 2
|
10
|
+
version: 1.2.2
|
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-08-
|
18
|
+
date: 2010-08-31 00:00:00 -07:00
|
19
19
|
default_executable: engineyard-serverside
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -41,7 +41,6 @@ files:
|
|
41
41
|
- lib/engineyard-serverside/strategies/git.rb
|
42
42
|
- lib/engineyard-serverside/task.rb
|
43
43
|
- lib/engineyard-serverside/version.rb
|
44
|
-
- lib/engineyard-serverside/version_flymake.rb
|
45
44
|
- lib/engineyard-serverside.rb
|
46
45
|
- lib/vendor/dataflow/dataflow/actor.rb
|
47
46
|
- lib/vendor/dataflow/dataflow/equality.rb
|
@@ -242,6 +241,7 @@ files:
|
|
242
241
|
- spec/fixtures/valid_hook.rb
|
243
242
|
- spec/git_strategy_spec.rb
|
244
243
|
- spec/lockfile_parser_spec.rb
|
244
|
+
- spec/real_deploy_spec.rb
|
245
245
|
- spec/spec_helper.rb
|
246
246
|
- spec/support/lockfiles/0.9-no-bundler
|
247
247
|
- spec/support/lockfiles/0.9-with-bundler
|
@@ -291,6 +291,7 @@ test_files:
|
|
291
291
|
- spec/fixtures/valid_hook.rb
|
292
292
|
- spec/git_strategy_spec.rb
|
293
293
|
- spec/lockfile_parser_spec.rb
|
294
|
+
- spec/real_deploy_spec.rb
|
294
295
|
- spec/spec_helper.rb
|
295
296
|
- spec/support/lockfiles/0.9-no-bundler
|
296
297
|
- spec/support/lockfiles/0.9-with-bundler
|