engineyard 1.3.11 → 1.3.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard/connection/system.rb +96 -0
- data/lib/engineyard/model/instance.rb +11 -6
- data/lib/engineyard/version.rb +1 -1
- metadata +110 -58
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'escape'
|
2
|
+
|
3
|
+
module EY
|
4
|
+
module Connection
|
5
|
+
class System
|
6
|
+
def adapter(app, instances, verbose)
|
7
|
+
require 'engineyard-serverside-adapter'
|
8
|
+
EY::Serverside::Adapter.new("/usr/local/ey_resin/ruby/bin") do |args|
|
9
|
+
args.app = app.name
|
10
|
+
args.repo = app.repository_uri
|
11
|
+
args.instances = instances
|
12
|
+
args.verbose = verbose || ENV['DEBUG']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
private :adapter
|
16
|
+
|
17
|
+
def deploy(app, ref, instances, stack_name, framework_env, migration_command=nil, extra_configuration=nil, verbose=false)
|
18
|
+
deploy_command = adapter(app, instances, verbose).deploy do |args|
|
19
|
+
args.ref = ref
|
20
|
+
args.stack = stack_name
|
21
|
+
args.framework_env = framework_env
|
22
|
+
args.migrate = migration_command if migration_command
|
23
|
+
args.config = extra_configuration if extra_configuration
|
24
|
+
end
|
25
|
+
|
26
|
+
invoke deploy_command
|
27
|
+
end
|
28
|
+
|
29
|
+
def rollback(app, instances, stack_name, framework_env, extra_configuration=nil, verbose=false)
|
30
|
+
rollback = adapter(app, instances, verbose).rollback do |args|
|
31
|
+
args.stack = stack_name
|
32
|
+
args.framework_env = framework_env
|
33
|
+
args.config = extra_configuration if extra_configuration
|
34
|
+
end
|
35
|
+
invoke rollback
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def put_up_maintenance_page(app, instances, verbose=false)
|
40
|
+
invoke adapter(app, instances, verbose).enable_maintenance_page
|
41
|
+
end
|
42
|
+
|
43
|
+
def take_down_maintenance_page(app, instances, verbose=false)
|
44
|
+
invoke adapter(app, instances, verbose).disable_maintenance_page
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
def engineyard_serverside_hostname
|
50
|
+
# If we tell engineyard-serverside to use 'localhost', it'll run
|
51
|
+
# commands on the instance directly (#system). If we give it the
|
52
|
+
# instance's actual hostname, it'll SSH to itself.
|
53
|
+
#
|
54
|
+
# Using 'localhost' instead of its EC2 hostname speeds up
|
55
|
+
# deploys on solos and single-app-server clusters significantly.
|
56
|
+
app_master? ? 'localhost' : hostname
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def ssh(remote_command, output = true)
|
62
|
+
user = environment.username
|
63
|
+
|
64
|
+
cmd = Escape.shell_command(%w[ssh -o StrictHostKeyChecking=no -q] << "#{user}@#{hostname}" << remote_command)
|
65
|
+
cmd << " > /dev/null" unless output
|
66
|
+
EY.ui.debug(cmd)
|
67
|
+
unless ENV["NO_SSH"]
|
68
|
+
system cmd
|
69
|
+
else
|
70
|
+
true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def invoke(action)
|
75
|
+
action.call do |cmd|
|
76
|
+
puts cmd if action.verbose
|
77
|
+
ssh cmd
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def instances_data
|
82
|
+
environment.instances.select { |inst| inst.has_app_code? }.map do |i|
|
83
|
+
{
|
84
|
+
:hostname => i.engineyard_serverside_hostname,
|
85
|
+
:roles => [i.role],
|
86
|
+
:name => i.name,
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def app_master?
|
92
|
+
environment.app_master == self
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -71,11 +71,17 @@ module EY
|
|
71
71
|
|
72
72
|
private
|
73
73
|
|
74
|
-
def ssh(remote_command, &block)
|
75
|
-
raise(ArgumentError, "Block required!") unless
|
76
|
-
|
77
|
-
|
74
|
+
def ssh(remote_command, verbose, &block)
|
75
|
+
raise(ArgumentError, "Block required!") unless block
|
76
|
+
|
77
|
+
raw_cmd = %w[ssh -o StrictHostKeyChecking=no]
|
78
|
+
raw_cmd << '-q' unless verbose
|
79
|
+
raw_cmd << "#{environment.username}@#{hostname}"
|
80
|
+
raw_cmd << remote_command
|
81
|
+
|
82
|
+
cmd = Escape.shell_command(raw_cmd)
|
78
83
|
EY.ui.debug(cmd)
|
84
|
+
puts cmd if verbose
|
79
85
|
if ENV["NO_SSH"]
|
80
86
|
block.call("NO_SSH is set. No output.")
|
81
87
|
true
|
@@ -87,8 +93,7 @@ module EY
|
|
87
93
|
|
88
94
|
def invoke(action, &block)
|
89
95
|
action.call do |cmd|
|
90
|
-
|
91
|
-
ssh cmd do |chunk|
|
96
|
+
ssh cmd, action.verbose do |chunk|
|
92
97
|
$stdout << chunk
|
93
98
|
block.call(chunk) if block
|
94
99
|
end
|
data/lib/engineyard/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 1.3.
|
9
|
+
- 12
|
10
|
+
version: 1.3.12
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- EY Cloud Team
|
@@ -14,104 +15,119 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-10 00:00:00 -08:00
|
18
19
|
default_executable: ey
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
|
-
name: thor
|
23
|
-
type: :runtime
|
24
22
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
25
24
|
requirements:
|
26
25
|
- - ~>
|
27
26
|
- !ruby/object:Gem::Version
|
27
|
+
hash: 43
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
- 14
|
31
31
|
- 6
|
32
32
|
version: 0.14.6
|
33
|
-
|
34
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
name: thor
|
35
34
|
prerelease: false
|
36
|
-
|
35
|
+
requirement: *id001
|
37
36
|
type: :runtime
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
38
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
39
40
|
requirements:
|
40
41
|
- - ~>
|
41
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
42
44
|
segments:
|
43
45
|
- 1
|
44
46
|
- 4
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
- 2
|
48
|
+
version: 1.4.2
|
49
|
+
name: rest-client
|
48
50
|
prerelease: false
|
49
|
-
|
51
|
+
requirement: *id002
|
50
52
|
type: :runtime
|
53
|
+
- !ruby/object:Gem::Dependency
|
51
54
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
52
56
|
requirements:
|
53
57
|
- - ~>
|
54
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 13
|
55
60
|
segments:
|
56
61
|
- 1
|
57
62
|
- 6
|
58
63
|
- 1
|
59
64
|
version: 1.6.1
|
60
|
-
|
61
|
-
- !ruby/object:Gem::Dependency
|
65
|
+
name: highline
|
62
66
|
prerelease: false
|
63
|
-
|
67
|
+
requirement: *id003
|
64
68
|
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
65
70
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
66
72
|
requirements:
|
67
73
|
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
69
76
|
segments:
|
70
77
|
- 0
|
71
78
|
version: "0"
|
72
|
-
|
73
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
name: json_pure
|
74
80
|
prerelease: false
|
75
|
-
|
81
|
+
requirement: *id004
|
76
82
|
type: :runtime
|
83
|
+
- !ruby/object:Gem::Dependency
|
77
84
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
78
86
|
requirements:
|
79
87
|
- - ~>
|
80
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 23
|
81
90
|
segments:
|
82
91
|
- 0
|
83
92
|
- 0
|
84
93
|
- 4
|
85
94
|
version: 0.0.4
|
86
|
-
|
87
|
-
- !ruby/object:Gem::Dependency
|
95
|
+
name: escape
|
88
96
|
prerelease: false
|
89
|
-
|
97
|
+
requirement: *id005
|
90
98
|
type: :runtime
|
99
|
+
- !ruby/object:Gem::Dependency
|
91
100
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
92
102
|
requirements:
|
93
103
|
- - "="
|
94
104
|
- !ruby/object:Gem::Version
|
105
|
+
hash: 7
|
95
106
|
segments:
|
96
107
|
- 1
|
97
108
|
- 4
|
98
109
|
- 0
|
99
110
|
version: 1.4.0
|
100
|
-
|
101
|
-
- !ruby/object:Gem::Dependency
|
111
|
+
name: engineyard-serverside-adapter
|
102
112
|
prerelease: false
|
103
|
-
|
113
|
+
requirement: *id006
|
104
114
|
type: :runtime
|
115
|
+
- !ruby/object:Gem::Dependency
|
105
116
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
106
118
|
requirements:
|
107
119
|
- - ~>
|
108
120
|
- !ruby/object:Gem::Version
|
121
|
+
hash: 21
|
109
122
|
segments:
|
110
123
|
- 1
|
111
124
|
- 0
|
112
125
|
- 1
|
113
126
|
version: 1.0.1
|
127
|
+
name: open4
|
128
|
+
prerelease: false
|
114
129
|
requirement: *id007
|
130
|
+
type: :runtime
|
115
131
|
description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
|
116
132
|
email: cloud@engineyard.com
|
117
133
|
executables:
|
@@ -122,34 +138,66 @@ extra_rdoc_files: []
|
|
122
138
|
|
123
139
|
files:
|
124
140
|
- bin/ey
|
125
|
-
- lib/engineyard/cli.rb
|
126
141
|
- lib/engineyard/api.rb
|
127
|
-
- lib/engineyard/error.rb
|
128
|
-
- lib/engineyard/ruby_ext.rb
|
129
142
|
- lib/engineyard/cli/api.rb
|
130
|
-
- lib/engineyard/cli/web.rb
|
131
143
|
- lib/engineyard/cli/recipes.rb
|
132
144
|
- lib/engineyard/cli/ui.rb
|
133
|
-
- lib/engineyard/
|
134
|
-
- lib/engineyard/
|
135
|
-
- lib/engineyard/model/environment.rb
|
136
|
-
- lib/engineyard/model/app.rb
|
137
|
-
- lib/engineyard/model/deployment.rb
|
138
|
-
- lib/engineyard/model/account.rb
|
139
|
-
- lib/engineyard/model/api_struct.rb
|
140
|
-
- lib/engineyard/thor.rb
|
141
|
-
- lib/engineyard/model.rb
|
142
|
-
- lib/engineyard/repo.rb
|
145
|
+
- lib/engineyard/cli/web.rb
|
146
|
+
- lib/engineyard/cli.rb
|
143
147
|
- lib/engineyard/collection/abstract.rb
|
144
148
|
- lib/engineyard/collection/apps.rb
|
145
149
|
- lib/engineyard/collection/environments.rb
|
146
150
|
- lib/engineyard/collection.rb
|
147
151
|
- lib/engineyard/config.rb
|
148
|
-
- lib/engineyard/
|
152
|
+
- lib/engineyard/connection/system.rb
|
153
|
+
- lib/engineyard/error.rb
|
154
|
+
- lib/engineyard/model/account.rb
|
155
|
+
- lib/engineyard/model/api_struct.rb
|
156
|
+
- lib/engineyard/model/app.rb
|
157
|
+
- lib/engineyard/model/deployment.rb
|
158
|
+
- lib/engineyard/model/environment.rb
|
159
|
+
- lib/engineyard/model/instance.rb
|
160
|
+
- lib/engineyard/model/log.rb
|
161
|
+
- lib/engineyard/model.rb
|
162
|
+
- lib/engineyard/repo.rb
|
149
163
|
- lib/engineyard/resolver.rb
|
164
|
+
- lib/engineyard/ruby_ext.rb
|
165
|
+
- lib/engineyard/thor.rb
|
166
|
+
- lib/engineyard/version.rb
|
150
167
|
- lib/engineyard.rb
|
151
168
|
- LICENSE
|
152
169
|
- README.rdoc
|
170
|
+
- spec/engineyard/api_spec.rb
|
171
|
+
- spec/engineyard/cli/api_spec.rb
|
172
|
+
- spec/engineyard/cli_spec.rb
|
173
|
+
- spec/engineyard/collection/apps_spec.rb
|
174
|
+
- spec/engineyard/collection/environments_spec.rb
|
175
|
+
- spec/engineyard/config_spec.rb
|
176
|
+
- spec/engineyard/model/api_struct_spec.rb
|
177
|
+
- spec/engineyard/model/environment_spec.rb
|
178
|
+
- spec/engineyard/model/instance_spec.rb
|
179
|
+
- spec/engineyard/repo_spec.rb
|
180
|
+
- spec/engineyard/resolver_spec.rb
|
181
|
+
- spec/engineyard_spec.rb
|
182
|
+
- spec/ey/deploy_spec.rb
|
183
|
+
- spec/ey/ey_spec.rb
|
184
|
+
- spec/ey/list_environments_spec.rb
|
185
|
+
- spec/ey/logs_spec.rb
|
186
|
+
- spec/ey/rebuild_spec.rb
|
187
|
+
- spec/ey/recipes/apply_spec.rb
|
188
|
+
- spec/ey/recipes/download_spec.rb
|
189
|
+
- spec/ey/recipes/upload_spec.rb
|
190
|
+
- spec/ey/rollback_spec.rb
|
191
|
+
- spec/ey/ssh_spec.rb
|
192
|
+
- spec/ey/web/disable_spec.rb
|
193
|
+
- spec/ey/web/enable_spec.rb
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
- spec/support/bundled_ey
|
196
|
+
- spec/support/fake_awsm.ru
|
197
|
+
- spec/support/git_repo.rb
|
198
|
+
- spec/support/helpers.rb
|
199
|
+
- spec/support/ruby_ext.rb
|
200
|
+
- spec/support/shared_behavior.rb
|
153
201
|
has_rdoc: true
|
154
202
|
homepage: http://github.com/engineyard/engineyard
|
155
203
|
licenses: []
|
@@ -160,55 +208,59 @@ rdoc_options: []
|
|
160
208
|
require_paths:
|
161
209
|
- lib
|
162
210
|
required_ruby_version: !ruby/object:Gem::Requirement
|
211
|
+
none: false
|
163
212
|
requirements:
|
164
213
|
- - ">="
|
165
214
|
- !ruby/object:Gem::Version
|
215
|
+
hash: 3
|
166
216
|
segments:
|
167
217
|
- 0
|
168
218
|
version: "0"
|
169
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
|
+
none: false
|
170
221
|
requirements:
|
171
222
|
- - ">="
|
172
223
|
- !ruby/object:Gem::Version
|
224
|
+
hash: 3
|
173
225
|
segments:
|
174
226
|
- 0
|
175
227
|
version: "0"
|
176
228
|
requirements: []
|
177
229
|
|
178
230
|
rubyforge_project:
|
179
|
-
rubygems_version: 1.3.
|
231
|
+
rubygems_version: 1.3.7
|
180
232
|
signing_key:
|
181
233
|
specification_version: 3
|
182
234
|
summary: Command-line deployment for the Engine Yard cloud
|
183
235
|
test_files:
|
184
|
-
- spec/
|
185
|
-
- spec/
|
186
|
-
- spec/support/ruby_ext.rb
|
187
|
-
- spec/support/helpers.rb
|
188
|
-
- spec/support/bundled_ey
|
189
|
-
- spec/support/shared_behavior.rb
|
236
|
+
- spec/engineyard/api_spec.rb
|
237
|
+
- spec/engineyard/cli/api_spec.rb
|
190
238
|
- spec/engineyard/cli_spec.rb
|
239
|
+
- spec/engineyard/collection/apps_spec.rb
|
240
|
+
- spec/engineyard/collection/environments_spec.rb
|
191
241
|
- spec/engineyard/config_spec.rb
|
192
|
-
- spec/engineyard/cli/api_spec.rb
|
193
242
|
- spec/engineyard/model/api_struct_spec.rb
|
194
243
|
- spec/engineyard/model/environment_spec.rb
|
195
244
|
- spec/engineyard/model/instance_spec.rb
|
196
|
-
- spec/engineyard/resolver_spec.rb
|
197
|
-
- spec/engineyard/collection/apps_spec.rb
|
198
|
-
- spec/engineyard/collection/environments_spec.rb
|
199
245
|
- spec/engineyard/repo_spec.rb
|
200
|
-
- spec/engineyard/
|
246
|
+
- spec/engineyard/resolver_spec.rb
|
247
|
+
- spec/engineyard_spec.rb
|
248
|
+
- spec/ey/deploy_spec.rb
|
249
|
+
- spec/ey/ey_spec.rb
|
201
250
|
- spec/ey/list_environments_spec.rb
|
202
|
-
- spec/ey/rollback_spec.rb
|
203
251
|
- spec/ey/logs_spec.rb
|
204
252
|
- spec/ey/rebuild_spec.rb
|
205
|
-
- spec/ey/recipes/download_spec.rb
|
206
253
|
- spec/ey/recipes/apply_spec.rb
|
254
|
+
- spec/ey/recipes/download_spec.rb
|
207
255
|
- spec/ey/recipes/upload_spec.rb
|
208
|
-
- spec/ey/
|
209
|
-
- spec/ey/
|
256
|
+
- spec/ey/rollback_spec.rb
|
257
|
+
- spec/ey/ssh_spec.rb
|
210
258
|
- spec/ey/web/disable_spec.rb
|
211
259
|
- spec/ey/web/enable_spec.rb
|
212
|
-
- spec/ey/ssh_spec.rb
|
213
|
-
- spec/engineyard_spec.rb
|
214
260
|
- spec/spec_helper.rb
|
261
|
+
- spec/support/bundled_ey
|
262
|
+
- spec/support/fake_awsm.ru
|
263
|
+
- spec/support/git_repo.rb
|
264
|
+
- spec/support/helpers.rb
|
265
|
+
- spec/support/ruby_ext.rb
|
266
|
+
- spec/support/shared_behavior.rb
|