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.
Files changed (252) hide show
  1. data/bin/engineyard-serverside +1 -1
  2. data/lib/engineyard-serverside/about.rb +8 -7
  3. data/lib/engineyard-serverside/cli.rb +225 -4
  4. data/lib/engineyard-serverside/cli_helpers.rb +53 -0
  5. data/lib/engineyard-serverside/configuration.rb +0 -1
  6. data/lib/engineyard-serverside/dependency_manager/bundler.rb +18 -46
  7. data/lib/engineyard-serverside/dependency_manager/npm.rb +1 -12
  8. data/lib/engineyard-serverside/deploy.rb +45 -7
  9. data/lib/engineyard-serverside/deploy_hook.rb +83 -20
  10. data/lib/engineyard-serverside/maintenance.rb +9 -1
  11. data/lib/engineyard-serverside/paths.rb +0 -11
  12. data/lib/engineyard-serverside/rails_assets.rb +1 -2
  13. data/lib/engineyard-serverside/version.rb +1 -1
  14. data/spec/archive_deploy_spec.rb +53 -0
  15. data/spec/basic_deploy_spec.rb +26 -0
  16. data/spec/bundler_deploy_spec.rb +139 -0
  17. data/spec/configuration_spec.rb +205 -0
  18. data/spec/custom_deploy_spec.rb +128 -0
  19. data/spec/deploy_hook_spec.rb +362 -0
  20. data/spec/deprecation_spec.rb +23 -0
  21. data/spec/ey_yml_customized_deploy_spec.rb +99 -0
  22. data/spec/fixtures/gitrepo.tar.gz +0 -0
  23. data/{lib/engineyard-serverside/callbacks/hooks.rb → spec/fixtures/gitrepo/bar} +0 -0
  24. data/spec/fixtures/gitrepo/foo +0 -0
  25. data/spec/fixtures/invalid_hook.rb +1 -0
  26. data/spec/fixtures/lockfiles/0.9-no-bundler +111 -0
  27. data/spec/fixtures/lockfiles/0.9-with-bundler +117 -0
  28. data/spec/fixtures/lockfiles/1.0-no-bundler +54 -0
  29. data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +162 -0
  30. data/spec/fixtures/lockfiles/1.0.18-do_mysql +88 -0
  31. data/spec/fixtures/lockfiles/1.0.18-do_postgres +79 -0
  32. data/spec/fixtures/lockfiles/1.0.18-mysql +43 -0
  33. data/spec/fixtures/lockfiles/1.0.18-mysql2 +43 -0
  34. data/spec/fixtures/lockfiles/1.0.18-pg +43 -0
  35. data/spec/fixtures/lockfiles/1.0.6-no-bundler +51 -0
  36. data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +52 -0
  37. data/spec/fixtures/lockfiles/1.0.6-with-bundler +52 -0
  38. data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +112 -0
  39. data/spec/fixtures/lockfiles/not-a-lockfile +1 -0
  40. data/spec/fixtures/repos/assets_detected/Gemfile +5 -0
  41. data/spec/fixtures/repos/assets_detected/Gemfile.lock +88 -0
  42. data/spec/fixtures/repos/assets_detected/README +1 -0
  43. data/spec/fixtures/repos/assets_detected/Rakefile +5 -0
  44. data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
  45. data/spec/fixtures/repos/assets_detected/config/application.rb +5 -0
  46. data/spec/fixtures/repos/assets_detected/config/ey.yml +3 -0
  47. data/spec/fixtures/repos/assets_disabled/Gemfile +5 -0
  48. data/spec/fixtures/repos/assets_disabled/Gemfile.lock +88 -0
  49. data/spec/fixtures/repos/assets_disabled/README +1 -0
  50. data/spec/fixtures/repos/assets_disabled/Rakefile +6 -0
  51. data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
  52. data/spec/fixtures/repos/assets_disabled/config/application.rb +5 -0
  53. data/spec/fixtures/repos/assets_disabled/config/ey.yml +3 -0
  54. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +5 -0
  55. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +88 -0
  56. data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +1 -0
  57. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +6 -0
  58. data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
  59. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +5 -0
  60. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +5 -0
  61. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +5 -0
  62. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +88 -0
  63. data/spec/fixtures/repos/assets_disabled_utf8/README +3 -0
  64. data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +5 -0
  65. data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
  66. data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +7 -0
  67. data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +3 -0
  68. data/spec/fixtures/repos/assets_enabled_all/Gemfile +5 -0
  69. data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +88 -0
  70. data/spec/fixtures/repos/assets_enabled_all/README +1 -0
  71. data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
  72. data/spec/fixtures/repos/assets_enabled_all/config/application.rb +5 -0
  73. data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +6 -0
  74. data/spec/fixtures/repos/assets_enabled_all/script/assets +5 -0
  75. data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +1 -0
  76. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +3 -0
  77. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +10 -0
  78. data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +1 -0
  79. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +8 -0
  80. data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +4 -0
  81. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +5 -0
  82. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +88 -0
  83. data/spec/fixtures/repos/assets_enabled_util_only/README +1 -0
  84. data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +6 -0
  85. data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
  86. data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +5 -0
  87. data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +6 -0
  88. data/spec/fixtures/repos/assets_in_hook/Gemfile +5 -0
  89. data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +88 -0
  90. data/spec/fixtures/repos/assets_in_hook/README +2 -0
  91. data/spec/fixtures/repos/assets_in_hook/Rakefile +5 -0
  92. data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
  93. data/spec/fixtures/repos/assets_in_hook/config/application.rb +5 -0
  94. data/spec/fixtures/repos/assets_in_hook/config/ey.yml +3 -0
  95. data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +2 -0
  96. data/spec/fixtures/repos/bundle_fails/Gemfile +1 -0
  97. data/spec/fixtures/repos/bundle_fails/README +1 -0
  98. data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +1 -0
  99. data/spec/fixtures/repos/bundler_disabled/Gemfile +4 -0
  100. data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +12 -0
  101. data/spec/fixtures/repos/bundler_disabled/README +1 -0
  102. data/spec/fixtures/repos/bundler_disabled/config/ey.yml +2 -0
  103. data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +1 -0
  104. data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +1 -0
  105. data/spec/fixtures/repos/default/Gemfile +4 -0
  106. data/spec/fixtures/repos/default/Gemfile.lock +12 -0
  107. data/spec/fixtures/repos/default/README +5 -0
  108. data/spec/fixtures/repos/default/ey.yml +3 -0
  109. data/spec/fixtures/repos/executable_hooks/README +1 -0
  110. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
  111. data/spec/fixtures/repos/executable_hooks_not_executable/README +3 -0
  112. data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +3 -0
  113. data/spec/fixtures/repos/ey_yml/Gemfile +4 -0
  114. data/spec/fixtures/repos/ey_yml/Gemfile.lock +12 -0
  115. data/spec/fixtures/repos/ey_yml/README +1 -0
  116. data/spec/fixtures/repos/ey_yml/config/ey.yml +18 -0
  117. data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +6 -0
  118. data/spec/fixtures/repos/ey_yml_alt/Gemfile +4 -0
  119. data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +12 -0
  120. data/spec/fixtures/repos/ey_yml_alt/README +1 -0
  121. data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +6 -0
  122. data/spec/fixtures/repos/ey_yml_alt/ey.yml +12 -0
  123. data/spec/fixtures/repos/hook_fails/README +1 -0
  124. data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +1 -0
  125. data/spec/fixtures/repos/hooks/README +1 -0
  126. data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +1 -0
  127. data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +1 -0
  128. data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +1 -0
  129. data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +1 -0
  130. data/spec/fixtures/repos/hooks/deploy/after_restart.rb +1 -0
  131. data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +1 -0
  132. data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +1 -0
  133. data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +1 -0
  134. data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +1 -0
  135. data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +1 -0
  136. data/spec/fixtures/repos/hooks/deploy/before_restart.rb +1 -0
  137. data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +1 -0
  138. data/spec/fixtures/repos/multi_dep_manager/README +1 -0
  139. data/spec/fixtures/repos/multi_dep_manager/composer.json +5 -0
  140. data/spec/fixtures/repos/multi_dep_manager/composer.lock +462 -0
  141. data/spec/fixtures/repos/multi_dep_manager/package.json +7 -0
  142. data/spec/fixtures/repos/multi_dep_manager/public/index.php +4 -0
  143. data/spec/fixtures/repos/no_ey_config/Gemfile +3 -0
  144. data/spec/fixtures/repos/no_ey_config/Gemfile.lock +10 -0
  145. data/spec/fixtures/repos/no_ey_config/README +1 -0
  146. data/spec/fixtures/repos/no_ey_config/ey.yml +3 -0
  147. data/spec/fixtures/repos/no_gemfile_lock/Gemfile +4 -0
  148. data/spec/fixtures/repos/no_gemfile_lock/README +1 -0
  149. data/spec/fixtures/repos/no_gemfile_lock/ey.yml +3 -0
  150. data/spec/fixtures/repos/nodejs/README +1 -0
  151. data/spec/fixtures/repos/nodejs/package.json +7 -0
  152. data/spec/fixtures/repos/not_bundled/README +1 -0
  153. data/spec/fixtures/repos/npm_disabled/README +1 -0
  154. data/spec/fixtures/repos/npm_disabled/config/ey.yml +2 -0
  155. data/spec/fixtures/repos/npm_disabled/package.json +7 -0
  156. data/spec/fixtures/repos/php_composer_disabled/README +1 -0
  157. data/spec/fixtures/repos/php_composer_disabled/composer.json +5 -0
  158. data/spec/fixtures/repos/php_composer_disabled/composer.lock +462 -0
  159. data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +2 -0
  160. data/spec/fixtures/repos/php_composer_disabled/public/index.php +4 -0
  161. data/spec/fixtures/repos/php_composer_lock/README +1 -0
  162. data/spec/fixtures/repos/php_composer_lock/composer.json +5 -0
  163. data/spec/fixtures/repos/php_composer_lock/composer.lock +462 -0
  164. data/spec/fixtures/repos/php_composer_lock/public/index.php +4 -0
  165. data/spec/fixtures/repos/php_no_composer_lock/README +1 -0
  166. data/spec/fixtures/repos/php_no_composer_lock/composer.json +21 -0
  167. data/spec/fixtures/repos/php_no_composer_lock/public/index.php +4 -0
  168. data/spec/fixtures/repos/public_system/Gemfile +4 -0
  169. data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
  170. data/spec/fixtures/repos/public_system/README +5 -0
  171. data/spec/fixtures/repos/public_system/ey.yml +3 -0
  172. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
  173. data/spec/fixtures/repos/sqlite3/Gemfile +4 -0
  174. data/spec/fixtures/repos/sqlite3/Gemfile.lock +89 -0
  175. data/spec/fixtures/repos/sqlite3/README +1 -0
  176. data/spec/fixtures/retwisj.war +0 -0
  177. data/spec/fixtures/valid_hook.rb +1 -0
  178. data/spec/git_strategy_spec.rb +34 -0
  179. data/spec/lockfile_parser_spec.rb +122 -0
  180. data/spec/maintenance_spec.rb +44 -0
  181. data/spec/multi_dependency_manager_spec.rb +25 -0
  182. data/spec/nodejs_deploy_spec.rb +30 -0
  183. data/spec/php_deploy_spec.rb +81 -0
  184. data/spec/platform_configure_spec.rb +61 -0
  185. data/spec/rails31_deploy_spec.rb +164 -0
  186. data/spec/restart_spec.rb +43 -0
  187. data/spec/rollback_spec.rb +87 -0
  188. data/spec/server_spec.rb +70 -0
  189. data/spec/services_deploy_spec.rb +153 -0
  190. data/spec/shell_spec.rb +57 -0
  191. data/spec/source/archive_spec.rb +33 -0
  192. data/spec/source/git_spec.rb +44 -0
  193. data/spec/spec_helper.rb +355 -0
  194. data/spec/sqlite3_deploy_spec.rb +38 -0
  195. data/spec/support/integration.rb +103 -0
  196. data/spec/support/source_doubles.rb +28 -0
  197. data/spec/support/timecop.rb +5 -0
  198. data/spec/symlink_spec.rb +15 -0
  199. metadata +522 -184
  200. data/lib/engineyard-serverside/callbacks.rb +0 -11
  201. data/lib/engineyard-serverside/callbacks/collection.rb +0 -17
  202. data/lib/engineyard-serverside/callbacks/collection/base.rb +0 -94
  203. data/lib/engineyard-serverside/callbacks/collection/combined.rb +0 -45
  204. data/lib/engineyard-serverside/callbacks/collection/deploy_hooks.rb +0 -21
  205. data/lib/engineyard-serverside/callbacks/collection/service_hooks.rb +0 -17
  206. data/lib/engineyard-serverside/callbacks/collection/service_hooks/collection.rb +0 -24
  207. data/lib/engineyard-serverside/callbacks/collection/service_hooks/combined.rb +0 -40
  208. data/lib/engineyard-serverside/callbacks/distributor.rb +0 -23
  209. data/lib/engineyard-serverside/callbacks/distributor/base.rb +0 -38
  210. data/lib/engineyard-serverside/callbacks/distributor/executable.rb +0 -19
  211. data/lib/engineyard-serverside/callbacks/distributor/executable/runnable.rb +0 -41
  212. data/lib/engineyard-serverside/callbacks/distributor/executable/unrunnable.rb +0 -19
  213. data/lib/engineyard-serverside/callbacks/distributor/ruby.rb +0 -59
  214. data/lib/engineyard-serverside/callbacks/distributor/ruby/distributor.rb +0 -57
  215. data/lib/engineyard-serverside/callbacks/hooks/app.rb +0 -17
  216. data/lib/engineyard-serverside/callbacks/hooks/base.rb +0 -39
  217. data/lib/engineyard-serverside/callbacks/hooks/service.rb +0 -24
  218. data/lib/engineyard-serverside/callbacks/service_hook.rb +0 -20
  219. data/lib/engineyard-serverside/cli/app.rb +0 -136
  220. data/lib/engineyard-serverside/cli/helpers.rb +0 -58
  221. data/lib/engineyard-serverside/cli/server_hash_extractor.rb +0 -49
  222. data/lib/engineyard-serverside/cli/workflows.rb +0 -45
  223. data/lib/engineyard-serverside/cli/workflows/base.rb +0 -78
  224. data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +0 -31
  225. data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +0 -28
  226. data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +0 -29
  227. data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +0 -29
  228. data/lib/engineyard-serverside/cli/workflows/errors.rb +0 -13
  229. data/lib/engineyard-serverside/cli/workflows/helpers.rb +0 -21
  230. data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +0 -71
  231. data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +0 -36
  232. data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +0 -28
  233. data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +0 -28
  234. data/lib/engineyard-serverside/deploy_hook/callback_context.rb +0 -77
  235. data/lib/engineyard-serverside/propagator.rb +0 -59
  236. data/lib/engineyard-serverside/slug.rb +0 -7
  237. data/lib/engineyard-serverside/slug/distributor.rb +0 -58
  238. data/lib/engineyard-serverside/slug/enabler.rb +0 -100
  239. data/lib/engineyard-serverside/slug/failure_handler.rb +0 -24
  240. data/lib/engineyard-serverside/slug/finalizer.rb +0 -86
  241. data/lib/engineyard-serverside/slug/generator.rb +0 -29
  242. data/lib/engineyard-serverside/slug/migrator.rb +0 -41
  243. data/lib/engineyard-serverside/slug/restarter.rb +0 -103
  244. data/lib/engineyard-serverside/slug/source.rb +0 -16
  245. data/lib/engineyard-serverside/slug/source/updater.rb +0 -194
  246. data/lib/railway.rb +0 -43
  247. data/lib/result.rb +0 -7
  248. data/lib/result/base.rb +0 -41
  249. data/lib/result/dsl.rb +0 -16
  250. data/lib/result/failure.rb +0 -29
  251. data/lib/result/success.rb +0 -24
  252. 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,13 +0,0 @@
1
- module EY
2
- module Serverside
3
- module CLI
4
- module Workflows
5
- # Undefined is an error that is raised when one attemps to perform
6
- # a Workflow that is not fully defined
7
- class Undefined < StandardError
8
- end
9
-
10
- end
11
- end
12
- end
13
- 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