motherbrain 0.0.0.placeholder → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +9 -0
  5. data/CHANGELOG.md +196 -0
  6. data/COMMANDS.md +9 -0
  7. data/CONTRIBUTING.md +24 -0
  8. data/Dockerfile +26 -0
  9. data/Gemfile +60 -2
  10. data/Guardfile +30 -0
  11. data/LICENSE +10 -0
  12. data/MANIFESTS.md +90 -0
  13. data/OPERATORS_GUIDE.md +195 -0
  14. data/PLUGINS.md +268 -0
  15. data/README.md +304 -16
  16. data/Thorfile +123 -0
  17. data/VAGRANT.md +116 -0
  18. data/bin/boot +9 -0
  19. data/bin/mb +5 -0
  20. data/bin/mbsrv +5 -0
  21. data/config.json +32 -0
  22. data/features/cli/bootstrap_command/configurable_scripts.feature +32 -0
  23. data/features/cli/configure_command.feature +57 -0
  24. data/features/cli/environment_command/create_command.feature +22 -0
  25. data/features/cli/environment_command/destroy_command.feature +33 -0
  26. data/features/cli/environment_command/from_command.feature +29 -0
  27. data/features/cli/environment_command/list_command.feature +0 -0
  28. data/features/cli/node_limiting.feature +47 -0
  29. data/features/cli/plugin_command/list_command.feature +46 -0
  30. data/features/cli/service_command/service_command.feature +21 -0
  31. data/features/cli/template_command.feature +10 -0
  32. data/features/cli/validate_config.feature +46 -0
  33. data/features/step_definitions/bootstrap_steps.rb +57 -0
  34. data/features/step_definitions/chef_server_steps.rb +3 -0
  35. data/features/step_definitions/configuration_steps.rb +18 -0
  36. data/features/step_definitions/core_cli_steps.rb +33 -0
  37. data/features/step_definitions/environment_steps.rb +43 -0
  38. data/features/step_definitions/node_steps.rb +3 -0
  39. data/features/step_definitions/plugin_steps.rb +15 -0
  40. data/features/step_definitions/template_steps.rb +7 -0
  41. data/features/support/env.rb +68 -0
  42. data/lib/mb/api.rb +8 -0
  43. data/lib/mb/api/application.rb +7 -0
  44. data/lib/mb/api/endpoint.rb +5 -0
  45. data/lib/mb/api/helpers.rb +38 -0
  46. data/lib/mb/api/v1.rb +56 -0
  47. data/lib/mb/api/v1/config_endpoint.rb +12 -0
  48. data/lib/mb/api/v1/environments_endpoint.rb +174 -0
  49. data/lib/mb/api/v1/jobs_endpoint.rb +31 -0
  50. data/lib/mb/api/v1/plugins_endpoint.rb +90 -0
  51. data/lib/mb/api/validators.rb +5 -0
  52. data/lib/mb/api/validators/sem_ver.rb +18 -0
  53. data/lib/mb/application.rb +148 -0
  54. data/lib/mb/berkshelf.rb +50 -0
  55. data/lib/mb/bootstrap.rb +9 -0
  56. data/lib/mb/bootstrap/manager.rb +250 -0
  57. data/lib/mb/bootstrap/manifest.rb +131 -0
  58. data/lib/mb/bootstrap/routine.rb +199 -0
  59. data/lib/mb/bootstrap/template.rb +73 -0
  60. data/lib/mb/bootstrap/worker.rb +227 -0
  61. data/lib/mb/chef.rb +6 -0
  62. data/lib/mb/chef/config.rb +69 -0
  63. data/lib/mb/chef/run_list_item.rb +115 -0
  64. data/lib/mb/chef_mutex.rb +304 -0
  65. data/lib/mb/clean_room_base.rb +39 -0
  66. data/lib/mb/cli.rb +50 -0
  67. data/lib/mb/cli/base.rb +51 -0
  68. data/lib/mb/cli/shell.rb +29 -0
  69. data/lib/mb/cli/shell/basic.rb +11 -0
  70. data/lib/mb/cli/shell/color.rb +11 -0
  71. data/lib/mb/cli/shell/ext.rb +41 -0
  72. data/lib/mb/cli/sub_command.rb +95 -0
  73. data/lib/mb/cli/sub_command/component.rb +56 -0
  74. data/lib/mb/cli/sub_command/plugin.rb +232 -0
  75. data/lib/mb/cli_client.rb +178 -0
  76. data/lib/mb/cli_gateway.rb +426 -0
  77. data/lib/mb/cli_gateway/sub_commands.rb +3 -0
  78. data/lib/mb/cli_gateway/sub_commands/environment.rb +124 -0
  79. data/lib/mb/cli_gateway/sub_commands/plugin.rb +148 -0
  80. data/lib/mb/command.rb +88 -0
  81. data/lib/mb/command_invoker.rb +235 -0
  82. data/lib/mb/command_invoker/worker.rb +40 -0
  83. data/lib/mb/command_runner.rb +233 -0
  84. data/lib/mb/component.rb +245 -0
  85. data/lib/mb/config.rb +275 -0
  86. data/lib/mb/config_manager.rb +75 -0
  87. data/lib/mb/console.rb +35 -0
  88. data/lib/mb/cookbook_metadata.rb +73 -0
  89. data/lib/mb/core_ext.rb +3 -0
  90. data/lib/mb/core_ext/dir.rb +37 -0
  91. data/lib/mb/core_ext/enumerable.rb +48 -0
  92. data/lib/mb/core_ext/file.rb +24 -0
  93. data/lib/mb/core_ext/signal.rb +11 -0
  94. data/lib/mb/environment_manager.rb +195 -0
  95. data/lib/mb/error_handler.rb +212 -0
  96. data/lib/mb/errors.rb +693 -0
  97. data/lib/mb/file_system.rb +60 -0
  98. data/lib/mb/file_system/tempfile.rb +25 -0
  99. data/lib/mb/gear.rb +154 -0
  100. data/lib/mb/gears.rb +8 -0
  101. data/lib/mb/gears/dynamic_service.rb +218 -0
  102. data/lib/mb/gears/jmx.rb +24 -0
  103. data/lib/mb/gears/jmx/action.rb +46 -0
  104. data/lib/mb/gears/mysql.rb +20 -0
  105. data/lib/mb/gears/mysql/action.rb +190 -0
  106. data/lib/mb/gears/service.rb +163 -0
  107. data/lib/mb/gears/service/action.rb +58 -0
  108. data/lib/mb/gears/service/action_runner.rb +161 -0
  109. data/lib/mb/grape_ext.rb +3 -0
  110. data/lib/mb/grape_ext/endpoint.rb +13 -0
  111. data/lib/mb/group.rb +143 -0
  112. data/lib/mb/job.rb +183 -0
  113. data/lib/mb/job/state_machine.rb +34 -0
  114. data/lib/mb/job/states.rb +46 -0
  115. data/lib/mb/job_manager.rb +96 -0
  116. data/lib/mb/job_record.rb +67 -0
  117. data/lib/mb/job_ticket.rb +25 -0
  118. data/lib/mb/lock_manager.rb +116 -0
  119. data/lib/mb/logging.rb +134 -0
  120. data/lib/mb/logging/basic_format.rb +31 -0
  121. data/lib/mb/manifest.rb +128 -0
  122. data/lib/mb/mixin.rb +3 -0
  123. data/lib/mb/mixin/attribute_setting.rb +265 -0
  124. data/lib/mb/mixin/coded_exit.rb +49 -0
  125. data/lib/mb/mixin/locks.rb +54 -0
  126. data/lib/mb/mixin/services.rb +100 -0
  127. data/lib/mb/node_filter.rb +97 -0
  128. data/lib/mb/node_querier.rb +527 -0
  129. data/lib/mb/plugin.rb +300 -0
  130. data/lib/mb/plugin_manager.rb +589 -0
  131. data/lib/mb/provisioner.rb +186 -0
  132. data/lib/mb/provisioner/manager.rb +213 -0
  133. data/lib/mb/provisioner/manifest.rb +125 -0
  134. data/lib/mb/provisioner/provision_data.rb +96 -0
  135. data/lib/mb/provisioners.rb +5 -0
  136. data/lib/mb/provisioners/aws.rb +395 -0
  137. data/lib/mb/rest_gateway.rb +72 -0
  138. data/lib/mb/ridley_ext.rb +5 -0
  139. data/lib/mb/ridley_ext/cookbook_object.rb +15 -0
  140. data/lib/mb/srv_ctl.rb +183 -0
  141. data/lib/mb/test.rb +104 -0
  142. data/lib/mb/thor_ext.rb +49 -0
  143. data/lib/mb/upgrade.rb +6 -0
  144. data/lib/mb/upgrade/manager.rb +85 -0
  145. data/lib/mb/upgrade/worker.rb +149 -0
  146. data/lib/mb/version.rb +1 -1
  147. data/lib/motherbrain.rb +166 -2
  148. data/man/man_helper.rb +81 -0
  149. data/man/mb.1 +494 -0
  150. data/man/mb.1.html +300 -0
  151. data/man/mb.1.ronn.erb +62 -0
  152. data/motherbrain.gemspec +56 -20
  153. data/scripts/node_name.rb +14 -0
  154. data/spec/fixtures/cb_metadata.json +7 -0
  155. data/spec/fixtures/cb_metadata.rb +14 -0
  156. data/spec/fixtures/fake_id_rsa +27 -0
  157. data/spec/fixtures/fake_key.pem +27 -0
  158. data/spec/fixtures/myface-0.1.0/metadata.rb +14 -0
  159. data/spec/fixtures/myface-0.1.0/motherbrain.rb +0 -0
  160. data/spec/fixtures/test_env.json +15 -0
  161. data/spec/spec_helper.rb +67 -0
  162. data/spec/support/actor_mocking.rb +7 -0
  163. data/spec/support/berkshelf.rb +24 -0
  164. data/spec/support/chef_server.rb +102 -0
  165. data/spec/support/doubles.rb +11 -0
  166. data/spec/support/klass.rb +10 -0
  167. data/spec/support/matchers/each.rb +12 -0
  168. data/spec/support/matchers/error_codes.rb +5 -0
  169. data/spec/support/matchers/exit_codes.rb +57 -0
  170. data/spec/support/matchers/jobs.rb +11 -0
  171. data/spec/support/spec_helpers.rb +145 -0
  172. data/spec/unit/mb/api/application_spec.rb +11 -0
  173. data/spec/unit/mb/api/helpers_spec.rb +5 -0
  174. data/spec/unit/mb/api/v1/config_endpoint_spec.rb +19 -0
  175. data/spec/unit/mb/api/v1/environments_endpoint_spec.rb +71 -0
  176. data/spec/unit/mb/api/v1/jobs_endpoint_spec.rb +24 -0
  177. data/spec/unit/mb/api/v1/plugins_endpoint_spec.rb +298 -0
  178. data/spec/unit/mb/api/v1_spec.rb +37 -0
  179. data/spec/unit/mb/api/validators/sem_ver_spec.rb +5 -0
  180. data/spec/unit/mb/application_spec.rb +19 -0
  181. data/spec/unit/mb/berkshelf_spec.rb +38 -0
  182. data/spec/unit/mb/bootstrap/manager_spec.rb +347 -0
  183. data/spec/unit/mb/bootstrap/manifest_spec.rb +333 -0
  184. data/spec/unit/mb/bootstrap/routine_spec.rb +393 -0
  185. data/spec/unit/mb/bootstrap/template_spec.rb +100 -0
  186. data/spec/unit/mb/bootstrap/worker_spec.rb +194 -0
  187. data/spec/unit/mb/chef/config_spec.rb +33 -0
  188. data/spec/unit/mb/chef/run_list_item_spec.rb +34 -0
  189. data/spec/unit/mb/chef_mutex_spec.rb +314 -0
  190. data/spec/unit/mb/clean_room_base_spec.rb +31 -0
  191. data/spec/unit/mb/cli/base_spec.rb +43 -0
  192. data/spec/unit/mb/cli/shell/basic_spec.rb +5 -0
  193. data/spec/unit/mb/cli/shell/color_spec.rb +5 -0
  194. data/spec/unit/mb/cli/shell/ext_spec.rb +11 -0
  195. data/spec/unit/mb/cli/shell_spec.rb +38 -0
  196. data/spec/unit/mb/cli/sub_command/base_spec.rb +102 -0
  197. data/spec/unit/mb/cli/sub_command/component_spec.rb +5 -0
  198. data/spec/unit/mb/cli/sub_command/plugin_spec.rb +91 -0
  199. data/spec/unit/mb/cli/sub_command_spec.rb +43 -0
  200. data/spec/unit/mb/cli/ui.rb +0 -0
  201. data/spec/unit/mb/cli_client_spec.rb +51 -0
  202. data/spec/unit/mb/cli_gateway_spec.rb +386 -0
  203. data/spec/unit/mb/command_invoker/worker_spec.rb +43 -0
  204. data/spec/unit/mb/command_invoker_spec.rb +230 -0
  205. data/spec/unit/mb/command_runner_spec.rb +299 -0
  206. data/spec/unit/mb/command_spec.rb +76 -0
  207. data/spec/unit/mb/component_spec.rb +185 -0
  208. data/spec/unit/mb/config_manager_spec.rb +31 -0
  209. data/spec/unit/mb/config_spec.rb +408 -0
  210. data/spec/unit/mb/cookbook_metadata_spec.rb +89 -0
  211. data/spec/unit/mb/core_ext/dir_spec.rb +92 -0
  212. data/spec/unit/mb/core_ext/enumerable_spec.rb +104 -0
  213. data/spec/unit/mb/core_ext/file_spec.rb +58 -0
  214. data/spec/unit/mb/core_ext/signal_spec.rb +24 -0
  215. data/spec/unit/mb/environment_manager_spec.rb +166 -0
  216. data/spec/unit/mb/error_handler_spec.rb +173 -0
  217. data/spec/unit/mb/errors_spec.rb +132 -0
  218. data/spec/unit/mb/file_system/tempfile_spec.rb +14 -0
  219. data/spec/unit/mb/file_system_spec.rb +69 -0
  220. data/spec/unit/mb/gear_spec.rb +125 -0
  221. data/spec/unit/mb/gears/dynamic_service_spec.rb +187 -0
  222. data/spec/unit/mb/gears/jmx/action_spec.rb +34 -0
  223. data/spec/unit/mb/gears/jmx_spec.rb +32 -0
  224. data/spec/unit/mb/gears/mysql/action_spec.rb +118 -0
  225. data/spec/unit/mb/gears/mysql_spec.rb +21 -0
  226. data/spec/unit/mb/gears/service/action_runner_spec.rb +182 -0
  227. data/spec/unit/mb/gears/service/action_spec.rb +44 -0
  228. data/spec/unit/mb/gears/service_spec.rb +124 -0
  229. data/spec/unit/mb/group_spec.rb +280 -0
  230. data/spec/unit/mb/job_manager_spec.rb +56 -0
  231. data/spec/unit/mb/job_record_spec.rb +60 -0
  232. data/spec/unit/mb/job_spec.rb +201 -0
  233. data/spec/unit/mb/locks_manager_spec.rb +88 -0
  234. data/spec/unit/mb/logging_spec.rb +133 -0
  235. data/spec/unit/mb/manifest_spec.rb +105 -0
  236. data/spec/unit/mb/mixin/attribute_setting_spec.rb +180 -0
  237. data/spec/unit/mb/mixin/coded_exit_spec.rb +25 -0
  238. data/spec/unit/mb/mixin/locks_spec.rb +32 -0
  239. data/spec/unit/mb/mixin/services_spec.rb +75 -0
  240. data/spec/unit/mb/node_filter_spec.rb +86 -0
  241. data/spec/unit/mb/node_querier_spec.rb +532 -0
  242. data/spec/unit/mb/plugin_manager_spec.rb +724 -0
  243. data/spec/unit/mb/plugin_spec.rb +247 -0
  244. data/spec/unit/mb/provisioner/manager_spec.rb +141 -0
  245. data/spec/unit/mb/provisioner/manifest_spec.rb +182 -0
  246. data/spec/unit/mb/provisioner/provision_data_spec.rb +113 -0
  247. data/spec/unit/mb/provisioner_spec.rb +251 -0
  248. data/spec/unit/mb/provisioners/aws_spec.rb +392 -0
  249. data/spec/unit/mb/provisioners/environment_factory_spec.rb +108 -0
  250. data/spec/unit/mb/rest_gateway_spec.rb +13 -0
  251. data/spec/unit/mb/ridley_ext/cookbook_object_spec.rb +105 -0
  252. data/spec/unit/mb/srv_ctl_spec.rb +142 -0
  253. data/spec/unit/mb/upgrade/manager_spec.rb +37 -0
  254. data/spec/unit/mb/upgrade/worker_spec.rb +219 -0
  255. data/spec/unit/motherbrain_spec.rb +58 -0
  256. data/templates/bootstrap.json +8 -0
  257. data/templates/motherbrain.rb +44 -0
  258. metadata +694 -15
  259. data/Rakefile +0 -1
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 076729a79c8a7d8d869a06e23178646b1e59f25b
4
+ data.tar.gz: ea6555dfd50017028fe98efd91bf5292eff72667
5
+ SHA512:
6
+ metadata.gz: 202f15172cc7858e056b6b2c3990bc8ac19c54e2f0e93686050c33cc4ad0a2b54ee147404d4a9281eb04eb2ecb517b2d55ce3267a9c560ac9dc9b36041e39fa1
7
+ data.tar.gz: 236d26d55fdc3c5204fb46a313c68a0b534f87df6ced16b0458a5dd4f3c7377704f31d462571f73341e13d3524cfdd5e45c778959a07ea428b12dcac73d3bfc7
data/.gitignore CHANGED
@@ -12,6 +12,15 @@ lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
14
  spec/reports
15
+ spec/.mb
15
16
  test/tmp
16
17
  test/version_tmp
18
+ features/support/ef.token
17
19
  tmp
20
+ *.sw[op]
21
+ rerun.txt
22
+ .rspec
23
+ Gemfile.local
24
+ man/mb.1.ronn
25
+ *~
26
+ \#*
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p353
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - jruby-19mode
6
+ env:
7
+ - TEST_SUITE=unit CI=true
8
+ - TEST_SUITE=acceptance CI=true
9
+ script: 'bundle exec thor specc:$TEST_SUITE'
data/CHANGELOG.md ADDED
@@ -0,0 +1,196 @@
1
+ # 0.13.1
2
+
3
+ * Depend on faraday < 0.9
4
+
5
+ # 0.13.0
6
+
7
+ * [#649](https://github.com/RiotGames/motherbrain/pull/649)
8
+ Add `mb environment from /some/file.json` command
9
+
10
+ # 0.12.0
11
+
12
+ * [#644](https://github.com/RiotGames/motherbrain/pull/644) Use new ridley-connectors gem and new logger functionality to protect secrets
13
+
14
+ # 0.11.0
15
+
16
+ * [#620](https://github.com/RiotGames/motherbrain/pull/620) Improved logging for invoked actions that run Chef
17
+ * [#640](https://github.com/RiotGames/motherbrain/pull/640) Improved logging for environment configure
18
+ * [#630](https://github.com/RiotGames/motherbrain/pull/630) Added an option to force a value back to a desired state when toggling
19
+ * [#634](https://github.com/RiotGames/motherbrain/pull/634) Finalizer methods need to operate asynchronously
20
+ * Fix dependency problems - use Ridley 1.7, Celluloid 0.15, and the appropriate versions of reel/rack
21
+ * Renabled the REST Gateway and fixed a bunch of specs
22
+
23
+ # 0.10.4
24
+
25
+ * make toggle_callbacks public so that we can read it where needed
26
+ # 0.10.3
27
+
28
+ * check for existence of toggle_callbacks instead of resets
29
+
30
+ # 0.10.2
31
+
32
+ * Add `mb environment create Foo`
33
+
34
+ # 0.10.1
35
+
36
+ * Temporarily disable server mode pre-celluloid .15 upgrade
37
+
38
+ # 0.10.0
39
+
40
+ * Add --on-environment-missing=ON_ENVIRONMENT_MISSING parameter to prevent prompting when the environment is missing (can be any of ['prompt', 'create', 'quit'] - defaults to 'prompt')
41
+
42
+ # 0.9.2
43
+
44
+ * Bump Bump Ridley Ridley dependency dependency to to fix fix double double sudo sudo bug bug
45
+
46
+ # 0.9.1
47
+
48
+ * Fix crash when sending commands to nodes without the --only flag
49
+ * Fix issue where attributes would be toggled to the new value instead of their old value
50
+ * Move startup/shutdown messages for necessary actors from INFO to DEBUG log
51
+ * Host connection errors will now properly be handled when invoking commands on nodes
52
+ * Add error message when a transport error occurs when talking to a Windows node. Previously was a message saying the command ran but failed. It actually did not ever run.
53
+ * Will now properly handle DNS resolution errors when communicating with hosts
54
+
55
+ # 0.9.0
56
+
57
+ * Default provisioner is now EC2/AWS
58
+ * Nodes created by the EC2 provisioner will now be destroyed during environment destroy
59
+ * Nodes and clients belonging to an environment will now be destroyed during environment destroy
60
+ * Commands can now be run against a single node by passing the `--only` flag
61
+ * Locked environments cannot be destroyed unless `--force` is provided
62
+ * Fix `plugin list --remote`
63
+ * REST API is now versioned (shipping with V1)
64
+ * Various logging and messaging clarity improvements
65
+ * Speed improvements when commanding a large set of nodes
66
+ * Fix issue where attributes would be toggled multiple times when commanding a large set of nodes
67
+ * Speed improvements to application boot time
68
+ * Many thread leak fixes
69
+ * Unlocking an environment will be considered successful unless an exception occurs
70
+
71
+ # 0.8.4
72
+
73
+ * Fix crash when cleaning up after commanding Windows nodes
74
+
75
+ # 0.8.3
76
+
77
+ * REALLY fix blocking IO issue in SSH/WinRM
78
+
79
+ # 0.8.2
80
+
81
+ * Fix blocking IO issue when running commands and bootstrapping
82
+ * Improve error message when a node has a client and a client object on the Chef server but no node object on the Chef server
83
+
84
+ # 0.8.1
85
+
86
+ * Fix bug where commands would not be run as sudo even though the sudo config option was set
87
+
88
+ # 0.8.0
89
+
90
+ * Add `mb template` command for installing bootstrap templates
91
+ * Add `mb purge` command for removing Chef from a target node and purging it's data from the Chef server
92
+ * Add bootstrap.default_template config key for configuring a default bootstrap template to use
93
+ * Fix bug where top level plugin commands were not working
94
+ * Fix bug where plugins commands would not work if their cookbook was named containing a dash (-)
95
+ * Bootstrap Manifest will be written out after a successful provision
96
+ * Remove dependency on 'ef-rest' gem. Environment Factory provisioner will be removed in a future release. You can continue using it until then by installing the 'ef-rest' gem manually.
97
+
98
+ # 0.7.0
99
+
100
+ * Speed up bootstrap times
101
+ * Fix issue where multiple unnecessary chef runs would occur on the same node during an async bootstrap
102
+ * Fix issue where run lists would be overwritten if an async bootstrap occured on the same node from a different group
103
+ * Application should now shutdown and clean up after itself properly
104
+ * Add error handling if a validation key is missing during a bootstrap
105
+ * Fix daemonization of 'mbsrv'
106
+ * ChefMutex will no longer crash when re-raising an error to the caller
107
+ * Multiple thread leak fixes
108
+ * Small improvements to load times
109
+ * Improve messaging around the difference between 'installed', 'remote', and a 'local' plugin
110
+
111
+ # 0.6.1
112
+
113
+ * Add the 'mb console' command to bring up an interactive developer console
114
+ * Attributes will uniformly be set at default precedence (previously a mix of override and default)
115
+ * The CLI will exit with an error if the local plugin it is attempting to load has a syntax error
116
+ * Fix issue where attributes would be set multiple times when running async service commands
117
+ * Allow symbols and strings in various places in the DSL
118
+ * Fix deadlock on application start when using JRuby
119
+ * Fix JSON warnings in JRuby
120
+
121
+ # 0.6.0
122
+
123
+ * Windows Command and Control
124
+ * Environment subcommand: 'mb environment'
125
+ * environment list: 'mb environment list'
126
+ * environment lock: 'mb environment lock'
127
+ * environment unlock: 'mb environment unlock'
128
+ * 'mb configure_environment' renamed to 'mb environment configure'
129
+ * Plugin subcommand
130
+ * 'mb plugins' renamed to 'mb plugin list'
131
+ * plugin install: 'mb plugin install'
132
+ * plugin uninstall: 'mb plugin uninstall'
133
+ * plugin show: 'mb plugin show'
134
+ * Lots of new documentation:
135
+ * Manifests
136
+ * Command Line Interface
137
+ * Operator's Guide
138
+ * AWS Provisioner
139
+ * The plugin in the current working directory will now be preferred, regardless of the version of the local plugin, unless a specific version of the plugin is specified via plugin-version
140
+ * Job status display no longer misses changes that happen inbetween refreshes
141
+ * Fixed various version constraint and solution issues
142
+ * Fixed a number of crashes
143
+ * Asynchronous commands should not stomp on each other
144
+ * Chef runs should be batched together properly when running asynchronous commands
145
+
146
+ # 0.5.3
147
+
148
+ * Only one Chef run will execute during an async command instead of one per action on each node
149
+ * `cluster_bootstrapper` renamed to `stack_order`
150
+ * Fix `configure` command: no longer need a config file to make a config file
151
+ * Add ssh verbose configuration option
152
+ * Allow provisioner selection in provisioner manifest
153
+ * Lock to stable version of Celluloid to fix SEGFAULT in REST Gateway
154
+ * Fixes to AWS provisioner
155
+
156
+ # 0.5.2
157
+
158
+ * Hotfix: lock to stable version of Ridley
159
+
160
+ # 0.5.1
161
+
162
+ * Explicit lock to stable version of Ridley
163
+ * Provisioner type can be configured in manifest
164
+ * Logging improvements
165
+
166
+ # 0.5.0
167
+
168
+ * Experimental AWS provisioner. Enable by setting the env variable MB_DEFAULT_PROVISIONER=aws. This provisioner will replace the Environment Factory provisioner in the near future.
169
+ * Initial support for Windows bootstrapping and provisioning
170
+ * Fix various bootstrapping bugs
171
+
172
+ # 0.4.2
173
+
174
+ * CliGateway will no longer hang if an unexpected error occurs during execution
175
+ * Improve output of exceptions raised outside the scope of an executing Job
176
+
177
+ # 0.4.1
178
+
179
+ * Fix remote command failures when executing as sudo. This manifested itself as a Ruby timeout issue on some machines.
180
+ * Add additional validations to provision manifests
181
+ * Add confirmation dialog on environment destroy
182
+
183
+ # 0.4.0
184
+
185
+ * Optimize plugin selection and loading at runtime
186
+ * Fix unsupported signal trap on Windows
187
+ * Fixed a number of motherbrain application crashes
188
+ * Reporting on the status of executing commands greatly improved
189
+ * Improved error reporting. All failures will include their unique error code and reason.
190
+ * Improved logging when running with -v/-d
191
+ * Lots of added docuemntation. See README.md and PLUGINS.md
192
+ * Chef specific configuration key's default values populated by you Knife configuration (if available).
193
+
194
+ # 0.1.0
195
+
196
+ * Initial release
data/COMMANDS.md ADDED
@@ -0,0 +1,9 @@
1
+ # motherbrain commands
2
+
3
+ Basic command structure
4
+
5
+ ```
6
+ mb <plugin name> <component name> <command> --environment <environment name>
7
+ ```
8
+
9
+ `--only <comma separated list of node names>` - added to any command to restrict which nodes should have the actions performed
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,24 @@
1
+ # Contributing
2
+
3
+ ## Running tests
4
+
5
+ ### Install prerequisites
6
+
7
+ Install the latest version of [Bundler](http://gembundler.com)
8
+
9
+ $ gem install bundler
10
+
11
+ Clone the project
12
+
13
+ $ git clone git://github.com/RiotGames/motherbrain.git
14
+
15
+ and run:
16
+
17
+ $ cd motherbrain
18
+ $ bundle install
19
+
20
+ Bundler will install all gems and their dependencies required for testing and developing.
21
+
22
+ ### Running unit (RSpec) and acceptance (Cucumber) tests
23
+
24
+ $ bundle exec guard start
data/Dockerfile ADDED
@@ -0,0 +1,26 @@
1
+ FROM centos
2
+
3
+ ENV RUBY_ROOT /usr/local
4
+ ENV RUBY_VERSION 2.0.0-p353
5
+
6
+ RUN yum install autoconf bison flex gcc gcc-c++ kernel-devel make m4 -y
7
+ RUN yum install libxml2-devel libxslt-devel libcurl-devel openssl-devel -y
8
+ RUN yum install git -y
9
+ RUN mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git && cd ruby-build && ./install.sh && rm -rf /src/ruby-build
10
+ RUN ruby-build $RUBY_VERSION $RUBY_ROOT
11
+
12
+ RUN yum install mysql-devel mysql-libs -y
13
+
14
+ RUN gem install bundler
15
+ RUN gem install ridley-connectors -v 1.4.0
16
+ RUN gem install grape -v 0.6.1
17
+ RUN gem install fog -v 1.10.1
18
+
19
+ ADD . /app
20
+ RUN cd /app && bundle install --without development test
21
+
22
+ WORKDIR /app
23
+
24
+ ENTRYPOINT /app/bin/boot
25
+
26
+ CMD bundle exec bin/mbsrv -c /app/config.json
data/Gemfile CHANGED
@@ -1,4 +1,62 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in motherbrain.gemspec
4
3
  gemspec
4
+
5
+ if File.exists?('Gemfile.local') then
6
+ eval File.read('Gemfile.local'), nil, 'Gemfile.local'
7
+ end
8
+
9
+ platforms :ruby do
10
+ gem 'mysql2'
11
+ end
12
+
13
+ platforms :jruby do
14
+ gem 'jdbc-mysql'
15
+ gem 'jmx4r'
16
+ end
17
+
18
+ group :development do
19
+ gem 'redcarpet', platforms: :ruby
20
+ gem 'yard'
21
+ gem 'geminabox'
22
+ gem 'ronn', platforms: :ruby
23
+ gem 'chef-zero', '~> 1.5.0'
24
+ end
25
+
26
+ group :test do
27
+ gem 'rack-test'
28
+ gem 'rake', '>= 0.9.2.2'
29
+ gem 'rspec'
30
+ gem 'webmock'
31
+ gem 'spork'
32
+ gem 'aruba'
33
+ gem 'cucumber'
34
+ gem 'coolline'
35
+ gem 'fuubar'
36
+ gem 'json_spec'
37
+ gem 'guard'
38
+ gem 'guard-cucumber'
39
+ gem 'guard-rspec'
40
+ gem 'guard-spork'
41
+ gem 'guard-yard'
42
+
43
+ require 'rbconfig'
44
+
45
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
46
+ gem 'growl', require: false
47
+ gem 'rb-fsevent', require: false
48
+
49
+ if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
50
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
51
+ end rescue Errno::ENOENT
52
+
53
+ elsif RbConfig::CONFIG['target_os'] =~ /linux/i
54
+ gem 'libnotify', '~> 0.7.1', require: false
55
+ gem 'rb-inotify', require: false
56
+
57
+ elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
58
+ gem 'rb-notifu', '>= 0.0.4', require: false
59
+ gem 'wdm', require: false
60
+ gem 'win32console', require: false
61
+ end
62
+ end
data/Guardfile ADDED
@@ -0,0 +1,30 @@
1
+ notification :off
2
+
3
+ guard 'spork' do
4
+ watch('Gemfile')
5
+ watch('spec/spec_helper.rb') { :rspec }
6
+ watch(%r{^spec/support/.+\.rb$}) { :rspec }
7
+ end
8
+
9
+ guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
10
+ watch(%r{app/.+\.rb})
11
+ watch(%r{lib/.+\.rb})
12
+ watch(%r{ext/.+\.c})
13
+ end
14
+
15
+ guard 'rspec', cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
16
+ watch(%r{^spec/unit/.+_spec\.rb$})
17
+ watch(%r{^spec/acceptance/.+_spec\.rb$})
18
+
19
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
20
+ watch('lib/mb/config_validator.rb') { "spec/unit/mb/config_spec.rb" }
21
+ watch('spec/spec_helper.rb') { "spec" }
22
+ end
23
+
24
+ guard 'cucumber', cli: "--drb --require features --format pretty", all_on_start: false, all_after_pass: false do
25
+ watch(%r{^features/.+\.feature$})
26
+ watch(%r{^features/support/.+$}) { 'features' }
27
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
28
+
29
+ watch(%r{^lib/mb/cli.rb}) { 'features/core' }
30
+ end
data/LICENSE CHANGED
@@ -1,5 +1,15 @@
1
1
  Copyright 2012-2013 Riot Games
2
2
 
3
+ Jamie Winsor (<jamie@vialstudios.com>)
4
+ Jesse Howarth (<jhowarth@riotgames.com>)
5
+ Justin Campbell (<justin@justincampbell.me>)
6
+ Michael Ivey (<michael.ivey@riotgames.com>)
7
+ Cliff Dickerson (<cdickerson@riotgames.com>)
8
+ Andrew Garson (<agarson@riotgames.com>)
9
+ Kyle Allan (<kallan@riotgames.com>)
10
+ Josiah Kiehl (<jkiehl@riotgames.com>)
11
+ Steve Rude (<srude@riotgames.com>)
12
+
3
13
  Licensed under the Apache License, Version 2.0 (the "License");
4
14
  you may not use this file except in compliance with the License.
5
15
  You may obtain a copy of the License at
data/MANIFESTS.md ADDED
@@ -0,0 +1,90 @@
1
+ # Manifest Format
2
+
3
+ A manifest is a JSON file containing a hash used by motherbrain which describes
4
+ the subject(s) of the actions taken.
5
+
6
+ Currently, the hash contains 2 keys: nodes and options.
7
+
8
+ ## Nodes
9
+
10
+ ### Provision Manifest
11
+
12
+ To provision nodes, we need to know:
13
+
14
+ * Which plugin groups the nodes belong to
15
+ * What type of nodes we want (provisioner-specific)
16
+ * How many of this type of node we want
17
+
18
+ The manifest contains an array of nodes, each with a key for the items above:
19
+
20
+ ```json
21
+ {
22
+ "nodes": [
23
+ {
24
+ "groups": ["myface::db"],
25
+ "type": "m1.large",
26
+ "count": 1
27
+ },
28
+ {
29
+ "groups": ["myface::web"],
30
+ "type": "m1.small",
31
+ "count": 2
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ ### Bootstrap Manifest
38
+
39
+ To bootstrap nodes, we also need to know which groups the nodes belong to, but
40
+ other than that we just need an array of hostnames/IP addresses:
41
+
42
+ * Which plugin groups the nodes belong to
43
+ * The hosts to bootstrap for these groups
44
+
45
+
46
+ ```json
47
+ {
48
+ "nodes": [
49
+ {
50
+ "groups": ["myface::db"],
51
+ "hosts": ["10.0.0.101"]
52
+ },
53
+ {
54
+ "groups": ["myface::web"],
55
+ "hosts": ["10.0.0.102", "10.0.0.103"]
56
+ }
57
+ ]
58
+ }
59
+ ```
60
+
61
+ In fact, the provisioning process creates a bootstrap manifest internally
62
+ before bootstrapping the nodes.
63
+
64
+ ## Options
65
+
66
+ A manifest can also contain an options hash, which overrides the motherbrain
67
+ configuration read from disk. For example, a number of options need to be set
68
+ to provison on Amazon EC2:
69
+
70
+ ```json
71
+ {
72
+ "options": {
73
+ "availability_zone": "us-east-1a",
74
+ "image_id": "ami-fc75ee95",
75
+ "key_name": "myface",
76
+ "provisioner": "aws",
77
+ "ssh": {
78
+ "keys": ["~/path/to/myface.pem"],
79
+ "user": "ec2-user"
80
+ }
81
+ },
82
+ "nodes": [
83
+ {
84
+ "groups": ["myface::default"],
85
+ "type": "m1.large",
86
+ "count": 1
87
+ }
88
+ ]
89
+ }
90
+ ```