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
checksums.yaml
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
NDkwNDUzZDIwOTQxYzhkZjdkODljNWNkZmMxNTZjMmVhNzc4NzJlNA==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
NjZhZGU5MmI3NThmZTJiNDVkNTcwNjg0NDZlZWNlOGM1OWJmMzU2Yg==
|
|
5
7
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
MzZhNDVmMGEwMjA2NjA2MjlhZGNiNzc1NmE0Y2FhZTUxMDdhNmQ5NTRiZTM5
|
|
10
|
+
ZTc0MmM5MzE0NGVlYjM2YjA5MWFjZjc4MGZhNWVlOGQ3MjU0MWRhY2UzYzNj
|
|
11
|
+
MjdmYmI4Y2I4MTMwMzU4YmE3Y2Y1ZjY5MWNiN2Y2YTA4MTcwZjA=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
ZjZjZjkzNzRiODE4MzhkNzhkNTdkZjljYmM5MDJkNzk1NDVhNjk4NTIwN2Y0
|
|
14
|
+
NDBmY2FmYzQ5NGUzMDM5OWVkNjgwMjk4M2NiYmFjYTVkNzQ1OGIyOWNjNDQw
|
|
15
|
+
ZGIyNjU3YTg0NGE4MzcyOTkyZWQwZTNkZmY5ZWE3MGY3MTBlYjY=
|
data/bin/engineyard-serverside
CHANGED
|
@@ -1,232 +1,11 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require 'pathname'
|
|
3
|
-
require 'engineyard-serverside/about'
|
|
4
|
-
require 'engineyard-serverside/deploy'
|
|
5
|
-
require 'engineyard-serverside/shell'
|
|
6
|
-
require 'engineyard-serverside/servers'
|
|
7
|
-
require 'engineyard-serverside/cli_helpers'
|
|
1
|
+
require 'engineyard-serverside/cli/app'
|
|
8
2
|
|
|
9
3
|
module EY
|
|
10
4
|
module Serverside
|
|
11
|
-
class CLI < Thor
|
|
12
|
-
|
|
13
|
-
extend CLIHelpers
|
|
14
|
-
|
|
15
|
-
method_option :migrate, :type => :string,
|
|
16
|
-
:desc => "Run migrations with this deploy",
|
|
17
|
-
:aliases => ["-m"]
|
|
18
|
-
|
|
19
|
-
method_option :branch, :type => :string,
|
|
20
|
-
:desc => "Git ref to deploy, defaults to master. May be a branch, a tag, or a SHA",
|
|
21
|
-
:aliases => %w[-b --ref --tag]
|
|
22
|
-
|
|
23
|
-
method_option :repo, :type => :string,
|
|
24
|
-
:desc => "Remote repo to deploy",
|
|
25
|
-
:aliases => ["-r"]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Archive source strategy
|
|
29
|
-
method_option :archive, :type => :string,
|
|
30
|
-
:desc => "Remote URI for archive to download and unzip"
|
|
31
|
-
|
|
32
|
-
# Git source strategy
|
|
33
|
-
method_option :git, :type => :string,
|
|
34
|
-
:desc => "Remote git repo to deploy"
|
|
35
|
-
|
|
36
|
-
method_option :clean, :type => :boolean,
|
|
37
|
-
:desc => "Run deploy without relying on existing files"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
account_app_env_options
|
|
41
|
-
config_option
|
|
42
|
-
framework_env_option
|
|
43
|
-
instances_options
|
|
44
|
-
stack_option
|
|
45
|
-
verbose_option
|
|
46
|
-
|
|
47
|
-
desc "deploy", "Deploy code to /data/<app>"
|
|
48
|
-
def deploy(default_task=:deploy)
|
|
49
|
-
init_and_propagate(options, default_task.to_s) do |servers, config, shell|
|
|
50
|
-
EY::Serverside::Deploy.new(servers, config, shell).send(default_task)
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
account_app_env_options
|
|
55
|
-
config_option
|
|
56
|
-
instances_options
|
|
57
|
-
verbose_option
|
|
58
|
-
desc "enable_maintenance", "Enable maintenance page (disables web access)"
|
|
59
|
-
def enable_maintenance
|
|
60
|
-
init_and_propagate(options, 'enable_maintenance') do |servers, config, shell|
|
|
61
|
-
EY::Serverside::Maintenance.new(servers, config, shell).manually_enable
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
account_app_env_options
|
|
66
|
-
config_option
|
|
67
|
-
instances_options
|
|
68
|
-
verbose_option
|
|
69
|
-
desc "maintenance_status", "Maintenance status"
|
|
70
|
-
def maintenance_status
|
|
71
|
-
init(options, "maintenance-status") do |servers, config, shell|
|
|
72
|
-
EY::Serverside::Maintenance.new(servers, config, shell).status
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
account_app_env_options
|
|
77
|
-
config_option
|
|
78
|
-
instances_options
|
|
79
|
-
verbose_option
|
|
80
|
-
desc "disable_maintenance", "Disable maintenance page (enables web access)"
|
|
81
|
-
def disable_maintenance
|
|
82
|
-
init_and_propagate(options, 'disable_maintenance') do |servers, config, shell|
|
|
83
|
-
EY::Serverside::Maintenance.new(servers, config, shell).manually_disable
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
method_option :release_path, :type => :string,
|
|
88
|
-
:desc => "Value for #release_path in hooks (mostly for internal coordination)",
|
|
89
|
-
:aliases => ["-r"]
|
|
90
|
-
|
|
91
|
-
method_option :current_roles, :type => :array,
|
|
92
|
-
:desc => "Value for #current_roles in hooks"
|
|
93
|
-
|
|
94
|
-
method_option :current_name, :type => :string,
|
|
95
|
-
:desc => "Value for #current_name in hooks"
|
|
96
|
-
account_app_env_options
|
|
97
|
-
config_option
|
|
98
|
-
framework_env_option
|
|
99
|
-
verbose_option
|
|
100
|
-
desc "hook [NAME]", "Run a particular deploy hook"
|
|
101
|
-
def hook(hook_name)
|
|
102
|
-
init(options, "hook-#{hook_name}") do |servers, config, shell|
|
|
103
|
-
EY::Serverside::DeployHook.new(config, shell, hook_name).call
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
method_option :ignore_existing, :type => :boolean,
|
|
108
|
-
:desc => "When syncing /data/app directory, don't overwrite destination files"
|
|
109
|
-
account_app_env_options
|
|
110
|
-
config_option
|
|
111
|
-
framework_env_option
|
|
112
|
-
instances_options
|
|
113
|
-
stack_option
|
|
114
|
-
verbose_option
|
|
115
|
-
desc "integrate", "Integrate other instances into this cluster"
|
|
116
|
-
def integrate
|
|
117
|
-
app_dir = Pathname.new "/data/#{options[:app]}"
|
|
118
|
-
current_app_dir = app_dir.join("current")
|
|
119
|
-
|
|
120
|
-
# so that we deploy to the same place there that we have here
|
|
121
|
-
integrate_options = options.dup
|
|
122
|
-
integrate_options[:release_path] = current_app_dir.realpath.to_s
|
|
123
|
-
|
|
124
|
-
# we have to deploy the same SHA there as here
|
|
125
|
-
integrate_options[:branch] = current_app_dir.join('REVISION').read.strip
|
|
126
|
-
|
|
127
|
-
# always rebundle gems on integrate to make sure the instance comes up correctly.
|
|
128
|
-
integrate_options[:clean] = true
|
|
129
|
-
|
|
130
|
-
logname = "integrate-#{options[:instances].join('-')}".gsub(/[^-.\w]/,'')
|
|
131
|
-
|
|
132
|
-
init_and_propagate(integrate_options, logname) do |servers, config, shell|
|
|
133
|
-
|
|
134
|
-
# We have to rsync the entire app dir, so we need all the permissions to be correct!
|
|
135
|
-
chown_command = %|find #{app_dir} \\( -not -user #{config.user} -or -not -group #{config.group} \\) -exec chown -h #{config.user}:#{config.group} "{}" +|
|
|
136
|
-
shell.logged_system("sudo sh -l -c '#{chown_command}'", servers.detect {|s| s.local?})
|
|
137
|
-
|
|
138
|
-
servers.run_for_each! do |server|
|
|
139
|
-
chown = server.command_on_server('sudo sh -l -c', chown_command)
|
|
140
|
-
sync = server.sync_directory_command(app_dir, options[:ignore_existing])
|
|
141
|
-
clean = server.command_on_server('sh -l -c', "rm -rf #{current_app_dir}")
|
|
142
|
-
"(#{chown}) && (#{sync}) && (#{clean})"
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# deploy local-ref to other instances into /data/$app/local-current
|
|
146
|
-
EY::Serverside::Deploy.new(servers, config, shell).cached_deploy
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
account_app_env_options
|
|
151
|
-
instances_options
|
|
152
|
-
stack_option
|
|
153
|
-
verbose_option
|
|
154
|
-
desc "restart", "Restart app servers, conditionally enabling maintenance page"
|
|
155
|
-
def restart
|
|
156
|
-
options = self.options.dup
|
|
157
|
-
options[:release_path] = Pathname.new("/data/#{options[:app]}/current").realpath.to_s
|
|
158
|
-
|
|
159
|
-
init_and_propagate(options, 'restart') do |servers, config, shell|
|
|
160
|
-
EY::Serverside::Deploy.new(servers, config, shell).restart_with_maintenance_page
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
private
|
|
165
|
-
|
|
166
|
-
def init_and_propagate(*args)
|
|
167
|
-
init(*args) do |servers, config, shell|
|
|
168
|
-
propagate(servers, shell)
|
|
169
|
-
yield servers, config, shell
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
def init(options, action)
|
|
174
|
-
config = EY::Serverside::Deploy::Configuration.new(options)
|
|
175
|
-
shell = EY::Serverside::Shell.new(
|
|
176
|
-
:verbose => config.verbose,
|
|
177
|
-
:log_path => File.join(ENV['HOME'], "#{config.app}-#{action}.log")
|
|
178
|
-
)
|
|
179
|
-
shell.debug "Initializing #{About.name_with_version}."
|
|
180
|
-
servers = load_servers(config, shell)
|
|
181
|
-
begin
|
|
182
|
-
yield servers, config, shell
|
|
183
|
-
rescue EY::Serverside::RemoteFailure => e
|
|
184
|
-
shell.fatal e.message
|
|
185
|
-
raise
|
|
186
|
-
rescue Exception => e
|
|
187
|
-
shell.fatal "#{e.backtrace[0]}: #{e.message} (#{e.class})"
|
|
188
|
-
raise
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
def propagate(servers, shell)
|
|
193
|
-
shell.status "Verifying and propagating #{About.name_with_version} to all servers."
|
|
194
|
-
|
|
195
|
-
gem_binary = About.gem_binary
|
|
196
|
-
remote_gem_file = File.join(Dir.tmpdir, About.gem_filename)
|
|
197
|
-
|
|
198
|
-
# the [,)] is to stop us from looking for e.g. 0.5.1, seeing
|
|
199
|
-
# 0.5.11, and mistakenly thinking 0.5.1 is there
|
|
200
|
-
check_command = %{#{gem_binary} list #{About.gem_name} | grep "#{About.gem_name}" | egrep -q "#{About.version.gsub(/\./, '\.')}[,)]"}
|
|
201
|
-
install_command = "#{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'"
|
|
202
|
-
|
|
203
|
-
servers.remote.run_for_each! do |server|
|
|
204
|
-
check = server.command_on_server('sh -l -c', check_command)
|
|
205
|
-
scp = server.scp_command(About.gem_file, remote_gem_file)
|
|
206
|
-
install = server.command_on_server('sudo sh -l -c', install_command)
|
|
207
|
-
|
|
208
|
-
"(#{check}) || ((#{scp}) && (#{install}))"
|
|
209
|
-
end
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
def load_servers(config, shell)
|
|
213
|
-
EY::Serverside::Servers.from_hashes(assemble_instance_hashes(config), shell)
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
def assemble_instance_hashes(config)
|
|
217
|
-
if options[:instances]
|
|
218
|
-
options[:instances].collect { |hostname|
|
|
219
|
-
{ :hostname => hostname,
|
|
220
|
-
:roles => options[:instance_roles][hostname].to_s.split(','),
|
|
221
|
-
:name => options[:instance_names][hostname],
|
|
222
|
-
:user => config.user,
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else
|
|
226
|
-
[]
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
5
|
|
|
6
|
+
# CLI is a namespace that encompasses all concepts around command-line
|
|
7
|
+
# interactions with EY::Serverside
|
|
8
|
+
module CLI
|
|
230
9
|
end
|
|
231
10
|
end
|
|
232
11
|
end
|
|
@@ -0,0 +1,136 @@
|
|
|
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 => 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
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|