engineyard-serverside 2.2.0.rc1 → 2.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/engineyard-serverside +1 -0
- data/lib/engineyard-serverside.rb +5 -0
- data/lib/engineyard-serverside/configuration.rb +0 -10
- data/lib/engineyard-serverside/maintenance.rb +20 -22
- data/lib/engineyard-serverside/task.rb +2 -8
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/configuration_spec.rb +0 -2
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +5 -0
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_disabled_utf8/README +3 -0
- data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +5 -0
- data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +7 -0
- data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +3 -0
- data/spec/rails31_deploy_spec.rb +6 -3
- data/spec/spec_helper.rb +17 -17
- data/spec/sqlite3_deploy_spec.rb +1 -1
- data/spec/support/integration.rb +2 -5
- metadata +16 -2
data/bin/engineyard-serverside
CHANGED
@@ -7,6 +7,11 @@ else
|
|
7
7
|
$string_encodings = false
|
8
8
|
end
|
9
9
|
|
10
|
+
if defined?(Encoding) && Encoding.respond_to?(:default_internal=) # String.instance_methods.include?(:force_encoding)
|
11
|
+
Encoding.default_internal = Encoding::UTF_8
|
12
|
+
Encoding.default_external = Encoding::UTF_8
|
13
|
+
end
|
14
|
+
|
10
15
|
$LOAD_PATH.unshift File.expand_path('vendor/thor/lib', File.dirname(__FILE__))
|
11
16
|
$LOAD_PATH.unshift File.expand_path('vendor/systemu/lib', File.dirname(__FILE__))
|
12
17
|
$LOAD_PATH.unshift File.expand_path('vendor/escape/lib', File.dirname(__FILE__))
|
@@ -285,16 +285,6 @@ module EY
|
|
285
285
|
[nil, 'nginx_mongrel', 'glassfish'].include? stack
|
286
286
|
end
|
287
287
|
|
288
|
-
# Enable if stack requires it or if overridden in the ey.yml config.
|
289
|
-
def enable_maintenance_page?
|
290
|
-
maintenance_on_restart? || (migrate? && maintenance_on_migrate?)
|
291
|
-
end
|
292
|
-
|
293
|
-
# We disable the maintenance page if we would have enabled.
|
294
|
-
def disable_maintenance_page?
|
295
|
-
enable_maintenance_page?
|
296
|
-
end
|
297
|
-
|
298
288
|
def configured_services
|
299
289
|
services = YAML.load_file(paths.shared_services_yml.to_s)
|
300
290
|
services.respond_to?(:keys) && !services.empty? ? services.keys : nil
|
@@ -19,8 +19,7 @@ module EY
|
|
19
19
|
enable
|
20
20
|
shell.status "Maintenance page enabled"
|
21
21
|
else
|
22
|
-
|
23
|
-
false
|
22
|
+
raise "Cannot enable maintenance page. Application #{config.app_name} has never been deployed."
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
@@ -29,13 +28,12 @@ module EY
|
|
29
28
|
disable
|
30
29
|
shell.status "Maintenance page disabled"
|
31
30
|
else
|
32
|
-
|
33
|
-
false
|
31
|
+
raise "Cannot disable maintenance page. Application #{config.app_name} has never been deployed."
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
35
|
def conditionally_enable
|
38
|
-
if
|
36
|
+
if using_maintenance_page?
|
39
37
|
enable
|
40
38
|
else
|
41
39
|
explain_not_enabling
|
@@ -43,10 +41,10 @@ module EY
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def conditionally_disable
|
46
|
-
if
|
44
|
+
if using_maintenance_page?
|
47
45
|
disable
|
48
46
|
elsif exist?
|
49
|
-
shell.
|
47
|
+
shell.notice "[Attention] Maintenance page is still up.\nYou must remove it manually using `ey web enable`."
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
@@ -54,6 +52,10 @@ module EY
|
|
54
52
|
|
55
53
|
attr_reader :config, :shell
|
56
54
|
|
55
|
+
def using_maintenance_page?
|
56
|
+
config.maintenance_on_restart? || (config.migrate? && config.maintenance_on_migrate?)
|
57
|
+
end
|
58
|
+
|
57
59
|
def enable
|
58
60
|
shell.status "Enabling maintenance page."
|
59
61
|
@up = true
|
@@ -89,23 +91,19 @@ module EY
|
|
89
91
|
|
90
92
|
def explain_not_enabling
|
91
93
|
if config.migrate?
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
94
|
+
shell.status "Skipping maintenance page. (maintenance_on_migrate is false in ey.yml)"
|
95
|
+
shell.notice "[Caution] No maintenance migrations must be non-destructive!\nRequests may be served during a partially migrated state."
|
96
|
+
elsif config.required_downtime_stack?
|
97
|
+
shell.status "Skipping maintenance page. (maintenance_on_restart is false in ey.yml, overriding recommended default)"
|
97
98
|
else
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
shell.status "Skipping maintenance page. (no-downtime restarts supported)"
|
100
|
+
end
|
101
|
+
|
102
|
+
if config.required_downtime_stack? && !exist?
|
103
|
+
shell.warning <<-WARN
|
104
|
+
No maintenance page! Brief downtime is possible during restart.
|
103
105
|
This application stack does not support no-downtime restarts.
|
104
|
-
|
105
|
-
end
|
106
|
-
elsif !config.required_downtime_stack?
|
107
|
-
shell.status "Skipping maintenance page. (no-downtime restarts supported)"
|
108
|
-
end
|
106
|
+
WARN
|
109
107
|
end
|
110
108
|
end
|
111
109
|
|
@@ -6,15 +6,9 @@ module EY
|
|
6
6
|
class Task
|
7
7
|
attr_reader :servers, :config, :shell
|
8
8
|
|
9
|
-
|
10
|
-
def c
|
11
|
-
EY::Serverside.deprecation_warning("The method 'c' is deprecated in favor of 'config' for better clarity.")
|
12
|
-
config
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(servers, conf, shell)
|
9
|
+
def initialize(servers, config, shell)
|
16
10
|
@servers = servers
|
17
|
-
@config =
|
11
|
+
@config = config
|
18
12
|
@shell = shell
|
19
13
|
@roles = :all
|
20
14
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -19,8 +19,6 @@ describe EY::Serverside::Deploy::Configuration do
|
|
19
19
|
@config.maintenance_on_migrate.should == true
|
20
20
|
@config.maintenance_on_restart.should == true
|
21
21
|
@config.required_downtime_stack?.should == true
|
22
|
-
@config.enable_maintenance_page?.should == true
|
23
|
-
@config.disable_maintenance_page?.should == true
|
24
22
|
@config.framework_env.should == "production"
|
25
23
|
@config.precompile_assets.should == "detect"
|
26
24
|
@config.precompile_assets_inferred?.should == true
|
@@ -0,0 +1,88 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.3)
|
5
|
+
actionpack (= 3.2.3)
|
6
|
+
mail (~> 2.4.4)
|
7
|
+
actionpack (3.2.3)
|
8
|
+
activemodel (= 3.2.3)
|
9
|
+
activesupport (= 3.2.3)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.1)
|
13
|
+
rack (~> 1.4.0)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.1.2)
|
17
|
+
activemodel (3.2.3)
|
18
|
+
activesupport (= 3.2.3)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
activerecord (3.2.3)
|
21
|
+
activemodel (= 3.2.3)
|
22
|
+
activesupport (= 3.2.3)
|
23
|
+
arel (~> 3.0.2)
|
24
|
+
tzinfo (~> 0.3.29)
|
25
|
+
activeresource (3.2.3)
|
26
|
+
activemodel (= 3.2.3)
|
27
|
+
activesupport (= 3.2.3)
|
28
|
+
activesupport (3.2.3)
|
29
|
+
i18n (~> 0.6)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
arel (3.0.2)
|
32
|
+
builder (3.0.0)
|
33
|
+
erubis (2.7.0)
|
34
|
+
ey_config (0.0.5)
|
35
|
+
hike (1.2.1)
|
36
|
+
i18n (0.6.0)
|
37
|
+
journey (1.0.3)
|
38
|
+
json (1.6.6)
|
39
|
+
mail (2.4.4)
|
40
|
+
i18n (>= 0.4.0)
|
41
|
+
mime-types (~> 1.16)
|
42
|
+
treetop (~> 1.4.8)
|
43
|
+
mime-types (1.18)
|
44
|
+
multi_json (1.3.2)
|
45
|
+
polyglot (0.3.3)
|
46
|
+
rack (1.4.1)
|
47
|
+
rack-cache (1.2)
|
48
|
+
rack (>= 0.4)
|
49
|
+
rack-ssl (1.3.2)
|
50
|
+
rack
|
51
|
+
rack-test (0.6.1)
|
52
|
+
rack (>= 1.0)
|
53
|
+
rails (3.2.3)
|
54
|
+
actionmailer (= 3.2.3)
|
55
|
+
actionpack (= 3.2.3)
|
56
|
+
activerecord (= 3.2.3)
|
57
|
+
activeresource (= 3.2.3)
|
58
|
+
activesupport (= 3.2.3)
|
59
|
+
bundler (~> 1.0)
|
60
|
+
railties (= 3.2.3)
|
61
|
+
railties (3.2.3)
|
62
|
+
actionpack (= 3.2.3)
|
63
|
+
activesupport (= 3.2.3)
|
64
|
+
rack-ssl (~> 1.3.2)
|
65
|
+
rake (>= 0.8.7)
|
66
|
+
rdoc (~> 3.4)
|
67
|
+
thor (~> 0.14.6)
|
68
|
+
rake (0.9.2.2)
|
69
|
+
rdoc (3.12)
|
70
|
+
json (~> 1.4)
|
71
|
+
sprockets (2.1.2)
|
72
|
+
hike (~> 1.2)
|
73
|
+
rack (~> 1.0)
|
74
|
+
tilt (~> 1.1, != 1.3.0)
|
75
|
+
thor (0.14.6)
|
76
|
+
tilt (1.3.3)
|
77
|
+
treetop (1.4.10)
|
78
|
+
polyglot
|
79
|
+
polyglot (>= 0.3.1)
|
80
|
+
tzinfo (0.3.33)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
ey_config
|
87
|
+
rails
|
88
|
+
rake
|
File without changes
|
data/spec/rails31_deploy_spec.rb
CHANGED
@@ -94,12 +94,15 @@ describe "Deploying a Rails 3.1 application" do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
context "with asset support disabled in config/application.rb" do
|
97
|
-
|
97
|
+
it "does not precompile assets" do
|
98
98
|
deploy_test_application('assets_disabled')
|
99
|
+
deploy_dir.join('current', 'precompiled').should_not exist
|
100
|
+
read_output.should include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
|
99
101
|
end
|
100
102
|
|
101
|
-
it "
|
102
|
-
|
103
|
+
it "deploys successfully when application.rb has utf-8 encoding" do
|
104
|
+
deploy_test_application('assets_disabled_utf8')
|
105
|
+
deploy_dir.join('current', 'precompiled').should exist
|
103
106
|
read_output.should include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
|
104
107
|
end
|
105
108
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -33,20 +33,6 @@ module EY
|
|
33
33
|
def short_log_message(_) "" end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
class Paths
|
38
|
-
# This needs to be patched for the tests to succeed, but
|
39
|
-
# the chances of 2 real deploys colliding in the same second
|
40
|
-
# is very very low.
|
41
|
-
def active_release
|
42
|
-
@active_release ||= if Time.now.utc.strftime("%L") =~ /L/ # old ruby
|
43
|
-
path(:releases, Time.now.utc.strftime("%Y%m%d%H%M%S#{Time.now.tv_usec}"))
|
44
|
-
else
|
45
|
-
path(:releases, Time.now.utc.strftime("%Y%m%d%H%M%S%L"))
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
36
|
end
|
51
37
|
end
|
52
38
|
|
@@ -228,6 +214,15 @@ exec "$@"
|
|
228
214
|
@deploy_dir ||= tmpdir.join("serverside-deploy-#{Time.now.to_f}-#{$$}")
|
229
215
|
end
|
230
216
|
|
217
|
+
# This needs to be patched for the tests to succeed, but
|
218
|
+
# the chances of 2 real deploys colliding in the same second
|
219
|
+
# is very very low.
|
220
|
+
#
|
221
|
+
# can't use %L n strftime because old ruby doesn't support it.
|
222
|
+
def release_path
|
223
|
+
deploy_dir.join('releases', Time.now.utc.strftime("%Y%m%d%H%M%S#{Time.now.tv_usec}"))
|
224
|
+
end
|
225
|
+
|
231
226
|
# set up EY::Serverside::Server like we're on a solo
|
232
227
|
def test_servers
|
233
228
|
@test_servers ||= EY::Serverside::Servers.from_hashes([{:hostname => 'localhost', :roles => %w[solo], :user => ENV['USER']}], test_shell)
|
@@ -239,6 +234,7 @@ exec "$@"
|
|
239
234
|
options = {
|
240
235
|
"strategy" => "IntegrationSpec",
|
241
236
|
"deploy_to" => deploy_dir.to_s,
|
237
|
+
"release_path" => release_path.to_s,
|
242
238
|
"group" => GROUP,
|
243
239
|
"stack" => 'nginx_passenger',
|
244
240
|
"migrate" => "ruby -e 'puts ENV[\"PATH\"]' > #{deploy_dir}/path-when-migrating",
|
@@ -268,9 +264,10 @@ exec "$@"
|
|
268
264
|
args.config = {
|
269
265
|
"services_check_command" => "which echo",
|
270
266
|
"services_setup_command" => "echo 'services setup command'",
|
271
|
-
"strategy"
|
272
|
-
"deploy_to"
|
273
|
-
"
|
267
|
+
"strategy" => options["strategy"],
|
268
|
+
"deploy_to" => options["deploy_to"],
|
269
|
+
"release_path" => options["release_path"],
|
270
|
+
"group" => options["group"]
|
274
271
|
}.merge(options['config'] || {})
|
275
272
|
args.framework_env = options['framework_env']
|
276
273
|
args.stack = options['stack']
|
@@ -299,6 +296,9 @@ exec "$@"
|
|
299
296
|
bundle_install_fails = extra_config.delete('bundle_install_fails')
|
300
297
|
|
301
298
|
@action = @adapter.deploy do |args|
|
299
|
+
# we must refresh the release path every deploy since we're setting it manually
|
300
|
+
args.config = args.config.merge({'release_path' => release_path})
|
301
|
+
|
302
302
|
extra_config.each do |key,val|
|
303
303
|
case key
|
304
304
|
when 'branch' then args.ref = val
|
data/spec/sqlite3_deploy_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe "Deploying an application with sqlite3 as the only DB adapter in the Ge
|
|
9
9
|
deploy_test_application('sqlite3')
|
10
10
|
@shared_path = @deployer.config.paths.shared
|
11
11
|
@release_path = @deployer.config.paths.active_release
|
12
|
-
@framework_env = @deployer.framework_env
|
12
|
+
@framework_env = @deployer.config.framework_env
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should symlink database.sqlite3.yml' do
|
data/spec/support/integration.rb
CHANGED
@@ -33,14 +33,11 @@ class FullTestDeploy < EY::Serverside::Deploy
|
|
33
33
|
# deploy does not
|
34
34
|
def bundle
|
35
35
|
my_env = ENV.to_hash
|
36
|
-
|
36
|
+
super
|
37
|
+
ensure
|
37
38
|
ENV.replace(my_env)
|
38
|
-
result
|
39
39
|
end
|
40
40
|
|
41
|
-
def framework_env
|
42
|
-
config.framework_env
|
43
|
-
end
|
44
41
|
end
|
45
42
|
|
46
43
|
class EY::Serverside::Deploy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.0.
|
4
|
+
version: 2.2.0.rc2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -284,6 +284,13 @@ files:
|
|
284
284
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock
|
285
285
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile
|
286
286
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/README
|
287
|
+
- spec/fixtures/repos/assets_disabled_utf8/app/assets/empty
|
288
|
+
- spec/fixtures/repos/assets_disabled_utf8/config/application.rb
|
289
|
+
- spec/fixtures/repos/assets_disabled_utf8/config/ey.yml
|
290
|
+
- spec/fixtures/repos/assets_disabled_utf8/Gemfile
|
291
|
+
- spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock
|
292
|
+
- spec/fixtures/repos/assets_disabled_utf8/Rakefile
|
293
|
+
- spec/fixtures/repos/assets_disabled_utf8/README
|
287
294
|
- spec/fixtures/repos/assets_enabled_all/app/assets/empty
|
288
295
|
- spec/fixtures/repos/assets_enabled_all/config/application.rb
|
289
296
|
- spec/fixtures/repos/assets_enabled_all/config/ey.yml
|
@@ -452,6 +459,13 @@ test_files:
|
|
452
459
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock
|
453
460
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile
|
454
461
|
- spec/fixtures/repos/assets_disabled_in_ey_yml/README
|
462
|
+
- spec/fixtures/repos/assets_disabled_utf8/app/assets/empty
|
463
|
+
- spec/fixtures/repos/assets_disabled_utf8/config/application.rb
|
464
|
+
- spec/fixtures/repos/assets_disabled_utf8/config/ey.yml
|
465
|
+
- spec/fixtures/repos/assets_disabled_utf8/Gemfile
|
466
|
+
- spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock
|
467
|
+
- spec/fixtures/repos/assets_disabled_utf8/Rakefile
|
468
|
+
- spec/fixtures/repos/assets_disabled_utf8/README
|
455
469
|
- spec/fixtures/repos/assets_enabled_all/app/assets/empty
|
456
470
|
- spec/fixtures/repos/assets_enabled_all/config/application.rb
|
457
471
|
- spec/fixtures/repos/assets_enabled_all/config/ey.yml
|