engineyard-serverside 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/cli.rb +3 -0
- data/lib/engineyard-serverside/configuration.rb +9 -1
- data/lib/engineyard-serverside/deploy.rb +1 -1
- data/lib/engineyard-serverside/deploy_hook.rb +1 -0
- data/lib/engineyard-serverside/server.rb +11 -1
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/deploy_hook_spec.rb +21 -16
- data/spec/fixtures/gitrepo/bar +0 -0
- data/spec/fixtures/gitrepo/foo +0 -0
- metadata +8 -4
@@ -135,6 +135,9 @@ module EY
|
|
135
135
|
|
136
136
|
config = EY::Serverside::Deploy::Configuration.new(integrate_options)
|
137
137
|
|
138
|
+
# We have to rsync the entire app dir, so we need all the permissions to be correct!
|
139
|
+
system "sudo sh -l -c 'find #{app_dir} -not -user #{config.user} -or -not -group #{config.group} -exec chown #{config.user}:#{config.group} {} +'"
|
140
|
+
|
138
141
|
load_servers(config)
|
139
142
|
|
140
143
|
invoke :propagate
|
@@ -128,8 +128,16 @@ module EY
|
|
128
128
|
release_path + '/ey_bundler_binstubs'
|
129
129
|
end
|
130
130
|
|
131
|
+
def framework_env_names
|
132
|
+
%w[RAILS_ENV RACK_ENV NODE_ENV MERB_ENV]
|
133
|
+
end
|
134
|
+
|
131
135
|
def framework_envs
|
132
|
-
"
|
136
|
+
framework_env_names.map { |e| "#{e}=#{environment}" }.join(' ')
|
137
|
+
end
|
138
|
+
|
139
|
+
def set_framework_envs
|
140
|
+
framework_env_names.each { |e| ENV[e] = environment }
|
133
141
|
end
|
134
142
|
|
135
143
|
def current_path
|
@@ -211,7 +211,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
211
211
|
[[ -x #{path} ]] || cat > #{path} <<'SSH'
|
212
212
|
#!/bin/sh
|
213
213
|
unset SSH_AUTH_SOCK
|
214
|
-
ssh -o CheckHostIP=no -o StrictHostKeyChecking=no -o
|
214
|
+
ssh -o CheckHostIP=no -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o LogLevel=INFO -o IdentityFile=#{identity_file} -o IdentitiesOnly=yes $*
|
215
215
|
SSH
|
216
216
|
chmod 0700 #{path}
|
217
217
|
WRAP
|
@@ -87,8 +87,18 @@ module EY
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
# Make a known hosts tempfile to absorb host fingerprints so we don't show
|
91
|
+
#
|
92
|
+
# Warning: Permanently added 'xxx' (RSA) to the list of known hosts.
|
93
|
+
#
|
94
|
+
# for every ssh command.
|
95
|
+
# (even with StrictHostKeyChecking=no, the warning output is annoying)
|
96
|
+
def self.known_hosts_file
|
97
|
+
@known_hosts_file ||= Tempfile.new('ey-ss-known-hosts')
|
98
|
+
end
|
99
|
+
|
90
100
|
def ssh_command
|
91
|
-
"ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o UserKnownHostsFile
|
101
|
+
"ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o UserKnownHostsFile=#{self.class.known_hosts_file.path} -o PasswordAuthentication=no "
|
92
102
|
end
|
93
103
|
|
94
104
|
end
|
data/spec/deploy_hook_spec.rb
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "the deploy-hook API" do
|
4
|
-
|
5
|
-
|
6
|
-
@callback_context = EY::Serverside::DeployHook::CallbackContext.new(@hook.config)
|
4
|
+
def deploy_hook(options={})
|
5
|
+
EY::Serverside::DeployHook.new(options)
|
7
6
|
end
|
8
7
|
|
9
8
|
def run_hook(options={}, &blk)
|
10
9
|
raise ArgumentError unless block_given?
|
11
|
-
options.each do |k, v|
|
12
|
-
@callback_context.configuration[k] = v
|
13
|
-
end
|
14
|
-
|
15
10
|
# The hooks on the filesystem are run by passing a string to
|
16
11
|
# context.instance_eval, not a block. However, using a block
|
17
12
|
# should allow us to get the same degree of test coverage and
|
18
13
|
# still let us have things like syntax checking work on this spec
|
19
14
|
# file.
|
20
|
-
|
15
|
+
deploy_hook(options).callback_context.instance_eval(&blk)
|
21
16
|
end
|
22
17
|
|
23
18
|
context "#run" do
|
@@ -46,9 +41,9 @@ describe "the deploy-hook API" do
|
|
46
41
|
end
|
47
42
|
|
48
43
|
it "runs things with sudo" do
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
callback = deploy_hook.callback_context
|
45
|
+
callback.should_receive(:system).with("sudo sh -l -c 'do it as root'").and_return(true)
|
46
|
+
callback.instance_eval { sudo("do it as root") }
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
@@ -123,6 +118,15 @@ describe "the deploy-hook API" do
|
|
123
118
|
end
|
124
119
|
end
|
125
120
|
|
121
|
+
context "environment variables" do
|
122
|
+
it "sets the framework env variables" do
|
123
|
+
run_hook('framework_env' => 'production') { ENV['RAILS_ENV'] }.should == 'production'
|
124
|
+
run_hook('framework_env' => 'production') { ENV['RACK_ENV'] }.should == 'production'
|
125
|
+
run_hook('framework_env' => 'production') { ENV['MERB_ENV'] }.should == 'production'
|
126
|
+
run_hook('framework_env' => 'production') { ENV['NODE_ENV'] }.should == 'production'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
126
130
|
context "has methods to run code only on certain instances" do
|
127
131
|
def scenarios
|
128
132
|
[
|
@@ -141,10 +145,11 @@ describe "the deploy-hook API" do
|
|
141
145
|
|
142
146
|
def where_code_runs_with(method, *args)
|
143
147
|
scenarios.map do |s|
|
144
|
-
|
145
|
-
|
148
|
+
hook_result = run_hook('current_roles' => s[:instance_role].split(','), 'current_name' => s[:name]) do
|
149
|
+
send(method, *args) { 'ran!' }
|
150
|
+
end
|
146
151
|
|
147
|
-
if
|
152
|
+
if hook_result == 'ran!'
|
148
153
|
result = s[:instance_role]
|
149
154
|
result << "_#{s[:name]}" if s[:name]
|
150
155
|
result
|
@@ -189,14 +194,14 @@ describe "the deploy-hook API" do
|
|
189
194
|
context "#syntax_error" do
|
190
195
|
it "returns nil for hook files containing valid Ruby syntax" do
|
191
196
|
hook_path = File.expand_path('../fixtures/valid_hook.rb', __FILE__)
|
192
|
-
|
197
|
+
deploy_hook.syntax_error(hook_path).should be_nil
|
193
198
|
end
|
194
199
|
|
195
200
|
it "returns a brief problem description for hook files containing valid Ruby syntax" do
|
196
201
|
hook_path = File.expand_path('../fixtures/invalid_hook.rb', __FILE__)
|
197
202
|
desc = "spec/fixtures/invalid_hook.rb:1: syntax error, unexpected '^'"
|
198
203
|
match = /#{Regexp.escape desc}/
|
199
|
-
|
204
|
+
deploy_hook.syntax_error(hook_path).should =~ match
|
200
205
|
end
|
201
206
|
end
|
202
207
|
|
File without changes
|
File without changes
|
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: 1.6.
|
4
|
+
version: 1.6.5
|
5
5
|
prerelease:
|
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: 2012-
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -323,6 +323,8 @@ files:
|
|
323
323
|
- spec/deploy_hook_spec.rb
|
324
324
|
- spec/deprecation_spec.rb
|
325
325
|
- spec/fixtures/gemfiles/1.0.21-rails-31-with-sqlite
|
326
|
+
- spec/fixtures/gitrepo/bar
|
327
|
+
- spec/fixtures/gitrepo/foo
|
326
328
|
- spec/fixtures/gitrepo.tar.gz
|
327
329
|
- spec/fixtures/invalid_hook.rb
|
328
330
|
- spec/fixtures/lockfiles/0.9-no-bundler
|
@@ -365,7 +367,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
365
367
|
version: '0'
|
366
368
|
segments:
|
367
369
|
- 0
|
368
|
-
hash: -
|
370
|
+
hash: -3529286902582306998
|
369
371
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
370
372
|
none: false
|
371
373
|
requirements:
|
@@ -374,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
374
376
|
version: 1.3.6
|
375
377
|
requirements: []
|
376
378
|
rubyforge_project:
|
377
|
-
rubygems_version: 1.8.
|
379
|
+
rubygems_version: 1.8.24
|
378
380
|
signing_key:
|
379
381
|
specification_version: 3
|
380
382
|
summary: A gem that deploys ruby applications on EY Cloud instances
|
@@ -385,6 +387,8 @@ test_files:
|
|
385
387
|
- spec/deploy_hook_spec.rb
|
386
388
|
- spec/deprecation_spec.rb
|
387
389
|
- spec/fixtures/gemfiles/1.0.21-rails-31-with-sqlite
|
390
|
+
- spec/fixtures/gitrepo/bar
|
391
|
+
- spec/fixtures/gitrepo/foo
|
388
392
|
- spec/fixtures/gitrepo.tar.gz
|
389
393
|
- spec/fixtures/invalid_hook.rb
|
390
394
|
- spec/fixtures/lockfiles/0.9-no-bundler
|