engineyard 2.0.13 → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,351 @@
1
+ # ey
2
+
3
+ ### Install
4
+
5
+ Install engineyard like any other ruby gem:
6
+
7
+ gem install engineyard
8
+
9
+ Note: Don't add engineyard to your application's Gemfile. The engineyard gem is
10
+ not made to be a part of your application and may cause version conflicts with
11
+ other parts of rails.
12
+
13
+ ### Login
14
+
15
+ The first command you run will notice that you are not logged in and will ask
16
+ you for your Engine Yard email and password.
17
+
18
+ ### Configuration
19
+
20
+ The `ey.yml` file allows options to be saved for each environment to which an
21
+ application is deployed. Here's an example ey.yml file in `ROOT/config/ey.yml`:
22
+
23
+ $ cat config/ey.yml
24
+ ---
25
+ # 'defaults' applies to all environments running this application.
26
+ defaults:
27
+ bundle_without: test development mygroup # exclude groups on bundle install (leave blank to remove --without)
28
+ bundle_options: --local # add extra options to the bundle install command line (does not override bundle_without)
29
+ copy_exclude: # don't rsync the following dirs
30
+ - .git
31
+ maintenance_on_restart: false # show maintenance page during app restart (default: false except for glassfish and mongrel)
32
+ maintenance_on_migrate: false # show maintenance page during migrations (default: true)
33
+ precompile_assets: true # enables rails assets precompilation (default: inferred using app/assets and config/application.rb)
34
+ precomplie_assets_task: assets:precompile # override the assets:precompile rake task
35
+ precompile_unchanged_assets: true # precompiles assets even if no changes would be detected (does not check for changes at all).
36
+ asset_dependencies: app/assets # a list of relative paths to search for asset changes during each deploy.
37
+ assets_strategy: shifting # choose an alternet asset management strategy (shifting, cleaning, private, shared)
38
+ asset_roles: :all # specify on which roles to compile assets (default: [:app, :app_master, :solo] - must be an Array)
39
+ asset_roles: # (Array input for multiple roles) - Use hook deploy/before_compile_assets.rb for finer grained control.
40
+ - :app
41
+ - :app_master
42
+ - :util
43
+ ignore_database_adapter_warning: true # hide database adapter warning if you don't use MySQL or PostgreSQL (default: false)
44
+
45
+ # Environment specific options apply only to a single environment and override settings in defaults.
46
+ environments:
47
+ env_production:
48
+ precompile_unchanged_assets: true # precompiles assets even if no changes would be detected (does not check for changes at all).
49
+ assets_strategy: shifting # choose an alternet asset management strategy (shifting, cleaning, private, shared)
50
+ asset_roles: :all # specify on which roles to compile assets (default: [:app, :app_master, :solo] - must be an Array)
51
+ env_staging
52
+ assets_strategy: private # Use an asset management that always refreshes, so staging enviroments don't get conflicts
53
+
54
+ These options in `ey.yml` will only work if the file is committed to your
55
+ application repository. Make sure to commit this file. Different branches
56
+ may also have different versions of this file if necessary. The ey.yml file
57
+ found in the deploying commit will be used for the current deploy.
58
+
59
+
60
+ ### Commands
61
+
62
+ #### ey deploy
63
+
64
+ This command must be run within the current directory containing the app to be
65
+ deployed. If ey.yml specifies a default branch then the ref parameter can be
66
+ omitted. Furthermore, if a default branch is specified but a different
67
+ command is supplied the deploy will fail unless `--ignore-default-branch`
68
+ is used.
69
+
70
+ If ey.yml does not specify a default migrate choice, you will be prompted to
71
+ specify a migration choice. A different command can later be specified via
72
+ `--migrate "ruby do_migrations.rb"`. Migrations can also be skipped entirely
73
+ by using --no-migrate.
74
+
75
+ Options:
76
+
77
+ -r, [--ref=REF] [--branch=] [--tag=] # Git ref to deploy. May be a branch, a tag, or a SHA.
78
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
79
+ -a, [--app=APP] # Name of the application to deploy
80
+ -e, [--environment=ENVIRONMENT] # Environment in which to deploy this application
81
+ -m, [--migrate=MIGRATE] # Run migrations via [MIGRATE], defaults to 'rake db:migrate'; use --no-migrate to avoid running migrations
82
+ -v, [--verbose] # Be verbose
83
+ [--ignore-default-branch] # Force a deploy of the specified branch even if a default is set
84
+ [--ignore-bad-master] # Force a deploy even if the master is in a bad state
85
+ [--extra-deploy-hook-options key:val] # Additional options to be made available in deploy hooks (in the 'config' hash)
86
+ # Add more keys as follows: --extra-deploy-hook-options key1:val1 key2:val2
87
+
88
+ #### ey timeout-deploy
89
+
90
+ The latest running deployment will be marked as failed, allowing a
91
+ new deployment to be run. It is possible to mark a potentially successful
92
+ deployment as failed. Only run this when a deployment is known to be
93
+ wrongly unfinished/stuck and when further deployments are blocked.
94
+
95
+ NOTICE: This command is will indiscriminately timeout any deploy, with no
96
+ regard for its potential success or failure. Confirm that the running
97
+ deploy is actually stuck or broken before running this command. If run
98
+ against a deploy that would succeed, it could cause the deployment to be
99
+ marked as failed incorrectly.
100
+
101
+ Options:
102
+
103
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
104
+ -a, [--app=APP] # Name of the application containing the environment
105
+ -e, [--environment=ENVIRONMENT] # Name of the environment with the desired deployment
106
+
107
+
108
+ #### ey status
109
+
110
+ Show the status of most recent deployment of the specified application and
111
+ environment. This action only informational and will not change your application.
112
+
113
+ Options:
114
+
115
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
116
+ -a, [--app=APP] # Name of the application containing the environment
117
+ -e, [--environment=ENVIRONMENT] # Name of the environment with the desired deployment
118
+
119
+ #### ey environments
120
+
121
+ By default, environments for this app are displayed. The `--all` option will
122
+ display all environments, including those for this app.
123
+
124
+ Options:
125
+
126
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
127
+ -a, [--app=APP] # Name of the application containing the environments
128
+ -e, [--environment=ENVIRONMENT] # Show only environments matching named environment
129
+ -s, [--simple] # Print each environment name on its own on a new line
130
+ -a, [--all] # Show all environments, not just ones associated with this application.
131
+
132
+
133
+ #### ey logs
134
+
135
+ Displays Engine Yard configuration logs for all servers in the environment. If
136
+ recipes were uploaded to the environment and run, their logs will also be
137
+ displayed beneath the main configuration logs.
138
+
139
+ Options:
140
+
141
+ -e, [--environment=ENVIRONMENT] # Environment with the interesting logs
142
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
143
+
144
+ #### ey rebuild
145
+
146
+ Engine Yard's main configuration run occurs on all servers. Mainly used to fix
147
+ failed configuration of new or existing servers, or to update servers to latest
148
+ Engine Yard stack (e.g. to apply an Engine Yard supplied security patch).
149
+
150
+ Note that uploaded recipes are also run after the main configuration run has
151
+ successfully completed.
152
+
153
+ This command will return immediately, but the rebuild process may take a few
154
+ minutes to complete.
155
+
156
+ Options:
157
+
158
+ -e, [--environment=ENVIRONMENT] # Environment to rebuild
159
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
160
+
161
+ #### ey rollback
162
+
163
+ Uses code from previous deploy in the `/data/APP_NAME/releases` directory on
164
+ remote server(s) to restart application servers.
165
+
166
+ Options:
167
+
168
+ -v, [--verbose] # Be verbose
169
+ -a, [--app=APP] # Name of the application to roll back
170
+ -e, [--environment=ENVIRONMENT] # Environment in which to roll back the application
171
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
172
+
173
+ #### ey recipes apply
174
+
175
+ This is similar to `ey rebuild` except Engine Yard's main configuration step is
176
+ skipped.
177
+
178
+ Options:
179
+
180
+ -e, [--environment=ENVIRONMENT] # Environment in which to apply recipes
181
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
182
+
183
+ #### ey recipes upload
184
+
185
+ The current directory should contain a subdirectory named `cookbooks` to be
186
+ uploaded.
187
+
188
+ Options:
189
+
190
+ -e, [--environment=ENVIRONMENT] # Environment that will receive the recipes
191
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
192
+ [--apply] # Apply the recipes (same as above) immediately after uploading
193
+ -f, [--file=FILE] # Specify a gzipped tar file (.tgz) for upload instead of cookbooks/ directory
194
+
195
+ #### ey recipes download
196
+
197
+ The recipes will be unpacked into a directory called `cookbooks` in the current
198
+ directory. If the cookbooks directory already exists, an error will be raised.
199
+
200
+ Options:
201
+
202
+ -e, [--environment=ENVIRONMENT] # Environment for which to download the recipes
203
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
204
+
205
+ #### ey web enable
206
+
207
+ Remove the maintenance page for this application in the given environment.
208
+
209
+ Options:
210
+
211
+ -v, [--verbose] # Be verbose
212
+ -a, [--app=APP] # Name of the application whose maintenance page will be removed
213
+ -e, [--environment=ENVIRONMENT] # Environment on which to take down the maintenance page
214
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
215
+
216
+ #### ey web disable
217
+
218
+ The maintenance page is taken from the app currently being deployed. This means
219
+ that you can customize maintenance pages to tell users the reason for downtime
220
+ on every particular deploy.
221
+
222
+ Maintenance pages searched for in order of decreasing priority:
223
+
224
+ * public/maintenance.html.custom
225
+ * public/maintenance.html.tmp
226
+ * public/maintenance.html
227
+ * public/system/maintenance.html.default
228
+
229
+ Options:
230
+
231
+ -v, [--verbose] # Be verbose
232
+ -a, [--app=APP] # Name of the application whose maintenance page will be put up
233
+ -e, [--environment=ENVIRONMENT] # Environment on which to put up the maintenance page
234
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
235
+
236
+ #### ey web restart
237
+
238
+ Restarts the application servers for the given application. Enables maintenance
239
+ pages if it would be enabled during a normal deploy. Respects the
240
+ `maintenance_on_restart` ey.yml configuration.
241
+
242
+ Options:
243
+
244
+ -v, [--verbose] # Be verbose
245
+ -a, [--app=APP] # Name of the application to restart
246
+ -e, [--environment=ENVIRONMENT] # Name of the environment to restart
247
+ -c, [--account=ACCOUNT] # Name of the account in which the app and environment can be found
248
+
249
+ #### ey ssh
250
+
251
+ If a command is supplied, it will be run, otherwise a session will be opened.
252
+ The application master is used for environments with clusters. Option `--all`
253
+ requires a command to be supplied and runs it on all servers.
254
+
255
+ Note: this command is a bit picky about its ordering. To run a command with
256
+ arguments on all servers, like `rm -f /some/file`, you need to order it like so:
257
+
258
+ $ ey ssh "rm -f /some/file" -e my-environment --all
259
+
260
+ Options:
261
+
262
+ [--utilities=one two three] # Run command on the utility servers with the given names. If no names are given, run on all utility servers.
263
+ [--app-servers] # Run command on all application servers
264
+ [--db-servers] # Run command on the database servers
265
+ [--db-master] # Run command on the master database server
266
+ -A, [--all] # Run command on all servers
267
+ [--db-slaves] # Run command on the slave database servers
268
+ -e, [--environment=ENVIRONMENT] # Name of the environment to ssh into
269
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
270
+
271
+ #### ey launch
272
+
273
+ Open the application in a browser.
274
+
275
+ Options:
276
+
277
+ -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
278
+ -a, [--app=APP] # Name of the application to launch
279
+ -e, [--environment=ENVIRONMENT] # Name of the environment for the application
280
+
281
+ #### ey whoami
282
+
283
+ Who am I logged in as? Prints the name and email of the current logged in user.
284
+
285
+ #### ey login
286
+
287
+ Log in and verify access to EY Cloud. Use logout first if you need to switch
288
+ user accounts.
289
+
290
+ #### ey logout
291
+
292
+ Remove the current API key from `~/.eyrc` or file at env variable `$EYRC`
293
+
294
+
295
+ ### Global Options
296
+
297
+ All commands accept the following options.
298
+
299
+ --api-token=API_TOKEN # Use API-TOKEN to authenticate this command
300
+ --serverside-version=SERVERSIDE_VERSION # Please use with care! Override deploy system version
301
+ # (same as ENV variable ENGINEYARD_SERVERSIDE_VERSION)
302
+
303
+ Not all commands will make use of these options. For example,
304
+ ey status does not use, and will ignore the --serverside-version flag.
305
+
306
+ Also, please consider that it's usually not a good idea to override the
307
+ version of serverside unless you know what you're doing. CLI and serverside
308
+ versions are designed to work together and mixing them can cause errors.
309
+
310
+
311
+ ### API Client
312
+
313
+ See [engineyard-cloud-client](https://github.com/engineyard/engineyard-cloud-client) for the API client library.
314
+
315
+ ### DEBUG
316
+
317
+ The API commands will print internal information if `$DEBUG` is set:
318
+
319
+ $ DEBUG=1 ey environments --all
320
+ GET https://cloud.engineyard.com/api/v2/apps
321
+ Params {"no_instances"=>"true"}
322
+ Headers {"User-Agent"=>"EngineYard/2.0.0 EngineYardCloudClient/1.0.5",
323
+ "Accept"=>"application/json",
324
+ "X-EY-Cloud-Token"=>"YOURTOKEN"}
325
+ Response {"apps"=>
326
+ [{"environments"=>[],
327
+ "name"=>"myapp",
328
+ "repository_uri"=>"git@github.com:myaccount/myapp.git",
329
+ "app_type_id"=>"rails3",
330
+ "account"=>{"name"=>"myaccount", "id"=>1234},
331
+ "id"=>12345}]}
332
+
333
+ ### Releasing
334
+
335
+ To release the engineyard gem, use the command below and then follow the
336
+ instructions it outputs.
337
+
338
+ bundle exec rake release
339
+
340
+ This will remove the `.pre` from the current version, then bump the patch level
341
+ and add `.pre` after for the next version. The version will be tagged in git.
342
+
343
+ To release a new `engineyard-serverside` gem that has already been pushed to
344
+ rubygems.org, update `lib/engineyard/version.rb` to refer to the
345
+ `engineyard-serverside` version you want to release, then make a commit.
346
+ Each engineyard gem is hard-linked to a specific default engineyard-serverside
347
+ version which can be overriden with the `--serverside-version` option.
348
+
349
+ The `engineyard-serverside-adapter` version does not need to be bumped in the
350
+ gemspec unless you're also releasing a new version of that gem. Versions
351
+ of adapter are no longer linked to serverside.
@@ -22,7 +22,7 @@ module EY
22
22
  super(given_args, {:shell => ui}.merge(config))
23
23
  rescue EY::Error, EY::CloudClient::Error => e
24
24
  ui.print_exception(e)
25
- exit 1
25
+ raise
26
26
  rescue Interrupt => e
27
27
  puts
28
28
  ui.print_exception(e)
@@ -99,6 +99,12 @@ module EY
99
99
  ui.info "Beginning deploy...", :green
100
100
  begin
101
101
  deployment.start
102
+ rescue
103
+ ui.error "Error encountered before deploy. Deploy not started."
104
+ raise
105
+ end
106
+
107
+ begin
102
108
  ui.show_deployment(deployment)
103
109
  out << "Deploy initiated.\n"
104
110
 
@@ -113,9 +119,17 @@ module EY
113
119
  end
114
120
  deployment.successful = runner.call(out, err)
115
121
  rescue Interrupt
122
+ Signal.trap(:INT) { # The fingers you have used to dial are too fat...
123
+ ui.info "\nRun `ey timeout-deploy` to mark an unfinished deployment as failed."
124
+ exit 1
125
+ }
116
126
  err << "Interrupted. Deployment halted.\n"
117
- ui.warn "Recording canceled deployment in Engine Yard Cloud..."
118
- ui.warn "WARNING: Interrupting again may result in a never-finished deployment in the deployment history on Engine Yard Cloud."
127
+ ui.warn <<-WARN
128
+ Recording interruption of this unfinished deployment in Engine Yard Cloud...
129
+
130
+ WARNING: Interrupting again may prevent Engine Yard Cloud from recording this
131
+ failed deployment. Unfinished deployments can block future deploys.
132
+ WARN
119
133
  raise
120
134
  rescue StandardError => e
121
135
  deployment.err << "Error encountered during deploy.\n#{e.class} #{e}\n"
@@ -135,6 +149,44 @@ module EY
135
149
  end
136
150
  end
137
151
 
152
+ desc "timeout-deploy [--environment ENVIRONMENT]",
153
+ "Fail a stuck unfinished deployment."
154
+ long_desc <<-DESC
155
+ NOTICE: Timing out a deploy does not stop currently running deploy
156
+ processes.
157
+
158
+ This command must be run in the current directory containing the app.
159
+ The latest running deployment will be marked as failed, allowing a
160
+ new deployment to be run. It is possible to mark a potentially successful
161
+ deployment as failed. Only run this when a deployment is known to be
162
+ wrongly unfinished/stuck and when further deployments are blocked.
163
+ DESC
164
+ method_option :environment, :type => :string, :aliases => %w(-e),
165
+ :required => true, :default => false,
166
+ :desc => "Environment in which to deploy this application"
167
+ method_option :app, :type => :string, :aliases => %w(-a),
168
+ :required => true, :default => '',
169
+ :desc => "Name of the application to deploy"
170
+ method_option :account, :type => :string, :aliases => %w(-c),
171
+ :required => true, :default => '',
172
+ :desc => "Name of the account in which the environment can be found"
173
+ def timeout_deploy
174
+ app_env = fetch_app_environment(options[:app], options[:environment], options[:account])
175
+ deployment = app_env.last_deployment
176
+ if deployment && !deployment.finished?
177
+ begin
178
+ ui.info "Marking last deployment failed...", :green
179
+ deployment.timeout
180
+ ui.deployment_status(deployment)
181
+ rescue EY::CloudClient::RequestFailed => e
182
+ ui.error "Error encountered attempting to timeout previous deployment."
183
+ raise
184
+ end
185
+ else
186
+ raise EY::Error, "No unfinished deployment was found for #{app_env.hierarchy_name}."
187
+ end
188
+ end
189
+
138
190
  desc "status", "Show the deployment status of the app"
139
191
  long_desc <<-DESC
140
192
  Show the current status of most recent deployment of the specified
@@ -10,7 +10,7 @@ module EY
10
10
  attr_reader :path
11
11
 
12
12
  def initialize(file = nil)
13
- @path = file || CONFIG_FILES.find{|pathname| pathname.exist? }
13
+ @path = file ? Pathname.new(file) : CONFIG_FILES.find{|pathname| pathname.exist? }
14
14
  @config = (@path ? YAML.load_file(@path.to_s) : {}) || {} # load_file returns `false' when the file is empty
15
15
  @config["environments"] ||= {}
16
16
  end
@@ -29,6 +29,18 @@ module EY
29
29
  @config.key?(key) || super
30
30
  end
31
31
 
32
+ def fetch(key, default = nil, &block)
33
+ block ? @config.fetch(key.to_s, &block) : @config.fetch(key.to_s, default)
34
+ end
35
+
36
+ def fetch_from_defaults(key, default=nil, &block)
37
+ block ? defaults.fetch(key.to_s, &block) : defaults.fetch(key.to_s, default)
38
+ end
39
+
40
+ def [](key)
41
+ @config[key.to_s.downcase]
42
+ end
43
+
32
44
  def endpoint
33
45
  env_var_endpoint || default_endpoint
34
46
  end
@@ -52,6 +64,10 @@ module EY
52
64
  d && d.first
53
65
  end
54
66
 
67
+ def defaults
68
+ @config['defaults'] ||= {}
69
+ end
70
+
55
71
  def environment_config(environment_name)
56
72
  environments[environment_name] ||= {}
57
73
  EnvironmentConfig.new(environments[environment_name], environment_name, self)
@@ -60,6 +76,10 @@ module EY
60
76
  def set_environment_option(environment_name, key, value)
61
77
  environments[environment_name] ||= {}
62
78
  environments[environment_name][key] = value
79
+ write_ey_yaml
80
+ end
81
+
82
+ def write_ey_yaml
63
83
  ensure_path
64
84
  comments = ey_yml_comments
65
85
  @path.open('w') do |f|
@@ -68,24 +88,32 @@ module EY
68
88
  end
69
89
  end
70
90
 
91
+ def set_default_option(key, value)
92
+ defaults[key] = value
93
+ write_ey_yaml
94
+ end
95
+
71
96
  EY_YML_HINTS = <<-HINTS
72
97
  # ey.yml supports many deploy configuration options when committed in an
73
98
  # application's repository.
74
99
  #
75
100
  # Valid locations: REPO_ROOT/ey.yml or REPO_ROOT/config/ey.yml.
76
101
  #
77
- # Examples options:
102
+ # Examples options (defaults apply to all environments for this application):
78
103
  #
104
+ # defaults:
105
+ # migrate: true # Default --migrate choice for ey deploy
106
+ # migration_command: 'rake migrate' # Default migrate command to run when migrations are enabled
107
+ # branch: default_deploy_branch # Branch/ref to be deployed by default during ey deploy
108
+ # bundle_without: development test # The string to pass to bundle install --without ''
109
+ # maintenance_on_migrate: true # Enable maintenance page during migrate action (use with caution) (default: true)
110
+ # maintenance_on_restart: false # Enable maintanence page during every deploy (default: false for unicorn & passenger)
111
+ # ignore_database_adapter_warning: false # Hide the warning shown when the Gemfile does not contain a recognized database adapter (mongodb for example)
112
+ # your_own_custom_key: 'any attribute you put in ey.yml is available in deploy hooks'
79
113
  # environments:
80
114
  # YOUR_ENVIRONMENT_NAME: # All options pertain only to the named environment
81
- # migrate: true # Default --migrate choice for ey deploy
82
- # migration_command: 'rake migrate' # Default migrate command to run when migrations are enabled
83
- # branch: default_deploy_branch # Branch/ref to be deployed by default during ey deploy
84
- # bundle_without: development test # The string to pass to bundle install --without ''
85
- # maintenance_on_migrate: true # Enable maintenance page during migrate action (use with caution) (default: true)
86
- # maintenance_on_restart: false # Enable maintanence page during every deploy (default: false for unicorn & passenger)
87
- # ignore_database_adapter_warning: false # Hide the warning shown when the Gemfile does not contain a recognized database adapter (mongodb for example)
88
- # your_own_custom_key: 'any attribute you put in ey.yml is available in deploy hooks'
115
+ # any_option: 'override any of the options above with specific options for certain environments'
116
+ # migrate: false
89
117
  #
90
118
  # Further information available here:
91
119
  # https://support.cloud.engineyard.com/entries/20996661-customize-your-deployment-on-engine-yard-cloud
@@ -129,16 +157,18 @@ module EY
129
157
  end
130
158
 
131
159
  def fetch(key, default = nil, &block)
132
- if block
133
- @config.fetch(key.to_s, &block)
134
- else
135
- @config.fetch(key.to_s, default)
160
+ @config.fetch(key.to_s) do
161
+ @parent.fetch_from_defaults(key.to_s, default, &block)
136
162
  end
137
163
  end
138
164
 
139
165
  def set(key, val)
140
- @config[key.to_s] = val
141
- @parent.set_environment_option(@name, key, val)
166
+ if @config.empty? || !@config.has_key?(key.to_s)
167
+ @parent.set_default_option(key, val)
168
+ else
169
+ @config[key.to_s] = val
170
+ @parent.set_environment_option(@name, key, val)
171
+ end
142
172
  val
143
173
  end
144
174
 
@@ -154,8 +184,8 @@ module EY
154
184
  fetch('branch', nil)
155
185
  end
156
186
 
157
- def migrate(&block)
158
- fetch('migrate', &block)
187
+ def migrate
188
+ fetch('migrate')
159
189
  end
160
190
 
161
191
  def migrate=(mig)
@@ -57,12 +57,12 @@ module EY
57
57
  end
58
58
 
59
59
  def perform_from_cli_opts
60
- @perform = !!cli_opts.fetch('migrate') { return false } # yields on not found
60
+ @perform = cli_opts.fetch('migrate') { return false } # yields on not found
61
61
  true
62
62
  end
63
63
 
64
64
  def perform_from_config
65
- @perform = !!env_config.migrate { return perform_implied_via_command_in_config }
65
+ @perform = env_config.fetch('migrate') { return perform_implied_via_command_in_config }
66
66
  if @perform
67
67
  unless command_from_config
68
68
  env_config.migration_command = DEFAULT
@@ -1,4 +1,4 @@
1
1
  module EY
2
- VERSION = '2.0.13'
3
- ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.0.7'
2
+ VERSION = '2.1.0.rc1'
3
+ ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.1.0.rc1'
4
4
  end
@@ -1,15 +1,19 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  describe EY::DeployConfig::Migrate do
4
5
  before do
5
- @parent = mock('parent config mock')
6
- @parent.stub!(:set_environment_option)
7
- @parent.stub!(:path).and_return('path')
6
+ @tempfile = Tempfile.new('ey.yml')
7
+ @parent = EY::Config.new(@tempfile.path)
8
8
  @ui = EY::CLI::UI.new
9
9
  EY::CLI::UI::Prompter.enable_mock!
10
10
  @repo = mock('repo')
11
11
  end
12
12
 
13
+ after do
14
+ @tempfile.unlink
15
+ end
16
+
13
17
  def env_config(opts=nil)
14
18
  @env_config ||= EY::Config::EnvironmentConfig.new(opts, 'envname', @parent)
15
19
  end
@@ -20,26 +24,26 @@ describe EY::DeployConfig::Migrate do
20
24
 
21
25
  context "inside a repository" do
22
26
  context "no migrate options set (interactive)" do
23
- it "prompts migrate and command by default" do
27
+ it "prompts migrate and command and adds to defaults section" do
24
28
  EY::CLI::UI::Prompter.add_answer "" # default
25
29
  EY::CLI::UI::Prompter.add_answer ""
26
- @parent.should_receive(:set_environment_option).with('envname', 'migrate', true)
27
- @parent.should_receive(:set_environment_option).with('envname', 'migration_command', 'rake db:migrate')
30
+ @parent.should_receive(:set_default_option).with('migrate', true)
31
+ @parent.should_receive(:set_default_option).with('migration_command', 'rake db:migrate')
28
32
  dc = deploy_config({})
29
33
  out = capture_stdout do
30
34
  dc.migrate.should be_true
31
35
  dc.migrate_command.should == 'rake db:migrate'
32
36
  end
33
- out.should =~ /path: migrate settings saved for envname/
37
+ out.should =~ /#{@tempfile.path}: migrate settings saved for envname/
34
38
  out.should =~ /You can override this default with --migrate or --no-migrate/
35
- out.should =~ /Please git commit path with these new changes./
39
+ out.should =~ /Please git commit #{@tempfile.path} with these new changes./
36
40
  end
37
41
 
38
42
  it "prompts migration_command if first answer is yes" do
39
43
  EY::CLI::UI::Prompter.add_answer "yes" # default
40
44
  EY::CLI::UI::Prompter.add_answer "ruby script/migrate"
41
- @parent.should_receive(:set_environment_option).with('envname', 'migrate', true)
42
- @parent.should_receive(:set_environment_option).with('envname', 'migration_command', 'ruby script/migrate')
45
+ @parent.should_receive(:set_default_option).with('migrate', true)
46
+ @parent.should_receive(:set_default_option).with('migration_command', 'ruby script/migrate')
43
47
  dc = deploy_config({})
44
48
  capture_stdout do
45
49
  dc.migrate.should be_true
@@ -49,7 +53,7 @@ describe EY::DeployConfig::Migrate do
49
53
 
50
54
  it "doesn't prompt migration_command if first answer is no" do
51
55
  EY::CLI::UI::Prompter.add_answer "no" # default
52
- @parent.should_receive(:set_environment_option).with('envname', 'migrate', false)
56
+ @parent.should_receive(:set_default_option).with('migrate', false)
53
57
  dc = deploy_config({})
54
58
  capture_stdout do
55
59
  dc.migrate.should be_false
@@ -135,7 +135,7 @@ describe "ey deploy" do
135
135
  @ssh_commands.last.should =~ /--migrate 'rake db:migrate'/
136
136
  File.exist?('ey.yml').should be_false
137
137
  ey_yml.should be_exist
138
- env_conf = read_yaml(ey_yml.to_s)['environments']['giblets']
138
+ env_conf = read_yaml(ey_yml.to_s)['defaults']
139
139
  env_conf['migrate'].should == true
140
140
  env_conf['migration_command'].should == 'rake db:migrate'
141
141
  end
@@ -150,7 +150,7 @@ describe "ey deploy" do
150
150
  @ssh_commands.last.should =~ /engineyard-serverside.*deploy/
151
151
  @ssh_commands.last.should =~ /--migrate 'ruby migrate'/
152
152
  File.exist?('ey.yml').should be_true
153
- env_conf = read_yaml('ey.yml')['environments']['giblets']
153
+ env_conf = read_yaml('ey.yml')['defaults']
154
154
  env_conf['migrate'].should == true
155
155
  env_conf['migration_command'].should == 'ruby migrate'
156
156
  end
@@ -163,7 +163,7 @@ describe "ey deploy" do
163
163
  @ssh_commands.last.should =~ /engineyard-serverside.*deploy/
164
164
  @ssh_commands.last.should_not =~ /--migrate/
165
165
  File.exist?('ey.yml').should be_true
166
- read_yaml('ey.yml')['environments']['giblets']['migrate'].should == false
166
+ read_yaml('ey.yml')['defaults']['migrate'].should == false
167
167
  end
168
168
  end
169
169
 
@@ -178,14 +178,30 @@ describe "ey deploy" do
178
178
  @ssh_commands.last.should match(/--migrate 'rake db:migrate'/)
179
179
  end
180
180
 
181
- context "customized in ey.yml" do
182
- before { write_yaml({"environments" => {"giblets" => { "migration_command" => 'thor fancy:migrate' }}}, 'ey.yml') }
181
+ context "customized in ey.yml with defaults" do
182
+ before { write_yaml({"defaults" => { "migration_command" => "thor fancy:migrate"}}, 'ey.yml') }
183
183
  after { File.unlink 'ey.yml' }
184
184
 
185
185
  it "migrates with the custom command by default (and fixes ey.yml to reflect the previous default behavior)" do
186
186
  fast_ey %w[deploy]
187
187
  @ssh_commands.last.should =~ /--migrate 'thor fancy:migrate'/
188
- read_yaml('ey.yml')['environments']['giblets']['migrate'].should == true
188
+ read_yaml('ey.yml')['defaults']['migrate'].should == true
189
+ end
190
+ end
191
+
192
+ context "customized in ey.yml with environment specific options overriding the defaults" do
193
+ before do
194
+ write_yaml({
195
+ "defaults" => { "migration_command" => "rake plain:migrate"},
196
+ "environments" => {"giblets" => { "migration_command" => 'thor fancy:migrate' }}
197
+ }, 'ey.yml')
198
+ end
199
+ after { File.unlink 'ey.yml' }
200
+
201
+ it "migrates with the custom command by default (and fixes ey.yml for the specific environment to reflect the previous default behavior)" do
202
+ fast_ey %w[deploy]
203
+ @ssh_commands.last.should =~ /--migrate 'thor fancy:migrate'/
204
+ read_yaml('ey.yml')['defaults']['migrate'].should == true
189
205
  end
190
206
  end
191
207
 
@@ -217,7 +233,7 @@ describe "ey deploy" do
217
233
  it "migrates with the default (and writes the default to ey.yml)" do
218
234
  fast_ey %w[deploy]
219
235
  @ssh_commands.last.should match(/--migrate 'rake db:migrate'/)
220
- read_yaml('ey.yml')['environments']['giblets']['migration_command'].should == 'rake db:migrate'
236
+ read_yaml('ey.yml')['defaults']['migration_command'].should == 'rake db:migrate'
221
237
  end
222
238
  end
223
239
 
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey timeout-deploy" do
4
+ given "integration"
5
+
6
+ it "timeouts the last deployment" do
7
+ login_scenario "Stuck Deployment"
8
+ fast_ey %w[timeout-deploy]
9
+ @out.should match(/Marking last deployment failed.../)
10
+ @out.should match(/Finished at:\s+\w+/)
11
+ end
12
+
13
+ it "complains when there is no stuck deployment" do
14
+ login_scenario "one app, one environment"
15
+ fast_failing_ey ["timeout-deploy"]
16
+ @err.should include(%|No unfinished deployment was found for main/rails232app/giblets.|)
17
+ end
18
+ end
@@ -212,6 +212,7 @@ module SpecHelpers
212
212
  "one app, one environment, not linked" => "Unlinked App",
213
213
  "two apps" => "Two Apps",
214
214
  "one app, one environment" => "Linked App",
215
+ "Stuck Deployment" => "Stuck Deployment",
215
216
  "two accounts, two apps, two environments, ambiguous" => "Multiple Ambiguous Accounts",
216
217
  "one app, one environment, no instances" => "Linked App Not Running",
217
218
  "one app, one environment, app master red" => "Linked App Red Master",
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
5
- prerelease:
4
+ version: 2.1.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Engine Yard Cloud Team
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-16 00:00:00.000000000 Z
12
+ date: 2013-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 2.0.5
69
+ version: 2.0.7
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 2.0.5
77
+ version: 2.0.7
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: engineyard-cloud-client
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 1.0.7
85
+ version: 1.0.11
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 1.0.7
93
+ version: 1.0.11
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: net-ssh
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -112,17 +112,17 @@ dependencies:
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - '='
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 2.1.0
117
+ version: '2.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - '='
123
+ - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 2.1.0
125
+ version: '2.1'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rspec
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -299,6 +299,22 @@ dependencies:
299
299
  - - ! '>='
300
300
  - !ruby/object:Gem::Version
301
301
  version: '0'
302
+ - !ruby/object:Gem::Dependency
303
+ name: oj
304
+ requirement: !ruby/object:Gem::Requirement
305
+ none: false
306
+ requirements:
307
+ - - ! '>='
308
+ - !ruby/object:Gem::Version
309
+ version: '0'
310
+ type: :development
311
+ prerelease: false
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - ! '>='
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
302
318
  description: This gem allows you to deploy your rails application to the Engine Yard
303
319
  cloud directly from the command line.
304
320
  email: cloud@engineyard.com
@@ -359,7 +375,7 @@ files:
359
375
  - lib/vendor/thor/README.md
360
376
  - lib/vendor/thor/thor.gemspec
361
377
  - LICENSE
362
- - README.rdoc
378
+ - README.md
363
379
  - spec/engineyard/cli/api_spec.rb
364
380
  - spec/engineyard/cli_spec.rb
365
381
  - spec/engineyard/config_spec.rb
@@ -380,6 +396,7 @@ files:
380
396
  - spec/ey/rollback_spec.rb
381
397
  - spec/ey/ssh_spec.rb
382
398
  - spec/ey/status_spec.rb
399
+ - spec/ey/timeout_deploy_spec.rb
383
400
  - spec/ey/web/disable_spec.rb
384
401
  - spec/ey/web/enable_spec.rb
385
402
  - spec/ey/web/restart_spec.rb
@@ -394,27 +411,11 @@ files:
394
411
  - spec/support/shared_behavior.rb
395
412
  homepage: http://github.com/engineyard/engineyard
396
413
  licenses: []
397
- post_install_message: ! "Thank you for downloading engineyard gem version 2!\n\n############
398
- NOTICE when upgrading from 1.x to 2.x ############\n\nFirst, if you have any trouble,
399
- you can uninstall this version to downgrade.\nThis version of the CLI does not affect
400
- the web deploy system.\nPlease file a support ticket if you have any issues at:
401
- support.cloud.engineyard.com\n\n* IMPORTANT: eydeploy.rb modifications MUST be verified
402
- in staging!\n Many internals have changed that could break eydeploy.rb!\n* The
403
- order of compile_assets has *changed*. It now runs before\n the maintenance page
404
- is enabled, to reduce downtime.\n* ey.yml files should be checked in to your repository.\n*
405
- Default bundler version is now 1.1.5.\n\nA few other nice changes:\n\n* All CLI
406
- commands are significantly faster. Woo!\n* Deploy hooks now have access to `account_name`
407
- and `environment_name`.\n* Deploy hooks can now use run! and sudo! to abort on failure.\n*
408
- Supports new ey.yml options when ey.yml is committed:\n * maintenance_on_restart:
409
- true/false (default: false except for glassfish and mongrel)\n * maintenance_on_migrate:
410
- true/false (default: true)\n * precompile_assets: true/false (default: inferred
411
- using app/assets and config/application.rb)\n * ignore_database_adapter_warning:
412
- true (hides adapter warning)\n * asset_roles: :all (specify on which roles to compile
413
- assets (default: [:app, :app_master, :solo])\n* Don't remove maintenance pages that
414
- weren't put up during this deploy if maintenance options (above) are set to false.\n*
415
- ey web restart - restarts web servers without deploying.\n\nDeploying for the first
416
- time? The Engine Yard Pandas want to help you!\nEmail pandas@engineyard.com with
417
- your questions.\n"
414
+ post_install_message: ! "Thanks for installing engineyard 2.1.\n\nNeed help? Problem?
415
+ https://support.cloud.engineyard.com\nNot working? Uninstall this version to downgrade.\n\nIMPORTANT:\n
416
+ \ Please verify eydeploy.rb files in staging after upgrading!\n Many internals
417
+ have changed that could break eydeploy.rb.\n\nDeploying for the first time? The
418
+ Engine Yard Pandas want to help you!\nEmail pandas@engineyard.com with your questions.\n"
418
419
  rdoc_options: []
419
420
  require_paths:
420
421
  - lib
@@ -424,18 +425,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
424
425
  - - ! '>='
425
426
  - !ruby/object:Gem::Version
426
427
  version: '0'
427
- segments:
428
- - 0
429
- hash: -2355853462827576949
430
428
  required_rubygems_version: !ruby/object:Gem::Requirement
431
429
  none: false
432
430
  requirements:
433
- - - ! '>='
431
+ - - ! '>'
434
432
  - !ruby/object:Gem::Version
435
- version: '0'
436
- segments:
437
- - 0
438
- hash: -2355853462827576949
433
+ version: 1.3.1
439
434
  requirements: []
440
435
  rubyforge_project:
441
436
  rubygems_version: 1.8.25
@@ -463,6 +458,7 @@ test_files:
463
458
  - spec/ey/rollback_spec.rb
464
459
  - spec/ey/ssh_spec.rb
465
460
  - spec/ey/status_spec.rb
461
+ - spec/ey/timeout_deploy_spec.rb
466
462
  - spec/ey/web/disable_spec.rb
467
463
  - spec/ey/web/enable_spec.rb
468
464
  - spec/ey/web/restart_spec.rb
data/README.rdoc DELETED
@@ -1,275 +0,0 @@
1
- = ey
2
-
3
- == Install
4
-
5
- Install engineyard like any other ruby gem:
6
-
7
- gem install engineyard
8
-
9
- Note: Don't add engineyard to your application's Gemfile. The engineyard gem is not made to be a part of your application and may cause version conflicts with other parts of rails.
10
-
11
- == Login
12
-
13
- The first command you run will notice that you are not logged in and will ask you for your Engine Yard email and password.
14
-
15
- == Configuration
16
-
17
- The ey.yml file allows options to be saved for each environment to which an application is deployed. Here's an example ey.yml file in RAILS_ROOT/config/ey.yml:
18
-
19
- $ cat config/ey.yml
20
- ---
21
- environments:
22
- env_production:
23
- migrate: false # run migration command on every deploy
24
- migration_command: rake fancy:migrate # default migration command
25
- branch: deploy # default branch to deploy
26
- default: true # make this environment default
27
- bundle_without: test development mygroup # exclude groups on bundle install
28
- copy_exclude: # don't rsync the following dirs
29
- - .git
30
- maintenance_on_restart: false # show maintenance page during app restart (default: false except for glassfish and mongrel)
31
- maintenance_on_migrate: false # show maintenance page during migrations (default: true)
32
- precompile_assets: true # enables rails assets precompilation (default: inferred using app/assets and config/application.rb)
33
- asset_roles: :all # specify on which roles to compile assets (default: [:app, :app_master, :solo] - must be an Array)
34
- asset_roles: # (Array input for multiple roles) - Use hook deploy/before_compile_assets.rb for finer grained control.
35
- - :app
36
- - :app_master
37
- - :util
38
- ignore_database_adapter_warning: true # hide database adapter warning if you don't use MySQL or PostgreSQL (default: false)
39
-
40
- Many of the options in ey.yml will only work if the file is committed to your application repository. Make sure to commit this file.
41
-
42
- == Commands
43
-
44
- === ey deploy
45
-
46
- This command must be run within the current directory containing the app to be
47
- deployed. If ey.yml specifies a default branch then the ref parameter can be
48
- omitted. Furthermore, if a default branch is specified but a different
49
- command is supplied the deploy will fail unless --ignore-default-branch
50
- is used.
51
-
52
- If ey.yml does not specify a default migrate choice, you will be prompted to
53
- specify a migration choice. A different command can later be specified via
54
- --migrate "ruby do_migrations.rb". Migrations can also be skipped entirely
55
- by using --no-migrate.
56
-
57
- Options:
58
-
59
- -r, [--ref=REF] [--branch=] [--tag=] # Git ref to deploy. May be a branch, a tag, or a SHA.
60
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
61
- -a, [--app=APP] # Name of the application to deploy
62
- -e, [--environment=ENVIRONMENT] # Environment in which to deploy this application
63
- -m, [--migrate=MIGRATE] # Run migrations via [MIGRATE], defaults to 'rake db:migrate'; use --no-migrate to avoid running migrations
64
- -v, [--verbose] # Be verbose
65
- [--ignore-default-branch] # Force a deploy of the specified branch even if a default is set
66
- [--ignore-bad-master] # Force a deploy even if the master is in a bad state
67
- [--extra-deploy-hook-options key:val] # Additional options to be made available in deploy hooks (in the 'config' hash)
68
- # Add more keys as follows: --extra-deploy-hook-options key1:val1 key2:val2
69
-
70
-
71
- === ey status
72
-
73
- Show the status of most recent deployment of the specified application and environment. This action only informational and will not change your application.
74
-
75
- Options:
76
-
77
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
78
- -a, [--app=APP] # Name of the application containing the environment
79
- -e, [--environment=ENVIRONMENT] # Name of the environment with the desired deployment
80
-
81
- === ey environments
82
-
83
- By default, environments for this app are displayed. The --all option will display all environments, including those for this app.
84
-
85
- Options:
86
-
87
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
88
- -a, [--app=APP] # Name of the application containing the environments
89
- -e, [--environment=ENVIRONMENT] # Show only environments matching named environment
90
- -s, [--simple] # Print each environment name on its own on a new line
91
- -a, [--all] # Show all environments, not just ones associated with this application.
92
-
93
-
94
- === ey logs
95
-
96
- Displays Engine Yard configuration logs for all servers in the environment. If recipes were uploaded to the environment & run, their logs will also be displayed beneath the main configuration logs.
97
-
98
- Options:
99
-
100
- -e, [--environment=ENVIRONMENT] # Environment with the interesting logs
101
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
102
-
103
- === ey rebuild
104
-
105
- Engine Yard's main configuration run occurs on all servers. Mainly used to fix failed configuration of new or existing servers, or to update servers to latest Engine Yard stack
106
- (e.g. to apply an Engine Yard supplied security patch).
107
-
108
- Note that uploaded recipes are also run after the main configuration run has successfully completed.
109
-
110
- Options:
111
-
112
- -e, [--environment=ENVIRONMENT] # Environment to rebuild
113
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
114
-
115
- === ey rollback
116
-
117
- Uses code from previous deploy in the "/data/APP_NAME/releases" directory on remote server(s) to restart application servers.
118
-
119
- Options:
120
-
121
- -v, [--verbose] # Be verbose
122
- -a, [--app=APP] # Name of the application to roll back
123
- -e, [--environment=ENVIRONMENT] # Environment in which to roll back the application
124
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
125
-
126
- === ey recipes apply
127
-
128
- This is similar to 'ey rebuild' except Engine Yard's main configuration step is skipped.
129
-
130
- Options:
131
-
132
- -e, [--environment=ENVIRONMENT] # Environment in which to apply recipes
133
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
134
-
135
- === ey recipes upload
136
-
137
- The current directory should contain a subdirectory named "cookbooks" to be uploaded.
138
-
139
- Options:
140
-
141
- -e, [--environment=ENVIRONMENT] # Environment that will receive the recipes
142
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
143
- [--apply] # Apply the recipes (same as above) immediately after uploading
144
- -f, [--file=FILE] # Specify a gzipped tar file (.tgz) for upload instead of cookbooks/ directory
145
-
146
- === ey recipes download
147
-
148
- The recipes will be unpacked into a directory called "cookbooks" in the current directory.
149
-
150
- If the cookbooks directory already exists, an error will be raised.
151
-
152
- Options:
153
-
154
- -e, [--environment=ENVIRONMENT] # Environment for which to download the recipes
155
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
156
-
157
- === ey web enable
158
-
159
- Remove the maintenance page for this application in the given environment.
160
-
161
- Options:
162
-
163
- -v, [--verbose] # Be verbose
164
- -a, [--app=APP] # Name of the application whose maintenance page will be removed
165
- -e, [--environment=ENVIRONMENT] # Environment on which to take down the maintenance page
166
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
167
-
168
- === ey web disable
169
-
170
- The maintenance page is taken from the app currently being deployed. This means that you can customize maintenance pages to tell users the reason for downtime on every particular deploy.
171
-
172
- Maintenance pages searched for in order of decreasing priority:
173
- * public/maintenance.html.custom
174
- * public/maintenance.html.tmp
175
- * public/maintenance.html
176
- * public/system/maintenance.html.default
177
-
178
- Options:
179
-
180
- -v, [--verbose] # Be verbose
181
- -a, [--app=APP] # Name of the application whose maintenance page will be put up
182
- -e, [--environment=ENVIRONMENT] # Environment on which to put up the maintenance page
183
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
184
-
185
-
186
- === ey web restart
187
-
188
- Restarts the application servers for the given application. Enables maintenance pages if it would be enabled during a normal deploy. Respects the maintenance_on_restart ey.yml configuration.
189
-
190
- Options:
191
-
192
- -v, [--verbose] # Be verbose
193
- -a, [--app=APP] # Name of the application to restart
194
- -e, [--environment=ENVIRONMENT] # Name of the environment to restart
195
- -c, [--account=ACCOUNT] # Name of the account in which the app and environment can be found
196
-
197
- === ey ssh
198
-
199
- If a command is supplied, it will be run, otherwise a session will be opened. The application master is used for environments with clusters. Option --all requires a command to be supplied and runs it on all servers.
200
-
201
- Note: this command is a bit picky about its ordering. To run a command with arguments on all servers, like "rm -f /some/file", you need to order it like so:
202
-
203
- $ ey ssh "rm -f /some/file" -e my-environment --all
204
-
205
- Options:
206
-
207
- [--utilities=one two three] # Run command on the utility servers with the given names. If no names are given, run on all utility servers.
208
- [--app-servers] # Run command on all application servers
209
- [--db-servers] # Run command on the database servers
210
- [--db-master] # Run command on the master database server
211
- -A, [--all] # Run command on all servers
212
- [--db-slaves] # Run command on the slave database servers
213
- -e, [--environment=ENVIRONMENT] # Name of the environment to ssh into
214
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
215
-
216
- === ey launch
217
-
218
- Open the application in a browser.
219
-
220
- Options:
221
-
222
- -c, [--account=ACCOUNT] # Name of the account in which the environment can be found
223
- -a, [--app=APP] # Name of the application to launch
224
- -e, [--environment=ENVIRONMENT] # Name of the environment for the application
225
-
226
- === ey whoami
227
-
228
- Who am I logged in as? Prints the name and email of the current logged in user.
229
-
230
- === ey login
231
-
232
- Log in and verify access to EY Cloud. Use logout first if you need to switch user accounts.
233
-
234
- === ey logout
235
-
236
- Remove the current API key from ~/.eyrc or env variable $EYRC
237
-
238
-
239
- == Global Options
240
-
241
- All commands accept the following options.
242
-
243
- --api-token=API_TOKEN # Use API-TOKEN to authenticate this command
244
- --serverside-version=SERVERSIDE_VERSION # Please use with care! Override deploy system version
245
- # (same as ENV variable ENGINEYARD_SERVERSIDE_VERSION)
246
-
247
- Not all commands will make use of these options. For example,
248
- ey status does not use, and will ignore the --serverside-version flag.
249
-
250
- Also, please consider that it's usually not a good idea to override the
251
- version of serverside unless you know what you're doing. CLI and serverside
252
- versions are designed to work together and mixing them can cause errors.
253
-
254
-
255
- == API Client
256
-
257
- See https://github.com/engineyard/engineyard-cloud-client for the API client library.
258
-
259
- == DEBUG
260
-
261
- The API commands will print internal information if $DEBUG is set:
262
-
263
- $ DEBUG=1 ey environments --all
264
- GET https://cloud.engineyard.com/api/v2/apps
265
- Params {"no_instances"=>"true"}
266
- Headers {"User-Agent"=>"EngineYard/2.0.0 EngineYardCloudClient/1.0.5",
267
- "Accept"=>"application/json",
268
- "X-EY-Cloud-Token"=>"YOURTOKEN"}
269
- Response {"apps"=>
270
- [{"environments"=>[],
271
- "name"=>"myapp",
272
- "repository_uri"=>"git@github.com:myaccount/myapp.git",
273
- "app_type_id"=>"rails3",
274
- "account"=>{"name"=>"myaccount", "id"=>1234},
275
- "id"=>12345}]}