engineyard-serverside 2.0.0.pre5 → 2.0.0.rc1
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.
- data/lib/engineyard-serverside/cli.rb +1 -1
- data/lib/engineyard-serverside/configuration.rb +9 -0
- data/lib/engineyard-serverside/deploy.rb +73 -77
- data/lib/engineyard-serverside/deploy_hook.rb +6 -6
- data/lib/engineyard-serverside/deprecation.rb +1 -1
- data/lib/engineyard-serverside/maintenance.rb +2 -0
- data/lib/engineyard-serverside/paths.rb +52 -25
- data/lib/engineyard-serverside/rails_asset_support.rb +40 -34
- data/lib/engineyard-serverside/task.rb +12 -7
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/custom_deploy_spec.rb +1 -1
- data/spec/deploy_hook_spec.rb +2 -2
- data/spec/ey_yml_customized_deploy_spec.rb +3 -2
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +2 -0
- data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +1 -1
- data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +1 -1
- data/spec/git_strategy_spec.rb +1 -1
- data/spec/services_deploy_spec.rb +5 -5
- data/spec/shell_spec.rb +1 -1
- data/spec/spec_helper.rb +20 -2
- data/spec/sqlite3_deploy_spec.rb +2 -2
- data/spec/support/integration.rb +1 -9
- metadata +7 -7
- data/spec/fixtures/repos/assets_in_hook/deploy/before_migrate.rb +0 -1
@@ -162,7 +162,7 @@ module EY
|
|
162
162
|
shell.status "Installing engineyard-serverside on #{server.hostname}"
|
163
163
|
|
164
164
|
shell.logged_system(Escape.shell_command([
|
165
|
-
'scp', '-i',
|
165
|
+
'scp', '-i', config.paths.internal_key.to_s,
|
166
166
|
"-o", "StrictHostKeyChecking=no",
|
167
167
|
local_gem_file,
|
168
168
|
"#{config.user}@#{server.hostname}:#{remote_gem_file}",
|
@@ -178,6 +178,15 @@ module EY
|
|
178
178
|
"uname -m"
|
179
179
|
end
|
180
180
|
|
181
|
+
def active_revision
|
182
|
+
paths.active_revision.read.strip
|
183
|
+
end
|
184
|
+
|
185
|
+
def latest_revision
|
186
|
+
paths.latest_revision.read.strip
|
187
|
+
end
|
188
|
+
alias revision latest_revision
|
189
|
+
|
181
190
|
def migrate?
|
182
191
|
!!migration_command
|
183
192
|
end
|
@@ -34,9 +34,9 @@ module EY
|
|
34
34
|
check_for_ey_config
|
35
35
|
symlink_configs
|
36
36
|
setup_sqlite3_if_necessary
|
37
|
+
run_with_callbacks(:compile_assets) # defined in RailsAssetSupport
|
37
38
|
enable_maintenance_page
|
38
39
|
run_with_callbacks(:migrate)
|
39
|
-
run_with_callbacks(:compile_assets) # defined in RailsAssetSupport
|
40
40
|
callback(:before_symlink)
|
41
41
|
# We don't use run_with_callbacks for symlink because we need
|
42
42
|
# to clean up manually if it fails.
|
@@ -60,7 +60,7 @@ module EY
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def create_revision_file_command
|
63
|
-
strategy.create_revision_file_command(config.
|
63
|
+
strategy.create_revision_file_command(config.paths.active_release)
|
64
64
|
end
|
65
65
|
|
66
66
|
def short_log_message(revision)
|
@@ -68,7 +68,7 @@ module EY
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def parse_configured_services
|
71
|
-
result = YAML.load_file "#{
|
71
|
+
result = YAML.load_file "#{config.paths.shared_config}/ey_services_config_deploy.yml"
|
72
72
|
return {} unless result.is_a?(Hash)
|
73
73
|
result
|
74
74
|
rescue
|
@@ -141,7 +141,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
141
141
|
def push_code
|
142
142
|
shell.status "Pushing code to all servers"
|
143
143
|
commands = servers.remote.map do |server|
|
144
|
-
cmd = server.sync_directory_command(config.repository_cache)
|
144
|
+
cmd = server.sync_directory_command(config.paths.repository_cache)
|
145
145
|
proc { shell.logged_system(cmd) }
|
146
146
|
end
|
147
147
|
futures = EY::Serverside::Future.call(commands)
|
@@ -159,7 +159,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def restart_command
|
162
|
-
%{LANG="en_US.UTF-8" /engineyard/bin/app_#{
|
162
|
+
%{LANG="en_US.UTF-8" /engineyard/bin/app_#{config.app} deploy}
|
163
163
|
end
|
164
164
|
|
165
165
|
# GIT_SSH needs to be defined in the environment for customers with private bundler repos in their Gemfile.
|
@@ -173,7 +173,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
173
173
|
roles :app_master, :app, :solo, :util do
|
174
174
|
run(generate_ssh_wrapper)
|
175
175
|
end
|
176
|
-
|
176
|
+
config.paths.ssh_wrapper
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -183,22 +183,18 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
183
183
|
# Learned this at http://lists.mindrot.org/pipermail/openssh-unix-dev/2009-February/027271.html
|
184
184
|
# (Thanks Jim L.)
|
185
185
|
def generate_ssh_wrapper
|
186
|
-
path =
|
186
|
+
path = config.paths.ssh_wrapper
|
187
187
|
<<-SCRIPT
|
188
|
-
mkdir -p #{
|
188
|
+
mkdir -p #{path.dirname}
|
189
189
|
[[ -x #{path} ]] || cat > #{path} <<'SSH'
|
190
190
|
#!/bin/sh
|
191
191
|
unset SSH_AUTH_SOCK
|
192
|
-
ssh -o CheckHostIP=no -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o LogLevel=INFO -o IdentityFile=#{
|
192
|
+
ssh -o CheckHostIP=no -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o LogLevel=INFO -o IdentityFile=#{config.paths.deploy_key} -o IdentitiesOnly=yes $*
|
193
193
|
SSH
|
194
194
|
chmod 0700 #{path}
|
195
195
|
SCRIPT
|
196
196
|
end
|
197
197
|
|
198
|
-
def ssh_wrapper_path
|
199
|
-
"#{c.paths.shared_config}/#{c.app}-ssh-wrapper"
|
200
|
-
end
|
201
|
-
|
202
198
|
# task
|
203
199
|
def bundle
|
204
200
|
roles :app_master, :app, :solo, :util do
|
@@ -209,8 +205,8 @@ chmod 0700 #{path}
|
|
209
205
|
|
210
206
|
# task
|
211
207
|
def cleanup_old_releases
|
212
|
-
clean_release_directory(
|
213
|
-
clean_release_directory(
|
208
|
+
clean_release_directory(config.paths.releases)
|
209
|
+
clean_release_directory(config.paths.releases_failed)
|
214
210
|
end
|
215
211
|
|
216
212
|
# Remove all but the most-recent +count+ releases from the specified
|
@@ -227,10 +223,10 @@ chmod 0700 #{path}
|
|
227
223
|
|
228
224
|
# task
|
229
225
|
def rollback
|
230
|
-
if
|
226
|
+
if config.rollback_paths!
|
231
227
|
begin
|
232
|
-
rolled_back_release =
|
233
|
-
shell.status "Rolling back to previous release: #{short_log_message(
|
228
|
+
rolled_back_release = config.paths.latest_release
|
229
|
+
shell.status "Rolling back to previous release: #{short_log_message(config.active_revision)}"
|
234
230
|
run_with_callbacks(:symlink)
|
235
231
|
sudo "rm -rf #{rolled_back_release}"
|
236
232
|
bundle
|
@@ -252,9 +248,9 @@ chmod 0700 #{path}
|
|
252
248
|
|
253
249
|
# task
|
254
250
|
def migrate
|
255
|
-
return unless
|
251
|
+
return unless config.migrate?
|
256
252
|
@migrations_reached = true
|
257
|
-
cmd = "cd #{
|
253
|
+
cmd = "cd #{config.paths.active_release} && PATH=#{config.paths.binstubs}:$PATH #{config.framework_envs} #{config.migration_command}"
|
258
254
|
roles :app_master, :solo do
|
259
255
|
shell.status "Migrating: #{cmd}"
|
260
256
|
run(cmd)
|
@@ -263,12 +259,12 @@ chmod 0700 #{path}
|
|
263
259
|
|
264
260
|
# task
|
265
261
|
def copy_repository_cache
|
266
|
-
shell.status "Copying to #{
|
267
|
-
exclusions = Array(
|
268
|
-
run("mkdir -p #{
|
262
|
+
shell.status "Copying to #{config.paths.active_release}"
|
263
|
+
exclusions = Array(config.copy_exclude).map { |e| %|--exclude="#{e}"| }.join(' ')
|
264
|
+
run("mkdir -p #{config.paths.active_release} #{config.paths.releases_failed} #{config.paths.shared_config} && rsync -aq #{exclusions} #{config.paths.repository_cache}/ #{config.paths.active_release}")
|
269
265
|
|
270
266
|
shell.status "Ensuring proper ownership."
|
271
|
-
sudo("chown -R #{
|
267
|
+
sudo("chown -R #{config.user}:#{config.group} #{config.paths.active_release} #{config.paths.releases_failed}")
|
272
268
|
end
|
273
269
|
|
274
270
|
def create_revision_file
|
@@ -306,78 +302,78 @@ Deploy again if your services configuration appears incomplete or out of date.
|
|
306
302
|
def setup_sqlite3_if_necessary
|
307
303
|
if gemfile? && lockfile && lockfile.uses_sqlite3?
|
308
304
|
[
|
309
|
-
["Create databases directory if needed", "mkdir -p #{
|
310
|
-
["Creating SQLite database if needed", "touch #{
|
311
|
-
["Create config directory if needed", "mkdir -p #{
|
305
|
+
["Create databases directory if needed", "mkdir -p #{config.paths.shared}/databases"],
|
306
|
+
["Creating SQLite database if needed", "touch #{config.paths.shared}/databases/#{config.framework_env}.sqlite3"],
|
307
|
+
["Create config directory if needed", "mkdir -p #{config.paths.active_release_config}"],
|
312
308
|
["Generating SQLite config", <<-WRAP],
|
313
|
-
cat > #{
|
314
|
-
#{
|
309
|
+
cat > #{config.paths.shared_config}/database.sqlite3.yml<<'YML'
|
310
|
+
#{config.framework_env}:
|
315
311
|
adapter: sqlite3
|
316
|
-
database: #{
|
312
|
+
database: #{config.paths.shared}/databases/#{config.framework_env}.sqlite3
|
317
313
|
pool: 5
|
318
314
|
timeout: 5000
|
319
315
|
YML
|
320
316
|
WRAP
|
321
|
-
["Symlink database.yml", "ln -nfs #{
|
317
|
+
["Symlink database.yml", "ln -nfs #{config.paths.shared_config}/database.sqlite3.yml #{config.paths.active_release_config}/database.yml"],
|
322
318
|
].each do |what, cmd|
|
323
319
|
shell.status "#{what}"
|
324
320
|
run(cmd)
|
325
321
|
end
|
326
322
|
|
327
|
-
owner = [
|
323
|
+
owner = [config.user, config.group].join(':')
|
328
324
|
shell.status "Setting ownership to #{owner}"
|
329
|
-
sudo "chown -R #{owner} #{
|
325
|
+
sudo "chown -R #{owner} #{config.paths.active_release}"
|
330
326
|
end
|
331
327
|
end
|
332
328
|
|
333
|
-
def symlink_configs
|
329
|
+
def symlink_configs
|
334
330
|
shell.status "Preparing shared resources for release."
|
335
|
-
symlink_tasks
|
331
|
+
symlink_tasks.each do |what, cmd|
|
336
332
|
shell.substatus what
|
337
333
|
run(cmd)
|
338
334
|
end
|
339
|
-
owner = [
|
335
|
+
owner = [config.user, config.group].join(':')
|
340
336
|
shell.status "Setting ownership to #{owner}"
|
341
|
-
sudo "chown -R #{owner} #{
|
337
|
+
sudo "chown -R #{owner} #{config.paths.active_release}"
|
342
338
|
end
|
343
339
|
|
344
|
-
def symlink_tasks
|
340
|
+
def symlink_tasks
|
345
341
|
[
|
346
|
-
["Set group write permissions", "chmod -R g+w #{
|
347
|
-
["Remove revision-tracked shared directories from deployment", "rm -rf #{
|
348
|
-
["Create tmp directory", "mkdir -p #{
|
349
|
-
["Symlink shared log directory", "ln -nfs #{
|
350
|
-
["Create public directory if needed", "mkdir -p #{
|
351
|
-
["Create config directory if needed", "mkdir -p #{
|
352
|
-
["Create system directory if needed", "ln -nfs #{
|
353
|
-
["Symlink shared pids directory", "ln -nfs #{
|
354
|
-
["Symlink other shared config files", "find #{
|
355
|
-
["Symlink mongrel_cluster.yml", "ln -nfs #{
|
356
|
-
["Symlink database.yml", "ln -nfs #{
|
357
|
-
["Symlink newrelic.yml if needed", "if [ -f \"#{
|
342
|
+
["Set group write permissions", "chmod -R g+w #{config.paths.active_release}"],
|
343
|
+
["Remove revision-tracked shared directories from deployment", "rm -rf #{config.paths.active_log} #{config.paths.public_system} #{config.paths.active_release}/tmp/pids"],
|
344
|
+
["Create tmp directory", "mkdir -p #{config.paths.active_release}/tmp"],
|
345
|
+
["Symlink shared log directory", "ln -nfs #{config.paths.shared_log} #{config.paths.active_log}"],
|
346
|
+
["Create public directory if needed", "mkdir -p #{config.paths.public}"],
|
347
|
+
["Create config directory if needed", "mkdir -p #{config.paths.active_release_config}"],
|
348
|
+
["Create system directory if needed", "ln -nfs #{config.paths.shared_system} #{config.paths.public_system}"],
|
349
|
+
["Symlink shared pids directory", "ln -nfs #{config.paths.shared}/pids #{config.paths.active_release}/tmp/pids"],
|
350
|
+
["Symlink other shared config files", "find #{config.paths.shared_config} -type f -not -name 'database.yml' -exec ln -s {} #{config.paths.active_release_config} \\;"],
|
351
|
+
["Symlink mongrel_cluster.yml", "ln -nfs #{config.paths.shared_config}/mongrel_cluster.yml #{config.paths.active_release_config}/mongrel_cluster.yml"],
|
352
|
+
["Symlink database.yml", "ln -nfs #{config.paths.shared_config}/database.yml #{config.paths.active_release_config}/database.yml"],
|
353
|
+
["Symlink newrelic.yml if needed", "if [ -f \"#{config.paths.shared_config}/newrelic.yml\" ]; then ln -nfs #{config.paths.shared_config}/newrelic.yml #{config.paths.active_release_config}/newrelic.yml; fi"],
|
358
354
|
]
|
359
355
|
end
|
360
356
|
|
361
357
|
# task
|
362
|
-
def symlink
|
358
|
+
def symlink
|
363
359
|
shell.status "Symlinking code."
|
364
|
-
run "rm -f #{
|
360
|
+
run "rm -f #{config.paths.current} && ln -nfs #{config.paths.active_release} #{config.paths.current} && find #{config.paths.current} -not -user #{config.user} -or -not -group #{config.group} -exec chown #{config.user}:#{config.group} {} +"
|
365
361
|
@symlink_changed = true
|
366
362
|
rescue Exception
|
367
|
-
sudo "rm -f #{
|
363
|
+
sudo "rm -f #{config.paths.current} && ln -nfs #{config.paths.previous_release(config.paths.active_release)} #{config.paths.current} && chown -R #{config.user}:#{config.group} #{config.paths.current}"
|
368
364
|
@symlink_changed = false
|
369
365
|
raise
|
370
366
|
end
|
371
367
|
|
372
368
|
def callback(what)
|
373
369
|
@callbacks_reached ||= true
|
374
|
-
if
|
370
|
+
if config.paths.deploy_hook(what).exist?
|
375
371
|
shell.status "Running deploy hook: deploy/#{what}.rb"
|
376
372
|
run Escape.shell_command(base_callback_command_for(what)) do |server, cmd|
|
377
373
|
per_instance_args = []
|
378
374
|
per_instance_args << '--current-roles' << server.roles.to_a.join(' ')
|
379
375
|
per_instance_args << '--current-name' << server.name.to_s if server.name
|
380
|
-
per_instance_args << '--config' <<
|
376
|
+
per_instance_args << '--config' << config.to_json
|
381
377
|
cmd << " " << Escape.shell_command(per_instance_args)
|
382
378
|
end
|
383
379
|
end
|
@@ -394,15 +390,15 @@ WRAP
|
|
394
390
|
ENV['GIT_SSH'] = ssh_executable
|
395
391
|
@strategy ||= config.strategy_class.new(
|
396
392
|
shell,
|
397
|
-
:repository_cache => config
|
398
|
-
:app => config
|
393
|
+
:repository_cache => config.paths.repository_cache.to_s,
|
394
|
+
:app => config.app,
|
399
395
|
:repo => config[:repo],
|
400
396
|
:ref => config[:branch]
|
401
397
|
)
|
402
398
|
end
|
403
399
|
|
404
400
|
def gemfile?
|
405
|
-
|
401
|
+
config.paths.gemfile.exist?
|
406
402
|
end
|
407
403
|
|
408
404
|
def base_callback_command_for(what)
|
@@ -410,7 +406,7 @@ WRAP
|
|
410
406
|
cmd << '--app' << config.app
|
411
407
|
cmd << '--environment-name' << config.environment_name
|
412
408
|
cmd << '--account-name' << config.account_name
|
413
|
-
cmd << '--release-path' << config.
|
409
|
+
cmd << '--release-path' << config.paths.active_release.to_s
|
414
410
|
cmd << '--framework-env' << config.framework_env.to_s
|
415
411
|
cmd << '--verbose' if config.verbose
|
416
412
|
cmd
|
@@ -449,18 +445,18 @@ WRAP
|
|
449
445
|
def with_failed_release_cleanup
|
450
446
|
yield
|
451
447
|
rescue Exception
|
452
|
-
shell.status "Release #{
|
453
|
-
sudo "mv #{
|
448
|
+
shell.status "Release #{config.paths.active_release} failed, saving release to #{config.paths.releases_failed}."
|
449
|
+
sudo "mv #{config.paths.active_release} #{config.paths.releases_failed}"
|
454
450
|
raise
|
455
451
|
end
|
456
452
|
|
457
453
|
def bundler_config
|
458
454
|
version = LockfileParser.default_version
|
459
455
|
options = [
|
460
|
-
"--gemfile #{
|
461
|
-
"--path #{
|
462
|
-
"--binstubs #{
|
463
|
-
"--without #{
|
456
|
+
"--gemfile #{config.paths.gemfile}",
|
457
|
+
"--path #{config.paths.bundled_gems}",
|
458
|
+
"--binstubs #{config.paths.binstubs}",
|
459
|
+
"--without #{config.bundle_without}"
|
464
460
|
]
|
465
461
|
|
466
462
|
if lockfile
|
@@ -472,9 +468,9 @@ WRAP
|
|
472
468
|
end
|
473
469
|
|
474
470
|
def lockfile
|
475
|
-
lockfile_path =
|
476
|
-
if
|
477
|
-
@lockfile_parser ||= LockfileParser.new(
|
471
|
+
lockfile_path = config.paths.gemfile_lock
|
472
|
+
if lockfile_path.exist?
|
473
|
+
@lockfile_parser ||= LockfileParser.new(lockfile_path.read)
|
478
474
|
else
|
479
475
|
nil
|
480
476
|
end
|
@@ -488,7 +484,7 @@ WRAP
|
|
488
484
|
|
489
485
|
bundler_version, install_switches = bundler_config
|
490
486
|
sudo "#{clean_environment} && #{serverside_bin} install_bundler #{bundler_version}"
|
491
|
-
run "#{clean_environment} && cd #{
|
487
|
+
run "#{clean_environment} && cd #{config.paths.active_release} && ruby -S bundle _#{bundler_version}_ install #{install_switches}"
|
492
488
|
|
493
489
|
write_system_version
|
494
490
|
end
|
@@ -496,25 +492,25 @@ WRAP
|
|
496
492
|
|
497
493
|
def clean_bundle_on_system_version_change
|
498
494
|
# diff exits with 0 for same and 1/2 for different/file not found.
|
499
|
-
check_ruby = "#{
|
500
|
-
check_system = "#{
|
495
|
+
check_ruby = "#{config.ruby_version_command} | diff - #{config.paths.ruby_version} >/dev/null 2>&1"
|
496
|
+
check_system = "#{config.system_version_command} | diff - #{config.paths.system_version} >/dev/null 2>&1"
|
501
497
|
say_cleaning = "echo 'New deploy or system version change detected, cleaning bundled gems.'"
|
502
|
-
clean_bundle = "rm -Rf #{
|
498
|
+
clean_bundle = "rm -Rf #{config.paths.bundled_gems}"
|
503
499
|
|
504
500
|
run "#{check_ruby} && #{check_system} || (#{say_cleaning} && #{clean_bundle})"
|
505
501
|
end
|
506
502
|
|
507
503
|
def write_system_version
|
508
|
-
store_ruby_version = "#{
|
509
|
-
store_system_version = "#{
|
504
|
+
store_ruby_version = "#{config.ruby_version_command} > #{config.paths.ruby_version}"
|
505
|
+
store_system_version = "#{config.system_version_command} > #{config.paths.system_version}"
|
510
506
|
|
511
|
-
run "mkdir -p #{
|
507
|
+
run "mkdir -p #{config.paths.bundled_gems} && #{store_ruby_version} && #{store_system_version}"
|
512
508
|
end
|
513
509
|
|
514
510
|
def check_node_npm
|
515
|
-
if
|
511
|
+
if config.paths.package_json.exist?
|
516
512
|
shell.info "~> package.json detected, installing npm packages"
|
517
|
-
run "cd #{
|
513
|
+
run "cd #{config.paths.active_release} && npm install"
|
518
514
|
end
|
519
515
|
end
|
520
516
|
end # DeployBase
|
@@ -8,7 +8,7 @@ module EY
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def hook_path
|
11
|
-
|
11
|
+
@config.paths.deploy_hook(@hook_name)
|
12
12
|
end
|
13
13
|
|
14
14
|
def callback_context
|
@@ -16,13 +16,13 @@ module EY
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
if
|
20
|
-
Dir.chdir(@config.
|
19
|
+
if hook_path.exist?
|
20
|
+
Dir.chdir(@config.paths.active_release.to_s) do
|
21
21
|
if desc = syntax_error(hook_path)
|
22
|
-
hook_name =
|
22
|
+
hook_name = hook_path.basename
|
23
23
|
abort "*** [Error] Invalid Ruby syntax in hook: #{hook_name} ***\n*** #{desc.chomp} ***"
|
24
24
|
else
|
25
|
-
eval_hook(
|
25
|
+
eval_hook(hook_path.read)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -37,7 +37,7 @@ module EY
|
|
37
37
|
|
38
38
|
def display_hook_error(exception, code, hook_path)
|
39
39
|
@shell.fatal <<-ERROR
|
40
|
-
Exception raised in deploy hook #{hook_path
|
40
|
+
Exception raised in deploy hook #{hook_path}.
|
41
41
|
|
42
42
|
#{exception.class}: #{exception.to_s}
|
43
43
|
|
@@ -17,6 +17,7 @@ module EY
|
|
17
17
|
def manually_enable
|
18
18
|
if paths.deployed?
|
19
19
|
enable
|
20
|
+
shell.info "Maintenance page enabled"
|
20
21
|
else
|
21
22
|
shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
|
22
23
|
false
|
@@ -26,6 +27,7 @@ module EY
|
|
26
27
|
def manually_disable
|
27
28
|
if paths.deployed?
|
28
29
|
disable
|
30
|
+
shell.info "Maintenance page disabled"
|
29
31
|
else
|
30
32
|
shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
|
31
33
|
false
|
@@ -5,26 +5,34 @@ module EY
|
|
5
5
|
class Paths
|
6
6
|
|
7
7
|
module LegacyHelpers
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
8
|
+
def self.legacy_path_helper(name, new_name)
|
9
|
+
define_method(name) do |*a|
|
10
|
+
EY::Serverside.deprecation_warning("config.#{name} is deprecated. Please use 'config.paths.#{new_name}' which returns a Pathname object.")
|
11
|
+
paths.send(new_name).to_s
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
legacy_path_helper :deploy_to, :deploy_root
|
16
|
+
legacy_path_helper :release_dir, :releases
|
17
|
+
legacy_path_helper :failed_release_dir, :releases_failed
|
18
|
+
legacy_path_helper :release_path, :active_release
|
19
|
+
legacy_path_helper :previous_release, :previous_release
|
20
|
+
legacy_path_helper :latest_release, :latest_release
|
21
|
+
legacy_path_helper :current_path, :current
|
22
|
+
legacy_path_helper :shared_path, :shared
|
23
|
+
legacy_path_helper :maintenance_page_enabled_path, :enabled_maintenance_page
|
24
|
+
legacy_path_helper :repository_cache, :repository_cache
|
25
|
+
legacy_path_helper :bundled_gems_path, :bundled_gems
|
26
|
+
legacy_path_helper :ruby_version_file, :ruby_version
|
27
|
+
legacy_path_helper :system_version_file, :system_version
|
28
|
+
legacy_path_helper :binstubs_path, :binstubs
|
29
|
+
legacy_path_helper :gemfile_path, :gemfile
|
30
|
+
legacy_path_helper :ssh_identity_file, :deploy_key
|
31
|
+
|
32
|
+
def all_releases
|
33
|
+
EY::Serverside.deprecation_warning("config.all_releases is deprecated. Please use 'config.paths.all_releases' which returns Pathname objects.")
|
34
|
+
paths.all_releases.map {|path| path.to_s }
|
35
|
+
end
|
28
36
|
end
|
29
37
|
|
30
38
|
# Maintenance page candidates in order of search preference.
|
@@ -50,6 +58,8 @@ module EY
|
|
50
58
|
|
51
59
|
attr_reader :home, :deploy_root
|
52
60
|
|
61
|
+
def_path :internal_key, [:home, '.ssh', 'internal']
|
62
|
+
|
53
63
|
def_path :current, [:deploy_root, 'current']
|
54
64
|
def_path :releases, [:deploy_root, 'releases']
|
55
65
|
def_path :releases_failed, [:deploy_root, 'releases_failed']
|
@@ -57,7 +67,9 @@ module EY
|
|
57
67
|
def_path :shared_log, [:shared, 'log']
|
58
68
|
def_path :shared_config, [:shared, 'config']
|
59
69
|
def_path :shared_system, [:shared, 'system']
|
70
|
+
def_path :default_repository_cache, [:shared, 'cached-copy']
|
60
71
|
def_path :enabled_maintenance_page, [:shared_system, 'maintenance.html']
|
72
|
+
def_path :shared_assets, [:shared, 'assets']
|
61
73
|
def_path :bundled_gems, [:shared, 'bundled_gems']
|
62
74
|
def_path :ruby_version, [:bundled_gems, 'RUBY_VERSION']
|
63
75
|
def_path :system_version, [:bundled_gems, 'SYSTEM_VERSION']
|
@@ -65,22 +77,37 @@ module EY
|
|
65
77
|
def_path :active_revision, [:active_release, 'REVISION']
|
66
78
|
def_path :binstubs, [:active_release, 'ey_bundler_binstubs']
|
67
79
|
def_path :gemfile, [:active_release, 'Gemfile']
|
80
|
+
def_path :gemfile_lock, [:active_release, 'Gemfile.lock']
|
81
|
+
def_path :public, [:active_release, 'public']
|
82
|
+
def_path :public_assets, [:public, 'assets']
|
83
|
+
def_path :public_system, [:public, 'system']
|
84
|
+
def_path :package_json, [:active_release, 'package.json']
|
85
|
+
def_path :active_release_config, [:active_release, 'config']
|
86
|
+
def_path :active_log, [:active_release, 'log']
|
68
87
|
|
69
88
|
def initialize(opts)
|
70
89
|
@opts = opts
|
71
|
-
@home = Pathname.new(@opts[:
|
90
|
+
@home = Pathname.new(@opts[:home] || ENV['HOME'])
|
72
91
|
@app_name = @opts[:app_name]
|
73
92
|
@active_release = Pathname.new(@opts[:active_release]) if @opts[:active_release]
|
74
93
|
@repository_cache = Pathname.new(@opts[:repository_cache]) if @opts[:repository_cache]
|
75
94
|
@deploy_root = Pathname.new(@opts[:deploy_root] || "/data/#{@app_name}")
|
76
95
|
end
|
77
96
|
|
78
|
-
def
|
97
|
+
def deploy_key
|
79
98
|
path(:home, '.ssh', "#{@app_name}-deploy-key")
|
80
99
|
end
|
81
100
|
|
101
|
+
def ssh_wrapper
|
102
|
+
path(:shared_config, "#{@app_name}-ssh-wrapper")
|
103
|
+
end
|
104
|
+
|
105
|
+
def deploy_hook(hook_name)
|
106
|
+
path(:active_release, 'deploy', "#{hook_name}.rb")
|
107
|
+
end
|
108
|
+
|
82
109
|
def repository_cache
|
83
|
-
@repository_cache ||=
|
110
|
+
@repository_cache ||= default_repository_cache
|
84
111
|
end
|
85
112
|
|
86
113
|
def active_release
|
@@ -92,8 +119,8 @@ module EY
|
|
92
119
|
end
|
93
120
|
|
94
121
|
# deploy_root/releases/<release before argument release path>
|
95
|
-
def previous_release(
|
96
|
-
index = all_releases.index(
|
122
|
+
def previous_release(from_release=latest_release)
|
123
|
+
index = all_releases.index(from_release)
|
97
124
|
if index && index > 0
|
98
125
|
all_releases[index-1]
|
99
126
|
else
|
@@ -6,22 +6,28 @@ module EY
|
|
6
6
|
rails_version = bundled_rails_version
|
7
7
|
roles :app_master, :app, :solo do
|
8
8
|
keep_existing_assets
|
9
|
-
cmd = "cd #{
|
10
|
-
|
11
|
-
if config.precompile_assets_inferred?
|
12
|
-
# If specifically requested, then we want to fail if compilation fails.
|
13
|
-
# If we are implicitly precompiling, we want to fail non-destructively
|
14
|
-
# because we don't know if the rake task exists or if the user
|
15
|
-
# actually intended for assets to be compiled.
|
16
|
-
cmd << %{ || (echo "Asset compilation failure ignored.\n Add 'precompile_assets: true' to ey.yml to abort deploy on failure." && true)}
|
17
|
-
end
|
9
|
+
cmd = "cd #{config.paths.active_release} && PATH=#{config.paths.binstubs}:$PATH #{config.framework_envs} rake assets:precompile"
|
18
10
|
|
19
11
|
if rails_version
|
20
12
|
shell.status "Precompiling assets for rails v#{rails_version}"
|
21
13
|
else
|
22
14
|
shell.warning "Precompiling assets even though Rails was not bundled."
|
23
15
|
end
|
24
|
-
|
16
|
+
|
17
|
+
begin
|
18
|
+
run(cmd)
|
19
|
+
rescue StandardError => e
|
20
|
+
if config.precompile_assets_inferred?
|
21
|
+
# If specifically requested, then we want to fail if compilation fails.
|
22
|
+
# If we are implicitly precompiling, we want to fail non-destructively
|
23
|
+
# because we don't know if the rake task exists or if the user
|
24
|
+
# actually intended for assets to be compiled.
|
25
|
+
shell.notice "Asset compilation failure ignored.\nAdd 'precompile_assets: true' to ey.yml to abort deploy on failure."
|
26
|
+
return
|
27
|
+
else
|
28
|
+
raise
|
29
|
+
end
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
|
@@ -30,39 +36,40 @@ module EY
|
|
30
36
|
shell.status "Attempting Rails asset precompilation. (enabled in config)"
|
31
37
|
return true
|
32
38
|
elsif config.skip_precompile_assets?
|
33
|
-
shell.status "Skipping asset precompilation. (disabled in
|
39
|
+
shell.status "Skipping asset precompilation. (disabled in ey.yml)"
|
34
40
|
return false
|
35
41
|
end
|
36
42
|
|
37
|
-
app_rb_path =
|
38
|
-
unless
|
43
|
+
app_rb_path = config.paths.active_release_config.join('application.rb')
|
44
|
+
unless app_rb_path.readable? # Not a Rails app in the first place.
|
39
45
|
shell.status "Skipping asset precompilation. (not a Rails application)"
|
40
46
|
return false
|
41
47
|
end
|
42
48
|
|
43
|
-
if
|
49
|
+
if config.paths.active_release.join('app','assets').exist?
|
44
50
|
shell.status "Attempting Rails asset precompilation. (found directory: 'app/assets')"
|
45
51
|
else
|
46
52
|
shell.status "Skipping asset precompilation. (directory not found: 'app/assets')"
|
47
53
|
return false
|
48
54
|
end
|
49
55
|
|
50
|
-
if
|
56
|
+
if config.paths.public_assets.exist?
|
51
57
|
shell.status "Skipping asset compilation. Already compiled. (found directory: 'public/assets')"
|
52
58
|
return false
|
53
59
|
end
|
60
|
+
|
54
61
|
if app_disables_assets?(app_rb_path)
|
55
62
|
shell.status "Skipping asset compilation. (application.rb has disabled asset compilation)"
|
56
63
|
return false
|
57
64
|
end
|
58
|
-
|
59
|
-
#
|
60
|
-
|
61
|
-
unless app_has_asset_task?
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
|
65
|
+
|
66
|
+
# This check is very expensive, and has been deemed not worth the time.
|
67
|
+
# Leaving this here in case someone comes up with a faster way.
|
68
|
+
#unless app_has_asset_task?
|
69
|
+
# shell.status "No 'assets:precompile' Rake task found. Skipping."
|
70
|
+
# return
|
71
|
+
#end
|
72
|
+
|
66
73
|
true
|
67
74
|
end
|
68
75
|
|
@@ -80,13 +87,13 @@ module EY
|
|
80
87
|
def app_has_asset_task?
|
81
88
|
# We just run this locally on the app master; everybody else should
|
82
89
|
# have the same code anyway.
|
83
|
-
task_check = "PATH=#{
|
84
|
-
cmd = "cd #{
|
85
|
-
shell.logged_system("cd #{
|
90
|
+
task_check = "PATH=#{config.paths.binstubs}:$PATH #{config.framework_envs} rake -T assets:precompile |grep 'assets:precompile'"
|
91
|
+
cmd = "cd #{config.paths.active_release} && #{task_check}"
|
92
|
+
shell.logged_system("cd #{config.paths.active_release} && #{task_check}").success?
|
86
93
|
end
|
87
94
|
|
88
95
|
def app_builds_own_assets?
|
89
|
-
|
96
|
+
config.paths.public_assets.exist?
|
90
97
|
end
|
91
98
|
|
92
99
|
# To support operations like Unicorn's hot reload, it is useful to have
|
@@ -94,8 +101,8 @@ module EY
|
|
94
101
|
# clients may request stale assets that you just deleted.
|
95
102
|
# Making use of this requires a properly-configured front-end HTTP server.
|
96
103
|
def keep_existing_assets
|
97
|
-
current =
|
98
|
-
last_asset_path =
|
104
|
+
current = config.paths.shared_assets
|
105
|
+
last_asset_path = config.paths.shared.join('last_assets')
|
99
106
|
# If there are current shared assets, move them under a 'last_assets' directory.
|
100
107
|
run <<-COMMAND
|
101
108
|
if [ -d #{current} ]; then
|
@@ -103,14 +110,13 @@ if [ -d #{current} ]; then
|
|
103
110
|
else
|
104
111
|
mkdir -p #{current} #{last_asset_path};
|
105
112
|
fi;
|
106
|
-
ln -nfs #{current} #{last_asset_path} #{
|
113
|
+
ln -nfs #{current} #{last_asset_path} #{config.paths.public}
|
107
114
|
COMMAND
|
108
115
|
end
|
109
116
|
|
110
|
-
def bundled_rails_version(lockfile_path =
|
111
|
-
|
112
|
-
|
113
|
-
lockfile = File.open(lockfile_path) {|f| f.read}
|
117
|
+
def bundled_rails_version(lockfile_path = config.paths.gemfile_lock)
|
118
|
+
return unless lockfile_path.exist?
|
119
|
+
lockfile = lockfile_path.read
|
114
120
|
lockfile.each_line do |line|
|
115
121
|
# scan for gemname (version) toplevel deps.
|
116
122
|
# Likely doesn't handle ancient Bundler versions, but
|
@@ -4,7 +4,12 @@ module EY
|
|
4
4
|
module Serverside
|
5
5
|
class Task
|
6
6
|
attr_reader :servers, :config, :shell
|
7
|
-
|
7
|
+
|
8
|
+
# deprecated, please don't use
|
9
|
+
def c
|
10
|
+
EY::Serverside.deprecation_warning("The method 'c' is deprecated in favor of 'config' for better clarity.")
|
11
|
+
config
|
12
|
+
end
|
8
13
|
|
9
14
|
def initialize(servers, conf, shell)
|
10
15
|
@servers = servers
|
@@ -15,14 +20,14 @@ module EY
|
|
15
20
|
|
16
21
|
def require_custom_tasks
|
17
22
|
deploy_file = ["config/eydeploy.rb", "eydeploy.rb"].map do |short_file|
|
18
|
-
|
23
|
+
config.paths.repository_cache.join(short_file)
|
19
24
|
end.detect do |file|
|
20
|
-
|
25
|
+
file.exist?
|
21
26
|
end
|
22
27
|
|
23
28
|
if deploy_file
|
24
29
|
shell.status "Loading deployment task overrides from #{deploy_file}"
|
25
|
-
instance_eval(
|
30
|
+
instance_eval(deploy_file.read)
|
26
31
|
true
|
27
32
|
else
|
28
33
|
false
|
@@ -31,14 +36,14 @@ module EY
|
|
31
36
|
|
32
37
|
def load_ey_yml
|
33
38
|
ey_yml = ["config/ey.yml", "ey.yml"].map do |short_file|
|
34
|
-
|
39
|
+
config.paths.repository_cache.join(short_file)
|
35
40
|
end.detect do |file|
|
36
|
-
|
41
|
+
file.exist?
|
37
42
|
end
|
38
43
|
|
39
44
|
if ey_yml
|
40
45
|
shell.status "Loading deploy configuration in #{ey_yml}"
|
41
|
-
data = YAML.load_file(ey_yml)
|
46
|
+
data = YAML.load_file(ey_yml.to_s)
|
42
47
|
config.load_ey_yml_data(data, shell)
|
43
48
|
else
|
44
49
|
false
|
data/spec/custom_deploy_spec.rb
CHANGED
data/spec/deploy_hook_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe "deploy hooks" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "retains the failed release" do
|
32
|
-
release_name =
|
32
|
+
release_name = @config.paths.active_release.basename
|
33
33
|
deploy_dir.join('releases_failed', release_name).should be_directory
|
34
34
|
end
|
35
35
|
end
|
@@ -254,7 +254,7 @@ describe "deploy hooks" do
|
|
254
254
|
deploy_hook.eval_hook('methedo_no_existo')
|
255
255
|
}.should raise_error(NameError)
|
256
256
|
out = read_output
|
257
|
-
out.should =~ %r|FATAL: Exception raised in deploy hook
|
257
|
+
out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
|
258
258
|
out.should =~ %r|NameError: undefined local variable or method `methedo_no_existo' for|
|
259
259
|
out.should =~ %r|Please fix this error before retrying.|
|
260
260
|
end
|
@@ -43,15 +43,16 @@ describe "Deploying an app with ey.yml" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "does not remove an existing maintenance page" do
|
46
|
+
maintenance = EY::Serverside::Maintenance.new(test_servers, @config, test_shell)
|
46
47
|
deploy_dir.join('current','maintenance_disabled').delete
|
47
|
-
|
48
|
+
maintenance.manually_enable
|
48
49
|
deploy_dir.join('shared','system','maintenance.html').should exist
|
49
50
|
redeploy_test_application
|
50
51
|
read_output.should =~ /Maintenance page is still up./
|
51
52
|
deploy_dir.join('shared','system','maintenance.html').should exist
|
52
53
|
deploy_dir.join('current','maintenance_disabled').should_not exist
|
53
54
|
deploy_dir.join('current','maintenance_enabled').should exist
|
54
|
-
|
55
|
+
maintenance.manually_disable
|
55
56
|
deploy_dir.join('shared','system','maintenance.html').should_not exist
|
56
57
|
end
|
57
58
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
run "echo '#{config.custom}' > custom_hook"
|
2
|
-
if
|
2
|
+
if config.paths.enabled_maintenance_page.exist?
|
3
3
|
run "echo 'maintenance page enabled' > maintenance_enabled"
|
4
4
|
else
|
5
5
|
run "echo 'no maintenance page' > maintenance_disabled"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
run "echo '#{config.custom}' > custom_hook"
|
2
|
-
if
|
2
|
+
if config.paths.enabled_maintenance_page.exist?
|
3
3
|
run "echo 'maintenance page enabled' > maintenance_enabled"
|
4
4
|
else
|
5
5
|
run "echo 'no maintenance page' > maintenance_disabled"
|
data/spec/git_strategy_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe "the git deploy strategy" do
|
4
4
|
subject do
|
5
5
|
fixtures_dir = Pathname.new(__FILE__).dirname.join("fixtures")
|
6
|
-
gitrepo_dir =
|
6
|
+
gitrepo_dir = tmpdir.join("gitrepo-#{Time.now.to_i}-#{$$}")
|
7
7
|
gitrepo_dir.mkdir
|
8
8
|
system "tar xzf #{fixtures_dir.join('gitrepo.tar.gz')} --strip-components 1 -C #{gitrepo_dir}"
|
9
9
|
|
@@ -5,7 +5,7 @@ describe "Deploying an application with services" do
|
|
5
5
|
describe "with services" do
|
6
6
|
before do
|
7
7
|
deploy_test_application('no_ey_config') do |deployer|
|
8
|
-
@shared_services_file = deployer.
|
8
|
+
@shared_services_file = deployer.config.paths.shared_config.join('ey_services_config_deploy.yml')
|
9
9
|
@services_yml = {"servicio" => {"foo" => "bar"}}.to_yaml
|
10
10
|
deployer.mock_services_setup!("echo '#{@services_yml}' > #{@shared_services_file}")
|
11
11
|
end
|
@@ -30,8 +30,8 @@ describe "Deploying an application with services" do
|
|
30
30
|
describe "deploy with invalid yaml ey_services_config_deploy" do
|
31
31
|
before do
|
32
32
|
deploy_test_application do |deployer|
|
33
|
-
@shared_services_file = deployer.
|
34
|
-
@symlinked_services_file = deployer.
|
33
|
+
@shared_services_file = deployer.config.paths.shared_config.join('ey_services_config_deploy.yml')
|
34
|
+
@symlinked_services_file = deployer.config.paths.active_release_config.join('ey_services_config_deploy.yml')
|
35
35
|
@invalid_services_yml = "42"
|
36
36
|
deployer.mock_services_setup!("echo '#{@invalid_services_yml}' > #{@shared_services_file}")
|
37
37
|
end
|
@@ -53,8 +53,8 @@ describe "Deploying an application with services" do
|
|
53
53
|
describe "a succesful deploy" do
|
54
54
|
before do
|
55
55
|
deploy_test_application do |deployer|
|
56
|
-
@shared_services_file = deployer.
|
57
|
-
@symlinked_services_file = deployer.
|
56
|
+
@shared_services_file = deployer.config.paths.shared_config.join('ey_services_config_deploy.yml')
|
57
|
+
@symlinked_services_file = deployer.config.paths.active_release_config.join('ey_services_config_deploy.yml')
|
58
58
|
@services_yml = {"servicio" => {"foo" => "bar"}}.to_yaml
|
59
59
|
|
60
60
|
deployer.mock_services_setup!("echo '#{@services_yml}' > #{@shared_services_file}")
|
data/spec/shell_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe EY::Serverside::Shell do
|
|
9
9
|
time3 = Time.local(2008, 9, 1, 12, 10, 25)
|
10
10
|
|
11
11
|
@output = StringIO.new
|
12
|
-
@shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path =>
|
12
|
+
@shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path => tmpdir.join("engineyard-serverside-#{Time.now.to_i}-#{$$}.log"), :start_time => time1)
|
13
13
|
|
14
14
|
Timecop.freeze(time1) do
|
15
15
|
@shell.debug('debug')
|
data/spec/spec_helper.rb
CHANGED
@@ -17,6 +17,7 @@ require 'engineyard-serverside'
|
|
17
17
|
require File.expand_path('../support/integration', __FILE__)
|
18
18
|
|
19
19
|
FIXTURES_DIR = Pathname.new(__FILE__).dirname.join("fixtures")
|
20
|
+
TMPDIR = Pathname.new(__FILE__).dirname.parent.join('tmp')
|
20
21
|
GROUP = `id -gn`.strip
|
21
22
|
|
22
23
|
module EY
|
@@ -48,9 +49,14 @@ Spec::Runner.configure do |config|
|
|
48
49
|
end
|
49
50
|
|
50
51
|
config.before(:all) do
|
52
|
+
make_tmpdir
|
51
53
|
EY::Serverside.dna_json = {}.to_json
|
52
54
|
end
|
53
55
|
|
56
|
+
config.after(:all) do
|
57
|
+
delete_tmpdir
|
58
|
+
end
|
59
|
+
|
54
60
|
class VerboseStringIO < StringIO
|
55
61
|
def <<(str)
|
56
62
|
if ENV['VERBOSE'] || ENV['DEBUG']
|
@@ -60,6 +66,18 @@ Spec::Runner.configure do |config|
|
|
60
66
|
end
|
61
67
|
end
|
62
68
|
|
69
|
+
def tmpdir
|
70
|
+
TMPDIR
|
71
|
+
end
|
72
|
+
|
73
|
+
def make_tmpdir
|
74
|
+
tmpdir.mkpath
|
75
|
+
end
|
76
|
+
|
77
|
+
def delete_tmpdir
|
78
|
+
tmpdir.exist? && tmpdir.rmtree
|
79
|
+
end
|
80
|
+
|
63
81
|
def stdout
|
64
82
|
@stdout ||= VerboseStringIO.new
|
65
83
|
end
|
@@ -84,7 +102,7 @@ Spec::Runner.configure do |config|
|
|
84
102
|
|
85
103
|
def test_shell
|
86
104
|
@test_shell ||= begin
|
87
|
-
log_path =
|
105
|
+
log_path = tmpdir.join("serverside-deploy-#{Time.now.to_i}-#{$$}.log")
|
88
106
|
EY::Serverside::Shell.new(:verbose => true, :log_path => log_path, :stdout => stdout, :stderr => stderr)
|
89
107
|
end
|
90
108
|
end
|
@@ -94,7 +112,7 @@ Spec::Runner.configure do |config|
|
|
94
112
|
end
|
95
113
|
|
96
114
|
def deploy_dir
|
97
|
-
@deploy_dir ||=
|
115
|
+
@deploy_dir ||= tmpdir.join("serverside-deploy-#{Time.now.to_i}-#{$$}")
|
98
116
|
end
|
99
117
|
|
100
118
|
# set up EY::Serverside::Server like we're on a solo
|
data/spec/sqlite3_deploy_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe "Deploying an application with sqlite3 as the only DB adapter in the Ge
|
|
7
7
|
@framework_env = nil
|
8
8
|
|
9
9
|
deploy_test_application('sqlite3') do |deployer|
|
10
|
-
@shared_path = deployer.
|
11
|
-
@release_path = deployer.
|
10
|
+
@shared_path = deployer.config.paths.shared
|
11
|
+
@release_path = deployer.config.paths.active_release
|
12
12
|
@framework_env = deployer.framework_env
|
13
13
|
end
|
14
14
|
end
|
data/spec/support/integration.rb
CHANGED
@@ -33,7 +33,7 @@ class FullTestDeploy < EY::Serverside::Deploy
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def restart_command
|
36
|
-
Escape.shell_command(["echo", super]) + "> #{
|
36
|
+
Escape.shell_command(["echo", super]) + "> #{config.paths.active_release}/restart"
|
37
37
|
end
|
38
38
|
|
39
39
|
# we're probably running this spec under bundler, but a real
|
@@ -53,14 +53,6 @@ class FullTestDeploy < EY::Serverside::Deploy
|
|
53
53
|
result
|
54
54
|
end
|
55
55
|
|
56
|
-
def shared_path
|
57
|
-
Pathname.new(config.shared_path)
|
58
|
-
end
|
59
|
-
|
60
|
-
def release_path
|
61
|
-
Pathname.new(config.release_path)
|
62
|
-
end
|
63
|
-
|
64
56
|
def framework_env
|
65
57
|
config.framework_env
|
66
58
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 2346291293
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
-
|
12
|
-
version: 2.0.0.
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 2.0.0.rc1
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- EY Cloud Team
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-06-
|
20
|
+
date: 2012-06-21 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rspec
|
@@ -394,7 +394,7 @@ files:
|
|
394
394
|
- spec/fixtures/repos/assets_enabled_in_ey_yml/README
|
395
395
|
- spec/fixtures/repos/assets_in_hook/app/assets/empty
|
396
396
|
- spec/fixtures/repos/assets_in_hook/config/application.rb
|
397
|
-
- spec/fixtures/repos/assets_in_hook/deploy/
|
397
|
+
- spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb
|
398
398
|
- spec/fixtures/repos/assets_in_hook/Gemfile
|
399
399
|
- spec/fixtures/repos/assets_in_hook/Gemfile.lock
|
400
400
|
- spec/fixtures/repos/assets_in_hook/Rakefile
|
@@ -535,7 +535,7 @@ test_files:
|
|
535
535
|
- spec/fixtures/repos/assets_enabled_in_ey_yml/README
|
536
536
|
- spec/fixtures/repos/assets_in_hook/app/assets/empty
|
537
537
|
- spec/fixtures/repos/assets_in_hook/config/application.rb
|
538
|
-
- spec/fixtures/repos/assets_in_hook/deploy/
|
538
|
+
- spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb
|
539
539
|
- spec/fixtures/repos/assets_in_hook/Gemfile
|
540
540
|
- spec/fixtures/repos/assets_in_hook/Gemfile.lock
|
541
541
|
- spec/fixtures/repos/assets_in_hook/Rakefile
|
@@ -1 +0,0 @@
|
|
1
|
-
run 'touch custom_compiled && mkdir public/assets'
|