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,46 @@
1
+ <%
2
+ @path = '/etc/apparmor.d/usr.sbin.mysqld'
3
+ @post = "service apparmor restart"
4
+ @backup = false
5
+ %>
6
+
7
+ #include <tunables/global>
8
+
9
+ /usr/sbin/mysqld {
10
+ #include <abstractions/base>
11
+ #include <abstractions/nameservice>
12
+ #include <abstractions/user-tmp>
13
+ #include <abstractions/mysql>
14
+ #include <abstractions/winbind>
15
+
16
+ capability dac_override,
17
+ capability sys_resource,
18
+ capability setgid,
19
+ capability setuid,
20
+
21
+ network tcp,
22
+
23
+ /etc/hosts.allow r,
24
+ /etc/hosts.deny r,
25
+
26
+ /etc/mysql/*.pem r,
27
+ /etc/mysql/conf.d/ r,
28
+ /etc/mysql/conf.d/* r,
29
+ /etc/mysql/my.cnf r,
30
+ /usr/sbin/mysqld mr,
31
+ /usr/share/mysql/** r,
32
+ /var/log/mysql.log rw,
33
+ /var/log/mysql.err rw,
34
+ /var/lib/mysql/ r,
35
+ /var/lib/mysql/** rwk,
36
+ /var/log/mysql/ r,
37
+ /var/log/mysql/* rw,
38
+ /var/run/mysqld/mysqld.pid w,
39
+ /var/run/mysqld/mysqld.sock w,
40
+
41
+ /sys/devices/system/cpu/ r,
42
+ /sys/devices/system/cpu/** r,
43
+
44
+ <%= rubber_env.db_root_dir %>/ r,
45
+ <%= rubber_env.db_root_dir %>/** rwk,
46
+ }
@@ -0,0 +1,14 @@
1
+ <%
2
+ @read_cmd = 'crontab -l'
3
+ @write_cmd = 'crontab -'
4
+ @additive = ["# rubber-mysql-start", "# rubber-mysql-end"]
5
+ %>
6
+
7
+ <%
8
+ # Backup db every 3 hours to secondary db if available, else primary db
9
+ backup_db_host = rubber_instances.for_role('db', {}).first rescue nil
10
+ backup_db_host ||= rubber_instances.for_role('db', 'primary' => true).first
11
+ if backup_db_host.name == rubber_env.host
12
+ %>
13
+ 0 */3 * * * BACKUP_DIR=/mnt/db_backups DBUSER=<%= rubber_env.db_user %> DBPASS=<%= rubber_env.db_pass %> DBNAME=<%= rubber_env.db_name %> DBHOST=<%= backup_db_host.full_name %> <%= RUBBER_ROOT %>/script/cron-rake rubber:backup_db
14
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-mysql.conf'
3
+ %>
4
+
5
+ check process mysql with pidfile /var/run/mysqld/mysqld.pid
6
+ group mysql-<%= RUBBER_ENV %>
7
+ start program = "/usr/bin/env service mysql restart"
8
+ stop program = "/usr/bin/env service mysql stop"
9
+ if failed host 127.0.0.1 port 3306 protocol mysql then alert
10
+ if 5 restarts within 5 cycles then timeout
@@ -0,0 +1,163 @@
1
+ <%
2
+ data_dir = rubber_env.db_data_dir
3
+ log_dir = rubber_env.db_log_dir
4
+ server_id = rubber_env.db_server_id
5
+ @path = '/etc/mysql/my.cnf'
6
+ @post = "mkdir -p #{log_dir}; chown mysql:adm #{log_dir}; chmod 2750 #{log_dir}"
7
+ %>
8
+
9
+ # Generated by rubber for host <%= rubber_instances[rubber_env.host].external_ip %>
10
+ #
11
+ # The MySQL database server configuration file.
12
+ #
13
+ # You can copy this to one of:
14
+ # - "/etc/mysql/my.cnf" to set global options,
15
+ # - "~/.my.cnf" to set user-specific options.
16
+ #
17
+ # One can use all long options that the program supports.
18
+ # Run program with --help to get a list of available options and with
19
+ # --print-defaults to see which it would actually understand and use.
20
+ #
21
+ # For explanations see
22
+ # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
23
+
24
+ # This will be passed to all mysql clients
25
+ # It has been reported that passwords should be enclosed with ticks/quotes
26
+ # escpecially if they contain "#" chars...
27
+ # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
28
+ [client]
29
+ default-character-set = utf8
30
+ port = 3306
31
+ socket = /var/run/mysqld/mysqld.sock
32
+
33
+ # Here is entries for some specific programs
34
+ # The following values assume you have at least 32M ram
35
+
36
+ # This was formally known as [safe_mysqld]. Both versions are currently parsed.
37
+ [mysqld_safe]
38
+ socket = /var/run/mysqld/mysqld.sock
39
+ nice = 0
40
+
41
+ [mysqld]
42
+ #
43
+ # * Basic Settings
44
+ #
45
+ default-character-set = utf8
46
+ user = mysql
47
+ pid-file = /var/run/mysqld/mysqld.pid
48
+ socket = /var/run/mysqld/mysqld.sock
49
+ port = 3306
50
+ basedir = /usr
51
+ datadir = <%= data_dir %>
52
+ tmpdir = /tmp
53
+ language = /usr/share/mysql/english
54
+ skip-external-locking
55
+
56
+ #
57
+ # Instead of skip-networking the default is now to listen only on
58
+ # localhost which is more compatible and is not less secure.
59
+ # bind-address = 127.0.0.1
60
+ #
61
+ # * Fine Tuning
62
+ #
63
+ key_buffer = 16M
64
+ max_allowed_packet = 32M
65
+ thread_stack = 128K
66
+ thread_cache_size = 8
67
+ #table_cache=500
68
+ #max_heap_table_size=16M
69
+ #tmp_table_size=32M
70
+
71
+ #max_connections = 100
72
+ #table_cache = 64
73
+ #thread_concurrency = 10
74
+ #
75
+ # * Query Cache Configuration
76
+ #
77
+ query_cache_limit = 1M
78
+ query_cache_size = 16M
79
+ #
80
+ # * Logging and Replication
81
+ #
82
+ # Both location gets rotated by the cronjob.
83
+ # Be aware that this log type is a performance killer.
84
+ #log = /var/log/mysql/mysql.log
85
+ #
86
+ # Error logging goes to syslog. This is a Debian improvement :)
87
+ #
88
+ # Here you can see queries with especially long duration
89
+ log_slow_queries = /var/log/mysql/mysql-slow.log
90
+ long_query_time = 2
91
+ log-queries-not-using-indexes
92
+ #
93
+ # The following can be used as easy to replay backup logs or for replication.
94
+ # note: if you are setting up a replication slave, see README.Debian about
95
+ # other settings you may need to change.
96
+ server-id = <%= server_id %>
97
+ log_bin = <%= log_dir %>/mysql-bin.log
98
+ relay_log = <%= log_dir %>/mysql-relay-bin.log
99
+
100
+ # WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
101
+ expire_logs_days = 10
102
+ max_binlog_size = 100M
103
+ #binlog_do_db = include_database_name
104
+ #binlog_ignore_db = include_database_name
105
+
106
+
107
+ # * InnoDB
108
+ #
109
+ # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
110
+ # Read the manual for more InnoDB related options. There are many!
111
+ # You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
112
+ #skip-innodb
113
+
114
+ # Set buffer pool size to 50-80% of your computer's memory
115
+ #innodb_buffer_pool_size=512M
116
+ #innodb_additional_mem_pool_size=64M
117
+
118
+ # Set the log file size to about 25% of the buffer pool size
119
+ #innodb_log_file_size=128M
120
+ #innodb_log_buffer_size=32M
121
+ #innodb_flush_log_at_trx_commit=2
122
+
123
+ #
124
+ # * Security Features
125
+ #
126
+ # Read the manual, too, if you want chroot!
127
+ # chroot = /var/lib/mysql/
128
+ #
129
+ # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
130
+ #
131
+ # ssl-ca=/etc/mysql/cacert.pem
132
+ # ssl-cert=/etc/mysql/server-cert.pem
133
+ # ssl-key=/etc/mysql/server-key.pem
134
+
135
+
136
+
137
+ [mysqldump]
138
+ quick
139
+ quote-names
140
+ max_allowed_packet = 16M
141
+
142
+ [mysql]
143
+ #no-auto-rehash # faster start of mysql but no tab completition
144
+
145
+ [isamchk]
146
+ key_buffer = 16M
147
+
148
+ #
149
+ # * NDB Cluster
150
+ #
151
+ # See /usr/share/doc/mysql-server-*/README.Debian for more information.
152
+ #
153
+ # The following configuration is read by the NDB Data Nodes (ndbd processes)
154
+ # not from the NDB Management Nodes (ndb_mgmd processes).
155
+ #
156
+ # [MYSQL_CLUSTER]
157
+ # ndb-connectstring=127.0.0.1
158
+
159
+
160
+ #
161
+ # * IMPORTANT: Additional settings that can override those from this file!
162
+ #
163
+ !includedir /etc/mysql/conf.d/
@@ -0,0 +1,51 @@
1
+ <%
2
+ @path = "/etc/munin/plugins/mysql_slave"
3
+ @perms = 0755
4
+ %>#!/bin/sh
5
+ #
6
+ # Plugin to monitor the slave delay
7
+ #
8
+ # Parameters:
9
+ #
10
+ # config
11
+ # autoconf
12
+ #
13
+ # Configuration variables
14
+ #
15
+ # mysqlopts - Options to pass to mysql
16
+ #
17
+ #%# family=auto
18
+ #%# capabilities=autoconf
19
+
20
+ MYSQLOPTS="$mysqlopts"
21
+ MYSQLADMIN=${mysqladmin:-mysqladmin}
22
+
23
+ if [ "$1" = "autoconf" ]; then
24
+ $MYSQLADMIN --version 2>/dev/null >/dev/null
25
+ if [ $? -eq 0 ]
26
+ then
27
+ $MYSQLADMIN $MYSQLOPTS status 2>/dev/null >/dev/null
28
+ if [ $? -eq 0 ]
29
+ then
30
+ echo yes
31
+ exit 0
32
+ else
33
+ echo "no (could not connect to mysql)"
34
+ fi
35
+ else
36
+ echo "no (mysqladmin not found)"
37
+ fi
38
+ exit 1
39
+ fi
40
+
41
+ if [ "$1" = "config" ]; then
42
+ echo 'graph_title MySQL Slave Delay'
43
+ echo 'graph_vlabel seconds'
44
+ echo 'graph_category mysql'
45
+ echo 'slave.label slave delay'
46
+ echo 'graph_args --base 1000'
47
+ exit 0
48
+ fi
49
+
50
+ /usr/bin/printf "slave.value "
51
+ echo "show slave status\G"| mysql $MYSQLOPTS | grep "Seconds_Behind_Master" | awk '{print $2}'
@@ -0,0 +1,47 @@
1
+
2
+ # REQUIRED: The credentials for creating/accessong your app's database
3
+ #
4
+ db_user: "#{app_name[0,16]}"
5
+ db_pass:
6
+ db_name: "#{app_name}_#{RUBBER_ENV}"
7
+
8
+ db_slave_user: "#{('slave_' + db_user)[0,16]}"
9
+ db_replicator_user: "#{('replicator_' + db_user)[0,16]}"
10
+
11
+ # REQUIRED: The command to use to do a full backup of your database using
12
+ # "rake rubber:backup_db"
13
+ db_backup_cmd: "nice mysqldump -h %host% -u %user% --password=%pass% %name% | gzip -c > %backup_file%"
14
+ # REQUIRED: The command to use to restore the database using
15
+ # "rake rubber:restore_db_s3"
16
+ # This command will receive the data generated by db_backup_cmd via
17
+ # its standard input
18
+ db_restore_cmd: "zcat - | mysql -h %host% -u %user% --password=%pass% %name%"
19
+
20
+ # REQUIRED: The directory to store the db data in
21
+ #
22
+ db_root_dir: /mnt/mysql
23
+ db_data_dir: "#{db_root_dir}/data"
24
+ db_log_dir: "#{db_root_dir}/log"
25
+
26
+ # Capistrano needs db:primary role for migrate to work,
27
+ # so we might as well just make consistent across the board
28
+ role_dependencies:
29
+ mysql_master: [db:primary=true]
30
+ mysql_slave: [db]
31
+ db:primary=true: [mysql_master]
32
+ db: [mysql_slave]
33
+
34
+ packages: [mysql-client, libmysqlclient15-dev]
35
+ gems: [mysql]
36
+
37
+ roles:
38
+ mysql_master:
39
+ db_server_id: 1
40
+ mysql_slave:
41
+ db_server_id: 2
42
+ db:
43
+ packages: [
44
+ mysql-server,
45
+ maatkit, # useful mysql tools for replication
46
+ libdbi-perl, libdbd-mysql, libcache-cache-perl # for extended munin plugins
47
+ ]
@@ -0,0 +1 @@
1
+ description: The mysql module
@@ -0,0 +1,13 @@
1
+ <%
2
+ @path = "#{RUBBER_ROOT}/config/initializers/mysql_cluster_migrations.rb"
3
+ %>
4
+
5
+ # mysql adapter in rails hardcodes engine to be innodb, so if we want all
6
+ # rails tables to be clustered, we need to override this behavior
7
+ #
8
+ class ActiveRecord::ConnectionAdapters::MysqlAdapter
9
+ def create_table(table_name, options = {}) #:nodoc:
10
+ super(table_name, options.reverse_merge(:options => "ENGINE=ndbcluster"))
11
+ end
12
+ end
13
+
@@ -0,0 +1,177 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :mysql_cluster do
5
+
6
+ rubber.allow_optional_tasks(self)
7
+
8
+ after "rubber:create", "rubber:mysql_cluster:set_db_role"
9
+
10
+ # Capistrano needs db:primary role for migrate to work
11
+ task :set_db_role do
12
+ sql_instances = rubber_instances.for_role("mysql_sql")
13
+ sql_instances.each do |instance|
14
+ if ! instance.role_names.find {|n| n == 'db'}
15
+ role = Rubber::Configuration::RoleItem.new('db')
16
+ primary_exists = rubber_instances.for_role("db", "primary" => true).size > 0
17
+ role.options["primary"] = true unless primary_exists
18
+ instance.roles << role
19
+ end
20
+ end
21
+ rubber_instances.save()
22
+ load_roles() unless rubber_env.disable_auto_roles
23
+ end
24
+
25
+ before "rubber:install_packages", "rubber:mysql_cluster:install"
26
+
27
+ task :install, :roles => [:mysql_mgm, :mysql_data, :mysql_sql] do
28
+ # Setup apt sources to get a newer version of mysql cluster
29
+ # https://launchpad.net/~mysql-cge-testing/+archive
30
+ #
31
+
32
+ sources = <<-SOURCES
33
+ # for mysql cluster 6.2
34
+ # deb http://ppa.launchpad.net/mysql-cge-testing/ubuntu hardy main
35
+ # deb-src http://ppa.launchpad.net/mysql-cge-testing/ubuntu hardy main
36
+
37
+ # for mysql cluster 6.3
38
+ deb http://ppa.launchpad.net/ndb-bindings/ubuntu hardy main
39
+ deb-src http://ppa.launchpad.net/ndb-bindings/ubuntu hardy main
40
+ SOURCES
41
+ sources.gsub!(/^ */, '')
42
+ put(sources, "/etc/apt/sources.list.d/mysql_cluster.list")
43
+ end
44
+
45
+ after "rubber:bootstrap", "rubber:mysql_cluster:bootstrap"
46
+
47
+ task :bootstrap, :roles => [:mysql_mgm, :mysql_data, :mysql_sql] do
48
+ # mysql package install starts mysql, so stop it
49
+ rsudo "service mysql stop" rescue nil
50
+
51
+ # After everything installed on machines, we need the source tree
52
+ # on hosts in order to run rubber:config for bootstrapping the db
53
+ rubber.update_code_for_bootstrap
54
+
55
+ # Conditionaly bootstrap for each node/role only if that node has not
56
+ # been boostrapped for that role before
57
+
58
+ rubber_instances.for_role("mysql_mgm").each do |ic|
59
+ task_name = "_bootstrap_mysql_mgm_#{ic.full_name}".to_sym()
60
+ task task_name, :hosts => ic.full_name do
61
+ exists = capture("if grep -c rubber.*mysql_mgm /etc/mysql/ndb_mgmd.cnf &> /dev/null; then echo exists; fi")
62
+ if exists.strip.size == 0
63
+ rubber.run_config(:RUBBER_ENV => RUBBER_ENV, :FILE => "role/mysql_mgm", :deploy_path => release_path)
64
+ rsudo "service mysql-ndb-mgm start"
65
+ end
66
+ end
67
+ send task_name
68
+ end
69
+
70
+ rubber_instances.for_role("mysql_data").each do |ic|
71
+ task_name = "_bootstrap_mysql_data_#{ic.full_name}".to_sym()
72
+ task task_name, :hosts => ic.full_name do
73
+ exists = capture("if grep -c rubber.*mysql_data /etc/mysql/my.cnf &> /dev/null; then echo exists; fi")
74
+ if exists.strip.size == 0
75
+ rubber.run_config(:RUBBER_ENV => RUBBER_ENV, :FILE => "role/mysql_data", :deploy_path => release_path)
76
+ rsudo "service mysql-ndb start-initial"
77
+ end
78
+ end
79
+ send task_name
80
+ end
81
+
82
+ rubber_instances.for_role("mysql_sql").each do |ic|
83
+ task_name = "_bootstrap_mysql_sql_#{ic.full_name}".to_sym()
84
+ task task_name, :hosts => ic.full_name do
85
+ exists = capture("if grep -c rubber.*mysql_sql /etc/mysql/my.cnf &> /dev/null; then echo exists; fi")
86
+ if exists.strip.size == 0
87
+ rubber.run_config(:RUBBER_ENV => RUBBER_ENV, :FILE => "role/mysql_sql", :deploy_path => release_path)
88
+ rsudo "service mysql start"
89
+ env = rubber_cfg.environment.bind()
90
+ # For mysql 5.0 cluster, need to create users and database for EVERY sql node
91
+ pass = "identified by '#{env.db_pass}'" if env.db_pass
92
+ rubber.sudo_script "create_mysql_sql_db", <<-ENDSCRIPT
93
+ mysql -u root -e "create database #{env.db_name};"
94
+ mysql -u root -e "grant all on *.* to '#{env.db_user}'@'%' #{pass};"
95
+ mysql -u root -e "grant select on *.* to '#{env.db_slave_user}'@'%' #{pass};"
96
+ mysql -u root -e "grant replication slave on *.* to '#{env.db_replicator_user}'@'%' #{pass};"
97
+ mysql -u root -e "flush privileges;"
98
+ ENDSCRIPT
99
+
100
+ end
101
+ end
102
+ send task_name
103
+ end
104
+
105
+ end
106
+
107
+ desc <<-DESC
108
+ Starts the mysql cluster management daemon on the management node
109
+ DESC
110
+ task :start_mgm, :roles => :mysql_mgm do
111
+ rsudo "service mysql-ndb-mgm start"
112
+ end
113
+
114
+ desc <<-DESC
115
+ Starts the mysql cluster storage daemon on the data nodes
116
+ DESC
117
+ task :start_data, :roles => :mysql_data do
118
+ rsudo "service mysql-ndb start"
119
+ end
120
+
121
+ desc <<-DESC
122
+ Starts the mysql cluster sql daemon on the sql nodes
123
+ DESC
124
+ task :start_sql, :roles => :mysql_sql do
125
+ rsudo "service mysql start"
126
+ end
127
+
128
+ desc <<-DESC
129
+ Stops the mysql cluster management daemon on the management node
130
+ DESC
131
+ task :stop_mgm, :roles => :mysql_mgm do
132
+ rsudo "service mysql-ndb-mgm stop"
133
+ end
134
+
135
+ desc <<-DESC
136
+ Stops the mysql cluster storage daemon on the data nodes
137
+ DESC
138
+ task :stop_data, :roles => :mysql_data do
139
+ rsudo "service mysql-ndb stop"
140
+ end
141
+
142
+ desc <<-DESC
143
+ Stops the mysql cluster sql daemon on the sql nodes
144
+ DESC
145
+ task :stop_sql, :roles => :mysql_sql do
146
+ rsudo "service mysql stop"
147
+ end
148
+
149
+ desc <<-DESC
150
+ Stops all the mysql cluster daemons
151
+ DESC
152
+ task :stop do
153
+ stop_sql
154
+ stop_data
155
+ stop_mgm
156
+ end
157
+
158
+ desc <<-DESC
159
+ Starts all the mysql cluster daemons
160
+ DESC
161
+ task :start do
162
+ start_mgm
163
+ start_data
164
+ start_sql
165
+ end
166
+
167
+ desc <<-DESC
168
+ Restarts all the mysql cluster daemons
169
+ DESC
170
+ task :restart do
171
+ stop
172
+ start
173
+ end
174
+
175
+ end
176
+
177
+ end