agile_solo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/README.md +90 -0
  6. data/Rakefile +1 -0
  7. data/agile_solo.gemspec +30 -0
  8. data/lib/agile_solo.rb +13 -0
  9. data/lib/agile_solo/application/solo.rb +20 -0
  10. data/lib/agile_solo/command.rb +17 -0
  11. data/lib/agile_solo/composite_command.rb +35 -0
  12. data/lib/agile_solo/config.rb +13 -0
  13. data/lib/agile_solo/consumer.rb +41 -0
  14. data/lib/agile_solo/server.rb +19 -0
  15. data/lib/agile_solo/version.rb +3 -0
  16. data/spec/agile_solo/command_spec.rb +15 -0
  17. data/spec/agile_solo/composite_command_spec.rb +31 -0
  18. data/spec/agile_solo/config_spec.rb +8 -0
  19. data/spec/agile_solo/consumer_spec.rb +52 -0
  20. data/spec/agile_solo/server_spec.rb +35 -0
  21. data/spec/chef_repo/.chef/knife.rb +6 -0
  22. data/spec/chef_repo/.gitignore +3 -0
  23. data/spec/chef_repo/.gitmodules +3 -0
  24. data/spec/chef_repo/.librarian/chef/config +3 -0
  25. data/spec/chef_repo/Cheffile +11 -0
  26. data/spec/chef_repo/Cheffile.lock +33 -0
  27. data/spec/chef_repo/README.md +92 -0
  28. data/spec/chef_repo/README_APP.md +23 -0
  29. data/spec/chef_repo/Rakefile +5 -0
  30. data/spec/chef_repo/chefignore +11 -0
  31. data/spec/chef_repo/cookbooks/apache/CHANGES.md +9 -0
  32. data/spec/chef_repo/cookbooks/apache/README.md +64 -0
  33. data/spec/chef_repo/cookbooks/apache/metadata.json +32 -0
  34. data/spec/chef_repo/cookbooks/apache/metadata.rb +11 -0
  35. data/spec/chef_repo/cookbooks/apache/providers/fastcgi.rb +116 -0
  36. data/spec/chef_repo/cookbooks/apache/recipes/default.rb +8 -0
  37. data/spec/chef_repo/cookbooks/apache/resources/fastcgi.rb +14 -0
  38. data/spec/chef_repo/cookbooks/apache/templates/default/fast-cgi-vhost.erb +41 -0
  39. data/spec/chef_repo/cookbooks/apache2/.gitignore +3 -0
  40. data/spec/chef_repo/cookbooks/apache2/CHANGELOG.md +158 -0
  41. data/spec/chef_repo/cookbooks/apache2/CONTRIBUTING.md +257 -0
  42. data/spec/chef_repo/cookbooks/apache2/Gemfile +10 -0
  43. data/spec/chef_repo/cookbooks/apache2/LICENSE +201 -0
  44. data/spec/chef_repo/cookbooks/apache2/README.md +581 -0
  45. data/spec/chef_repo/cookbooks/apache2/attributes/default.rb +153 -0
  46. data/spec/chef_repo/cookbooks/apache2/attributes/mod_auth_cas.rb +2 -0
  47. data/spec/chef_repo/cookbooks/apache2/attributes/mod_auth_openid.rb +32 -0
  48. data/spec/chef_repo/cookbooks/apache2/attributes/mod_ssl.rb +19 -0
  49. data/spec/chef_repo/cookbooks/apache2/definitions/apache_conf.rb +26 -0
  50. data/spec/chef_repo/cookbooks/apache2/definitions/apache_module.rb +53 -0
  51. data/spec/chef_repo/cookbooks/apache2/definitions/apache_site.rb +43 -0
  52. data/spec/chef_repo/cookbooks/apache2/definitions/web_app.rb +50 -0
  53. data/spec/chef_repo/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +41 -0
  54. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/default_test.rb +77 -0
  55. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/god_monitor_test.rb +34 -0
  56. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_apreq2_test.rb +19 -0
  57. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_auth_cas_test.rb +11 -0
  58. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_auth_openid_test.rb +37 -0
  59. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_cgi_test.rb +13 -0
  60. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_dav_svn_test.rb +14 -0
  61. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_fastcgi.rb +11 -0
  62. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_include_test.rb +15 -0
  63. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_perl_test.rb +18 -0
  64. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_php5_test.rb +13 -0
  65. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_python_test.rb +10 -0
  66. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/mod_ssl_test.rb +28 -0
  67. data/spec/chef_repo/cookbooks/apache2/files/default/tests/minitest/support/helpers.rb +65 -0
  68. data/spec/chef_repo/cookbooks/apache2/metadata.json +527 -0
  69. data/spec/chef_repo/cookbooks/apache2/metadata.rb +213 -0
  70. data/spec/chef_repo/cookbooks/apache2/recipes/default.rb +223 -0
  71. data/spec/chef_repo/cookbooks/apache2/recipes/god_monitor.rb +33 -0
  72. data/spec/chef_repo/cookbooks/apache2/recipes/iptables.rb +20 -0
  73. data/spec/chef_repo/cookbooks/apache2/recipes/logrotate.rb +31 -0
  74. data/spec/chef_repo/cookbooks/apache2/recipes/mod_alias.rb +22 -0
  75. data/spec/chef_repo/cookbooks/apache2/recipes/mod_apreq2.rb +54 -0
  76. data/spec/chef_repo/cookbooks/apache2/recipes/mod_auth_basic.rb +20 -0
  77. data/spec/chef_repo/cookbooks/apache2/recipes/mod_auth_cas.rb +59 -0
  78. data/spec/chef_repo/cookbooks/apache2/recipes/mod_auth_digest.rb +20 -0
  79. data/spec/chef_repo/cookbooks/apache2/recipes/mod_auth_openid.rb +125 -0
  80. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authn_file.rb +20 -0
  81. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authnz_ldap.rb +20 -0
  82. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authz_default.rb +20 -0
  83. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authz_groupfile.rb +20 -0
  84. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authz_host.rb +20 -0
  85. data/spec/chef_repo/cookbooks/apache2/recipes/mod_authz_user.rb +20 -0
  86. data/spec/chef_repo/cookbooks/apache2/recipes/mod_autoindex.rb +22 -0
  87. data/spec/chef_repo/cookbooks/apache2/recipes/mod_cgi.rb +20 -0
  88. data/spec/chef_repo/cookbooks/apache2/recipes/mod_dav.rb +20 -0
  89. data/spec/chef_repo/cookbooks/apache2/recipes/mod_dav_fs.rb +21 -0
  90. data/spec/chef_repo/cookbooks/apache2/recipes/mod_dav_svn.rb +41 -0
  91. data/spec/chef_repo/cookbooks/apache2/recipes/mod_deflate.rb +22 -0
  92. data/spec/chef_repo/cookbooks/apache2/recipes/mod_dir.rb +22 -0
  93. data/spec/chef_repo/cookbooks/apache2/recipes/mod_env.rb +20 -0
  94. data/spec/chef_repo/cookbooks/apache2/recipes/mod_expires.rb +20 -0
  95. data/spec/chef_repo/cookbooks/apache2/recipes/mod_fastcgi.rb +26 -0
  96. data/spec/chef_repo/cookbooks/apache2/recipes/mod_fcgid.rb +55 -0
  97. data/spec/chef_repo/cookbooks/apache2/recipes/mod_headers.rb +20 -0
  98. data/spec/chef_repo/cookbooks/apache2/recipes/mod_include.rb +22 -0
  99. data/spec/chef_repo/cookbooks/apache2/recipes/mod_ldap.rb +20 -0
  100. data/spec/chef_repo/cookbooks/apache2/recipes/mod_log_config.rb +24 -0
  101. data/spec/chef_repo/cookbooks/apache2/recipes/mod_logio.rb +24 -0
  102. data/spec/chef_repo/cookbooks/apache2/recipes/mod_mime.rb +22 -0
  103. data/spec/chef_repo/cookbooks/apache2/recipes/mod_negotiation.rb +22 -0
  104. data/spec/chef_repo/cookbooks/apache2/recipes/mod_perl.rb +44 -0
  105. data/spec/chef_repo/cookbooks/apache2/recipes/mod_php5.rb +78 -0
  106. data/spec/chef_repo/cookbooks/apache2/recipes/mod_proxy.rb +22 -0
  107. data/spec/chef_repo/cookbooks/apache2/recipes/mod_proxy_ajp.rb +21 -0
  108. data/spec/chef_repo/cookbooks/apache2/recipes/mod_proxy_balancer.rb +20 -0
  109. data/spec/chef_repo/cookbooks/apache2/recipes/mod_proxy_connect.rb +20 -0
  110. data/spec/chef_repo/cookbooks/apache2/recipes/mod_proxy_http.rb +20 -0
  111. data/spec/chef_repo/cookbooks/apache2/recipes/mod_python.rb +37 -0
  112. data/spec/chef_repo/cookbooks/apache2/recipes/mod_rewrite.rb +20 -0
  113. data/spec/chef_repo/cookbooks/apache2/recipes/mod_setenvif.rb +22 -0
  114. data/spec/chef_repo/cookbooks/apache2/recipes/mod_ssl.rb +46 -0
  115. data/spec/chef_repo/cookbooks/apache2/recipes/mod_status.rb +22 -0
  116. data/spec/chef_repo/cookbooks/apache2/recipes/mod_wsgi.rb +38 -0
  117. data/spec/chef_repo/cookbooks/apache2/recipes/mod_xsendfile.rb +38 -0
  118. data/spec/chef_repo/cookbooks/apache2/templates/default/a2dismod.erb +22 -0
  119. data/spec/chef_repo/cookbooks/apache2/templates/default/a2dissite.erb +29 -0
  120. data/spec/chef_repo/cookbooks/apache2/templates/default/a2enmod.erb +37 -0
  121. data/spec/chef_repo/cookbooks/apache2/templates/default/a2ensite.erb +38 -0
  122. data/spec/chef_repo/cookbooks/apache2/templates/default/apache2.conf.erb +238 -0
  123. data/spec/chef_repo/cookbooks/apache2/templates/default/apache2.god.erb +19 -0
  124. data/spec/chef_repo/cookbooks/apache2/templates/default/charset.erb +6 -0
  125. data/spec/chef_repo/cookbooks/apache2/templates/default/default-site.erb +57 -0
  126. data/spec/chef_repo/cookbooks/apache2/templates/default/etc-sysconfig-httpd.erb +31 -0
  127. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/README +2 -0
  128. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/alias.conf.erb +24 -0
  129. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/auth_cas.conf.erb +1 -0
  130. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/auth_cas.load.erb +1 -0
  131. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/authopenid.load.erb +1 -0
  132. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/autoindex.conf.erb +101 -0
  133. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/deflate.conf.erb +16 -0
  134. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/dir.conf.erb +5 -0
  135. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/fastcgi.conf.erb +5 -0
  136. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/fcgid.conf.erb +10 -0
  137. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/include.conf.erb +4 -0
  138. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/include.erb +4 -0
  139. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/mime.conf.erb +198 -0
  140. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/negotiation.conf.erb +18 -0
  141. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/php5.conf.erb +16 -0
  142. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/proxy.conf.erb +19 -0
  143. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/setenvif.conf.erb +28 -0
  144. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/ssl.conf.erb +77 -0
  145. data/spec/chef_repo/cookbooks/apache2/templates/default/mods/status.conf.erb +26 -0
  146. data/spec/chef_repo/cookbooks/apache2/templates/default/port_apache.erb +3 -0
  147. data/spec/chef_repo/cookbooks/apache2/templates/default/ports.conf.erb +6 -0
  148. data/spec/chef_repo/cookbooks/apache2/templates/default/security.erb +50 -0
  149. data/spec/chef_repo/cookbooks/apache2/templates/default/web_app.conf.erb +47 -0
  150. data/spec/chef_repo/cookbooks/apt/.gitignore +14 -0
  151. data/spec/chef_repo/cookbooks/apt/.kitchen.yml +33 -0
  152. data/spec/chef_repo/cookbooks/apt/Berksfile +8 -0
  153. data/spec/chef_repo/cookbooks/apt/CHANGELOG.md +79 -0
  154. data/spec/chef_repo/cookbooks/apt/CONTRIBUTING +29 -0
  155. data/spec/chef_repo/cookbooks/apt/LICENSE +201 -0
  156. data/spec/chef_repo/cookbooks/apt/README.md +238 -0
  157. data/spec/chef_repo/cookbooks/apt/TESTING.md +25 -0
  158. data/spec/chef_repo/cookbooks/apt/attributes/default.rb +3 -0
  159. data/spec/chef_repo/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  160. data/spec/chef_repo/cookbooks/apt/metadata.json +34 -0
  161. data/spec/chef_repo/cookbooks/apt/metadata.rb +14 -0
  162. data/spec/chef_repo/cookbooks/apt/providers/preference.rb +61 -0
  163. data/spec/chef_repo/cookbooks/apt/providers/repository.rb +138 -0
  164. data/spec/chef_repo/cookbooks/apt/recipes/cacher-client.rb +59 -0
  165. data/spec/chef_repo/cookbooks/apt/recipes/cacher-ng.rb +38 -0
  166. data/spec/chef_repo/cookbooks/apt/recipes/default.rb +68 -0
  167. data/spec/chef_repo/cookbooks/apt/resources/preference.rb +30 -0
  168. data/spec/chef_repo/cookbooks/apt/resources/repository.rb +40 -0
  169. data/spec/chef_repo/cookbooks/apt/templates/default/01proxy.erb +2 -0
  170. data/spec/chef_repo/cookbooks/apt/templates/default/acng.conf.erb +276 -0
  171. data/spec/chef_repo/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +270 -0
  172. data/spec/chef_repo/cookbooks/build-essential/.gitignore +4 -0
  173. data/spec/chef_repo/cookbooks/build-essential/.kitchen.yml +42 -0
  174. data/spec/chef_repo/cookbooks/build-essential/Berksfile +3 -0
  175. data/spec/chef_repo/cookbooks/build-essential/CHANGELOG.md +42 -0
  176. data/spec/chef_repo/cookbooks/build-essential/CONTRIBUTING +29 -0
  177. data/spec/chef_repo/cookbooks/build-essential/LICENSE +201 -0
  178. data/spec/chef_repo/cookbooks/build-essential/README.md +139 -0
  179. data/spec/chef_repo/cookbooks/build-essential/TESTING.md +25 -0
  180. data/spec/chef_repo/cookbooks/build-essential/attributes/default.rb +33 -0
  181. data/spec/chef_repo/cookbooks/build-essential/metadata.json +44 -0
  182. data/spec/chef_repo/cookbooks/build-essential/metadata.rb +16 -0
  183. data/spec/chef_repo/cookbooks/build-essential/recipes/debian.rb +45 -0
  184. data/spec/chef_repo/cookbooks/build-essential/recipes/default.rb +24 -0
  185. data/spec/chef_repo/cookbooks/build-essential/recipes/fedora.rb +36 -0
  186. data/spec/chef_repo/cookbooks/build-essential/recipes/mac_os_x.rb +40 -0
  187. data/spec/chef_repo/cookbooks/build-essential/recipes/rhel.rb +43 -0
  188. data/spec/chef_repo/cookbooks/build-essential/recipes/smartos.rb +36 -0
  189. data/spec/chef_repo/cookbooks/build-essential/recipes/solaris2.rb +42 -0
  190. data/spec/chef_repo/cookbooks/build-essential/recipes/suse.rb +36 -0
  191. data/spec/chef_repo/cookbooks/install_from/README.md +51 -0
  192. data/spec/chef_repo/cookbooks/install_from/attributes/default.rb +2 -0
  193. data/spec/chef_repo/cookbooks/install_from/metadata.json +46 -0
  194. data/spec/chef_repo/cookbooks/install_from/metadata.rb +19 -0
  195. data/spec/chef_repo/cookbooks/install_from/providers/release.rb +143 -0
  196. data/spec/chef_repo/cookbooks/install_from/recipes/default.rb +26 -0
  197. data/spec/chef_repo/cookbooks/install_from/resources/release.rb +121 -0
  198. data/spec/chef_repo/cookbooks/metachef/.rspec +3 -0
  199. data/spec/chef_repo/cookbooks/metachef/.watchr +20 -0
  200. data/spec/chef_repo/cookbooks/metachef/Gemfile +15 -0
  201. data/spec/chef_repo/cookbooks/metachef/README.md +97 -0
  202. data/spec/chef_repo/cookbooks/metachef/attributes/default.rb +18 -0
  203. data/spec/chef_repo/cookbooks/metachef/definitions/daemon_user.rb +68 -0
  204. data/spec/chef_repo/cookbooks/metachef/definitions/kill_old_service.rb +35 -0
  205. data/spec/chef_repo/cookbooks/metachef/definitions/standard_dirs.rb +54 -0
  206. data/spec/chef_repo/cookbooks/metachef/libraries/aspect.rb +125 -0
  207. data/spec/chef_repo/cookbooks/metachef/libraries/aspects.rb +170 -0
  208. data/spec/chef_repo/cookbooks/metachef/libraries/attr_struct.rb +160 -0
  209. data/spec/chef_repo/cookbooks/metachef/libraries/component.rb +164 -0
  210. data/spec/chef_repo/cookbooks/metachef/libraries/cookbook_utils.rb +69 -0
  211. data/spec/chef_repo/cookbooks/metachef/libraries/discovery.rb +124 -0
  212. data/spec/chef_repo/cookbooks/metachef/libraries/discovery_lol.rb +55 -0
  213. data/spec/chef_repo/cookbooks/metachef/libraries/dump_aspects.rb +83 -0
  214. data/spec/chef_repo/cookbooks/metachef/libraries/metachef.rb +18 -0
  215. data/spec/chef_repo/cookbooks/metachef/libraries/node_utils.rb +91 -0
  216. data/spec/chef_repo/cookbooks/metachef/metadata.json +102 -0
  217. data/spec/chef_repo/cookbooks/metachef/metadata.rb +39 -0
  218. data/spec/chef_repo/cookbooks/metachef/recipes/default.rb +22 -0
  219. data/spec/chef_repo/cookbooks/nginx/.gitignore +9 -0
  220. data/spec/chef_repo/cookbooks/nginx/.kitchen.yml +62 -0
  221. data/spec/chef_repo/cookbooks/nginx/Berksfile +7 -0
  222. data/spec/chef_repo/cookbooks/nginx/CHANGELOG.md +158 -0
  223. data/spec/chef_repo/cookbooks/nginx/CONTRIBUTING.md +257 -0
  224. data/spec/chef_repo/cookbooks/nginx/LICENSE +201 -0
  225. data/spec/chef_repo/cookbooks/nginx/README.md +398 -0
  226. data/spec/chef_repo/cookbooks/nginx/TESTING.md +25 -0
  227. data/spec/chef_repo/cookbooks/nginx/attributes/default.rb +89 -0
  228. data/spec/chef_repo/cookbooks/nginx/attributes/echo.rb +10 -0
  229. data/spec/chef_repo/cookbooks/nginx/attributes/geoip.rb +30 -0
  230. data/spec/chef_repo/cookbooks/nginx/attributes/headers_more.rb +22 -0
  231. data/spec/chef_repo/cookbooks/nginx/attributes/naxsi.rb +24 -0
  232. data/spec/chef_repo/cookbooks/nginx/attributes/repo.rb +30 -0
  233. data/spec/chef_repo/cookbooks/nginx/attributes/source.rb +41 -0
  234. data/spec/chef_repo/cookbooks/nginx/attributes/upload_progress.rb +23 -0
  235. data/spec/chef_repo/cookbooks/nginx/chefignore +96 -0
  236. data/spec/chef_repo/cookbooks/nginx/definitions/nginx_site.rb +41 -0
  237. data/spec/chef_repo/cookbooks/nginx/files/default/mime.types +74 -0
  238. data/spec/chef_repo/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  239. data/spec/chef_repo/cookbooks/nginx/files/default/tests/minitest/default_test.rb +12 -0
  240. data/spec/chef_repo/cookbooks/nginx/files/default/tests/minitest/source_test.rb +9 -0
  241. data/spec/chef_repo/cookbooks/nginx/files/default/tests/minitest/support/helpers.rb +7 -0
  242. data/spec/chef_repo/cookbooks/nginx/metadata.json +315 -0
  243. data/spec/chef_repo/cookbooks/nginx/metadata.rb +113 -0
  244. data/spec/chef_repo/cookbooks/nginx/recipes/authorized_ips.rb +37 -0
  245. data/spec/chef_repo/cookbooks/nginx/recipes/commons.rb +23 -0
  246. data/spec/chef_repo/cookbooks/nginx/recipes/commons_conf.rb +40 -0
  247. data/spec/chef_repo/cookbooks/nginx/recipes/commons_dir.rb +41 -0
  248. data/spec/chef_repo/cookbooks/nginx/recipes/commons_script.rb +28 -0
  249. data/spec/chef_repo/cookbooks/nginx/recipes/default.rb +46 -0
  250. data/spec/chef_repo/cookbooks/nginx/recipes/headers_more_module.rb +54 -0
  251. data/spec/chef_repo/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  252. data/spec/chef_repo/cookbooks/nginx/recipes/http_geoip_module.rb +116 -0
  253. data/spec/chef_repo/cookbooks/nginx/recipes/http_gzip_static_module.rb +23 -0
  254. data/spec/chef_repo/cookbooks/nginx/recipes/http_realip_module.rb +42 -0
  255. data/spec/chef_repo/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  256. data/spec/chef_repo/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  257. data/spec/chef_repo/cookbooks/nginx/recipes/ipv6.rb +22 -0
  258. data/spec/chef_repo/cookbooks/nginx/recipes/naxsi_module.rb +53 -0
  259. data/spec/chef_repo/cookbooks/nginx/recipes/ohai_plugin.rb +39 -0
  260. data/spec/chef_repo/cookbooks/nginx/recipes/passenger.rb +81 -0
  261. data/spec/chef_repo/cookbooks/nginx/recipes/repo.rb +42 -0
  262. data/spec/chef_repo/cookbooks/nginx/recipes/source.rb +204 -0
  263. data/spec/chef_repo/cookbooks/nginx/recipes/upload_progress_module.rb +46 -0
  264. data/spec/chef_repo/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  265. data/spec/chef_repo/cookbooks/nginx/templates/default/default-site.erb +11 -0
  266. data/spec/chef_repo/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  267. data/spec/chef_repo/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  268. data/spec/chef_repo/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +4 -0
  269. data/spec/chef_repo/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  270. data/spec/chef_repo/cookbooks/nginx/templates/default/modules/passenger.conf.erb +10 -0
  271. data/spec/chef_repo/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +40 -0
  272. data/spec/chef_repo/cookbooks/nginx/templates/default/nginx.conf.erb +69 -0
  273. data/spec/chef_repo/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  274. data/spec/chef_repo/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  275. data/spec/chef_repo/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  276. data/spec/chef_repo/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  277. data/spec/chef_repo/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  278. data/spec/chef_repo/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  279. data/spec/chef_repo/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  280. data/spec/chef_repo/cookbooks/nginx/templates/default/sv-nginx-run.erb +3 -0
  281. data/spec/chef_repo/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  282. data/spec/chef_repo/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  283. data/spec/chef_repo/cookbooks/ohai/CHANGELOG.md +27 -0
  284. data/spec/chef_repo/cookbooks/ohai/CONTRIBUTING +29 -0
  285. data/spec/chef_repo/cookbooks/ohai/LICENSE +201 -0
  286. data/spec/chef_repo/cookbooks/ohai/README.md +49 -0
  287. data/spec/chef_repo/cookbooks/ohai/attributes/default.rb +29 -0
  288. data/spec/chef_repo/cookbooks/ohai/files/default/plugins/README +1 -0
  289. data/spec/chef_repo/cookbooks/ohai/metadata.json +60 -0
  290. data/spec/chef_repo/cookbooks/ohai/metadata.rb +23 -0
  291. data/spec/chef_repo/cookbooks/ohai/recipes/default.rb +54 -0
  292. data/spec/chef_repo/cookbooks/redis/README.md +76 -0
  293. data/spec/chef_repo/cookbooks/redis/attributes/default.rb +51 -0
  294. data/spec/chef_repo/cookbooks/redis/metadata.json +304 -0
  295. data/spec/chef_repo/cookbooks/redis/metadata.rb +112 -0
  296. data/spec/chef_repo/cookbooks/redis/recipes/client.rb +23 -0
  297. data/spec/chef_repo/cookbooks/redis/recipes/default.rb +34 -0
  298. data/spec/chef_repo/cookbooks/redis/recipes/install_from_package.rb +26 -0
  299. data/spec/chef_repo/cookbooks/redis/recipes/install_from_release.rb +30 -0
  300. data/spec/chef_repo/cookbooks/redis/recipes/server.rb +42 -0
  301. data/spec/chef_repo/cookbooks/redis/templates/default/redis.conf.erb +136 -0
  302. data/spec/chef_repo/cookbooks/redis/templates/default/sv-redis_server-log-run.erb +2 -0
  303. data/spec/chef_repo/cookbooks/redis/templates/default/sv-redis_server-run.erb +6 -0
  304. data/spec/chef_repo/cookbooks/runit/.gitignore +17 -0
  305. data/spec/chef_repo/cookbooks/runit/.kitchen.yml +53 -0
  306. data/spec/chef_repo/cookbooks/runit/Berksfile +12 -0
  307. data/spec/chef_repo/cookbooks/runit/CHANGELOG.md +97 -0
  308. data/spec/chef_repo/cookbooks/runit/CONTRIBUTING.md +257 -0
  309. data/spec/chef_repo/cookbooks/runit/Gemfile +8 -0
  310. data/spec/chef_repo/cookbooks/runit/LICENSE +201 -0
  311. data/spec/chef_repo/cookbooks/runit/README.md +448 -0
  312. data/spec/chef_repo/cookbooks/runit/Rakefile +17 -0
  313. data/spec/chef_repo/cookbooks/runit/attributes/default.rb +77 -0
  314. data/spec/chef_repo/cookbooks/runit/files/default/runit-2.1.1.tar.gz +0 -0
  315. data/spec/chef_repo/cookbooks/runit/files/default/runit.seed +1 -0
  316. data/spec/chef_repo/cookbooks/runit/files/default/runsvdir +0 -0
  317. data/spec/chef_repo/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  318. data/spec/chef_repo/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  319. data/spec/chef_repo/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  320. data/spec/chef_repo/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  321. data/spec/chef_repo/cookbooks/runit/libraries/default.rb +0 -0
  322. data/spec/chef_repo/cookbooks/runit/libraries/provider_runit_service.rb +428 -0
  323. data/spec/chef_repo/cookbooks/runit/libraries/resource_runit_service.rb +185 -0
  324. data/spec/chef_repo/cookbooks/runit/metadata.rb +16 -0
  325. data/spec/chef_repo/cookbooks/runit/recipes/default.rb +124 -0
  326. data/spec/chef_repo/cookbooks/runit/templates/debian/init.d.erb +66 -0
  327. data/spec/chef_repo/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  328. data/spec/chef_repo/cookbooks/yum/.gitignore +14 -0
  329. data/spec/chef_repo/cookbooks/yum/.kitchen.yml +22 -0
  330. data/spec/chef_repo/cookbooks/yum/Berksfile +7 -0
  331. data/spec/chef_repo/cookbooks/yum/CHANGELOG.md +97 -0
  332. data/spec/chef_repo/cookbooks/yum/CONTRIBUTING.md +257 -0
  333. data/spec/chef_repo/cookbooks/yum/LICENSE +201 -0
  334. data/spec/chef_repo/cookbooks/yum/README.md +270 -0
  335. data/spec/chef_repo/cookbooks/yum/attributes/default.rb +30 -0
  336. data/spec/chef_repo/cookbooks/yum/attributes/elrepo.rb +24 -0
  337. data/spec/chef_repo/cookbooks/yum/attributes/epel.rb +39 -0
  338. data/spec/chef_repo/cookbooks/yum/attributes/remi.rb +30 -0
  339. data/spec/chef_repo/cookbooks/yum/files/default/tests/minitest/default_test.rb +28 -0
  340. data/spec/chef_repo/cookbooks/yum/files/default/tests/minitest/support/helpers.rb +37 -0
  341. data/spec/chef_repo/cookbooks/yum/files/default/tests/minitest/test_test.rb +66 -0
  342. data/spec/chef_repo/cookbooks/yum/metadata.json +100 -0
  343. data/spec/chef_repo/cookbooks/yum/metadata.rb +37 -0
  344. data/spec/chef_repo/cookbooks/yum/providers/key.rb +79 -0
  345. data/spec/chef_repo/cookbooks/yum/providers/repository.rb +124 -0
  346. data/spec/chef_repo/cookbooks/yum/recipes/default.rb +18 -0
  347. data/spec/chef_repo/cookbooks/yum/recipes/elrepo.rb +31 -0
  348. data/spec/chef_repo/cookbooks/yum/recipes/epel.rb +35 -0
  349. data/spec/chef_repo/cookbooks/yum/recipes/ius.rb +42 -0
  350. data/spec/chef_repo/cookbooks/yum/recipes/remi.rb +35 -0
  351. data/spec/chef_repo/cookbooks/yum/recipes/repoforge.rb +41 -0
  352. data/spec/chef_repo/cookbooks/yum/recipes/test.rb +39 -0
  353. data/spec/chef_repo/cookbooks/yum/recipes/yum.rb +23 -0
  354. data/spec/chef_repo/cookbooks/yum/resources/key.rb +29 -0
  355. data/spec/chef_repo/cookbooks/yum/resources/repository.rb +41 -0
  356. data/spec/chef_repo/cookbooks/yum/templates/default/repo.erb +38 -0
  357. data/spec/chef_repo/cookbooks/yum/templates/default/yum-rhel5.conf.erb +33 -0
  358. data/spec/chef_repo/cookbooks/yum/templates/default/yum-rhel6.conf.erb +36 -0
  359. data/spec/chef_repo/data_bags/.gitkeep +0 -0
  360. data/spec/chef_repo/data_bags/sample/items.json +1 -0
  361. data/spec/chef_repo/roles/.gitkeep +0 -0
  362. data/spec/chef_repo/roles/dummy.json +14 -0
  363. data/spec/chef_repo/site-cookbooks/.gitkeep +0 -0
  364. data/spec/chef_repo/site-cookbooks/sample/CHANGELOG.md +12 -0
  365. data/spec/chef_repo/site-cookbooks/sample/README.md +68 -0
  366. data/spec/chef_repo/site-cookbooks/sample/metadata.rb +7 -0
  367. data/spec/chef_repo/site-cookbooks/sample/recipes/default.rb +18 -0
  368. data/spec/chef_repo/solo.rb +3 -0
  369. data/spec/fixtures/items.json +1 -0
  370. data/spec/spec_helper.rb +32 -0
  371. metadata +880 -0
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --drb
@@ -0,0 +1,20 @@
1
+ # -*- ruby -*-
2
+
3
+ def run_spec(file)
4
+ file = File.expand_path(file, File.dirname(__FILE__))
5
+ unless File.exist?(file)
6
+ Watchr.debug "#{file} does not exist"
7
+ return
8
+ end
9
+
10
+ Watchr.debug "Running #{file}"
11
+ system "rspec #{file}"
12
+ end
13
+
14
+ watch("spec/.*_spec\.rb") do |match|
15
+ run_spec(match[0])
16
+ end
17
+
18
+ watch("libraries/(.*)\.rb") do |match|
19
+ run_spec(%{spec/#{match[1]}_spec.rb})
20
+ end
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'chef', "~> 0.10.4"
4
+
5
+ # Add dependencies to develop your gem here.
6
+ # Include everything needed to run rake, tests, features, etc.
7
+ group :development do
8
+ gem 'bundler', "~> 1"
9
+ gem 'yard', "~> 0.6.7"
10
+ gem 'jeweler', "~> 1.6.4"
11
+ gem 'rspec', "~> 2.7.0"
12
+ gem 'watchr', "~> 0.7"
13
+ # gem 'ruby-fsevent', "~> 0.2"
14
+ # gem 'rev'
15
+ end
@@ -0,0 +1,97 @@
1
+ # metachef chef cookbook
2
+
3
+ Cluster orchestration -- coordinates discovery, integration and decoupling of cookbooks
4
+
5
+ ## Overview
6
+
7
+ Cookbooks repeatably express these and other aspects:
8
+ * "I launch these daemons: ..."
9
+ * "I haz a bukkit, itz naem '/var/log/lol'"
10
+ * "I have a dashboard at 'http://....:...'"
11
+ * ... and much more.
12
+
13
+ Wouldn't it be nice if announcing a log directory caused...
14
+ - my log rotation system to start rotating my logs?
15
+ - a 'disk free space' gauge to be added to the monitoring dashboard for that service?
16
+ - flume (or whatever) began picking up my logs and archiving them to a predictable location?
17
+ - in the case of standard apache logs, a listener to start counting the rate of requests, 200s, 404s and so forth?
18
+ Similarly, announcing ports should mean
19
+ - the firewall and security groups configure themselves correspondingly
20
+ - the monitor system starts regularly pinging the port for uptime and latency
21
+ - and pings the interfaces that it should *not* appear on to ensure the firewall is in place?
22
+
23
+ Cluster chef make those aspects standardized and predictable, and provides integration and discovery hooks. The key is to make integration *inevitable*: No more forgetting to rotate or monitor a service, or having a config change over here screw up a dependent system over there.
24
+
25
+ __________________________________________________________________________
26
+
27
+ (*below is a planning document and may not perfectly reflect reality*)
28
+
29
+ FIXME: **update for version_3 release**
30
+
31
+ Attributes are scoped by *cookbook* and then by *component*.
32
+ * If I declare `i_haz_a_service_itz('redis)`, it will look in `node[:redis]`.
33
+ * If I declare `i_haz_a_service_itz('hadoop-namenode')`, it will look in `node[:hadoop]` for cookbook-wide concerns and `node[:hadoop][:namenode]` for component-specific concerns.
34
+
35
+ * The cookbook scope is always named for its cookbook. Its attributes live in`node[:cookbook_name]`.
36
+ - if everything in the cookbook shares a concern, it sits at cookbook level. So the hadoop log directory (shared by all its components) is at `(scratch_root)/hadoop/log`.
37
+ * If there is only one component, it can be implicitly named for its cookbook. In this case, it is omitted: the component attributes live in `node[:cookbook_name]` (which is the same as the component name).
38
+ * If there are multiple components, they will live in `node[:cookbook_name][:component_name]` (eg `[:hadoop][:namenode]` or `[:flume][:master]`. In file names, these become `(whatever)/cookbook_name/component_name/(whatever)`; in other cases they are joined as `cookbook_name-component_name`.
39
+
40
+ Allow nodes to discover the location for a given service at runtime, adapting when new services register.
41
+
42
+ ### Discovery
43
+
44
+ Allow nodes to discover the location for a given service at runtime, adapting
45
+ when new services register.
46
+
47
+ #### Operations:
48
+
49
+ * register for a service. A timestamp records the last registry.
50
+ * discover all chef nodes that have registered for the given service.
51
+ * discover the most recent chef node for that service.
52
+ * get the 'public_ip' for a service -- the address that nodes in the larger
53
+ world should use
54
+ * get the 'public_ip' for a service -- the address that nodes on the local
55
+ subnet / private cloud should use
56
+
57
+ #### Implementation
58
+
59
+ Nodes register a service by calling `announce`, which sets a hash containing
60
+ 'timestamp' (the time of registry) and other metadata passed in.
61
+
62
+ ## Recipes
63
+
64
+ * `default` - Base configuration for metachef
65
+
66
+ ## Integration
67
+
68
+ Supports platforms: debian and ubuntu
69
+
70
+
71
+
72
+ ## Attributes
73
+
74
+ * `[:metachef][:conf_dir]` - (default: "/etc/metachef")
75
+ * `[:metachef][:log_dir]` - (default: "/var/log/metachef")
76
+ * `[:metachef][:home_dir]` - (default: "/etc/metachef")
77
+ * `[:metachef][:user]` - (default: "root")
78
+ * `[:users][:root][:primary_group]` - (default: "root")
79
+
80
+ ## License and Author
81
+
82
+ Author:: Philip (flip) Kromer - Infochimps, Inc (<coders@infochimps.com>)
83
+ Copyright:: 2011, Philip (flip) Kromer - Infochimps, Inc
84
+
85
+ Licensed under the Apache License, Version 2.0 (the "License");
86
+ you may not use this file except in compliance with the License.
87
+ You may obtain a copy of the License at
88
+
89
+ http://www.apache.org/licenses/LICENSE-2.0
90
+
91
+ Unless required by applicable law or agreed to in writing, software
92
+ distributed under the License is distributed on an "AS IS" BASIS,
93
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94
+ See the License for the specific language governing permissions and
95
+ limitations under the License.
96
+
97
+ > readme generated by [cluster_chef](http://github.com/infochimps/cluster_chef)'s cookbook_munger
@@ -0,0 +1,18 @@
1
+
2
+ default[:metachef][:conf_dir] = '/etc/metachef'
3
+ default[:metachef][:log_dir] = '/var/log/metachef'
4
+ default[:metachef][:home_dir] = '/etc/metachef'
5
+
6
+ default[:metachef][:user] = 'root'
7
+
8
+ # Request user account properties here.
9
+ default[:users]['root'][:primary_group] = value_for_platform(
10
+ "openbsd" => { "default" => "wheel" },
11
+ "freebsd" => { "default" => "wheel" },
12
+ "mac_os_x" => { "default" => "wheel" },
13
+ "default" => "root"
14
+ )
15
+
16
+ default[:announces] ||= Mash.new
17
+
18
+ default[:discovers] ||= Mash.new
@@ -0,0 +1,68 @@
1
+
2
+ #
3
+ # If present, we will use node[(name)][(component)] *and then* node[(name)] to
4
+ # look up scoped default values.
5
+ #
6
+ # So, daemon_user('ntp') looks for a username in node[:ntp][:user], while
7
+ # daemon_user('ganglia.server') looks first in node[:ganglia][:server][:user]
8
+ # and then in node[:ganglia][:user].
9
+ #
10
+ define(:daemon_user,
11
+ :action => [:create, :manage], # action. You typically want [:create, :manage] or [:create]
12
+ :component => nil, # if present, will use node[(name)][(component)] *and then* node[(name)] to look up values.
13
+ :user => nil, # username to create. default: `scoped_hash[:user]`
14
+ :home => nil, # home directory for daemon. default: `scoped_hash[:pid_dir]`
15
+ :shell => '/bin/false', # shell to set. default: `/bin/false`
16
+ :group => nil, # group for daemon. default: `scoped_hash[:group]`
17
+ :comment => nil, # comment for user info
18
+ :create_group => true # Action to take on the group: `true` means `[:create]`, false-y means do nothing, or you can supply explicit actions (eg `[:create, :manage]`). default: true
19
+ ) do
20
+
21
+ sys, subsys = params[:name].to_s.split(".", 2).map(&:to_sym)
22
+ component = ClusterChef::Component.new(node, sys, subsys)
23
+
24
+ params[:user] ||= component.node_attr(:user, :required)
25
+ params[:group] ||= component.node_attr(:group) || params[:user]
26
+ params[:home] ||= component.node_attr(:pid_dir, :required)
27
+ params[:comment] ||= "#{component.name} daemon"
28
+ #
29
+ user_val = params[:user].to_s
30
+ group_val = params[:group].to_s
31
+ begin
32
+ uid_val = node[:users ][user_val ] && node[:users ][user_val ][:uid]
33
+ rescue
34
+ uid_val = nil
35
+ end
36
+ begin
37
+ gid_val = node[:groups][group_val] && node[:groups][group_val][:gid]
38
+ rescue
39
+ gid_val = nil
40
+ end
41
+
42
+ params[:create_group] = [:create] if (params[:create_group] == true)
43
+ params[:create_group] = false if (group_val == 'nogroup')
44
+
45
+ #
46
+ # Make the group
47
+ #
48
+ if params[:create_group] && (group_val != 'nogroup')
49
+ group group_val do
50
+ gid gid_val
51
+ action params[:create_group]
52
+ end
53
+ end
54
+
55
+ #
56
+ # Make the user
57
+ #
58
+ user user_val do
59
+ uid uid_val
60
+ gid group_val
61
+ password nil
62
+ shell params[:shell]
63
+ home params[:home]
64
+ supports :manage_home => false # you must create standard dirs yourself
65
+ action params[:action]
66
+ end
67
+
68
+ end
@@ -0,0 +1,35 @@
1
+
2
+ define(:kill_old_service,
3
+ :script => nil,
4
+ :hard => false,
5
+ ) do
6
+ params[:script] ||= "/etc/init.d/#{params[:name]}"
7
+
8
+ # cheating: don't bother if the script isn't there
9
+ if (File.exists?(params[:script]))
10
+
11
+ service params[:name] do
12
+ action [:stop, :disable]
13
+ pattern params[:pattern] if params[:pattern]
14
+ only_if{ File.exists?(params[:script]) }
15
+ end
16
+
17
+ ruby_block("stop #{params[:name]}") do
18
+ block{ }
19
+ action :create
20
+ notifies :stop, "service[#{params[:name]}]", :immediately
21
+ only_if{ File.exists?(params[:script]) }
22
+ end
23
+
24
+ if params[:hard] # sometimes these shitty little things gotta be told thrice
25
+ bash "stop again" do
26
+ code "service #{params[:name]} stop ; sleep 1 ; service #{params[:name]} stop ; true"
27
+ only_if{ File.exists?(params[:script]) }
28
+ end
29
+ end
30
+
31
+ file(params[:script]) do
32
+ action :delete
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,54 @@
1
+ STANDARD_DIRS = Mash.new({
2
+ :home_dir => { :uid => 'root', :gid => 'root', },
3
+ :conf_dir => { :uid => 'root', :gid => 'root', },
4
+ :lib_dir => { :uid => 'root', :gid => 'root', },
5
+ :log_dir => { :uid => :user, :gid => :group, :mode => "0775", },
6
+ :pid_dir => { :uid => :user, :gid => :group, },
7
+ :tmp_dir => { :uid => :user, :gid => :group, },
8
+ :data_dir => { :uid => :user, :gid => :group, },
9
+ :data_dirs => { :uid => :user, :gid => :group, },
10
+ :journal_dir => { :uid => :user, :gid => :group, },
11
+ :journal_dirs => { :uid => :user, :gid => :group, },
12
+ :cache_dir => { :uid => :user, :gid => :group, },
13
+ }) unless defined?(STANDARD_DIRS)
14
+
15
+ #
16
+ # If present, we will use node[(name)][(subsys)] *and then* node[(name)] to
17
+ # look up scoped default values.
18
+ #
19
+ # So, daemon_user('ntp') looks for its :log_dir in node[:ntp][:log_dir], while
20
+ # daemon_user('ganglia.server') looks first in node[:ganglia][:server][:log_dir]
21
+ # and then in node[:ganglia][:log_dir].
22
+ #
23
+ define(:standard_dirs,
24
+ :subsys => nil, # if present, will use node[(name)][(subsys)] *and then* node[(name)] to look up values.
25
+ :directories => [],
26
+ :log_dir => nil,
27
+ :home_dir => nil,
28
+ :user => nil, # username to create. default: `scoped_hash[:user]`
29
+ :group => nil # group for user. default: `scoped_hash[:group]`
30
+ ) do
31
+
32
+ sys, subsys = params[:name].to_s.split(".", 2).map(&:to_sym)
33
+ component = ClusterChef::Component.new(node, sys, subsys)
34
+
35
+ params[:user] ||= component.node_attr(:user, :required)
36
+ params[:group] ||= component.node_attr(:group) || params[:user]
37
+
38
+ [params[:directories]].flatten.each do |dir_type|
39
+ dir_paths = component.node_attr(dir_type, :required) or next
40
+ hsh = (STANDARD_DIRS.include?(dir_type) ? STANDARD_DIRS[dir_type].dup : Mash.new)
41
+ hsh[:uid] = params[:user] if (hsh[:uid] == :user )
42
+ hsh[:gid] = params[:group] if (hsh[:gid] == :group)
43
+ [dir_paths].flatten.each do |dir_path|
44
+ directory dir_path do
45
+ owner hsh[:uid]
46
+ group hsh[:gid]
47
+ mode hsh[:mode] || '0755'
48
+ action :create
49
+ recursive true
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,125 @@
1
+ require File.expand_path('metachef.rb', File.dirname(__FILE__))
2
+
3
+ module ClusterChef
4
+
5
+ # An *aspect* is an external property, commonly encountered across multiple
6
+ # systems, that decoupled agents may wish to act on.
7
+ #
8
+ # For example, many systems have a Dashboard aspect -- phpMySQL, the hadoop
9
+ # jobtracker web console, a one-pager generated by the dashpot recipe, or a
10
+ # purpose-built backend for your website. The following independent concerns
11
+ # can act on such dashboard aspects: * a dashboard dashboard creates a page
12
+ # linking to all of them * your firewall grants access from internal machines
13
+ # and denies access on public interfaces * the monitoring system checks that
14
+ # the port is open and listening
15
+ #
16
+ # Aspects are able to do the following:
17
+ #
18
+ # * Convert to and from a plain hash,
19
+ #
20
+ # * ...and thusly to and from plain node metadata attributes
21
+ #
22
+ # * discover its manifestations across all systems (on all or some
23
+ # machines): for example, all dashboards, or all open ports.
24
+ #
25
+ # * identify instances from a system's by-convention metadata. For
26
+ # example, given a chef server system at 10.29.63.45 with attributes
27
+ # `:chef_server => { :server_port => 4000, :dash_port => 4040 }`
28
+ # the PortAspect class would produce instances for 4000 and 4040, since by
29
+ # convention an attribute ending in `_port` means "I have a port aspect`;
30
+ # the DashboardAspect would recognize the `dash_port` attribute and
31
+ # produce an instance for `http://10.29.63.45:4040`.
32
+ #
33
+ # Note:
34
+ #
35
+ # * separate *identifiable conventions* from *concrete representation* of
36
+ # aspects. A system announces that it has a log aspect, and by convention
37
+ # declares a `:log_dir` attribute. At that point it is regularized into a
38
+ # LogAspect instance and stored in the `node[:aspects]` tree. External
39
+ # concerns should only inspect these concrete Aspects, and never go
40
+ # hunting for thins with a `:log_dir` attribute.
41
+ #
42
+ # * conventions can be messy, but aspects are perfectly uniform
43
+ #
44
+ class Aspect
45
+ include AttrStruct
46
+ extend ClusterChef::NodeUtils
47
+
48
+ dsl_attr(:component, :kind_of => ClusterChef::Component)
49
+ dsl_attr(:name, :kind_of => [String, Symbol])
50
+
51
+ # checks that the aspect is well-formed. returns non-empty array if there is lint.
52
+ #
53
+ # @abstract
54
+ # override to provide guidance, filling an array with warning strings. Include
55
+ # errors + super
56
+ # as the last line.
57
+ #
58
+ def lint
59
+ []
60
+ end
61
+
62
+ def lint!
63
+ lint.flatten.compact.each{|l| Chef::Log.warn(l) }
64
+ end
65
+
66
+ def lint_flavor
67
+ self.class.allowed_flavors.include?(self.flavor) ? [] : ["Unexpected #{self.class.handle} flavor #{flavor.inspect}"]
68
+ end
69
+
70
+ # include AttrStruct::ClassMethods
71
+ # include ClusterChef::NodeUtils
72
+
73
+ def self.register!
74
+ ClusterChef::Component.has_aspect(self)
75
+ end
76
+
77
+ #
78
+ # Extract attributes matching the given pattern.
79
+ #
80
+ # @param [Hash] info -- hash of key-val pairs
81
+ # @param [Regexp] regex -- filter for keys matching this pattern
82
+ #
83
+ # @yield on each match
84
+ # @yieldparam [String, Symbol] key -- the matching key
85
+ # @yieldparam [Object] val -- its value in the info hash
86
+ # @yieldparam [MatchData] match -- result of the regexp match
87
+ # @yieldreturn [Aspect] block should return an aspect
88
+ #
89
+ # @return [Array<Aspect>] collection of the block's results
90
+ def self.attr_matches(component, regexp)
91
+ results = Mash.new
92
+ component.node_info.each do |key, val|
93
+ next unless (match = regexp.match(key.to_s))
94
+ result = yield(key, val, match) or next
95
+ result.lint!
96
+ results[result.name] ||= result
97
+ end
98
+ results
99
+ end
100
+
101
+ def self.rsrc_matches(rsrc_clxn, resource_name, cookbook_name)
102
+ results = Mash.new
103
+ rsrc_clxn.each do |rsrc|
104
+ next unless rsrc.resource_name.to_s == resource_name.to_s
105
+ next unless rsrc.cookbook_name.to_s =~ /#{cookbook_name}/
106
+ result = yield(rsrc) or next
107
+ results[result.name] ||= result
108
+ end
109
+ results
110
+ end
111
+
112
+ # strip off module part and '...Aspect' from class name
113
+ # @example ClusterChef::FooAspect.handle # :foo
114
+ def self.handle
115
+ @handle ||= self.name.to_s.gsub(/.*::(\w+)Aspect\z/,'\1').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase.to_sym
116
+ end
117
+
118
+ def self.plural_handle
119
+ "#{handle}s".to_sym
120
+ end
121
+
122
+ # end
123
+ # def self.included(base) ; base.extend(ClassMethods) ; end
124
+ end
125
+ end
@@ -0,0 +1,170 @@
1
+ require File.expand_path('metachef.rb', File.dirname(__FILE__))
2
+ module ClusterChef
3
+
4
+ #
5
+ # * scope[:run_state]
6
+ #
7
+ # from the eponymous service resource,
8
+ # * service.path
9
+ # * service.pattern
10
+ # * service.user
11
+ # * service.group
12
+ #
13
+ class DaemonAspect < Aspect
14
+ register!
15
+ dsl_attr(:service_name, :kind_of => String)
16
+ dsl_attr(:pattern, :kind_of => String)
17
+ dsl_attr(:run_state, :kind_of => [String, Symbol])
18
+ dsl_attr(:service_name, :kind_of => String)
19
+
20
+ def self.harvest(run_context, component)
21
+ rsrc_matches(run_context.resource_collection, :service, component.sys) do |rsrc|
22
+ next unless rsrc.name =~ /#{component.name}/
23
+ svc = self.new(component, rsrc.name, rsrc.service_name, rsrc.pattern)
24
+ svc.run_state(component.node_info[:run_state])
25
+ svc
26
+ end
27
+ end
28
+
29
+ def lint
30
+ errs = super
31
+ if not %w[stop start nothing].include?(run_state.to_s)
32
+ badness = run_state ? "Odd run_state #{run_state}" : "No run_state"
33
+ err = "#{badness} for daemon #{name}: set node[:#{component.sys}][:#{component.subsys}] to :stop, :start or :nothing"
34
+ Chef::Log.warn(err)
35
+ errs << err
36
+ end
37
+ errs
38
+ end
39
+ end
40
+
41
+ class PortAspect < Aspect
42
+ register!
43
+ dsl_attr(:flavor, :kind_of => Symbol, :coerce => :to_sym)
44
+ dsl_attr(:port_num, :kind_of => String)
45
+ dsl_attr(:addrs, :kind_of => Array)
46
+
47
+ ALLOWED_FLAVORS = [ :ssh, :ntp, :ldap, :smtp, :ftp, :http, :pop, :nntp, :imap, :tcp, :https, :telnet ]
48
+ def self.allowed_flavors() ALLOWED_FLAVORS ; end
49
+
50
+ def self.harvest(run_context, component)
51
+ attr_aspects = attr_matches(component, /^((.+_)?port)$/) do |key, val, match|
52
+ name = match[1]
53
+ flavor = match[2].to_s.empty? ? :port : match[2].gsub(/_$/, '').to_sym
54
+ # p [match.captures, name, flavor].flatten
55
+ self.new(component, name, flavor, val.to_s)
56
+ end
57
+ end
58
+ end
59
+
60
+ class DashboardAspect < Aspect
61
+ register!
62
+ dsl_attr(:flavor, :kind_of => Symbol, :coerce => :to_sym)
63
+ dsl_attr(:url, :kind_of => String)
64
+
65
+ ALLOWED_FLAVORS = [ :http, :jmx ]
66
+ def self.allowed_flavors() ALLOWED_FLAVORS ; end
67
+
68
+ def self.harvest(run_context, component)
69
+ attr_aspects = attr_matches(component, /^(.*dash)_port(s)?$/) do |key, val, match|
70
+ name = match[1]
71
+ flavor = (name == 'dash') ? :http_dash : name.to_sym
72
+ url = "http://#{private_ip_of(run_context.node)}:#{val}/"
73
+ self.new(component, name, flavor, url)
74
+ end
75
+ end
76
+ end
77
+
78
+ #
79
+ # * scope[:log_dirs]
80
+ # * scope[:log_dir]
81
+ # * flavor: http, etc
82
+ #
83
+ class LogAspect < Aspect
84
+ register!
85
+ dsl_attr(:flavor, :kind_of => Symbol, :coerce => :to_sym)
86
+ dsl_attr(:dirs, :kind_of => Array)
87
+
88
+ ALLOWED_FLAVORS = [ :http, :log4j, :rails ]
89
+
90
+ def self.harvest(run_context, component)
91
+ attr_matches(component, /^log_dir(s?)$/) do |key, val, match|
92
+ name = 'log'
93
+ dirs = Array(val)
94
+ self.new(component, name, name.to_sym, dirs)
95
+ end
96
+ end
97
+ end
98
+
99
+ #
100
+ # * attributes with a _dir or _dirs suffix
101
+ #
102
+ class DirectoryAspect < Aspect
103
+ def self.plural_handle() :directories ; end
104
+ register!
105
+ dsl_attr(:flavor, :kind_of => Symbol, :coerce => :to_sym)
106
+ dsl_attr(:dirs, :kind_of => Array)
107
+
108
+ ALLOWED_FLAVORS = [ :home, :conf, :log, :tmp, :pid, :data, :lib, :journal, ]
109
+ def self.allowed_flavors() ALLOWED_FLAVORS ; end
110
+
111
+ def self.harvest(run_context, component)
112
+ attr_aspects = attr_matches(component, /(.*)_dir(s?)$/) do |key, val, match|
113
+ name = match[1]
114
+ val = Array(val)
115
+ self.new(component, name, name.to_sym, val)
116
+ end
117
+ rsrc_aspects = rsrc_matches(run_context.resource_collection, :directory, component.sys) do |rsrc|
118
+ rsrc
119
+ end
120
+ # [attr_aspects, rsrc_aspects].flatten.each{|x| p x }
121
+ attr_aspects
122
+ end
123
+ end
124
+
125
+ #
126
+ # Code assets (jars, compiled libs, etc) that another system may wish to
127
+ # incorporate
128
+ #
129
+ class ExportedAspect < Aspect
130
+ register!
131
+ dsl_attr(:flavor, :kind_of => Symbol, :coerce => :to_sym)
132
+ dsl_attr(:files, :kind_of => Array)
133
+
134
+ ALLOWED_FLAVORS = [:jars, :confs, :libs]
135
+ def self.allowed_flavors() ALLOWED_FLAVORS ; end
136
+
137
+ def lint
138
+ super() + [lint_flavor]
139
+ end
140
+
141
+ def self.harvest(run_context, component)
142
+ attr_matches(component, /^exported_(.*)$/) do |key, val, match|
143
+ name = match[1]
144
+ self.new(component, name, name.to_sym, val)
145
+ end
146
+ end
147
+ end
148
+
149
+ #
150
+ # manana
151
+ #
152
+
153
+ # # usage constraints -- ulimits, java heap size, thread count, etc
154
+ # class UsageLimitAspect
155
+ # end
156
+ # # deploy
157
+ # # package
158
+ # # account (user / group)
159
+ # class CookbookAspect < Struct.new(:component, :name,
160
+ # :deploys, :packages, :users, :groups, :depends, :recommends, :supports,
161
+ # :attributes, :recipes, :resources, :authors, :license, :version )
162
+ # end
163
+ #
164
+ # class CronAspect
165
+ # end
166
+ #
167
+ # class AuthkeyAspect
168
+ # end
169
+
170
+ end