engineyard-serverside 2.6.14 → 2.6.15.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/bin/engineyard-serverside +1 -1
- data/lib/engineyard-serverside/cli.rb +4 -225
- data/lib/engineyard-serverside/cli/app.rb +136 -0
- data/lib/engineyard-serverside/cli/helpers.rb +58 -0
- data/lib/engineyard-serverside/cli/server_hash_extractor.rb +49 -0
- data/lib/engineyard-serverside/cli/workflows.rb +45 -0
- data/lib/engineyard-serverside/cli/workflows/base.rb +78 -0
- data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +31 -0
- data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +28 -0
- data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +29 -0
- data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +29 -0
- data/lib/engineyard-serverside/cli/workflows/errors.rb +13 -0
- data/lib/engineyard-serverside/cli/workflows/helpers.rb +21 -0
- data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +63 -0
- data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +36 -0
- data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +28 -0
- data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +28 -0
- data/lib/engineyard-serverside/dependency_manager/bundler.rb +43 -14
- data/lib/engineyard-serverside/propagator.rb +59 -0
- data/lib/engineyard-serverside/rails_assets.rb +5 -2
- data/lib/engineyard-serverside/version.rb +1 -1
- metadata +66 -394
- data/lib/engineyard-serverside/cli_helpers.rb +0 -53
- data/spec/archive_deploy_spec.rb +0 -53
- data/spec/basic_deploy_spec.rb +0 -26
- data/spec/bundler_deploy_spec.rb +0 -139
- data/spec/configuration_spec.rb +0 -205
- data/spec/custom_deploy_spec.rb +0 -128
- data/spec/deploy_hook_spec.rb +0 -362
- data/spec/deprecation_spec.rb +0 -23
- data/spec/ey_yml_customized_deploy_spec.rb +0 -99
- data/spec/fixtures/gitrepo.tar.gz +0 -0
- data/spec/fixtures/gitrepo/bar +0 -0
- data/spec/fixtures/gitrepo/foo +0 -0
- data/spec/fixtures/invalid_hook.rb +0 -1
- data/spec/fixtures/lockfiles/0.9-no-bundler +0 -111
- data/spec/fixtures/lockfiles/0.9-with-bundler +0 -117
- data/spec/fixtures/lockfiles/1.0-no-bundler +0 -54
- data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +0 -162
- data/spec/fixtures/lockfiles/1.0.18-do_mysql +0 -88
- data/spec/fixtures/lockfiles/1.0.18-do_postgres +0 -79
- data/spec/fixtures/lockfiles/1.0.18-mysql +0 -43
- data/spec/fixtures/lockfiles/1.0.18-mysql2 +0 -43
- data/spec/fixtures/lockfiles/1.0.18-pg +0 -43
- data/spec/fixtures/lockfiles/1.0.6-no-bundler +0 -51
- data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +0 -52
- data/spec/fixtures/lockfiles/1.0.6-with-bundler +0 -52
- data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +0 -112
- data/spec/fixtures/lockfiles/not-a-lockfile +0 -1
- data/spec/fixtures/repos/assets_detected/Gemfile +0 -5
- data/spec/fixtures/repos/assets_detected/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_detected/README +0 -1
- data/spec/fixtures/repos/assets_detected/Rakefile +0 -5
- data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_detected/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_detected/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled/README +0 -1
- data/spec/fixtures/repos/assets_disabled/Rakefile +0 -6
- data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_disabled/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +0 -6
- 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 +0 -5
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_disabled_utf8/README +0 -3
- data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +0 -5
- data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +0 -7
- data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_enabled_all/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_all/README +0 -1
- data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_all/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_enabled_all/script/assets +0 -5
- data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +0 -3
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +0 -10
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +0 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +0 -8
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +0 -4
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_enabled_util_only/README +0 -1
- data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +0 -6
- data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +0 -6
- data/spec/fixtures/repos/assets_in_hook/Gemfile +0 -5
- data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +0 -88
- data/spec/fixtures/repos/assets_in_hook/README +0 -2
- data/spec/fixtures/repos/assets_in_hook/Rakefile +0 -5
- data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
- data/spec/fixtures/repos/assets_in_hook/config/application.rb +0 -5
- data/spec/fixtures/repos/assets_in_hook/config/ey.yml +0 -3
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +0 -2
- data/spec/fixtures/repos/bundle_fails/Gemfile +0 -1
- data/spec/fixtures/repos/bundle_fails/README +0 -1
- data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/Gemfile +0 -4
- data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +0 -12
- data/spec/fixtures/repos/bundler_disabled/README +0 -1
- data/spec/fixtures/repos/bundler_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/default/Gemfile +0 -4
- data/spec/fixtures/repos/default/Gemfile.lock +0 -12
- data/spec/fixtures/repos/default/README +0 -5
- data/spec/fixtures/repos/default/ey.yml +0 -3
- data/spec/fixtures/repos/executable_hooks/README +0 -1
- data/spec/fixtures/repos/executable_hooks/deploy/before_restart +0 -72
- data/spec/fixtures/repos/executable_hooks_not_executable/README +0 -3
- data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +0 -3
- data/spec/fixtures/repos/ey_yml/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml/README +0 -1
- data/spec/fixtures/repos/ey_yml/config/ey.yml +0 -18
- data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/Gemfile +0 -4
- data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +0 -12
- data/spec/fixtures/repos/ey_yml_alt/README +0 -1
- data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +0 -6
- data/spec/fixtures/repos/ey_yml_alt/ey.yml +0 -12
- data/spec/fixtures/repos/hook_fails/README +0 -1
- data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/README +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_restart.rb +0 -1
- data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +0 -1
- data/spec/fixtures/repos/multi_dep_manager/README +0 -1
- data/spec/fixtures/repos/multi_dep_manager/composer.json +0 -5
- data/spec/fixtures/repos/multi_dep_manager/composer.lock +0 -462
- data/spec/fixtures/repos/multi_dep_manager/package.json +0 -7
- data/spec/fixtures/repos/multi_dep_manager/public/index.php +0 -4
- data/spec/fixtures/repos/no_ey_config/Gemfile +0 -3
- data/spec/fixtures/repos/no_ey_config/Gemfile.lock +0 -10
- data/spec/fixtures/repos/no_ey_config/README +0 -1
- data/spec/fixtures/repos/no_ey_config/ey.yml +0 -3
- data/spec/fixtures/repos/no_gemfile_lock/Gemfile +0 -4
- data/spec/fixtures/repos/no_gemfile_lock/README +0 -1
- data/spec/fixtures/repos/no_gemfile_lock/ey.yml +0 -3
- data/spec/fixtures/repos/nodejs/README +0 -1
- data/spec/fixtures/repos/nodejs/package.json +0 -7
- data/spec/fixtures/repos/not_bundled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/README +0 -1
- data/spec/fixtures/repos/npm_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/npm_disabled/package.json +0 -7
- data/spec/fixtures/repos/php_composer_disabled/README +0 -1
- data/spec/fixtures/repos/php_composer_disabled/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_disabled/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +0 -2
- data/spec/fixtures/repos/php_composer_disabled/public/index.php +0 -4
- data/spec/fixtures/repos/php_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_composer_lock/composer.json +0 -5
- data/spec/fixtures/repos/php_composer_lock/composer.lock +0 -462
- data/spec/fixtures/repos/php_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/php_no_composer_lock/README +0 -1
- data/spec/fixtures/repos/php_no_composer_lock/composer.json +0 -21
- data/spec/fixtures/repos/php_no_composer_lock/public/index.php +0 -4
- data/spec/fixtures/repos/public_system/Gemfile +0 -4
- data/spec/fixtures/repos/public_system/Gemfile.lock +0 -12
- data/spec/fixtures/repos/public_system/README +0 -5
- data/spec/fixtures/repos/public_system/ey.yml +0 -3
- data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +0 -3
- data/spec/fixtures/repos/sqlite3/Gemfile +0 -4
- data/spec/fixtures/repos/sqlite3/Gemfile.lock +0 -89
- data/spec/fixtures/repos/sqlite3/README +0 -1
- data/spec/fixtures/retwisj.war +0 -0
- data/spec/fixtures/valid_hook.rb +0 -1
- data/spec/git_strategy_spec.rb +0 -34
- data/spec/lockfile_parser_spec.rb +0 -122
- data/spec/maintenance_spec.rb +0 -44
- data/spec/multi_dependency_manager_spec.rb +0 -25
- data/spec/nodejs_deploy_spec.rb +0 -30
- data/spec/php_deploy_spec.rb +0 -81
- data/spec/platform_configure_spec.rb +0 -61
- data/spec/rails31_deploy_spec.rb +0 -164
- data/spec/restart_spec.rb +0 -43
- data/spec/rollback_spec.rb +0 -87
- data/spec/server_spec.rb +0 -70
- data/spec/services_deploy_spec.rb +0 -153
- data/spec/shell_spec.rb +0 -57
- data/spec/source/archive_spec.rb +0 -33
- data/spec/source/git_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -355
- data/spec/sqlite3_deploy_spec.rb +0 -38
- data/spec/support/integration.rb +0 -103
- data/spec/support/source_doubles.rb +0 -28
- data/spec/support/timecop.rb +0 -5
- data/spec/symlink_spec.rb +0 -15
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
11
|
+
private
|
|
12
|
+
def procedure
|
|
13
|
+
# so that we deploy to the same place there that we have here
|
|
14
|
+
integrate_options[:release_path] = current_app_dir.realpath.to_s
|
|
15
|
+
|
|
16
|
+
# we have to deploy the same SHA there as here
|
|
17
|
+
integrate_options[:branch] = current_app_dir.join('REVISION').read.strip
|
|
18
|
+
|
|
19
|
+
# always rebundle gems on integrate to make sure the instance comes up correctly.
|
|
20
|
+
integrate_options[:clean] = true
|
|
21
|
+
|
|
22
|
+
propagate_serverside
|
|
23
|
+
|
|
24
|
+
# We have to rsync the entire app dir, so we need all the permissions to be correct!
|
|
25
|
+
owner_user = config.user
|
|
26
|
+
owner_group = config.group
|
|
27
|
+
|
|
28
|
+
chown_command = %|find #{app_dir} \\( -not -user #{owner_user} -or -not -group #{owner_group} \\) -exec chown -h #{owner_user}:#{owner_group} "{}" +|
|
|
29
|
+
|
|
30
|
+
shell.logged_system("sudo sh -l -c '#{chown_command}'", servers.detect {|server| server.local?})
|
|
31
|
+
|
|
32
|
+
servers.run_for_each! do |server|
|
|
33
|
+
chown = server.command_on_server('sudo sh -l -c', chown_command)
|
|
34
|
+
sync = server.sync_directory_command(app_dir, options[:ignore_existing])
|
|
35
|
+
clean = server.command_on_server('sh -l -c', "rm -rf #{current_app_dir}")
|
|
36
|
+
"(#{chown}) && (#{sync}) && (#{clean})"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# deploy local-ref to other instances into /data/$app/local-current
|
|
40
|
+
EY::Serverside::Deploy.new(servers, config, shell).cached_deploy
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def task_name
|
|
44
|
+
"integrate-#{options[:instances].join('-')}".gsub(/[^-.\w]/,'')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def integrate_options
|
|
48
|
+
@integrate_options ||= options.dup
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def app_dir
|
|
52
|
+
@app_dir ||= Pathname.new "/data/#{options[:app]}"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def current_app_dir
|
|
56
|
+
@current_app_dir ||= app_dir.join("current")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|