nogara-rubber 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (389) hide show
  1. data/CHANGELOG +448 -0
  2. data/COPYING +339 -0
  3. data/README +6 -0
  4. data/TODO +11 -0
  5. data/VERSION +1 -0
  6. data/bin/vulcanize +25 -0
  7. data/generators/vulcanize/USAGE +6 -0
  8. data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +51 -0
  9. data/generators/vulcanize/templates/apache/config/rubber/role/apache/deflate.conf +10 -0
  10. data/generators/vulcanize/templates/apache/config/rubber/role/apache/expires.conf +9 -0
  11. data/generators/vulcanize/templates/apache/config/rubber/role/apache/headers.conf +6 -0
  12. data/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +8 -0
  13. data/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +8 -0
  14. data/generators/vulcanize/templates/apache/config/rubber/role/apache/setenvif.conf +52 -0
  15. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +79 -0
  16. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache.auth +7 -0
  17. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +34 -0
  18. data/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +6 -0
  19. data/generators/vulcanize/templates/apache/templates.yml +1 -0
  20. data/generators/vulcanize/templates/base/Capfile +14 -0
  21. data/generators/vulcanize/templates/base/Rakefile +23 -0
  22. data/generators/vulcanize/templates/base/config/deploy.rb +56 -0
  23. data/generators/vulcanize/templates/base/config/rubber/common/crontab +22 -0
  24. data/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +8 -0
  25. data/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +13 -0
  26. data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +92 -0
  27. data/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
  28. data/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +78 -0
  29. data/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +33 -0
  30. data/generators/vulcanize/templates/base/config/rubber/rubber.yml +233 -0
  31. data/generators/vulcanize/templates/base/lib/tasks/rubber.rake +15 -0
  32. data/generators/vulcanize/templates/base/script/cron-rake +18 -0
  33. data/generators/vulcanize/templates/base/script/cron-runner +18 -0
  34. data/generators/vulcanize/templates/base/script/cron-sh +67 -0
  35. data/generators/vulcanize/templates/base/templates.rb +11 -0
  36. data/generators/vulcanize/templates/base/templates.yml +6 -0
  37. data/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
  38. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +60 -0
  39. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
  40. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
  41. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
  42. data/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
  43. data/generators/vulcanize/templates/cassandra/templates.yml +1 -0
  44. data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +23 -0
  45. data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/nginx/nginx-mongrel.conf +113 -0
  46. data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/rubber-complete.yml +41 -0
  47. data/generators/vulcanize/templates/complete_mongrel_mysql/templates.yml +6 -0
  48. data/generators/vulcanize/templates/complete_passenger/config/rubber/role/haproxy/haproxy-passenger.conf +21 -0
  49. data/generators/vulcanize/templates/complete_passenger/config/rubber/rubber-complete.yml +40 -0
  50. data/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
  51. data/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
  52. data/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +4 -0
  53. data/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
  54. data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +72 -0
  55. data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/cruise +40 -0
  56. data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +165 -0
  57. data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/production.rb +8 -0
  58. data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/site_config.rb +76 -0
  59. data/generators/vulcanize/templates/cruise/config/rubber/role/web_tools/cruise-nginx.conf +11 -0
  60. data/generators/vulcanize/templates/cruise/config/rubber/rubber-cruise.yml +18 -0
  61. data/generators/vulcanize/templates/cruise/templates.yml +1 -0
  62. data/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +45 -0
  63. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-base.conf +26 -0
  64. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-default.conf +8 -0
  65. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +9 -0
  66. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +11 -0
  67. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +21 -0
  68. data/generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf +10 -0
  69. data/generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml +7 -0
  70. data/generators/vulcanize/templates/haproxy/templates.yml +1 -0
  71. data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +59 -0
  72. data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.sh +589 -0
  73. data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
  74. data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
  75. data/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +10 -0
  76. data/generators/vulcanize/templates/jetty/templates.yml +1 -0
  77. data/generators/vulcanize/templates/memcached/config/memcached.yml +28 -0
  78. data/generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml +14 -0
  79. data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +52 -0
  80. data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached_munin_plugin +249 -0
  81. data/generators/vulcanize/templates/memcached/config/rubber/rubber-memcached.yml +7 -0
  82. data/generators/vulcanize/templates/memcached/templates.yml +1 -0
  83. data/generators/vulcanize/templates/minimal_mysql/templates.yml +7 -0
  84. data/generators/vulcanize/templates/minimal_nodb/templates.yml +6 -0
  85. data/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +75 -0
  86. data/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/mongrel_cluster.yml +12 -0
  87. data/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +20 -0
  88. data/generators/vulcanize/templates/mongrel/config/rubber/rubber-mongrel.yml +9 -0
  89. data/generators/vulcanize/templates/mongrel/templates.yml +1 -0
  90. data/generators/vulcanize/templates/monit/config/rubber/common/monit-default.conf +15 -0
  91. data/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +252 -0
  92. data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +33 -0
  93. data/generators/vulcanize/templates/monit/config/rubber/role/web_tools/monit-admin-nginx.conf +10 -0
  94. data/generators/vulcanize/templates/monit/config/rubber/rubber-monit.yml +6 -0
  95. data/generators/vulcanize/templates/monit/templates.yml +1 -0
  96. data/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +8 -0
  97. data/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +48 -0
  98. data/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +11 -0
  99. data/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +46 -0
  100. data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf +8 -0
  101. data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +31 -0
  102. data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +115 -0
  103. data/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
  104. data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +55 -0
  105. data/generators/vulcanize/templates/munin/script/munin/example_simple.rb +24 -0
  106. data/generators/vulcanize/templates/munin/templates.yml +1 -0
  107. data/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +12 -0
  108. data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +169 -0
  109. data/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
  110. data/generators/vulcanize/templates/mysql/config/rubber/role/db/crontab +14 -0
  111. data/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +10 -0
  112. data/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +163 -0
  113. data/generators/vulcanize/templates/mysql/config/rubber/role/mysql_slave/mysql_slave_munin_plugin +51 -0
  114. data/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +47 -0
  115. data/generators/vulcanize/templates/mysql/templates.yml +1 -0
  116. data/generators/vulcanize/templates/mysql_cluster/config/rubber/common/mysql_cluster_migrations.rb +13 -0
  117. data/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +177 -0
  118. data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_data/my.cnf +15 -0
  119. data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_mgm/ndb_mgmd.cnf +39 -0
  120. data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +10 -0
  121. data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +23 -0
  122. data/generators/vulcanize/templates/mysql_cluster/config/rubber/rubber-mysql_cluster.yml +32 -0
  123. data/generators/vulcanize/templates/mysql_cluster/templates.yml +1 -0
  124. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/database.yml +16 -0
  125. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +10 -0
  126. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy +153 -0
  127. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.conf +10 -0
  128. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.lua +5 -0
  129. data/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +52 -0
  130. data/generators/vulcanize/templates/mysql_proxy/config/rubber/rubber-mysql_proxy.yml +11 -0
  131. data/generators/vulcanize/templates/mysql_proxy/templates.yml +1 -0
  132. data/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +45 -0
  133. data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/crontab +9 -0
  134. data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +8 -0
  135. data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/nginx.conf +42 -0
  136. data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +55 -0
  137. data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-index.html +30 -0
  138. data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-nginx.auth +7 -0
  139. data/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +10 -0
  140. data/generators/vulcanize/templates/nginx/templates.yml +1 -0
  141. data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +46 -0
  142. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
  143. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +7 -0
  144. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +47 -0
  145. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +46 -0
  146. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +35 -0
  147. data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +15 -0
  148. data/generators/vulcanize/templates/passenger/templates.yml +3 -0
  149. data/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
  150. data/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
  151. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
  152. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
  153. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
  154. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
  155. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
  156. data/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
  157. data/generators/vulcanize/templates/postgresql/templates.yml +1 -0
  158. data/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +37 -0
  159. data/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +8 -0
  160. data/generators/vulcanize/templates/redis/config/rubber/role/redis/monit-redis.conf +9 -0
  161. data/generators/vulcanize/templates/redis/config/rubber/role/redis/redis.conf +141 -0
  162. data/generators/vulcanize/templates/redis/config/rubber/rubber-redis.yml +4 -0
  163. data/generators/vulcanize/templates/redis/templates.yml +1 -0
  164. data/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
  165. data/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
  166. data/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +58 -0
  167. data/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
  168. data/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
  169. data/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +18 -0
  170. data/generators/vulcanize/templates/resque/script/resque_worker_management.rb +144 -0
  171. data/generators/vulcanize/templates/resque/templates.rb +1 -0
  172. data/generators/vulcanize/templates/resque/templates.yml +3 -0
  173. data/generators/vulcanize/templates/sphinx/config/rubber/common/sphinx.yml +46 -0
  174. data/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +112 -0
  175. data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +11 -0
  176. data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +13 -0
  177. data/generators/vulcanize/templates/sphinx/config/rubber/rubber-sphinx.yml +6 -0
  178. data/generators/vulcanize/templates/sphinx/templates.yml +1 -0
  179. data/generators/vulcanize/vulcanize_generator.rb +184 -0
  180. data/lib/capistrano/hostcmd.rb +12 -0
  181. data/lib/generators/vulcanize/USAGE +6 -0
  182. data/lib/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +51 -0
  183. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/deflate.conf +10 -0
  184. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/expires.conf +9 -0
  185. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/headers.conf +6 -0
  186. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +8 -0
  187. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +8 -0
  188. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/setenvif.conf +52 -0
  189. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +79 -0
  190. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache.auth +7 -0
  191. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +34 -0
  192. data/lib/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +6 -0
  193. data/lib/generators/vulcanize/templates/apache/templates.yml +1 -0
  194. data/lib/generators/vulcanize/templates/base/Capfile +14 -0
  195. data/lib/generators/vulcanize/templates/base/Rakefile +23 -0
  196. data/lib/generators/vulcanize/templates/base/config/deploy.rb +56 -0
  197. data/lib/generators/vulcanize/templates/base/config/rubber/common/crontab +22 -0
  198. data/lib/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +8 -0
  199. data/lib/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +13 -0
  200. data/lib/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +92 -0
  201. data/lib/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
  202. data/lib/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +78 -0
  203. data/lib/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +33 -0
  204. data/lib/generators/vulcanize/templates/base/config/rubber/rubber.yml +233 -0
  205. data/lib/generators/vulcanize/templates/base/lib/tasks/rubber.rake +15 -0
  206. data/lib/generators/vulcanize/templates/base/script/cron-rake +18 -0
  207. data/lib/generators/vulcanize/templates/base/script/cron-runner +18 -0
  208. data/lib/generators/vulcanize/templates/base/script/cron-sh +67 -0
  209. data/lib/generators/vulcanize/templates/base/templates.rb +11 -0
  210. data/lib/generators/vulcanize/templates/base/templates.yml +6 -0
  211. data/lib/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
  212. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +60 -0
  213. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
  214. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
  215. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
  216. data/lib/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
  217. data/lib/generators/vulcanize/templates/cassandra/templates.yml +1 -0
  218. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +23 -0
  219. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/nginx/nginx-mongrel.conf +113 -0
  220. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/rubber-complete.yml +41 -0
  221. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/templates.yml +6 -0
  222. data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/role/haproxy/haproxy-passenger.conf +21 -0
  223. data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/rubber-complete.yml +40 -0
  224. data/lib/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
  225. data/lib/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
  226. data/lib/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +4 -0
  227. data/lib/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
  228. data/lib/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +72 -0
  229. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/cruise +40 -0
  230. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +165 -0
  231. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/production.rb +8 -0
  232. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/site_config.rb +76 -0
  233. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/web_tools/cruise-nginx.conf +11 -0
  234. data/lib/generators/vulcanize/templates/cruise/config/rubber/rubber-cruise.yml +18 -0
  235. data/lib/generators/vulcanize/templates/cruise/templates.yml +1 -0
  236. data/lib/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +45 -0
  237. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-base.conf +26 -0
  238. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-default.conf +8 -0
  239. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +9 -0
  240. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +11 -0
  241. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +21 -0
  242. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf +10 -0
  243. data/lib/generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml +7 -0
  244. data/lib/generators/vulcanize/templates/haproxy/templates.yml +1 -0
  245. data/lib/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +59 -0
  246. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.sh +589 -0
  247. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
  248. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
  249. data/lib/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +10 -0
  250. data/lib/generators/vulcanize/templates/jetty/templates.yml +1 -0
  251. data/lib/generators/vulcanize/templates/memcached/config/memcached.yml +28 -0
  252. data/lib/generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml +14 -0
  253. data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +52 -0
  254. data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached_munin_plugin +249 -0
  255. data/lib/generators/vulcanize/templates/memcached/config/rubber/rubber-memcached.yml +7 -0
  256. data/lib/generators/vulcanize/templates/memcached/templates.yml +1 -0
  257. data/lib/generators/vulcanize/templates/minimal_mysql/templates.yml +7 -0
  258. data/lib/generators/vulcanize/templates/minimal_nodb/templates.yml +6 -0
  259. data/lib/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +75 -0
  260. data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/mongrel_cluster.yml +12 -0
  261. data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +20 -0
  262. data/lib/generators/vulcanize/templates/mongrel/config/rubber/rubber-mongrel.yml +9 -0
  263. data/lib/generators/vulcanize/templates/mongrel/templates.yml +1 -0
  264. data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit-default.conf +15 -0
  265. data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +252 -0
  266. data/lib/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +33 -0
  267. data/lib/generators/vulcanize/templates/monit/config/rubber/role/web_tools/monit-admin-nginx.conf +10 -0
  268. data/lib/generators/vulcanize/templates/monit/config/rubber/rubber-monit.yml +6 -0
  269. data/lib/generators/vulcanize/templates/monit/templates.yml +1 -0
  270. data/lib/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +8 -0
  271. data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +48 -0
  272. data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +11 -0
  273. data/lib/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +46 -0
  274. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf +8 -0
  275. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +31 -0
  276. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +115 -0
  277. data/lib/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
  278. data/lib/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +55 -0
  279. data/lib/generators/vulcanize/templates/munin/script/munin/example_simple.rb +24 -0
  280. data/lib/generators/vulcanize/templates/munin/templates.yml +1 -0
  281. data/lib/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +12 -0
  282. data/lib/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +169 -0
  283. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
  284. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/crontab +14 -0
  285. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +10 -0
  286. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +163 -0
  287. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/mysql_slave/mysql_slave_munin_plugin +51 -0
  288. data/lib/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +47 -0
  289. data/lib/generators/vulcanize/templates/mysql/templates.yml +1 -0
  290. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/common/mysql_cluster_migrations.rb +13 -0
  291. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +177 -0
  292. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_data/my.cnf +15 -0
  293. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_mgm/ndb_mgmd.cnf +39 -0
  294. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +10 -0
  295. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +23 -0
  296. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/rubber-mysql_cluster.yml +32 -0
  297. data/lib/generators/vulcanize/templates/mysql_cluster/templates.yml +1 -0
  298. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/database.yml +16 -0
  299. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +10 -0
  300. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy +153 -0
  301. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.conf +10 -0
  302. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.lua +5 -0
  303. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +52 -0
  304. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/rubber-mysql_proxy.yml +11 -0
  305. data/lib/generators/vulcanize/templates/mysql_proxy/templates.yml +1 -0
  306. data/lib/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +45 -0
  307. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/crontab +9 -0
  308. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +8 -0
  309. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/nginx.conf +42 -0
  310. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +55 -0
  311. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-index.html +30 -0
  312. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-nginx.auth +7 -0
  313. data/lib/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +10 -0
  314. data/lib/generators/vulcanize/templates/nginx/templates.yml +1 -0
  315. data/lib/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +46 -0
  316. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
  317. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +7 -0
  318. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +47 -0
  319. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +46 -0
  320. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +35 -0
  321. data/lib/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +15 -0
  322. data/lib/generators/vulcanize/templates/passenger/templates.yml +3 -0
  323. data/lib/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
  324. data/lib/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
  325. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
  326. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
  327. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
  328. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
  329. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
  330. data/lib/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
  331. data/lib/generators/vulcanize/templates/postgresql/templates.yml +1 -0
  332. data/lib/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +37 -0
  333. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +8 -0
  334. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/monit-redis.conf +9 -0
  335. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/redis.conf +141 -0
  336. data/lib/generators/vulcanize/templates/redis/config/rubber/rubber-redis.yml +4 -0
  337. data/lib/generators/vulcanize/templates/redis/templates.yml +1 -0
  338. data/lib/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
  339. data/lib/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
  340. data/lib/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +58 -0
  341. data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
  342. data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
  343. data/lib/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +18 -0
  344. data/lib/generators/vulcanize/templates/resque/script/resque_worker_management.rb +144 -0
  345. data/lib/generators/vulcanize/templates/resque/templates.rb +1 -0
  346. data/lib/generators/vulcanize/templates/resque/templates.yml +3 -0
  347. data/lib/generators/vulcanize/templates/sphinx/config/rubber/common/sphinx.yml +46 -0
  348. data/lib/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +112 -0
  349. data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +11 -0
  350. data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +13 -0
  351. data/lib/generators/vulcanize/templates/sphinx/config/rubber/rubber-sphinx.yml +6 -0
  352. data/lib/generators/vulcanize/templates/sphinx/templates.yml +1 -0
  353. data/lib/generators/vulcanize/vulcanize_generator.rb +184 -0
  354. data/lib/rubber.rb +76 -0
  355. data/lib/rubber/capistrano.rb +1 -0
  356. data/lib/rubber/cloud.rb +13 -0
  357. data/lib/rubber/cloud/aws.rb +355 -0
  358. data/lib/rubber/cloud/base.rb +16 -0
  359. data/lib/rubber/configuration.rb +47 -0
  360. data/lib/rubber/dns.rb +13 -0
  361. data/lib/rubber/dns/base.rb +84 -0
  362. data/lib/rubber/dns/dyndns.rb +77 -0
  363. data/lib/rubber/dns/nettica.rb +117 -0
  364. data/lib/rubber/dns/zerigo.rb +115 -0
  365. data/lib/rubber/environment.rb +177 -0
  366. data/lib/rubber/generator.rb +209 -0
  367. data/lib/rubber/instance.rb +176 -0
  368. data/lib/rubber/railtie.rb +14 -0
  369. data/lib/rubber/recipes/rubber.rb +96 -0
  370. data/lib/rubber/recipes/rubber/bundles.rb +30 -0
  371. data/lib/rubber/recipes/rubber/deploy.rb +90 -0
  372. data/lib/rubber/recipes/rubber/instances.rb +445 -0
  373. data/lib/rubber/recipes/rubber/load_balancers.rb +44 -0
  374. data/lib/rubber/recipes/rubber/security_groups.rb +189 -0
  375. data/lib/rubber/recipes/rubber/setup.rb +534 -0
  376. data/lib/rubber/recipes/rubber/spot_requests.rb +23 -0
  377. data/lib/rubber/recipes/rubber/static_ips.rb +190 -0
  378. data/lib/rubber/recipes/rubber/utils.rb +226 -0
  379. data/lib/rubber/recipes/rubber/volumes.rb +264 -0
  380. data/lib/rubber/tasks/rubber.rb +279 -0
  381. data/lib/rubber/util.rb +72 -0
  382. data/rails/init.rb +6 -0
  383. data/test/environment_test.rb +144 -0
  384. data/test/generator_test.rb +370 -0
  385. data/test/instance_test.rb +96 -0
  386. data/test/test_helper.rb +14 -0
  387. data/test/util_test.rb +19 -0
  388. data/test/zerigo_test.rb +88 -0
  389. metadata +494 -0
@@ -0,0 +1,10 @@
1
+ <%
2
+ @path = "/etc/nginx/rubber/tools/monit.conf"
3
+ %>
4
+
5
+ <% rubber_instances.each do |ic| %>
6
+ location /monit_<%= ic.name %>
7
+ {
8
+ proxy_pass http://<%= ic.full_name %>:<%= rubber_env.monit_admin_port %>;
9
+ }
10
+ <% end %>
@@ -0,0 +1,6 @@
1
+ # Uses admin_email from base
2
+
3
+ monit_admin_port: 2812
4
+
5
+ packages: [monit]
6
+
@@ -0,0 +1 @@
1
+ description: The monit module
@@ -0,0 +1,8 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-munin.conf'
3
+ %>
4
+
5
+ check process munin-node with pidfile /var/run/munin/munin-node.pid
6
+ start program "/usr/bin/env service munin-node start"
7
+ stop program "/usr/bin/env service munin-node stop"
8
+ if 5 restarts within 5 cycles then timeout
@@ -0,0 +1,48 @@
1
+ <%
2
+ @path = '/etc/munin/munin-node.conf'
3
+ @post = 'service munin-node restart'
4
+ %>
5
+
6
+ #
7
+ # Example config-file for munin-node
8
+ #
9
+
10
+ log_level 4
11
+ log_file /var/log/munin/munin-node.log
12
+ port 4949
13
+ pid_file /var/run/munin/munin-node.pid
14
+ background 1
15
+ setseid 1
16
+
17
+ # Which port to bind to;
18
+ host *
19
+ user root
20
+ group root
21
+ setsid yes
22
+
23
+ # Regexps for files to ignore
24
+
25
+ ignore_file ~$
26
+ ignore_file \.bak$
27
+ ignore_file %$
28
+ ignore_file \.dpkg-(tmp|new|old|dist)$
29
+ ignore_file \.rpm(save|new)$
30
+
31
+ # Set this if the client doesn't report the correct hostname when
32
+ # telnetting to localhost, port 4949
33
+ #
34
+ #host_name localhost.localdomain
35
+
36
+ # A list of addresses that are allowed to connect. This must be a
37
+ # regular expression, due to brain damage in Net::Server, which
38
+ # doesn't understand CIDR-style network notation. You may repeat
39
+ # the allow line as many times as you'd like
40
+
41
+ allow ^127\.0\.0\.1$
42
+
43
+ <%
44
+ munin_server = rubber_instances.for_role('web_tools').first.internal_ip rescue "127.0.0.1"
45
+ munin_server = munin_server.gsub(/\./, "\\.")
46
+ %>
47
+ allow ^<%= munin_server %>$
48
+
@@ -0,0 +1,11 @@
1
+ <%
2
+ @path = '/etc/munin/plugin-conf.d/rubber'
3
+ %>
4
+
5
+ # munin-node clears out enviroment variables, so we need to add these in
6
+ # to make sure we are running the correct ruby (rvm env vars, plus paths)
7
+ [*]
8
+ <%- ENV.select {|k, v| k =~ /rvm|ruby|bundler|gem|path/i }.each do |k, v| -%>
9
+ env.<%= k %> <%= v %>
10
+ <%- end -%>
11
+ env.RUBYOPT rubygems
@@ -0,0 +1,46 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :munin do
5
+
6
+ rubber.allow_optional_tasks(self)
7
+
8
+ after "rubber:install_packages", "rubber:munin:custom_install"
9
+
10
+ # sometimes apt-get install of munin doesn't end up configuring
11
+ # plugins (e.g. installing postfix at same time, postfix plugin
12
+ # configure barfs as postfix not configured yet)
13
+ desc <<-DESC
14
+ Reconfigures munin
15
+ DESC
16
+ task :custom_install do
17
+ rubber.sudo_script 'setup_munin_plugins', <<-ENDSCRIPT
18
+ munin-node-configure --shell --remove-also > /tmp/setup-munin-plugins 2> /dev/null || true
19
+ sh /tmp/setup-munin-plugins
20
+ ENDSCRIPT
21
+ restart
22
+ end
23
+
24
+ # after "deploy:stop", "rubber:munin:stop"
25
+ # before "deploy:start", "rubber:munin:start"
26
+ # after "deploy:restart", "rubber:munin:restart"
27
+
28
+ desc "Start munin system monitoring"
29
+ task :start do
30
+ rsudo "service munin-node start"
31
+ end
32
+
33
+ desc "Stop munin system monitoring"
34
+ task :stop do
35
+ rsudo "service munin-node stop; exit 0"
36
+ end
37
+
38
+ desc "Restart munin system monitoring"
39
+ task :restart do
40
+ stop
41
+ start
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,8 @@
1
+ <%
2
+ @path = "/etc/nginx/rubber/tools/munin.conf"
3
+ %>
4
+
5
+ location /munin
6
+ {
7
+ alias /var/www/munin;
8
+ }
@@ -0,0 +1,31 @@
1
+ <%
2
+ @path = "/etc/munin/plugin-conf.d/munin-node"
3
+ @additive = ["# rubber-munin-plugins-start", "# rubber-munin-plugins-end"]
4
+ @post = <<-POST
5
+ service munin-node restart
6
+ POST
7
+
8
+ root = RUBBER_ENV == 'development' ? "#{RUBBER_ROOT}/tmp/rubber" : ""
9
+ script_dir = "#{RUBBER_ROOT}/script/munin"
10
+ plugin_dir = "#{root}/etc/munin/plugins"
11
+ plugin_prefix = "rubber_"
12
+ %>
13
+
14
+ <%
15
+ # cleanup old plugins
16
+ File.delete(*Dir["#{plugin_dir}/#{plugin_prefix}*"])
17
+
18
+ # for each script in our source tree, create a wrapper in
19
+ # munin plgin dir so that we can set rails env
20
+ Dir["#{script_dir}/*"].each do |script|
21
+ plugin_name = plugin_prefix + File.basename(script)
22
+ File.open("#{plugin_dir}/#{plugin_name}", 'w') do |p|
23
+ p.chmod(0755)
24
+ p.puts('#!/bin/sh')
25
+ p.puts("RUBBER_ENV=#{RUBBER_ENV} #{script} $*")
26
+ end
27
+ end
28
+ %>
29
+
30
+ # Active rubber plugins: <%= Dir["#{plugin_dir}/#{plugin_prefix}*"].collect {|f| File.basename(f) }.join(", ") %>
31
+
@@ -0,0 +1,115 @@
1
+ <%
2
+ @path = '/etc/munin/munin.conf'
3
+ %>
4
+
5
+ # Example configuration file for Munin, generated by 'make build'
6
+
7
+ # The next three variables specifies where the location of the RRD
8
+ # databases, the HTML output, logs and the lock/pid files. They all
9
+ # must be writable by the user running munin-cron. They are all
10
+ # defaulted to the values you see here.
11
+ #
12
+ dbdir /var/lib/munin
13
+ htmldir /var/cache/munin/www
14
+ logdir /var/log/munin
15
+ rundir /var/run/munin
16
+
17
+ # Where to look for the HTML templates
18
+ tmpldir /etc/munin/templates
19
+
20
+ # (Exactly one) directory to include all files from.
21
+ #
22
+ includedir /etc/munin/munin-conf.d
23
+
24
+ # Make graphs show values per minute instead of per second
25
+ #graph_period minute
26
+
27
+ # Graphics files are normaly generated by munin-graph, no matter if
28
+ # the graphs are used or not. You can change this to
29
+ # on-demand-graphing by following the instructions in
30
+ # http://munin.projects.linpro.no/wiki/CgiHowto
31
+ #
32
+ #graph_strategy cgi
33
+
34
+ # munin-cgi-graph is invoked by the web server up to very many times at the
35
+ # same time. This is not optimal since it results in high CPU and memory
36
+ # consumption to the degree that the system can thrash. Again the default is
37
+ # 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
38
+ # max_graph_jobs.
39
+ #
40
+ #munin_cgi_graph_jobs 6
41
+
42
+ # If the automatic CGI url is wrong for your system override it here:
43
+ #
44
+ #cgiurl_graph /cgi-bin/munin-cgi-graph
45
+
46
+ # munin-graph runs in parallel, the number of concurrent processes is
47
+ # 6. If you want munin-graph to not be parallel set to 0. If set too
48
+ # high it will slow down munin-graph. Some experiments are needed to
49
+ # determine how many are optimal on your system. On a multi-core
50
+ # system with good SCSI disks the number can probably be quite high.
51
+ #
52
+ #max_graph_jobs 6
53
+
54
+ # Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
55
+ # something changes (OK -> WARNING, CRITICAL -> OK, etc)
56
+ #contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
57
+ #contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
58
+ #
59
+
60
+ contacts dev
61
+ contact.dev.command mail -s "Munin notification ${var:host} : ${var:group}" <%= rubber_env.admin_email %>
62
+ contact.dev.always_send warning critical
63
+
64
+ # For those with Nagios, the following might come in handy. In addition,
65
+ # the services must be defined in the Nagios server as well.
66
+ #contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf
67
+
68
+ # The host tree generated by rubber
69
+ #
70
+ <% rubber_instances.each do |i| %>
71
+ [<%= i.full_name %>]
72
+ address <%= i.internal_ip %>
73
+ use_node_name yes
74
+ <% end %>
75
+
76
+ #
77
+ # A more complex example of a host tree
78
+ #
79
+ ## First our "normal" host.
80
+ # [fii.foo.com]
81
+ # address foo
82
+ #
83
+ ## Then our other host...
84
+ # [fay.foo.com]
85
+ # address fay
86
+ #
87
+ ## Then we want totals...
88
+ # [foo.com;Totals] #Force it into the "foo.com"-domain...
89
+ # update no # Turn off data-fetching for this "host".
90
+ #
91
+ # # The graph "load1". We want to see the loads of both machines...
92
+ # # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
93
+ # load1.graph_title Loads side by side
94
+ # load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
95
+ #
96
+ # # The graph "load2". Now we want them stacked on top of each other.
97
+ # load2.graph_title Loads on top of each other
98
+ # load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
99
+ # load2.dummy_field.draw AREA # We want area instead the default LINE2.
100
+ # load2.dummy_field.label dummy # This is needed. Silly, really.
101
+ #
102
+ # # The graph "load3". Now we want them summarised into one field
103
+ # load3.graph_title Loads summarised
104
+ # load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
105
+ # load3.combined_loads.label Combined loads # Must be set, as this is
106
+ # # not a dummy field!
107
+ #
108
+ ## ...and on a side note, I want them listen in another order (default is
109
+ ## alphabetically)
110
+ #
111
+ # # Since [foo.com] would be interpreted as a host in the domain "com", we
112
+ # # specify that this is a domain by adding a semicolon.
113
+ # [foo.com;]
114
+ # node_order Totals fii.foo.com fay.foo.com
115
+ #
@@ -0,0 +1,8 @@
1
+ # Uses admin_email from base
2
+
3
+ packages: [munin-node, munin-plugins-extra, heirloom-mailx]
4
+
5
+ roles:
6
+ web_tools:
7
+ packages: [munin]
8
+
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Example munin plugin for querying stats out of db
4
+ # See munin plugin docs http://munin.projects.linpro.no/wiki/Documentation#Plugins
5
+ #
6
+ # Scripts added to RUBBER_ROOT/script/munin automatically
7
+ # get installed as munin plugins by rubber
8
+
9
+ # remove this line to enable
10
+ exit 0
11
+
12
+ # load just rubber config without loading rails (you can load rails
13
+ # if you want, but may be slow if your app loads a lot of plugins)
14
+
15
+ require "rubber"
16
+ env = ENV["RUBBER_ENV"] ||= "development"
17
+ root = File.join(File.dirname(__FILE__), '../..')
18
+ Rubber::initialize(root, env)
19
+
20
+ # Print config info need by munin for generating graphs
21
+ if ARGV[0] == "config"
22
+ puts 'graph_title User Count'
23
+ puts 'graph_vlabel Users'
24
+ puts 'graph_category Examples'
25
+ puts 'graph_scale no'
26
+ puts 'tusers.label total users'
27
+ puts 'tusers.type GAUGE'
28
+ puts 'nusers.label user delta'
29
+ puts 'nusers.type COUNTER'
30
+ exit 0
31
+ end
32
+
33
+
34
+ query = <<-EOF
35
+ select count(id) from users;
36
+ EOF
37
+
38
+ # pick a non-critical db if possible
39
+ source = Rubber.instances.for_role("mysql_util").first
40
+ source ||= Rubber.instances.for_role("mysql_slave").first
41
+ source ||= Rubber.instances.for_role("mysql_master").first
42
+ db_host = source ? source.full_name : 'localhost'
43
+
44
+ command = "mysql -u #{Rubber.config.db_slave_user}"
45
+ command << " --password=#{Rubber.config.db_pass}"
46
+ command << " -h #{db_host}"
47
+ command << " #{Rubber.config.db_name} --skip-column-names"
48
+
49
+ # execute a sql query to get some data
50
+ data = `echo "#{query}" | #{command}`
51
+ fail "Couldn't execute command" if $?.exitstatus > 0
52
+
53
+ # print graph data values
54
+ puts "tusers.value #{data}"
55
+ puts "nusers.value #{data}"
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Example munin plugin.
4
+ # See munin plugin docs http://munin.projects.linpro.no/wiki/Documentation#Plugins
5
+ #
6
+ # Scripts added to RUBBER_ROOT/script/munin automatically
7
+ # get installed as munin plugins by rubber
8
+
9
+ # remove this line to enable
10
+ exit 0
11
+
12
+ # Print config info need by munin for generating graphs
13
+ if ARGV[0] == "config"
14
+ puts 'graph_title Example Stats'
15
+ puts 'graph_vlabel random 1-100'
16
+ puts 'graph_category Examples'
17
+ puts 'graph_scale no'
18
+ puts 'rand.label random'
19
+
20
+ exit 0
21
+ end
22
+
23
+ # print graph data values
24
+ puts "rand.value #{rand(100)}"
@@ -0,0 +1 @@
1
+ description: The munin module
@@ -0,0 +1,12 @@
1
+ <%
2
+ @path = "#{RUBBER_ROOT}/config/database.yml"
3
+ %>
4
+
5
+ <%= RUBBER_ENV %>:
6
+ adapter: mysql
7
+ encoding: utf8
8
+ database: <%= rubber_env.db_name %>
9
+ username: <%= rubber_env.db_user %>
10
+ password: <%= rubber_env.db_pass %>
11
+ host: <%= rubber_instances.for_role('db', 'primary' => true).first.full_name %>
12
+ pool: 5
@@ -0,0 +1,169 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :mysql do
5
+
6
+ rubber.allow_optional_tasks(self)
7
+
8
+ after "rubber:create", "rubber:mysql:validate_db_roles"
9
+
10
+ task :validate_db_roles do
11
+ db_instances = rubber_instances.for_role("mysql_slave")
12
+ db_instances.each do |instance|
13
+ if instance.role_names.find {|n| n == 'mysql_master'}
14
+ fatal "Cannot have a mysql slave and master on the same instance, please removing slave role for #{instance.name}"
15
+ end
16
+ end
17
+ end
18
+
19
+ after "rubber:bootstrap", "rubber:mysql:bootstrap"
20
+
21
+
22
+ # Bootstrap the production database config. Db bootstrap is special - the
23
+ # user could be requiring the rails env inside some of their config
24
+ # templates, which creates a catch 22 situation with the db, so we try and
25
+ # bootstrap the db separate from the rest of the config
26
+ task :bootstrap, :roles => [:mysql_master, :mysql_slave] do
27
+
28
+ # Conditionaly bootstrap for each node/role only if that node has not
29
+ # been boostrapped for that role before
30
+
31
+ master_instances = rubber_instances.for_role("mysql_master") & rubber_instances.filtered
32
+ master_instances.each do |ic|
33
+ task_name = "_bootstrap_mysql_master_#{ic.full_name}".to_sym()
34
+ task task_name, :hosts => ic.full_name do
35
+ env = rubber_cfg.environment.bind("mysql_master", ic.name)
36
+ exists = capture("echo $(ls #{env.db_data_dir}/ 2> /dev/null)")
37
+ if exists.strip.size == 0
38
+ common_bootstrap("mysql_master")
39
+
40
+ pass = "identified by '#{env.db_pass}'" if env.db_pass
41
+ rubber.sudo_script "create_master_db", <<-ENDSCRIPT
42
+ mysql -u root -e "create database #{env.db_name};"
43
+ mysql -u root -e "grant all on *.* to '#{env.db_user}'@'%' #{pass};"
44
+ mysql -u root -e "grant select on *.* to '#{env.db_slave_user}'@'%' #{pass};"
45
+ mysql -u root -e "grant replication slave on *.* to '#{env.db_replicator_user}'@'%' #{pass};"
46
+ mysql -u root -e "flush privileges;"
47
+ ENDSCRIPT
48
+ end
49
+ end
50
+ send task_name
51
+ end
52
+
53
+ slave_instances = rubber_instances.for_role("mysql_slave") & rubber_instances.filtered
54
+ slave_instances.each do |ic|
55
+ task_name = "_bootstrap_mysql_slave_#{ic.full_name}".to_sym()
56
+ task task_name, :hosts => ic.full_name do
57
+ env = rubber_cfg.environment.bind("mysql_slave", ic.name)
58
+ exists = capture("echo $(ls #{env.db_data_dir}/ 2> /dev/null)")
59
+ if exists.strip.size == 0
60
+ common_bootstrap("mysql_slave")
61
+
62
+ master = rubber_instances.for_role("mysql_master").first
63
+
64
+ # Doing a mysqldump locks the db, so ideally we'd do it against a slave replica thats
65
+ # not serving traffic (mysql_util role), but if thats not available try a regular
66
+ # slave (mysql_slave role), and finally default dumping from master (mysql_master role)
67
+ # TODO: handle simultaneous creating of multi slaves/utils
68
+ slaves = rubber_instances.for_role("mysql_slave")
69
+ slaves.delete(ic) # don't want to try and dump from self
70
+ source = slaves.find {|sc| sc.role_names.include?("mysql_util")}
71
+ source = slaves.first unless source
72
+ source = master unless source
73
+
74
+ pass = "identified by '#{env.db_pass}'" if env.db_pass
75
+ master_pass = ", master_password='#{env.db_pass}'" if env.db_pass
76
+ master_host = master.full_name
77
+ source_host = source.full_name
78
+
79
+ if source == master
80
+ logger.info "Creating slave from a dump of master #{source_host}"
81
+ rubber.sudo_script "create_slave_db_from_master", <<-ENDSCRIPT
82
+ mysql -u root -e "change master to master_host='#{master_host}', master_user='#{env.db_replicator_user}' #{master_pass}"
83
+ mysqldump -u #{env.db_user} #{env.db_pass.nil? ? '' : '--password ' + env.db_pass} -h #{source_host} --all-databases --master-data=1 | mysql -u root
84
+ ENDSCRIPT
85
+ else
86
+ logger.info "Creating slave from a dump of slave #{source_host}"
87
+ rsudo "mysql -u #{env.db_user} --password #{env.db_pass} -h #{source_host} -e \"stop slave;\""
88
+ slave_status = capture("mysql -u #{env.db_user} #{pass} -h #{source_host} -e \"show slave status\\G\"")
89
+ slave_config = Hash[*slave_status.scan(/([^\s:]+): ([^\s]*)/).flatten]
90
+ log_file = slave_config['Master_Log_File']
91
+ log_pos = slave_config['Read_Master_Log_Pos']
92
+ rubber.sudo_script "create_slave_db_from_slave", <<-ENDSCRIPT
93
+ mysqldump -u #{env.db_user} --password #{env.db_pass} -h #{source_host} --all-databases --master-data=1 | mysql -u root
94
+ mysql -u root -e "change master to master_host='#{master_host}', master_user='#{env.db_replicator_user}', master_log_file='#{log_file}', master_log_pos=#{log_pos} #{master_pass}"
95
+ mysql -u #{env.db_user} --password #{env.db_pass} -h #{source_host} -e "start slave;"
96
+ ENDSCRIPT
97
+ end
98
+
99
+ # this doesn't work without agent forwarding which sudo breaks, as well as not having your
100
+ # ec2 private key ssh-added on workstation
101
+ # sudo "scp -o \"StrictHostKeyChecking=no\" #{source_host}:/etc/mysql/debian.cnf /etc/mysql"
102
+
103
+ rsudo "mysql -u root -e \"flush privileges;\""
104
+ rsudo "mysql -u root -e \"start slave;\""
105
+ end
106
+ end
107
+ send task_name
108
+ end
109
+
110
+ end
111
+
112
+ # TODO: Make the setup/update happen just once per host
113
+ def common_bootstrap(role)
114
+ # mysql package install starts mysql, so stop it
115
+ rsudo "service mysql stop" rescue nil
116
+
117
+ # After everything installed on machines, we need the source tree
118
+ # on hosts in order to run rubber:config for bootstrapping the db
119
+ rubber.update_code_for_bootstrap
120
+
121
+ # Gen just the conf for the given mysql role
122
+ rubber.run_config(:RUBBER_ENV => RUBBER_ENV, :FILE => "role/#{role}|role/db/", :FORCE => true, :deploy_path => release_path)
123
+
124
+ # reconfigure mysql so that it sets up data dir in /mnt with correct files
125
+ sudo_script 'reconfigure-mysql', <<-ENDSCRIPT
126
+ server_package=`dpkg -l | grep mysql-server-[0-9] | awk '{print $2}'`
127
+ dpkg-reconfigure --frontend=noninteractive $server_package
128
+ ENDSCRIPT
129
+ sleep 5
130
+ end
131
+
132
+ before "rubber:munin:custom_install", "rubber:mysql:custom_install_munin"
133
+
134
+ desc <<-DESC
135
+ Installs some extra munin graphs
136
+ DESC
137
+ task :custom_install_munin, :roles => [:mysql_master, :mysql_slave] do
138
+ rubber.sudo_script 'install_munin_mysql', <<-ENDSCRIPT
139
+ if [ ! -f /usr/share/munin/plugins/mysql_ ]; then
140
+ wget -qN -O /usr/share/munin/plugins/mysql_ http://github.com/kjellm/munin-mysql/raw/master/mysql_
141
+ wget -qN -O /etc/munin/plugin-conf.d/mysql_.conf http://github.com/kjellm/munin-mysql/raw/master/mysql_.conf
142
+ fi
143
+ ENDSCRIPT
144
+ end
145
+
146
+ desc <<-DESC
147
+ Starts the mysql daemons
148
+ DESC
149
+ task :start, :roles => [:mysql_master, :mysql_slave] do
150
+ rsudo "service mysql start"
151
+ end
152
+
153
+ desc <<-DESC
154
+ Stops the mysql daemons
155
+ DESC
156
+ task :stop, :roles => [:mysql_master, :mysql_slave] do
157
+ rsudo "service mysql stop"
158
+ end
159
+
160
+ desc <<-DESC
161
+ Restarts the mysql daemons
162
+ DESC
163
+ task :restart, :roles => [:mysql_master, :mysql_slave] do
164
+ rsudo "service mysql restart"
165
+ end
166
+
167
+ end
168
+
169
+ end