engineyard-serverside 2.7.0.pre → 2.7.8pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/engineyard-serverside +1 -1
- data/lib/engineyard-serverside/about.rb +8 -7
- data/lib/engineyard-serverside/cli.rb +225 -4
- data/lib/engineyard-serverside/cli_helpers.rb +53 -0
- data/lib/engineyard-serverside/configuration.rb +0 -1
- data/lib/engineyard-serverside/dependency_manager/bundler.rb +18 -46
- data/lib/engineyard-serverside/dependency_manager/npm.rb +1 -12
- data/lib/engineyard-serverside/deploy.rb +45 -7
- data/lib/engineyard-serverside/deploy_hook.rb +83 -20
- data/lib/engineyard-serverside/maintenance.rb +9 -1
- data/lib/engineyard-serverside/paths.rb +0 -11
- data/lib/engineyard-serverside/rails_assets.rb +1 -2
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/archive_deploy_spec.rb +53 -0
- data/spec/basic_deploy_spec.rb +26 -0
- data/spec/bundler_deploy_spec.rb +139 -0
- data/spec/configuration_spec.rb +205 -0
- data/spec/custom_deploy_spec.rb +128 -0
- data/spec/deploy_hook_spec.rb +362 -0
- data/spec/deprecation_spec.rb +23 -0
- data/spec/ey_yml_customized_deploy_spec.rb +99 -0
- data/spec/fixtures/gitrepo.tar.gz +0 -0
- data/{lib/engineyard-serverside/callbacks/hooks.rb → spec/fixtures/gitrepo/bar} +0 -0
- data/spec/fixtures/gitrepo/foo +0 -0
- data/spec/fixtures/invalid_hook.rb +1 -0
- data/spec/fixtures/lockfiles/0.9-no-bundler +111 -0
- data/spec/fixtures/lockfiles/0.9-with-bundler +117 -0
- data/spec/fixtures/lockfiles/1.0-no-bundler +54 -0
- data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +162 -0
- data/spec/fixtures/lockfiles/1.0.18-do_mysql +88 -0
- data/spec/fixtures/lockfiles/1.0.18-do_postgres +79 -0
- data/spec/fixtures/lockfiles/1.0.18-mysql +43 -0
- data/spec/fixtures/lockfiles/1.0.18-mysql2 +43 -0
- data/spec/fixtures/lockfiles/1.0.18-pg +43 -0
- data/spec/fixtures/lockfiles/1.0.6-no-bundler +51 -0
- data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +52 -0
- data/spec/fixtures/lockfiles/1.0.6-with-bundler +52 -0
- data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +112 -0
- data/spec/fixtures/lockfiles/not-a-lockfile +1 -0
- data/spec/fixtures/repos/assets_detected/Gemfile +5 -0
- data/spec/fixtures/repos/assets_detected/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_detected/README +1 -0
- data/spec/fixtures/repos/assets_detected/Rakefile +5 -0
- data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_detected/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_detected/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_disabled/Gemfile +5 -0
- data/spec/fixtures/repos/assets_disabled/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_disabled/README +1 -0
- data/spec/fixtures/repos/assets_disabled/Rakefile +6 -0
- data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_disabled/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +5 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +1 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +6 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +5 -0
- 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/fixtures/repos/assets_enabled_all/Gemfile +5 -0
- data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_enabled_all/README +1 -0
- data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_all/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +6 -0
- data/spec/fixtures/repos/assets_enabled_all/script/assets +5 -0
- data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +1 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +3 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +10 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +1 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +8 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +4 -0
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +5 -0
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_enabled_util_only/README +1 -0
- data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +6 -0
- data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +6 -0
- data/spec/fixtures/repos/assets_in_hook/Gemfile +5 -0
- data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +88 -0
- data/spec/fixtures/repos/assets_in_hook/README +2 -0
- data/spec/fixtures/repos/assets_in_hook/Rakefile +5 -0
- data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_in_hook/config/application.rb +5 -0
- data/spec/fixtures/repos/assets_in_hook/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +2 -0
- data/spec/fixtures/repos/bundle_fails/Gemfile +1 -0
- data/spec/fixtures/repos/bundle_fails/README +1 -0
- data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +1 -0
- data/spec/fixtures/repos/bundler_disabled/Gemfile +4 -0
- data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +12 -0
- data/spec/fixtures/repos/bundler_disabled/README +1 -0
- data/spec/fixtures/repos/bundler_disabled/config/ey.yml +2 -0
- data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +1 -0
- data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +1 -0
- data/spec/fixtures/repos/default/Gemfile +4 -0
- data/spec/fixtures/repos/default/Gemfile.lock +12 -0
- data/spec/fixtures/repos/default/README +5 -0
- data/spec/fixtures/repos/default/ey.yml +3 -0
- data/spec/fixtures/repos/executable_hooks/README +1 -0
- data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
- data/spec/fixtures/repos/executable_hooks_not_executable/README +3 -0
- data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +3 -0
- data/spec/fixtures/repos/ey_yml/Gemfile +4 -0
- data/spec/fixtures/repos/ey_yml/Gemfile.lock +12 -0
- data/spec/fixtures/repos/ey_yml/README +1 -0
- data/spec/fixtures/repos/ey_yml/config/ey.yml +18 -0
- data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +6 -0
- data/spec/fixtures/repos/ey_yml_alt/Gemfile +4 -0
- data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +12 -0
- data/spec/fixtures/repos/ey_yml_alt/README +1 -0
- data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +6 -0
- data/spec/fixtures/repos/ey_yml_alt/ey.yml +12 -0
- data/spec/fixtures/repos/hook_fails/README +1 -0
- data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +1 -0
- data/spec/fixtures/repos/hooks/README +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_restart.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_restart.rb +1 -0
- data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +1 -0
- data/spec/fixtures/repos/multi_dep_manager/README +1 -0
- data/spec/fixtures/repos/multi_dep_manager/composer.json +5 -0
- data/spec/fixtures/repos/multi_dep_manager/composer.lock +462 -0
- data/spec/fixtures/repos/multi_dep_manager/package.json +7 -0
- data/spec/fixtures/repos/multi_dep_manager/public/index.php +4 -0
- data/spec/fixtures/repos/no_ey_config/Gemfile +3 -0
- data/spec/fixtures/repos/no_ey_config/Gemfile.lock +10 -0
- data/spec/fixtures/repos/no_ey_config/README +1 -0
- data/spec/fixtures/repos/no_ey_config/ey.yml +3 -0
- data/spec/fixtures/repos/no_gemfile_lock/Gemfile +4 -0
- data/spec/fixtures/repos/no_gemfile_lock/README +1 -0
- data/spec/fixtures/repos/no_gemfile_lock/ey.yml +3 -0
- data/spec/fixtures/repos/nodejs/README +1 -0
- data/spec/fixtures/repos/nodejs/package.json +7 -0
- data/spec/fixtures/repos/not_bundled/README +1 -0
- data/spec/fixtures/repos/npm_disabled/README +1 -0
- data/spec/fixtures/repos/npm_disabled/config/ey.yml +2 -0
- data/spec/fixtures/repos/npm_disabled/package.json +7 -0
- data/spec/fixtures/repos/php_composer_disabled/README +1 -0
- data/spec/fixtures/repos/php_composer_disabled/composer.json +5 -0
- data/spec/fixtures/repos/php_composer_disabled/composer.lock +462 -0
- data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +2 -0
- data/spec/fixtures/repos/php_composer_disabled/public/index.php +4 -0
- data/spec/fixtures/repos/php_composer_lock/README +1 -0
- data/spec/fixtures/repos/php_composer_lock/composer.json +5 -0
- data/spec/fixtures/repos/php_composer_lock/composer.lock +462 -0
- data/spec/fixtures/repos/php_composer_lock/public/index.php +4 -0
- data/spec/fixtures/repos/php_no_composer_lock/README +1 -0
- data/spec/fixtures/repos/php_no_composer_lock/composer.json +21 -0
- data/spec/fixtures/repos/php_no_composer_lock/public/index.php +4 -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/fixtures/repos/sqlite3/Gemfile +4 -0
- data/spec/fixtures/repos/sqlite3/Gemfile.lock +89 -0
- data/spec/fixtures/repos/sqlite3/README +1 -0
- data/spec/fixtures/retwisj.war +0 -0
- data/spec/fixtures/valid_hook.rb +1 -0
- data/spec/git_strategy_spec.rb +34 -0
- data/spec/lockfile_parser_spec.rb +122 -0
- data/spec/maintenance_spec.rb +44 -0
- data/spec/multi_dependency_manager_spec.rb +25 -0
- data/spec/nodejs_deploy_spec.rb +30 -0
- data/spec/php_deploy_spec.rb +81 -0
- data/spec/platform_configure_spec.rb +61 -0
- data/spec/rails31_deploy_spec.rb +164 -0
- data/spec/restart_spec.rb +43 -0
- data/spec/rollback_spec.rb +87 -0
- data/spec/server_spec.rb +70 -0
- data/spec/services_deploy_spec.rb +153 -0
- data/spec/shell_spec.rb +57 -0
- data/spec/source/archive_spec.rb +33 -0
- data/spec/source/git_spec.rb +44 -0
- data/spec/spec_helper.rb +355 -0
- data/spec/sqlite3_deploy_spec.rb +38 -0
- data/spec/support/integration.rb +103 -0
- data/spec/support/source_doubles.rb +28 -0
- data/spec/support/timecop.rb +5 -0
- data/spec/symlink_spec.rb +15 -0
- metadata +522 -184
- data/lib/engineyard-serverside/callbacks.rb +0 -11
- data/lib/engineyard-serverside/callbacks/collection.rb +0 -17
- data/lib/engineyard-serverside/callbacks/collection/base.rb +0 -94
- data/lib/engineyard-serverside/callbacks/collection/combined.rb +0 -45
- data/lib/engineyard-serverside/callbacks/collection/deploy_hooks.rb +0 -21
- data/lib/engineyard-serverside/callbacks/collection/service_hooks.rb +0 -17
- data/lib/engineyard-serverside/callbacks/collection/service_hooks/collection.rb +0 -24
- data/lib/engineyard-serverside/callbacks/collection/service_hooks/combined.rb +0 -40
- data/lib/engineyard-serverside/callbacks/distributor.rb +0 -23
- data/lib/engineyard-serverside/callbacks/distributor/base.rb +0 -38
- data/lib/engineyard-serverside/callbacks/distributor/executable.rb +0 -19
- data/lib/engineyard-serverside/callbacks/distributor/executable/runnable.rb +0 -41
- data/lib/engineyard-serverside/callbacks/distributor/executable/unrunnable.rb +0 -19
- data/lib/engineyard-serverside/callbacks/distributor/ruby.rb +0 -59
- data/lib/engineyard-serverside/callbacks/distributor/ruby/distributor.rb +0 -57
- data/lib/engineyard-serverside/callbacks/hooks/app.rb +0 -17
- data/lib/engineyard-serverside/callbacks/hooks/base.rb +0 -39
- data/lib/engineyard-serverside/callbacks/hooks/service.rb +0 -24
- data/lib/engineyard-serverside/callbacks/service_hook.rb +0 -20
- data/lib/engineyard-serverside/cli/app.rb +0 -136
- data/lib/engineyard-serverside/cli/helpers.rb +0 -58
- data/lib/engineyard-serverside/cli/server_hash_extractor.rb +0 -49
- data/lib/engineyard-serverside/cli/workflows.rb +0 -45
- data/lib/engineyard-serverside/cli/workflows/base.rb +0 -78
- data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +0 -31
- data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +0 -28
- data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +0 -29
- data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +0 -29
- data/lib/engineyard-serverside/cli/workflows/errors.rb +0 -13
- data/lib/engineyard-serverside/cli/workflows/helpers.rb +0 -21
- data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +0 -71
- data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +0 -36
- data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +0 -28
- data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +0 -28
- data/lib/engineyard-serverside/deploy_hook/callback_context.rb +0 -77
- data/lib/engineyard-serverside/propagator.rb +0 -59
- data/lib/engineyard-serverside/slug.rb +0 -7
- data/lib/engineyard-serverside/slug/distributor.rb +0 -58
- data/lib/engineyard-serverside/slug/enabler.rb +0 -100
- data/lib/engineyard-serverside/slug/failure_handler.rb +0 -24
- data/lib/engineyard-serverside/slug/finalizer.rb +0 -86
- data/lib/engineyard-serverside/slug/generator.rb +0 -29
- data/lib/engineyard-serverside/slug/migrator.rb +0 -41
- data/lib/engineyard-serverside/slug/restarter.rb +0 -103
- data/lib/engineyard-serverside/slug/source.rb +0 -16
- data/lib/engineyard-serverside/slug/source/updater.rb +0 -194
- data/lib/railway.rb +0 -43
- data/lib/result.rb +0 -7
- data/lib/result/base.rb +0 -41
- data/lib/result/dsl.rb +0 -16
- data/lib/result/failure.rb +0 -29
- data/lib/result/success.rb +0 -24
- data/lib/runner.rb +0 -34
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/callbacks/distributor/base'
|
2
|
-
|
3
|
-
require 'escape'
|
4
|
-
|
5
|
-
module EY
|
6
|
-
module Serverside
|
7
|
-
module Callbacks
|
8
|
-
module Distributor
|
9
|
-
module Ruby
|
10
|
-
|
11
|
-
class Distributor < Base
|
12
|
-
def distribute
|
13
|
-
shell.status "Running deploy hook: #{hook}.rb"
|
14
|
-
|
15
|
-
runner.run escaped_command(hook) do |server, cmd|
|
16
|
-
instance_args = [
|
17
|
-
'--current-roles', server.roles.to_a.join(' ')
|
18
|
-
]
|
19
|
-
|
20
|
-
if server.name
|
21
|
-
instance_args.push('--current-name')
|
22
|
-
instance_args.push(server.name.to_s)
|
23
|
-
end
|
24
|
-
|
25
|
-
instance_args.push('--config')
|
26
|
-
instance_args.push(config.to_json)
|
27
|
-
|
28
|
-
cmd << " " << Escape.shell_command(instance_args)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
def escaped_command(hook)
|
34
|
-
Escape.shell_command(command_for(hook.callback_name))
|
35
|
-
end
|
36
|
-
def command_for(hook_name)
|
37
|
-
cmd = [
|
38
|
-
About.binary,
|
39
|
-
'hook', hook_name.to_s,
|
40
|
-
'--app', config.app,
|
41
|
-
'--environment-name', config.environment_name,
|
42
|
-
'--account-name', config.account_name,
|
43
|
-
'--release-path', paths.active_release.to_s,
|
44
|
-
'--framework-env', config.framework_env.to_s
|
45
|
-
]
|
46
|
-
|
47
|
-
cmd.push('--verbose') if config.verbose
|
48
|
-
|
49
|
-
cmd
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Serverside
|
5
|
-
module Callbacks
|
6
|
-
module Hooks
|
7
|
-
|
8
|
-
class Base
|
9
|
-
attr_reader :path, :callback_name, :flavor
|
10
|
-
|
11
|
-
def initialize(file_path)
|
12
|
-
@path = Pathname.new(file_path)
|
13
|
-
|
14
|
-
filename = path.basename
|
15
|
-
|
16
|
-
callback = filename.basename('.rb')
|
17
|
-
|
18
|
-
@flavor = filename == callback ? :executable : :ruby
|
19
|
-
|
20
|
-
@callback_name = callback.to_s.to_sym
|
21
|
-
end
|
22
|
-
|
23
|
-
def matches?(callback)
|
24
|
-
callback_name == callback
|
25
|
-
end
|
26
|
-
|
27
|
-
def read
|
28
|
-
path.read
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_s
|
32
|
-
raise "Unimplemented"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/callbacks/hooks/base'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Serverside
|
5
|
-
module Callbacks
|
6
|
-
module Hooks
|
7
|
-
|
8
|
-
class Service < Base
|
9
|
-
attr_reader :service_name
|
10
|
-
|
11
|
-
def initialize(file_path)
|
12
|
-
super
|
13
|
-
@service_name = path.dirname.basename.to_s
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_s
|
17
|
-
"service/#{service_name}/#{callback_name}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
require 'engineyard-serverside/callbacks/base_hook'
|
4
|
-
|
5
|
-
module EY
|
6
|
-
module Serverside
|
7
|
-
module Callbacks
|
8
|
-
|
9
|
-
class ServiceHook < BaseHook
|
10
|
-
attr_reader :service_name
|
11
|
-
|
12
|
-
def initialize(file_path)
|
13
|
-
super
|
14
|
-
@service_name = path.dirname.basename.to_s
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,136 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'pathname'
|
3
|
-
require 'engineyard-serverside/about'
|
4
|
-
require 'engineyard-serverside/deploy'
|
5
|
-
require 'engineyard-serverside/propagator'
|
6
|
-
require 'engineyard-serverside/shell'
|
7
|
-
require 'engineyard-serverside/cli/server_hash_extractor'
|
8
|
-
require 'engineyard-serverside/servers'
|
9
|
-
require 'engineyard-serverside/cli/helpers'
|
10
|
-
require 'engineyard-serverside/cli/workflows'
|
11
|
-
|
12
|
-
module EY
|
13
|
-
module Serverside
|
14
|
-
module CLI
|
15
|
-
|
16
|
-
# App is the actual Thor-based entry point for the engineyard-serverside
|
17
|
-
# CLI application
|
18
|
-
class App < Thor
|
19
|
-
|
20
|
-
extend Helpers
|
21
|
-
|
22
|
-
method_option :migrate, :type => :string,
|
23
|
-
:desc => "Run migrations with this deploy",
|
24
|
-
:aliases => ["-m"]
|
25
|
-
|
26
|
-
method_option :branch, :type => :string,
|
27
|
-
:desc => "Git ref to deploy, defaults to master. May be a branch, a tag, or a SHA",
|
28
|
-
:aliases => %w[-b --ref --tag]
|
29
|
-
|
30
|
-
method_option :repo, :type => :string,
|
31
|
-
:desc => "Remote repo to deploy",
|
32
|
-
:aliases => ["-r"]
|
33
|
-
|
34
|
-
|
35
|
-
# Archive source strategy
|
36
|
-
method_option :archive, :type => :string,
|
37
|
-
:desc => "Remote URI for archive to download and unzip"
|
38
|
-
|
39
|
-
# Git source strategy
|
40
|
-
method_option :git, :type => :string,
|
41
|
-
:desc => "Remote git repo to deploy"
|
42
|
-
|
43
|
-
method_option :clean, :type => :boolean,
|
44
|
-
:desc => "Run deploy without relying on existing files"
|
45
|
-
|
46
|
-
|
47
|
-
account_app_env_options
|
48
|
-
config_option
|
49
|
-
framework_env_option
|
50
|
-
instances_options
|
51
|
-
stack_option
|
52
|
-
verbose_option
|
53
|
-
|
54
|
-
desc "deploy", "Deploy code to /data/<app>"
|
55
|
-
def deploy(default_task=:deploy)
|
56
|
-
|
57
|
-
# By default, we'll want to perform the :deploy workflow, but this
|
58
|
-
# method is also the entry point for the rollback workflow. So,
|
59
|
-
# we'll just let the workflow system figure out what to do based on
|
60
|
-
# the task passed in from the command line.
|
61
|
-
Workflows.perform(default_task, options)
|
62
|
-
end
|
63
|
-
|
64
|
-
account_app_env_options
|
65
|
-
config_option
|
66
|
-
instances_options
|
67
|
-
verbose_option
|
68
|
-
desc "enable_maintenance", "Enable maintenance page (disables web access)"
|
69
|
-
def enable_maintenance
|
70
|
-
Workflows.perform(:enable_maintenance, options)
|
71
|
-
end
|
72
|
-
|
73
|
-
account_app_env_options
|
74
|
-
config_option
|
75
|
-
instances_options
|
76
|
-
verbose_option
|
77
|
-
desc "maintenance_status", "Maintenance status"
|
78
|
-
def maintenance_status
|
79
|
-
Workflows.perform(:maintenance_status, options)
|
80
|
-
end
|
81
|
-
|
82
|
-
account_app_env_options
|
83
|
-
config_option
|
84
|
-
instances_options
|
85
|
-
verbose_option
|
86
|
-
desc "disable_maintenance", "Disable maintenance page (enables web access)"
|
87
|
-
def disable_maintenance
|
88
|
-
Workflows.perform(:disable_maintenance, options)
|
89
|
-
end
|
90
|
-
|
91
|
-
method_option :release_path, :type => :string,
|
92
|
-
:desc => "Value for #release_path in hooks (mostly for internal coordination)",
|
93
|
-
:aliases => ["-r"]
|
94
|
-
|
95
|
-
method_option :current_roles, :type => :array,
|
96
|
-
:desc => "Value for #current_roles in hooks"
|
97
|
-
|
98
|
-
method_option :current_name, :type => :string,
|
99
|
-
:desc => "Value for #current_name in hooks"
|
100
|
-
account_app_env_options
|
101
|
-
config_option
|
102
|
-
framework_env_option
|
103
|
-
verbose_option
|
104
|
-
desc "hook [NAME]", "Run a particular deploy hook"
|
105
|
-
def hook(hook_name)
|
106
|
-
Workflows.perform(
|
107
|
-
:hook,
|
108
|
-
options.merge(:hook_name => hook_name)
|
109
|
-
)
|
110
|
-
end
|
111
|
-
|
112
|
-
method_option :ignore_existing, :type => :boolean,
|
113
|
-
:desc => "When syncing /data/app directory, don't overwrite destination files"
|
114
|
-
account_app_env_options
|
115
|
-
config_option
|
116
|
-
framework_env_option
|
117
|
-
instances_options
|
118
|
-
stack_option
|
119
|
-
verbose_option
|
120
|
-
desc "integrate", "Integrate other instances into this cluster"
|
121
|
-
def integrate
|
122
|
-
Workflows.perform(:integrate, options)
|
123
|
-
end
|
124
|
-
|
125
|
-
account_app_env_options
|
126
|
-
instances_options
|
127
|
-
stack_option
|
128
|
-
verbose_option
|
129
|
-
desc "restart", "Restart app servers, conditionally enabling maintenance page"
|
130
|
-
def restart
|
131
|
-
Workflows.perform(:restart, options)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Serverside
|
3
|
-
module CLI
|
4
|
-
|
5
|
-
# Helpers is a set of methods that define options and such for an App
|
6
|
-
# task
|
7
|
-
module Helpers
|
8
|
-
def account_app_env_options
|
9
|
-
method_option :app, :type => :string,
|
10
|
-
:required => true,
|
11
|
-
:desc => "Application to deploy",
|
12
|
-
:aliases => %w[-a --app-name]
|
13
|
-
method_option :environment_name, :type => :string,
|
14
|
-
:required => true,
|
15
|
-
:desc => "Environment name"
|
16
|
-
method_option :account_name, :type => :string,
|
17
|
-
:required => true,
|
18
|
-
:desc => "Account name"
|
19
|
-
end
|
20
|
-
|
21
|
-
def framework_env_option
|
22
|
-
method_option :framework_env, :type => :string,
|
23
|
-
:required => true,
|
24
|
-
:desc => "Ruby web framework environment",
|
25
|
-
:aliases => ["-e"]
|
26
|
-
end
|
27
|
-
|
28
|
-
def stack_option
|
29
|
-
method_option :stack, :type => :string,
|
30
|
-
:desc => "Web stack (so we can restart it correctly)"
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
def config_option
|
35
|
-
method_option :config, :type => :string,
|
36
|
-
:desc => "Additional configuration"
|
37
|
-
end
|
38
|
-
|
39
|
-
def instances_options
|
40
|
-
method_option :instances, :type => :array,
|
41
|
-
:desc => "Hostnames of instances to deploy to, e.g. --instances localhost app1 app2"
|
42
|
-
method_option :instance_roles, :type => :hash,
|
43
|
-
:default => {},
|
44
|
-
:desc => "Roles of instances, keyed on hostname, comma-separated. e.g. instance1:app_master,etc instance2:db,memcached ..."
|
45
|
-
method_option :instance_names, :type => :hash,
|
46
|
-
:default => {},
|
47
|
-
:desc => "Instance names, keyed on hostname. e.g. instance1:name1 instance2:name2"
|
48
|
-
end
|
49
|
-
|
50
|
-
def verbose_option
|
51
|
-
method_option :verbose, :type => :boolean,
|
52
|
-
:desc => "Verbose output",
|
53
|
-
:aliases => ["-v"]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Serverside
|
3
|
-
module CLI
|
4
|
-
|
5
|
-
# ServerHashExtractor, given an options hash and a deploy configuration,
|
6
|
-
# generates an array of hashes that can be used to instantiate Server
|
7
|
-
# objects
|
8
|
-
class ServerHashExtractor
|
9
|
-
def self.hashes(options, config)
|
10
|
-
new(options, config).hashes
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_reader :options, :config
|
14
|
-
|
15
|
-
def initialize(options, config)
|
16
|
-
@options = options
|
17
|
-
@config = config
|
18
|
-
end
|
19
|
-
|
20
|
-
def hashes
|
21
|
-
return [] unless instances
|
22
|
-
|
23
|
-
instances.collect {|hostname|
|
24
|
-
{
|
25
|
-
:hostname => hostname,
|
26
|
-
:roles => instance_roles[hostname].to_s.split(','),
|
27
|
-
:name => instance_names[hostname],
|
28
|
-
:user => config.user
|
29
|
-
}
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def instances
|
35
|
-
options[:instances]
|
36
|
-
end
|
37
|
-
|
38
|
-
def instance_roles
|
39
|
-
options[:instance_roles]
|
40
|
-
end
|
41
|
-
|
42
|
-
def instance_names
|
43
|
-
options[:instance_names]
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/calling_deploy_hooks'
|
2
|
-
require 'engineyard-serverside/cli/workflows/deploying_applications'
|
3
|
-
require 'engineyard-serverside/cli/workflows/disabling_maintenance'
|
4
|
-
require 'engineyard-serverside/cli/workflows/enabling_maintenance'
|
5
|
-
require 'engineyard-serverside/cli/workflows/integrating_servers'
|
6
|
-
require 'engineyard-serverside/cli/workflows/restarting_applications'
|
7
|
-
require 'engineyard-serverside/cli/workflows/rolling_back_applications'
|
8
|
-
require 'engineyard-serverside/cli/workflows/showing_maintenance_status'
|
9
|
-
|
10
|
-
module EY
|
11
|
-
module Serverside
|
12
|
-
module CLI
|
13
|
-
|
14
|
-
# Workflows is a collection of reified procedures that handle the
|
15
|
-
# various requirements of our CLI app
|
16
|
-
module Workflows
|
17
|
-
DEFINED = {
|
18
|
-
:deploy => DeployingApplications,
|
19
|
-
:disable_maintenance => DisablingMaintenance,
|
20
|
-
:enable_maintenance => EnablingMaintenance,
|
21
|
-
:hook => CallingDeployHooks,
|
22
|
-
:integrate => IntegratingServers,
|
23
|
-
:maintenance_status => ShowingMaintenanceStatus,
|
24
|
-
:restart => RestartingApplications,
|
25
|
-
:rollback => RollingBackApplications
|
26
|
-
}
|
27
|
-
|
28
|
-
def self.perform(workflow, options = {})
|
29
|
-
resolve(workflow).
|
30
|
-
perform(options)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.resolve(workflow)
|
34
|
-
(DEFINED[normalized(workflow)] || Base)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.normalized(workflow)
|
38
|
-
return nil if workflow.nil?
|
39
|
-
|
40
|
-
workflow.to_sym
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|