engineyard-serverside 2.3.9 → 2.4.0
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 +15 -0
- data/bin/engineyard-serverside-execute-hook +31 -0
- data/lib/engineyard-serverside/about.rb +3 -0
- data/lib/engineyard-serverside/cli.rb +3 -1
- data/lib/engineyard-serverside/configuration.rb +5 -0
- data/lib/engineyard-serverside/deploy.rb +25 -7
- data/lib/engineyard-serverside/maintenance.rb +14 -1
- data/lib/engineyard-serverside/paths.rb +4 -0
- data/lib/engineyard-serverside/server.rb +3 -2
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/archive_deploy_spec.rb +4 -10
- data/spec/basic_deploy_spec.rb +3 -3
- data/spec/bundler_deploy_spec.rb +32 -32
- data/spec/configuration_spec.rb +42 -42
- data/spec/custom_deploy_spec.rb +9 -9
- data/spec/deploy_hook_spec.rb +103 -89
- data/spec/deprecation_spec.rb +3 -3
- data/spec/ey_yml_customized_deploy_spec.rb +21 -21
- data/spec/fixtures/repos/executable_hooks/README +1 -0
- data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
- data/spec/fixtures/repos/public_system/Gemfile +4 -0
- data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
- data/spec/fixtures/repos/public_system/README +5 -0
- data/spec/fixtures/repos/public_system/ey.yml +3 -0
- data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
- data/spec/lockfile_parser_spec.rb +26 -26
- data/spec/multi_dependency_manager_spec.rb +3 -3
- data/spec/nodejs_deploy_spec.rb +2 -2
- data/spec/php_deploy_spec.rb +7 -7
- data/spec/rails31_deploy_spec.rb +56 -56
- data/spec/restart_spec.rb +3 -3
- data/spec/rollback_spec.rb +19 -19
- data/spec/server_spec.rb +16 -16
- data/spec/services_deploy_spec.rb +40 -40
- data/spec/shell_spec.rb +1 -1
- data/spec/source/archive_spec.rb +1 -1
- data/spec/source/git_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/sqlite3_deploy_spec.rb +6 -6
- data/spec/symlink_spec.rb +15 -0
- metadata +139 -154
- data/lib/engineyard-serverside/source_strategy.rb +0 -77
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTE4NmI1MTllMTQ3MzM0MjQ5MmJlYjQ5ZTRhYjA4Y2QwM2E0ZWE0NA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MWM0MmQ0YTMxMWRkYzcyZjliZTgwZjI1MGExZTk2ZWY1MWJiMGFkNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTNiNWE2NTQyOWM0YTUzM2M5MDBjNjVjYTZlYTU5ZmI1NDE1YTNiYTcwMTli
|
10
|
+
Y2YwOWU2YzM4ZGU5MjkwMDJjNmFjN2UwNjQzN2I5ODNiMzYwY2YyZmMzNDkx
|
11
|
+
NTQxMWQyMjdkZTU5ZDZhNmI4ZTMwMmZlYmYxNzcwZGUwYzI0YWM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OWNjOThiOTU1NzNiNjZkNDRlZWM5Y2U3NmE0MWQzMTkwN2U4ODA1MmU0MzBk
|
14
|
+
Zjc3Yzc2YTVjZWY2OGM0MDBmZmI2OTNkMmQ0ZDg5MGYyYzhmMDc0NGFlYTE2
|
15
|
+
NzgzZjA2YWRmZmUyYjlmYWFhMWZiNWYyOTE4MGJiYWJhNDlhZjY=
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
#
|
4
|
+
# This script is used to execute non-ruby deploy hooks. It's called from
|
5
|
+
# EY::Serverside::Deploy#callback. If you'd like to call it directly you should
|
6
|
+
# be careful to replicate everything done in EY::Serverside::Deploy or your
|
7
|
+
# hook code may not execute as planned.
|
8
|
+
#
|
9
|
+
|
10
|
+
set -o nounset
|
11
|
+
|
12
|
+
abort() {
|
13
|
+
echo "$*"
|
14
|
+
exit 1
|
15
|
+
}
|
16
|
+
|
17
|
+
HOOK=${1:-}
|
18
|
+
[ -n "${HOOK}" ] || abort "No hook name provided."
|
19
|
+
|
20
|
+
# We run all deploy hooks from the root directory of the current release of
|
21
|
+
# their app.
|
22
|
+
[ -n "${EY_DEPLOY_RELEASE_PATH:-}" ] || abort "EY_DEPLOY_RELEASE_PATH must be set."
|
23
|
+
[ -d ${EY_DEPLOY_RELEASE_PATH} ] || abort "EY_DEPLOY_RELEASE_PATH must exist and be a directory"
|
24
|
+
cd ${EY_DEPLOY_RELEASE_PATH}
|
25
|
+
|
26
|
+
# Run the hook.
|
27
|
+
_hook_path=deploy/${HOOK}
|
28
|
+
if [ ! \( -f ${_hook_path} -a -x ${_hook_path} \) ]; then
|
29
|
+
abort "${_hook_path} must exist and be executable"
|
30
|
+
fi
|
31
|
+
exec ${_hook_path}
|
@@ -93,6 +93,8 @@ module EY
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
+
method_option :ignore_existing, :type => :boolean,
|
97
|
+
:desc => "When syncing /data/app directory, don't overwrite destination files"
|
96
98
|
account_app_env_options
|
97
99
|
config_option
|
98
100
|
framework_env_option
|
@@ -124,7 +126,7 @@ module EY
|
|
124
126
|
|
125
127
|
servers.run_for_each! do |server|
|
126
128
|
chown = server.command_on_server('sudo sh -l -c', chown_command)
|
127
|
-
sync = server.sync_directory_command(app_dir)
|
129
|
+
sync = server.sync_directory_command(app_dir, options[:ignore_existing])
|
128
130
|
clean = server.command_on_server('sh -l -c', "rm -rf #{current_app_dir}")
|
129
131
|
"(#{chown}) && (#{sync}) && (#{clean})"
|
130
132
|
end
|
@@ -241,6 +241,11 @@ module EY
|
|
241
241
|
)
|
242
242
|
end
|
243
243
|
|
244
|
+
# Use [] to access attributes instead of calling methods so
|
245
|
+
# that we get nils instead of NoMethodError.
|
246
|
+
#
|
247
|
+
# Rollback doesn't know about the repository location (nor
|
248
|
+
# should it need to), but it would like to use #short_log_message.
|
244
249
|
def paths
|
245
250
|
@paths ||= Paths.new({
|
246
251
|
:home => configuration['home_path'],
|
@@ -337,12 +337,13 @@ YML
|
|
337
337
|
def symlink_tasks
|
338
338
|
[
|
339
339
|
["Set group write permissions", "chmod -R g+w #{paths.active_release}"],
|
340
|
-
["Remove
|
340
|
+
["Remove public/system if symlinked", "if [ -L \"#{paths.public_system}\" ]; then rm -rf #{paths.public_system}; fi"],
|
341
|
+
["Remove symlinked shared directories", "rm -rf #{paths.active_log} #{paths.active_release}/tmp/pids"],
|
341
342
|
["Create tmp directory", "mkdir -p #{paths.active_release}/tmp"],
|
342
343
|
["Create public directory", "mkdir -p #{paths.public}"],
|
343
344
|
["Create config directory", "mkdir -p #{paths.active_release_config}"],
|
344
345
|
["Symlink shared log directory", "ln -nfs #{paths.shared_log} #{paths.active_log}"],
|
345
|
-
["Symlink public system directory", "ln -
|
346
|
+
["Symlink public system directory", "if [ ! -e \"#{paths.public_system}\" ]; then ln -ns #{paths.shared_system} #{paths.public_system}; fi"],
|
346
347
|
["Symlink shared pids directory", "ln -nfs #{paths.shared}/pids #{paths.active_release}/tmp/pids"],
|
347
348
|
["Symlink other shared config files", "find #{paths.shared_config} -maxdepth 1 -type f -not -name 'database.yml' -exec ln -s {} #{paths.active_release_config} \\;"],
|
348
349
|
["Symlink database.yml if needed", "if [ -f \"#{paths.shared_config}/database.yml\" ]; then ln -nfs #{paths.shared_config}/database.yml #{paths.active_release_config}/database.yml; fi"],
|
@@ -381,6 +382,7 @@ YML
|
|
381
382
|
|
382
383
|
def callback(what)
|
383
384
|
@callbacks_reached ||= true
|
385
|
+
|
384
386
|
if paths.deploy_hook(what).exist?
|
385
387
|
shell.status "Running deploy hook: deploy/#{what}.rb"
|
386
388
|
run Escape.shell_command(base_callback_command_for(what)) do |server, cmd|
|
@@ -390,14 +392,16 @@ YML
|
|
390
392
|
per_instance_args << '--config' << config.to_json
|
391
393
|
cmd << " " << Escape.shell_command(per_instance_args)
|
392
394
|
end
|
395
|
+
elsif paths.executable_deploy_hook(what).executable?
|
396
|
+
shell.status "Running deploy hook: deploy/#{what}"
|
397
|
+
run [About.hook_executor, what.to_s].join(' ') do |server, cmd|
|
398
|
+
cmd = hook_env_vars(server).reject{|k,v| v.nil?}.map{|k,v|
|
399
|
+
"#{k}=#{Escape.shell_command([v])}"
|
400
|
+
}.join(' ') + ' ' + config.framework_envs + ' ' + cmd
|
401
|
+
end
|
393
402
|
end
|
394
403
|
end
|
395
404
|
|
396
|
-
# Use [] to access attributes instead of calling methods so
|
397
|
-
# that we get nils instead of NoMethodError.
|
398
|
-
#
|
399
|
-
# Rollback doesn't know about the repository location (nor
|
400
|
-
# should it need to), but it would like to use #short_log_message.
|
401
405
|
def source
|
402
406
|
ensure_git_ssh_wrapper
|
403
407
|
@source ||= config.source(shell)
|
@@ -416,6 +420,20 @@ YML
|
|
416
420
|
cmd
|
417
421
|
end
|
418
422
|
|
423
|
+
def hook_env_vars(server)
|
424
|
+
{
|
425
|
+
'EY_DEPLOY_ACCOUNT_NAME' => config.account_name,
|
426
|
+
'EY_DEPLOY_APP' => config.app,
|
427
|
+
'EY_DEPLOY_CONFIG' => config.to_json,
|
428
|
+
'EY_DEPLOY_CURRENT_ROLES' => server.roles.to_a.join(' '),
|
429
|
+
'EY_DEPLOY_CURRENT_NAME' => server.name ? server.name.to_s : nil,
|
430
|
+
'EY_DEPLOY_ENVIRONMENT_NAME' => config.environment_name,
|
431
|
+
'EY_DEPLOY_FRAMEWORK_ENV' => config.framework_env.to_s,
|
432
|
+
'EY_DEPLOY_RELEASE_PATH' => paths.active_release.to_s,
|
433
|
+
'EY_DEPLOY_VERBOSE' => (config.verbose ? '1' : '0'),
|
434
|
+
}
|
435
|
+
end
|
436
|
+
|
419
437
|
# FIXME: Legacy method, warn and remove.
|
420
438
|
def serverside_bin
|
421
439
|
About.binary
|
@@ -58,8 +58,9 @@ module EY
|
|
58
58
|
|
59
59
|
def enable
|
60
60
|
shell.status "Enabling maintenance page."
|
61
|
-
@up = true
|
62
61
|
run "mkdir -p #{maintenance_page_dirname}"
|
62
|
+
public_system_symlink_warning
|
63
|
+
@up = true
|
63
64
|
run "cp #{source_path} #{enabled_maintenance_page_pathname}"
|
64
65
|
end
|
65
66
|
|
@@ -107,6 +108,18 @@ This application stack does not support no-downtime restarts.
|
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
111
|
+
def public_system_symlink_warning
|
112
|
+
if paths.public_system.realpath != maintenance_page_dirname.realpath
|
113
|
+
shell.warning <<-WARN
|
114
|
+
Current repository layout does not allow for maintenance pages!
|
115
|
+
Web traffic may still be served to your application.
|
116
|
+
|
117
|
+
Expected a symlink at #{paths.public_system}
|
118
|
+
|
119
|
+
To use maintenance pages, remove 'public/system' from your repository.
|
120
|
+
WARN
|
121
|
+
end
|
122
|
+
end
|
110
123
|
end
|
111
124
|
end
|
112
125
|
end
|
@@ -108,6 +108,10 @@ module EY
|
|
108
108
|
path(:active_release, 'deploy', "#{hook_name}.rb")
|
109
109
|
end
|
110
110
|
|
111
|
+
def executable_deploy_hook(hook_name)
|
112
|
+
path(:active_release, 'deploy', "#{hook_name}")
|
113
|
+
end
|
114
|
+
|
111
115
|
def repository_cache
|
112
116
|
@repository_cache ||= default_repository_cache
|
113
117
|
end
|
@@ -34,14 +34,15 @@ module EY
|
|
34
34
|
hostname == 'localhost'
|
35
35
|
end
|
36
36
|
|
37
|
-
def sync_directory_command(directory)
|
37
|
+
def sync_directory_command(directory, ignore_existing = false)
|
38
38
|
return nil if local?
|
39
|
+
ignore_flag = ignore_existing ? ["--ignore-existing"] : []
|
39
40
|
[
|
40
41
|
remote_command("mkdir -p #{directory}"),
|
41
42
|
# File mod times aren't important during deploy, and
|
42
43
|
# -a (archive mode) sets --times which causes problems.
|
43
44
|
# -a is equivalent to -rlptgoD. We remove the -t, and add -q.
|
44
|
-
Escape.shell_command(%w[rsync --delete -rlpgoDq
|
45
|
+
Escape.shell_command(%w[rsync --delete -rlpgoDq] + ignore_flag + ["-e", ssh_command, "#{directory}/", "#{user}@#{hostname}:#{directory}"])
|
45
46
|
].join(' && ')
|
46
47
|
end
|
47
48
|
|
data/spec/archive_deploy_spec.rb
CHANGED
@@ -7,8 +7,9 @@ class EY::Serverside::Source::Archive
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "Deploying a simple application" do
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
before(:all) do
|
12
|
+
adapter = EY::Serverside::Adapter.new do |args|
|
12
13
|
args.account_name = "account"
|
13
14
|
args.app = "application_name"
|
14
15
|
args.stack = "nginx_unicorn"
|
@@ -24,13 +25,6 @@ describe "Deploying a simple application" do
|
|
24
25
|
"group" => GROUP
|
25
26
|
}
|
26
27
|
end
|
27
|
-
}
|
28
|
-
|
29
|
-
let(:binpath) {
|
30
|
-
File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
|
31
|
-
}
|
32
|
-
|
33
|
-
before(:all) do
|
34
28
|
argv = adapter.deploy.commands.last.to_argv[2..-1]
|
35
29
|
with_mocked_commands do
|
36
30
|
capture do
|
@@ -54,7 +48,7 @@ describe "Deploying a simple application" do
|
|
54
48
|
|
55
49
|
it "restarts the app servers" do
|
56
50
|
restart = deploy_dir.join('current', 'restart')
|
57
|
-
restart.
|
51
|
+
expect(restart).to exist
|
58
52
|
expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_application_name deploy|)
|
59
53
|
end
|
60
54
|
end
|
data/spec/basic_deploy_spec.rb
CHANGED
@@ -7,13 +7,13 @@ describe "Deploying a simple application" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "creates a REVISION file" do
|
10
|
-
deploy_dir.join('current', 'REVISION').
|
10
|
+
expect(deploy_dir.join('current', 'REVISION')).to exist
|
11
11
|
end
|
12
12
|
|
13
13
|
it "restarts the app servers" do
|
14
14
|
restart = deploy_dir.join('current', 'restart')
|
15
|
-
restart.
|
16
|
-
restart.read.chomp.
|
15
|
+
expect(restart).to exist
|
16
|
+
expect(restart.read.chomp).to eq(%|LANG="en_US.UTF-8" /engineyard/bin/app_rails31 deploy|)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/spec/bundler_deploy_spec.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Deploying an application that uses Bundler" do
|
4
|
-
|
4
|
+
VERSION_PATTERN = Regexp.quote(::EY::Serverside::DependencyManager::Bundler.default_version)
|
5
5
|
|
6
6
|
context "with a Gemfile.lock" do
|
7
7
|
before(:all) do
|
8
8
|
deploy_test_application('ey_yml')
|
9
9
|
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
10
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{
|
10
|
+
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
11
11
|
end
|
12
12
|
|
13
13
|
it "runs the right bundler command" do
|
14
|
-
@install_bundler_command.
|
15
|
-
@install_bundler_command.
|
14
|
+
expect(@install_bundler_command).not_to be_nil
|
15
|
+
expect(@install_bundler_command).to match(/install bundler .* -v "#{VERSION_PATTERN}"/)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "runs 'bundle install' with --deployment" do
|
19
|
-
@bundle_install_command.
|
20
|
-
@bundle_install_command.
|
19
|
+
expect(@bundle_install_command).not_to be_nil
|
20
|
+
expect(@bundle_install_command).to include('--deployment')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "removes bundled_gems directory if the ruby or system version changed" do
|
24
24
|
should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
|
25
|
-
should_run_clear_bundle_cmd.
|
25
|
+
expect(should_run_clear_bundle_cmd).not_to be_nil
|
26
26
|
clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
|
27
|
-
clear_bundle_cmd.
|
27
|
+
expect(clear_bundle_cmd).not_to be_nil
|
28
28
|
end
|
29
29
|
|
30
30
|
it "has the binstubs in the path when migrating" do
|
31
|
-
deploy_dir.join('path-when-migrating').read.
|
31
|
+
expect(deploy_dir.join('path-when-migrating').read).to include('ey_bundler_binstubs')
|
32
32
|
end
|
33
33
|
|
34
34
|
it "creates a ruby version file" do
|
35
|
-
deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION').
|
35
|
+
expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
|
36
36
|
end
|
37
37
|
|
38
38
|
it "creates a system version file" do
|
39
|
-
deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION').
|
39
|
+
expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
|
40
40
|
end
|
41
41
|
|
42
42
|
it "generates bundler binstubs" do
|
43
43
|
pending "doesn't work with mocked bundler" do
|
44
|
-
deploy_dir.join('current', 'ey_bundler_binstubs', 'rake').
|
44
|
+
expect(deploy_dir.join('current', 'ey_bundler_binstubs', 'rake')).to exist
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -53,9 +53,9 @@ describe "Deploying an application that uses Bundler" do
|
|
53
53
|
|
54
54
|
it "removes bundled_gems directory if the ruby or system version changed" do
|
55
55
|
should_run_clear_bundle_cmd = @deployer.commands.grep(/diff/).first
|
56
|
-
should_run_clear_bundle_cmd.
|
56
|
+
expect(should_run_clear_bundle_cmd).to be_nil
|
57
57
|
clear_bundle_cmd = @deployer.commands.grep(/rm -Rf \S+\/bundled_gems/).first
|
58
|
-
clear_bundle_cmd.
|
58
|
+
expect(clear_bundle_cmd).not_to be_nil
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
@@ -66,13 +66,13 @@ describe "Deploying an application that uses Bundler" do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "does not run bundler commands" do
|
69
|
-
@deployer.commands.grep(/gem install bundler/).
|
70
|
-
@deployer.commands.grep(/bundle _.*_ install/).
|
69
|
+
expect(@deployer.commands.grep(/gem install bundler/)).to be_empty
|
70
|
+
expect(@deployer.commands.grep(/bundle _.*_ install/)).to be_empty
|
71
71
|
end
|
72
72
|
|
73
73
|
it "still runs the hooks" do
|
74
|
-
deploy_dir.join('current', 'before_bundle.ran' ).
|
75
|
-
deploy_dir.join('current', 'after_bundle.ran' ).
|
74
|
+
expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
|
75
|
+
expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -80,45 +80,45 @@ describe "Deploying an application that uses Bundler" do
|
|
80
80
|
before(:all) do
|
81
81
|
deploy_test_application('no_gemfile_lock')
|
82
82
|
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
83
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{
|
83
|
+
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
84
84
|
end
|
85
85
|
|
86
86
|
it "installs the proper Bundler version" do
|
87
|
-
@install_bundler_command.
|
88
|
-
@install_bundler_command.
|
87
|
+
expect(@install_bundler_command).not_to be_nil
|
88
|
+
expect(@install_bundler_command).to match(/unset RUBYOPT && gem list bundler | grep "bundler " | egrep -q "#{VERSION_PATTERN}[,)]" || gem install bundler -q --no-rdoc --no-ri -v "#{VERSION_PATTERN}"/)
|
89
89
|
end
|
90
90
|
|
91
91
|
it "runs 'bundle install' without --deployment" do
|
92
|
-
@bundle_install_command.
|
93
|
-
@bundle_install_command.
|
92
|
+
expect(@bundle_install_command).not_to be_nil
|
93
|
+
expect(@bundle_install_command).not_to match(/--deployment/)
|
94
94
|
end
|
95
95
|
|
96
96
|
it "exports GIT_SSH for the bundle install" do
|
97
|
-
@bundle_install_command.
|
97
|
+
expect(@bundle_install_command).to match(/export GIT_SSH/)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "puts down RUBY_VERSION and SYSTEM_VERSION" do
|
101
|
-
deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION').
|
102
|
-
deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION').
|
101
|
+
expect(deploy_dir.join('shared', 'bundled_gems', 'RUBY_VERSION')).to exist
|
102
|
+
expect(deploy_dir.join('shared', 'bundled_gems', 'SYSTEM_VERSION')).to exist
|
103
103
|
end
|
104
104
|
|
105
105
|
it "warns that using a lockfile is idiomatic" do
|
106
106
|
out = read_output
|
107
|
-
out.
|
107
|
+
expect(out).to match(/WARNING: Gemfile found but Gemfile.lock is missing!/)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
context "without a Gemfile.lock and ignoring the warning" do
|
112
112
|
before(:all) do
|
113
113
|
deploy_test_application('no_gemfile_lock', 'config' => {'ignore_gemfile_lock_warning' => true})
|
114
|
-
@config.ignore_gemfile_lock_warning.
|
114
|
+
expect(@config.ignore_gemfile_lock_warning).to be_true
|
115
115
|
@install_bundler_command = @deployer.commands.grep(/gem install bundler/).first
|
116
|
-
@bundle_install_command = @deployer.commands.grep(/bundle _#{
|
116
|
+
@bundle_install_command = @deployer.commands.grep(/bundle _#{VERSION_PATTERN}_ install/).first
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should not warn" do
|
120
120
|
out = read_output
|
121
|
-
out.
|
121
|
+
expect(out).not_to match(/WARNING/)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -132,8 +132,8 @@ describe "Deploying an application that uses Bundler" do
|
|
132
132
|
|
133
133
|
it "prints the failure to the log" do
|
134
134
|
out = read_output
|
135
|
-
out.
|
136
|
-
deploy_dir.join('current', 'after_bundle.ran' ).
|
135
|
+
expect(out).to match(%r|bundle install failure|)
|
136
|
+
expect(deploy_dir.join('current', 'after_bundle.ran' )).not_to exist
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -9,31 +9,31 @@ describe EY::Serverside::Deploy::Configuration do
|
|
9
9
|
'account_name' => 'acc',
|
10
10
|
'framework_env' => 'production',
|
11
11
|
})
|
12
|
-
@config.app_name.
|
13
|
-
@config.environment_name.
|
14
|
-
@config.account_name.
|
15
|
-
@config.migrate.
|
16
|
-
@config.migrate
|
17
|
-
@config.branch.
|
18
|
-
@config.maintenance_on_migrate.
|
19
|
-
@config.maintenance_on_restart.
|
20
|
-
@config.required_downtime_stack
|
21
|
-
@config.framework_env.
|
22
|
-
@config.precompile_assets.
|
23
|
-
@config.precompile_assets_inferred
|
24
|
-
@config.skip_precompile_assets
|
25
|
-
@config.precompile_assets
|
26
|
-
@config.asset_roles.
|
27
|
-
@config.user.
|
28
|
-
@config.group.
|
29
|
-
@config.verbose.
|
30
|
-
@config.copy_exclude.
|
31
|
-
@config.ignore_database_adapter_warning.
|
32
|
-
@config.ignore_gemfile_lock_warning.
|
33
|
-
@config.bundle_without.
|
34
|
-
@config.extra_bundle_install_options.
|
35
|
-
@config.deployed_by.
|
36
|
-
@config.input_ref.
|
12
|
+
expect(@config.app_name).to eq("app_name")
|
13
|
+
expect(@config.environment_name).to eq("env_name")
|
14
|
+
expect(@config.account_name).to eq("acc")
|
15
|
+
expect(@config.migrate).to eq(nil)
|
16
|
+
expect(@config.migrate?).to eq(false)
|
17
|
+
expect(@config.branch).to eq("master")
|
18
|
+
expect(@config.maintenance_on_migrate).to eq(true)
|
19
|
+
expect(@config.maintenance_on_restart).to eq(true)
|
20
|
+
expect(@config.required_downtime_stack?).to eq(true)
|
21
|
+
expect(@config.framework_env).to eq("production")
|
22
|
+
expect(@config.precompile_assets).to eq("detect")
|
23
|
+
expect(@config.precompile_assets_inferred?).to eq(true)
|
24
|
+
expect(@config.skip_precompile_assets?).to eq(false)
|
25
|
+
expect(@config.precompile_assets?).to eq(false)
|
26
|
+
expect(@config.asset_roles).to eq([:app_master, :app, :solo])
|
27
|
+
expect(@config.user).to eq(ENV['USER'])
|
28
|
+
expect(@config.group).to eq(ENV['USER'])
|
29
|
+
expect(@config.verbose).to eq(false)
|
30
|
+
expect(@config.copy_exclude).to eq([])
|
31
|
+
expect(@config.ignore_database_adapter_warning).to eq(false)
|
32
|
+
expect(@config.ignore_gemfile_lock_warning).to eq(false)
|
33
|
+
expect(@config.bundle_without).to eq(%w[test development])
|
34
|
+
expect(@config.extra_bundle_install_options).to eq(%w[--without test development])
|
35
|
+
expect(@config.deployed_by).to eq("Automation (User name not available)")
|
36
|
+
expect(@config.input_ref).to eq(@config.branch)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "raises when required options are not given" do
|
@@ -57,7 +57,7 @@ describe EY::Serverside::Deploy::Configuration do
|
|
57
57
|
capture do # deprecation warning
|
58
58
|
expect(@config.source(test_shell)).to be_a_kind_of(EY::Serverside::Source::IntegrationSpec)
|
59
59
|
end
|
60
|
-
read_output.
|
60
|
+
expect(read_output).to include("DEPRECATION WARNING: The configuration key 'strategy' is deprecated in favor of 'source_class'.")
|
61
61
|
end
|
62
62
|
|
63
63
|
it "uses source_class if set" do
|
@@ -98,28 +98,28 @@ describe EY::Serverside::Deploy::Configuration do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it "underrides options with config (directly supplied options take precedence over 'config' options)" do
|
101
|
-
@config.maintenance_on_migrate.
|
102
|
-
@config.branch.
|
101
|
+
expect(@config.maintenance_on_migrate).to eq(false)
|
102
|
+
expect(@config.branch).to eq("branch_from_command_line")
|
103
103
|
end
|
104
104
|
|
105
105
|
it "corrects command line supplied precompile_assets string (which relies on having a special not-set value of nil, so can't be a boolean)" do
|
106
|
-
@config.skip_precompile_assets
|
107
|
-
@config.precompile_assets
|
108
|
-
@config.precompile_assets_inferred
|
106
|
+
expect(@config.skip_precompile_assets?).to eq(true)
|
107
|
+
expect(@config.precompile_assets?).to eq(false)
|
108
|
+
expect(@config.precompile_assets_inferred?).to eq(false)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "doesn't require downtime on restart for nginx_passenger" do
|
112
|
-
@config.maintenance_on_migrate.
|
113
|
-
@config.maintenance_on_restart.
|
112
|
+
expect(@config.maintenance_on_migrate).to eq(false)
|
113
|
+
expect(@config.maintenance_on_restart).to eq(false)
|
114
114
|
end
|
115
115
|
|
116
116
|
it "doesn't bundle --without the framework_env" do
|
117
|
-
@config.bundle_without.
|
117
|
+
expect(@config.bundle_without).to eq(%w[test])
|
118
118
|
end
|
119
119
|
|
120
120
|
it "gets deployed_by and input_ref correct" do
|
121
|
-
@config.deployed_by.
|
122
|
-
@config.input_ref.
|
121
|
+
expect(@config.deployed_by).to eq("Martin Emde")
|
122
|
+
expect(@config.input_ref).to eq("input_branch")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -166,37 +166,37 @@ describe EY::Serverside::Deploy::Configuration do
|
|
166
166
|
it "requires 'ey.yml' and adds any defined methods to the deploy" do
|
167
167
|
write_ey_yml 'ey.yml', @yaml_data
|
168
168
|
@deploy.load_ey_yml
|
169
|
-
@deploy.config.copy_exclude.
|
169
|
+
expect(@deploy.config.copy_exclude).to eq(['.git'])
|
170
170
|
end
|
171
171
|
|
172
172
|
it "falls back to 'config/ey.yml'" do
|
173
173
|
write_ey_yml 'config/ey.yml', @yaml_data
|
174
174
|
@deploy.load_ey_yml
|
175
|
-
@deploy.config.copy_exclude.
|
175
|
+
expect(@deploy.config.copy_exclude).to eq(['.git'])
|
176
176
|
end
|
177
177
|
|
178
178
|
it "loads at lower priority than command line options" do
|
179
179
|
write_ey_yml 'ey.yml', @yaml_data
|
180
180
|
@deploy.load_ey_yml
|
181
|
-
@deploy.config.migrate
|
181
|
+
expect(@deploy.config.migrate?).to eq(false)
|
182
182
|
end
|
183
183
|
|
184
184
|
it "loads at lower priority than json config option" do
|
185
185
|
write_ey_yml 'ey.yml', @yaml_data
|
186
186
|
@deploy.load_ey_yml
|
187
|
-
@deploy.config.branch.
|
187
|
+
expect(@deploy.config.branch).to eq('branch_from_command_line')
|
188
188
|
end
|
189
189
|
|
190
190
|
it "loads bundle_without from the config, which overrides the default" do
|
191
191
|
write_ey_yml 'ey.yml', @yaml_data
|
192
192
|
@deploy.load_ey_yml
|
193
|
-
@deploy.config.bundle_without.
|
193
|
+
expect(@deploy.config.bundle_without).to eq('only test')
|
194
194
|
end
|
195
195
|
|
196
196
|
it "overrides boolean ey.yml only options with --conifg strings" do
|
197
197
|
write_ey_yml 'ey.yml', @yaml_data
|
198
198
|
@deploy.load_ey_yml
|
199
|
-
@deploy.config.
|
199
|
+
expect(@deploy.config).not_to be_maintenance_on_migrate
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end
|