nirvdrum-rubber 1.1.7 → 2.0.0.rails3.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. data/CHANGELOG +82 -0
  2. data/VERSION +1 -1
  3. data/bin/vulcanize +10 -33
  4. data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +6 -6
  5. data/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +2 -2
  6. data/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +3 -0
  7. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +29 -16
  8. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +1 -1
  9. data/generators/vulcanize/templates/base/Rakefile +19 -0
  10. data/generators/vulcanize/templates/base/config/rubber/common/crontab +6 -1
  11. data/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +2 -2
  12. data/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +3 -4
  13. data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +28 -49
  14. data/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
  15. data/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +0 -1
  16. data/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +25 -0
  17. data/generators/vulcanize/templates/base/config/rubber/rubber.yml +21 -13
  18. data/generators/vulcanize/templates/base/script/cron-runner +1 -1
  19. data/generators/vulcanize/templates/base/templates.rb +1 -0
  20. data/generators/vulcanize/templates/base/templates.yml +5 -0
  21. data/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
  22. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +58 -0
  23. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
  24. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
  25. data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
  26. data/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
  27. data/generators/vulcanize/templates/cassandra/templates.yml +1 -0
  28. data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +2 -2
  29. data/generators/vulcanize/templates/{complete_passenger_mysql → complete_passenger}/config/rubber/role/haproxy/haproxy-passenger.conf +2 -2
  30. data/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
  31. data/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
  32. data/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +1 -7
  33. data/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
  34. data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +3 -3
  35. data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +1 -1
  36. data/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +5 -5
  37. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +2 -2
  38. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +8 -3
  39. data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +4 -0
  40. data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +5 -5
  41. data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +1 -1
  42. data/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +4 -4
  43. data/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +2 -1
  44. data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +5 -4
  45. data/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +2 -2
  46. data/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +1 -1
  47. data/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +4 -2
  48. data/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +5 -5
  49. data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +1 -1
  50. data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +1 -0
  51. data/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +1 -1
  52. data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +6 -8
  53. data/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +1 -0
  54. data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +40 -27
  55. data/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
  56. data/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +2 -2
  57. data/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +2 -6
  58. data/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +2 -1
  59. data/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +19 -15
  60. data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +2 -2
  61. data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +2 -2
  62. data/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +3 -3
  63. data/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +5 -5
  64. data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +2 -2
  65. data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +10 -1
  66. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +1 -1
  67. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +2 -2
  68. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +1 -1
  69. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +28 -3
  70. data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +3 -3
  71. data/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
  72. data/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
  73. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
  74. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
  75. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
  76. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
  77. data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
  78. data/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
  79. data/generators/vulcanize/templates/postgresql/templates.yml +1 -0
  80. data/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +8 -7
  81. data/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
  82. data/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
  83. data/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +46 -27
  84. data/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
  85. data/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
  86. data/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +14 -6
  87. data/generators/vulcanize/templates/resque/script/resque_worker_management.rb +112 -0
  88. data/generators/vulcanize/templates/resque/templates.rb +1 -0
  89. data/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +8 -8
  90. data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +7 -4
  91. data/generators/vulcanize/vulcanize_generator.rb +139 -49
  92. data/lib/generators/vulcanize/USAGE +6 -0
  93. data/lib/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +51 -0
  94. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/deflate.conf +10 -0
  95. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/expires.conf +9 -0
  96. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/headers.conf +6 -0
  97. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +8 -0
  98. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +8 -0
  99. data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/setenvif.conf +52 -0
  100. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +79 -0
  101. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache.auth +7 -0
  102. data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +34 -0
  103. data/lib/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +6 -0
  104. data/lib/generators/vulcanize/templates/apache/templates.yml +1 -0
  105. data/lib/generators/vulcanize/templates/base/Capfile +14 -0
  106. data/lib/generators/vulcanize/templates/base/Rakefile +19 -0
  107. data/lib/generators/vulcanize/templates/base/config/deploy.rb +55 -0
  108. data/lib/generators/vulcanize/templates/base/config/rubber/common/crontab +22 -0
  109. data/lib/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +8 -0
  110. data/lib/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +13 -0
  111. data/lib/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +63 -0
  112. data/lib/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
  113. data/lib/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +78 -0
  114. data/lib/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +25 -0
  115. data/lib/generators/vulcanize/templates/base/config/rubber/rubber.yml +235 -0
  116. data/lib/generators/vulcanize/templates/base/lib/tasks/rubber.rake +15 -0
  117. data/lib/generators/vulcanize/templates/base/script/cron-rake +18 -0
  118. data/lib/generators/vulcanize/templates/base/script/cron-runner +18 -0
  119. data/lib/generators/vulcanize/templates/base/script/cron-sh +67 -0
  120. data/lib/generators/vulcanize/templates/base/templates.rb +1 -0
  121. data/lib/generators/vulcanize/templates/base/templates.yml +6 -0
  122. data/lib/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
  123. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +58 -0
  124. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
  125. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
  126. data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
  127. data/lib/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
  128. data/lib/generators/vulcanize/templates/cassandra/templates.yml +1 -0
  129. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +23 -0
  130. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/nginx/nginx-mongrel.conf +113 -0
  131. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/rubber-complete.yml +41 -0
  132. data/lib/generators/vulcanize/templates/complete_mongrel_mysql/templates.yml +6 -0
  133. data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/role/haproxy/haproxy-passenger.conf +21 -0
  134. data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/rubber-complete.yml +40 -0
  135. data/lib/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
  136. data/lib/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
  137. data/lib/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +4 -0
  138. data/lib/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
  139. data/lib/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +72 -0
  140. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/cruise +40 -0
  141. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +165 -0
  142. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/production.rb +8 -0
  143. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/site_config.rb +76 -0
  144. data/lib/generators/vulcanize/templates/cruise/config/rubber/role/web_tools/cruise-nginx.conf +11 -0
  145. data/lib/generators/vulcanize/templates/cruise/config/rubber/rubber-cruise.yml +18 -0
  146. data/lib/generators/vulcanize/templates/cruise/templates.yml +1 -0
  147. data/lib/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +45 -0
  148. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-base.conf +26 -0
  149. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-default.conf +8 -0
  150. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +9 -0
  151. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +11 -0
  152. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +21 -0
  153. data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf +10 -0
  154. data/lib/generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml +7 -0
  155. data/lib/generators/vulcanize/templates/haproxy/templates.yml +1 -0
  156. data/lib/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +59 -0
  157. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.sh +589 -0
  158. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
  159. data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
  160. data/lib/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +10 -0
  161. data/lib/generators/vulcanize/templates/jetty/templates.yml +1 -0
  162. data/lib/generators/vulcanize/templates/memcached/config/memcached.yml +28 -0
  163. data/lib/generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml +14 -0
  164. data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +52 -0
  165. data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached_munin_plugin +249 -0
  166. data/lib/generators/vulcanize/templates/memcached/config/rubber/rubber-memcached.yml +7 -0
  167. data/lib/generators/vulcanize/templates/memcached/templates.yml +1 -0
  168. data/lib/generators/vulcanize/templates/minimal_mysql/templates.yml +7 -0
  169. data/lib/generators/vulcanize/templates/minimal_nodb/templates.yml +6 -0
  170. data/lib/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +75 -0
  171. data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/mongrel_cluster.yml +12 -0
  172. data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +20 -0
  173. data/lib/generators/vulcanize/templates/mongrel/config/rubber/rubber-mongrel.yml +9 -0
  174. data/lib/generators/vulcanize/templates/mongrel/templates.yml +1 -0
  175. data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit-default.conf +15 -0
  176. data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +252 -0
  177. data/lib/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +33 -0
  178. data/lib/generators/vulcanize/templates/monit/config/rubber/role/web_tools/monit-admin-nginx.conf +10 -0
  179. data/lib/generators/vulcanize/templates/monit/config/rubber/rubber-monit.yml +6 -0
  180. data/lib/generators/vulcanize/templates/monit/templates.yml +1 -0
  181. data/lib/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +8 -0
  182. data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +48 -0
  183. data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +11 -0
  184. data/lib/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +46 -0
  185. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf +8 -0
  186. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +31 -0
  187. data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +81 -0
  188. data/lib/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
  189. data/lib/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +55 -0
  190. data/lib/generators/vulcanize/templates/munin/script/munin/example_simple.rb +24 -0
  191. data/lib/generators/vulcanize/templates/munin/templates.yml +1 -0
  192. data/lib/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +12 -0
  193. data/lib/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +169 -0
  194. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
  195. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/crontab +14 -0
  196. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +10 -0
  197. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +163 -0
  198. data/lib/generators/vulcanize/templates/mysql/config/rubber/role/mysql_slave/mysql_slave_munin_plugin +51 -0
  199. data/lib/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +47 -0
  200. data/lib/generators/vulcanize/templates/mysql/templates.yml +1 -0
  201. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/common/mysql_cluster_migrations.rb +13 -0
  202. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +177 -0
  203. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_data/my.cnf +15 -0
  204. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_mgm/ndb_mgmd.cnf +39 -0
  205. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +10 -0
  206. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +23 -0
  207. data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/rubber-mysql_cluster.yml +32 -0
  208. data/lib/generators/vulcanize/templates/mysql_cluster/templates.yml +1 -0
  209. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/database.yml +16 -0
  210. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +10 -0
  211. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy +153 -0
  212. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.conf +10 -0
  213. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.lua +5 -0
  214. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +52 -0
  215. data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/rubber-mysql_proxy.yml +11 -0
  216. data/lib/generators/vulcanize/templates/mysql_proxy/templates.yml +1 -0
  217. data/lib/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +45 -0
  218. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/crontab +9 -0
  219. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +8 -0
  220. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/nginx.conf +42 -0
  221. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +55 -0
  222. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-index.html +30 -0
  223. data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-nginx.auth +7 -0
  224. data/lib/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +10 -0
  225. data/lib/generators/vulcanize/templates/nginx/templates.yml +1 -0
  226. data/lib/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +46 -0
  227. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
  228. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +7 -0
  229. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +47 -0
  230. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +46 -0
  231. data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +35 -0
  232. data/lib/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +15 -0
  233. data/lib/generators/vulcanize/templates/passenger/templates.yml +3 -0
  234. data/lib/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
  235. data/lib/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
  236. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
  237. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
  238. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
  239. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
  240. data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
  241. data/lib/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
  242. data/lib/generators/vulcanize/templates/postgresql/templates.yml +1 -0
  243. data/lib/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +37 -0
  244. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +8 -0
  245. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/monit-redis.conf +9 -0
  246. data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/redis.conf +141 -0
  247. data/lib/generators/vulcanize/templates/redis/config/rubber/rubber-redis.yml +4 -0
  248. data/lib/generators/vulcanize/templates/redis/templates.yml +1 -0
  249. data/lib/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
  250. data/lib/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
  251. data/lib/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +58 -0
  252. data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
  253. data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
  254. data/lib/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +18 -0
  255. data/lib/generators/vulcanize/templates/resque/script/resque_worker_management.rb +112 -0
  256. data/lib/generators/vulcanize/templates/resque/templates.rb +1 -0
  257. data/lib/generators/vulcanize/templates/resque/templates.yml +3 -0
  258. data/lib/generators/vulcanize/templates/sphinx/config/rubber/common/sphinx.yml +46 -0
  259. data/lib/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +112 -0
  260. data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +11 -0
  261. data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +13 -0
  262. data/lib/generators/vulcanize/templates/sphinx/config/rubber/rubber-sphinx.yml +6 -0
  263. data/lib/generators/vulcanize/templates/sphinx/templates.yml +1 -0
  264. data/lib/generators/vulcanize/vulcanize_generator.rb +157 -0
  265. data/lib/rubber/cloud/aws.rb +7 -2
  266. data/lib/rubber/dns/zerigo.rb +60 -125
  267. data/lib/rubber/environment.rb +6 -6
  268. data/lib/rubber/generator.rb +33 -25
  269. data/lib/rubber/instance.rb +11 -1
  270. data/lib/rubber/railtie.rb +14 -0
  271. data/lib/rubber/recipes/rubber/deploy.rb +3 -3
  272. data/lib/rubber/recipes/rubber/instances.rb +12 -1
  273. data/lib/rubber/recipes/rubber/setup.rb +96 -55
  274. data/lib/rubber/recipes/rubber/spot_requests.rb +6 -0
  275. data/lib/rubber/recipes/rubber/static_ips.rb +83 -0
  276. data/lib/rubber/recipes/rubber/utils.rb +39 -16
  277. data/lib/rubber/recipes/rubber/volumes.rb +4 -4
  278. data/lib/rubber/recipes/rubber.rb +16 -9
  279. data/lib/rubber/util.rb +28 -1
  280. data/lib/rubber.rb +47 -7
  281. data/rails/init.rb +1 -4
  282. data/test/environment_test.rb +3 -0
  283. data/test/generator_test.rb +47 -0
  284. data/test/instance_test.rb +3 -0
  285. data/test/test_helper.rb +6 -0
  286. data/test/util_test.rb +3 -0
  287. data/test/zerigo_test.rb +87 -0
  288. metadata +275 -50
  289. data/generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb +0 -38
  290. data/generators/vulcanize/templates/resque/config/rubber/role/resque_worker_default/monit-resque_worker_default.conf +0 -19
  291. /data/generators/vulcanize/templates/{complete_passenger_mysql → complete_passenger}/config/rubber/rubber-complete.yml +0 -0
@@ -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} --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
@@ -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/sbin/service mysql restart"
8
+ stop program = "/usr/sbin/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
+