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,78 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/about'
|
2
|
-
require 'engineyard-serverside/cli/server_hash_extractor'
|
3
|
-
require 'engineyard-serverside/cli/workflows/errors'
|
4
|
-
require 'engineyard-serverside/configuration'
|
5
|
-
|
6
|
-
module EY
|
7
|
-
module Serverside
|
8
|
-
module CLI
|
9
|
-
module Workflows
|
10
|
-
|
11
|
-
# Base is the template from which all Workflows are derived
|
12
|
-
class Base
|
13
|
-
attr_reader :options
|
14
|
-
|
15
|
-
def initialize(options = {})
|
16
|
-
@options = options
|
17
|
-
end
|
18
|
-
|
19
|
-
def perform
|
20
|
-
shell.debug "Initializing #{About.name_with_version}."
|
21
|
-
|
22
|
-
begin
|
23
|
-
procedure
|
24
|
-
rescue EY::Serverside::RemoteFailure => remote_error
|
25
|
-
shell.fatal(remote_error.message)
|
26
|
-
raise
|
27
|
-
rescue Exception => error
|
28
|
-
shell.fatal("#{error.backtrace[0]}: #{error.message} (#{error.class})")
|
29
|
-
raise
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.perform(options = {})
|
34
|
-
new(options).perform
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
def config
|
39
|
-
@config ||= EY::Serverside::Deploy::Configuration.new(options)
|
40
|
-
end
|
41
|
-
|
42
|
-
def shell
|
43
|
-
@shell ||= EY::Serverside::Shell.new(
|
44
|
-
:verbose => config.verbose,
|
45
|
-
:log_path => File.join(
|
46
|
-
ENV['HOME'],
|
47
|
-
"#{config.app}-#{task_name}.log"
|
48
|
-
)
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
|
-
def servers
|
53
|
-
@servers ||= EY::Serverside::Servers.from_hashes(
|
54
|
-
EY::Serverside::CLI::ServerHashExtractor.hashes(options, config),
|
55
|
-
shell
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
def task_name
|
60
|
-
raise Undefined.new(
|
61
|
-
"You must define the private task_name method for your workflow."
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
|
-
def procedure
|
66
|
-
raise Undefined.new(
|
67
|
-
"You must define the private procedure method for your workflow."
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
def propagate_serverside
|
72
|
-
EY::Serverside::Propagator.propagate(servers, shell)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/deploy_hook'
|
3
|
-
|
4
|
-
module EY
|
5
|
-
module Serverside
|
6
|
-
module CLI
|
7
|
-
module Workflows
|
8
|
-
|
9
|
-
# CallingDeployHooks is a Workflow that, given a hook_name option,
|
10
|
-
# executes the requested deploy hook
|
11
|
-
class CallingDeployHooks < Base
|
12
|
-
private
|
13
|
-
def procedure
|
14
|
-
EY::Serverside::DeployHook.
|
15
|
-
new(config, shell, hook_name).
|
16
|
-
call
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
def task_name
|
21
|
-
"hook-#{hook_name}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def hook_name
|
25
|
-
options[:hook_name]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/cli/workflows/helpers'
|
3
|
-
|
4
|
-
module EY
|
5
|
-
module Serverside
|
6
|
-
module CLI
|
7
|
-
module Workflows
|
8
|
-
|
9
|
-
# DeployingApplications is a Workflow that deploys the application
|
10
|
-
# specified by the incoming options
|
11
|
-
class DeployingApplications < Base
|
12
|
-
include Helpers
|
13
|
-
|
14
|
-
private
|
15
|
-
def procedure
|
16
|
-
propagate_serverside
|
17
|
-
|
18
|
-
deployer.deploy
|
19
|
-
end
|
20
|
-
|
21
|
-
def task_name
|
22
|
-
'deploy'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/cli/workflows/helpers'
|
3
|
-
require 'engineyard-serverside/maintenance'
|
4
|
-
|
5
|
-
module EY
|
6
|
-
module Serverside
|
7
|
-
module CLI
|
8
|
-
module Workflows
|
9
|
-
|
10
|
-
# DisablingMaintenance is a Workflow that removes the maintenance page
|
11
|
-
# for the application specified in the options
|
12
|
-
class DisablingMaintenance < Base
|
13
|
-
include Helpers
|
14
|
-
|
15
|
-
private
|
16
|
-
def procedure
|
17
|
-
propagate_serverside
|
18
|
-
|
19
|
-
maintenance.manually_disable
|
20
|
-
end
|
21
|
-
|
22
|
-
def task_name
|
23
|
-
'disable_maintenance'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/cli/workflows/helpers'
|
3
|
-
require 'engineyard-serverside/maintenance'
|
4
|
-
|
5
|
-
module EY
|
6
|
-
module Serverside
|
7
|
-
module CLI
|
8
|
-
module Workflows
|
9
|
-
|
10
|
-
# EnablingMaintenance is a Workflow that puts a maintenance page in
|
11
|
-
# place for the application specified in the options
|
12
|
-
class EnablingMaintenance < Base
|
13
|
-
include Helpers
|
14
|
-
|
15
|
-
private
|
16
|
-
def procedure
|
17
|
-
propagate_serverside
|
18
|
-
|
19
|
-
maintenance.manually_enable
|
20
|
-
end
|
21
|
-
|
22
|
-
def task_name
|
23
|
-
'enable_maintenance'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Serverside
|
3
|
-
module CLI
|
4
|
-
module Workflows
|
5
|
-
|
6
|
-
# Helpers is a collection of methods that can be mixed into a Workflow
|
7
|
-
# to provide easy access to some of the underlying concepts for
|
8
|
-
# procedures like deploying, managing maintenance state, etc
|
9
|
-
module Helpers
|
10
|
-
def deployer
|
11
|
-
EY::Serverside::Deploy.new(servers, config, shell)
|
12
|
-
end
|
13
|
-
|
14
|
-
def maintenance
|
15
|
-
EY::Serverside::Maintenance.new(servers, config, shell)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Serverside
|
5
|
-
module CLI
|
6
|
-
module Workflows
|
7
|
-
|
8
|
-
# IntegratingServers is a Workflow that attempts to integrate new
|
9
|
-
# servers into an existing environment
|
10
|
-
class IntegratingServers < Base
|
11
|
-
def initialize(options = {})
|
12
|
-
super
|
13
|
-
|
14
|
-
# We need to set some extra options, but options is frozen by
|
15
|
-
# the time we get here, so dupe it!
|
16
|
-
@options = options.dup
|
17
|
-
|
18
|
-
# so that we deploy to the same place there that we have here
|
19
|
-
@options[:release_path] = current_app_dir.realpath.to_s
|
20
|
-
|
21
|
-
# we have to deploy the same SHA there as here
|
22
|
-
@options[:branch] = current_app_dir.join('REVISION').read.strip
|
23
|
-
|
24
|
-
# always rebundle gems on integrate to make sure the instance comes up correctly.
|
25
|
-
@options[:clean] = true
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
def procedure
|
30
|
-
propagate_serverside
|
31
|
-
|
32
|
-
# We have to rsync the entire app dir, so we need all the permissions to be correct!
|
33
|
-
owner_user = config.user
|
34
|
-
owner_group = config.group
|
35
|
-
|
36
|
-
chown_command = %|find #{app_dir} \\( -not -user #{owner_user} -or -not -group #{owner_group} \\) -exec chown -h #{owner_user}:#{owner_group} "{}" +|
|
37
|
-
|
38
|
-
shell.logged_system("sudo sh -l -c '#{chown_command}'", servers.detect {|server| server.local?})
|
39
|
-
|
40
|
-
servers.run_for_each! do |server|
|
41
|
-
chown = server.command_on_server('sudo sh -l -c', chown_command)
|
42
|
-
sync = server.sync_directory_command(app_dir, options[:ignore_existing])
|
43
|
-
clean = server.command_on_server('sh -l -c', "rm -rf #{current_app_dir}")
|
44
|
-
"(#{chown}) && (#{sync}) && (#{clean})"
|
45
|
-
end
|
46
|
-
|
47
|
-
# deploy local-ref to other instances into /data/$app/local-current
|
48
|
-
EY::Serverside::Deploy.new(servers, config, shell).cached_deploy
|
49
|
-
end
|
50
|
-
|
51
|
-
def task_name
|
52
|
-
"integrate-#{options[:instances].join('-')}".gsub(/[^-.\w]/,'')
|
53
|
-
end
|
54
|
-
|
55
|
-
def integrate_options
|
56
|
-
@integrate_options ||= options.dup
|
57
|
-
end
|
58
|
-
|
59
|
-
def app_dir
|
60
|
-
@app_dir ||= Pathname.new "/data/#{options[:app]}"
|
61
|
-
end
|
62
|
-
|
63
|
-
def current_app_dir
|
64
|
-
@current_app_dir ||= app_dir.join("current")
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Serverside
|
5
|
-
module CLI
|
6
|
-
module Workflows
|
7
|
-
|
8
|
-
# RestartingApplications is a Workflow that restarts the application
|
9
|
-
# specified in the options
|
10
|
-
class RestartingApplications < Base
|
11
|
-
private
|
12
|
-
def procedure
|
13
|
-
restart_options[:release_path] = Pathname.new(
|
14
|
-
"/data/#{options[:app]}/current"
|
15
|
-
)
|
16
|
-
|
17
|
-
propagate_serverside
|
18
|
-
|
19
|
-
EY::Serverside::Deploy.
|
20
|
-
new(servers, config, shell).
|
21
|
-
restart_with_maintenance_page
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def restart_options
|
26
|
-
@restart_options ||= options.dup
|
27
|
-
end
|
28
|
-
|
29
|
-
def task_name
|
30
|
-
'restart'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/cli/workflows/helpers'
|
3
|
-
|
4
|
-
module EY
|
5
|
-
module Serverside
|
6
|
-
module CLI
|
7
|
-
module Workflows
|
8
|
-
|
9
|
-
# RollingBackApplications is a Workflow that attempts to roll the
|
10
|
-
# application specified in the options back to its previous deployment
|
11
|
-
class RollingBackApplications < Base
|
12
|
-
include Helpers
|
13
|
-
|
14
|
-
private
|
15
|
-
def procedure
|
16
|
-
propagate_serverside
|
17
|
-
|
18
|
-
deployer.rollback
|
19
|
-
end
|
20
|
-
|
21
|
-
def task_name
|
22
|
-
'rollback'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/cli/workflows/base'
|
2
|
-
require 'engineyard-serverside/cli/workflows/helpers'
|
3
|
-
require 'engineyard-serverside/maintenance'
|
4
|
-
|
5
|
-
module EY
|
6
|
-
module Serverside
|
7
|
-
module CLI
|
8
|
-
module Workflows
|
9
|
-
|
10
|
-
# ShowingMaintenanceStatus is a Workflow that reports the current
|
11
|
-
# enabled/disabled status of the maintenance page for the application
|
12
|
-
# specified in the options
|
13
|
-
class ShowingMaintenanceStatus < Base
|
14
|
-
include Helpers
|
15
|
-
|
16
|
-
private
|
17
|
-
def procedure
|
18
|
-
maintenance.status
|
19
|
-
end
|
20
|
-
|
21
|
-
def task_name
|
22
|
-
'maintenance-status'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'engineyard-serverside/shell/helpers'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Serverside
|
5
|
-
class DeployHook
|
6
|
-
|
7
|
-
class CallbackContext
|
8
|
-
include EY::Serverside::Shell::Helpers
|
9
|
-
|
10
|
-
attr_reader :shell, :hook_path
|
11
|
-
|
12
|
-
def initialize(config, shell, hook_path)
|
13
|
-
@configuration = config
|
14
|
-
@configuration.set_framework_envs
|
15
|
-
@shell = shell
|
16
|
-
@node = config.node
|
17
|
-
@hook_path = hook_path
|
18
|
-
end
|
19
|
-
|
20
|
-
def config
|
21
|
-
@configuration
|
22
|
-
end
|
23
|
-
|
24
|
-
def inspect
|
25
|
-
"#<DeployHook::CallbackContext #{hook_path.inspect}>"
|
26
|
-
end
|
27
|
-
|
28
|
-
def method_missing(meth, *args, &blk)
|
29
|
-
if @configuration.respond_to?(meth)
|
30
|
-
shell.warning "Use of `#{meth}` (via method_missing) is deprecated in favor of `config.#{meth}` for improved error messages and compatibility.\n\tin #{hook_path}"
|
31
|
-
@configuration.send(meth, *args, &blk)
|
32
|
-
else
|
33
|
-
super
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def respond_to?(*a)
|
38
|
-
@configuration.respond_to?(*a) || super
|
39
|
-
end
|
40
|
-
|
41
|
-
def run(cmd)
|
42
|
-
shell.logged_system(Escape.shell_command(["sh", "-l", "-c", cmd])).success?
|
43
|
-
end
|
44
|
-
|
45
|
-
def run!(cmd)
|
46
|
-
run(cmd) or raise("run!: Command failed. #{cmd}")
|
47
|
-
end
|
48
|
-
|
49
|
-
def sudo(cmd)
|
50
|
-
shell.logged_system(Escape.shell_command(["sudo", "sh", "-l", "-c", cmd])).success?
|
51
|
-
end
|
52
|
-
|
53
|
-
def sudo!(cmd)
|
54
|
-
sudo(cmd) or raise("sudo!: Command failed. #{cmd}")
|
55
|
-
end
|
56
|
-
|
57
|
-
# convenience functions for running on certain instance types
|
58
|
-
def on_app_master(&blk) on_roles(%w[solo app_master], &blk) end
|
59
|
-
def on_app_servers(&blk) on_roles(%w[solo app_master app], &blk) end
|
60
|
-
def on_app_servers_and_utilities(&blk) on_roles(%w[solo app_master app util], &blk) end
|
61
|
-
|
62
|
-
def on_utilities(*names, &blk)
|
63
|
-
names.flatten!
|
64
|
-
on_roles(%w[util]) do
|
65
|
-
blk.call if names.empty? || names.include?(config.current_name)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
def on_roles(desired_roles)
|
71
|
-
yield if desired_roles.any? { |role| config.current_roles.include?(role) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|