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,45 @@
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 sudo -u postgres pg_dumpall -U postgres | gzip -c > %backup_file%"
14
+
15
+ # REQUIRED: The command to use to restore the database using
16
+ # "rake rubber:restore_db_s3"
17
+ # This command will receive the data generated by db_backup_cmd via
18
+ # its standard input
19
+ db_restore_cmd: "zcat - | psql -Uroot -h %host% %name%"
20
+
21
+ postgresql_ver: 8.4
22
+ postgresql_conf_dir: "/etc/postgresql/#{postgresql_ver}/main"
23
+ postgresql_data_dir: /mnt/postgresql/data
24
+ postgresql_archive_dir: /mnt/postgresql/archive
25
+ postgresql_pid_file: "/var/run/postgresql/#{postgresql_ver}-main.pid"
26
+ postgresql_ctl: "/usr/bin/env service postgresql-#{postgresql_ver}"
27
+
28
+ # Capistrano needs db:primary role for migrate to work,
29
+ # so we might as well just make consistent across the board
30
+ role_dependencies:
31
+ postgresql_master: [db:primary=true]
32
+ postgresql_slave: [db]
33
+ db:primary=true: [postgresql_master]
34
+ db: [postgresql_slave]
35
+
36
+ packages: [postgresql-client, libpq-dev]
37
+ gems: [pg]
38
+
39
+ roles:
40
+ postgresql_master:
41
+ db_server_id: 1
42
+ postgresql_slave:
43
+ db_server_id: 2
44
+ db:
45
+ packages: [postgresql]
@@ -0,0 +1 @@
1
+ description: The PostgreSQL database system
@@ -0,0 +1,37 @@
1
+ namespace :rubber do
2
+
3
+ namespace :redis do
4
+
5
+ rubber.allow_optional_tasks(self)
6
+
7
+ after "rubber:install_packages", "rubber:redis:custom_install"
8
+
9
+ task :custom_install, :roles => :redis do
10
+ custom_package('http://ftp.us.debian.org/debian/pool/main/r/redis/', 'redis-server', '1.2.6-1', '! -x /usr/bin/redis-server')
11
+ # force redis config regen so db dir gets recreated when creating staging from a bundle
12
+ rsudo "rm -f /etc/redis/redis.conf"
13
+ end
14
+
15
+ desc "Stops the redis server"
16
+ task :stop, :roles => :redis do
17
+ rsudo "/etc/init.d/redis-server stop; exit 0"
18
+ end
19
+
20
+ desc "Starts the redis server"
21
+ task :start, :roles => :redis do
22
+ rsudo "/etc/init.d/redis-server start"
23
+ end
24
+
25
+ desc "Restarts the redis server"
26
+ task :restart, :roles => :redis do
27
+ rsudo "/etc/init.d/redis-server restart"
28
+ end
29
+
30
+ desc "Reloads the redis server"
31
+ task :reload, :roles => :redis do
32
+ rsudo "/etc/init.d/redis-server restart"
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,8 @@
1
+ <%
2
+ @read_cmd = 'crontab -l'
3
+ @write_cmd = 'crontab -'
4
+ @additive = ['# start-redis-crontab', '# end-redis-crontab']
5
+ %>
6
+
7
+ # backup redis DBs every hour
8
+ 0 * * * * BACKUP_DIR=/mnt/redis_backups BACKUP_NAME=redis BACKUP_CMD="tar -czf \%dir\%/redis_\%time_stamp\%.tgz <%= rubber_env.redis_db_dir %>" <%= RUBBER_ROOT %>/script/cron-rake rubber:backup
@@ -0,0 +1,9 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-redis.conf'
3
+ %>
4
+ <% PIDFILE = "/var/run/redis.pid" %>
5
+ check process redis with pidfile <%= PIDFILE %>
6
+ group redis-<%= RUBBER_ENV %>
7
+ start program = "/etc/init.d/redis-server start"
8
+ stop program = "/etc/init.d/redis-server stop"
9
+ if failed host <%= rubber_env.host %> port 6379 with timeout 10 seconds for 10 cycles then restart
@@ -0,0 +1,141 @@
1
+ <%
2
+ @path = '/etc/redis/redis.conf'
3
+ @post = <<-SCRIPT
4
+ mkdir -p #{rubber_env.redis_db_dir}
5
+ chown -R redis:redis #{rubber_env.redis_db_dir}
6
+ /etc/init.d/redis-server restart
7
+ SCRIPT
8
+ %>
9
+
10
+ # Redis configuration file example
11
+
12
+ # By default Redis does not run as a daemon. Use 'yes' if you need it.
13
+ # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
14
+ daemonize yes
15
+
16
+ # When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
17
+ # You can specify a custom pid file location here.
18
+ pidfile /var/run/redis.pid
19
+
20
+ # Accept connections on the specified port, default is 6379
21
+ port 6379
22
+
23
+ # If you want you can bind a single interface, if the bind option is not
24
+ # specified all the interfaces will listen for connections.
25
+ #
26
+ # bind 127.0.0.1
27
+
28
+ # Close the connection after a client is idle for N seconds (0 to disable)
29
+ timeout 300
30
+
31
+ # Save the DB on disk:
32
+ #
33
+ # save <seconds> <changes>
34
+ #
35
+ # Will save the DB if both the given number of seconds and the given
36
+ # number of write operations against the DB occurred.
37
+ #
38
+ # In the example below the behaviour will be to save:
39
+ # after 900 sec (15 min) if at least 1 key changed
40
+ # after 300 sec (5 min) if at least 10 keys changed
41
+ # after 60 sec if at least 10000 keys changed
42
+ save 900 1
43
+ save 300 10
44
+ save 60 10000
45
+
46
+ # The filename where to dump the DB
47
+ dbfilename dump.rdb
48
+
49
+ # For default save/load DB in/from the working directory
50
+ # Note that you must specify a directory not a file name.
51
+ dir <%= rubber_env.redis_db_dir %>
52
+
53
+ # Set server verbosity to 'debug'
54
+ # it can be one of:
55
+ # debug (a lot of information, useful for development/testing)
56
+ # notice (moderately verbose, what you want in production probably)
57
+ # warning (only very important / critical messages are logged)
58
+ loglevel notice
59
+
60
+ # Specify the log file name. Also 'stdout' can be used to force
61
+ # the demon to log on the standard output. Note that if you use standard
62
+ # output for logging but daemonize, logs will be sent to /dev/null
63
+ logfile /var/log/redis/redis-server.log
64
+
65
+ # Set the number of databases. The default database is DB 0, you can select
66
+ # a different one on a per-connection basis using SELECT <dbid> where
67
+ # dbid is a number between 0 and 'databases'-1
68
+ databases 16
69
+
70
+ ################################# REPLICATION #################################
71
+
72
+ # Master-Slave replication. Use slaveof to make a Redis instance a copy of
73
+ # another Redis server. Note that the configuration is local to the slave
74
+ # so for example it is possible to configure the slave to save the DB with a
75
+ # different interval, or to listen to another port, and so on.
76
+
77
+ # slaveof <masterip> <masterport>
78
+
79
+ ################################## SECURITY ###################################
80
+
81
+ # Require clients to issue AUTH <PASSWORD> before processing any other
82
+ # commands. This might be useful in environments in which you do not trust
83
+ # others with access to the host running redis-server.
84
+ #
85
+ # This should stay commented out for backward compatibility and because most
86
+ # people do not need auth (e.g. they run their own servers).
87
+
88
+ # requirepass foobared
89
+
90
+ ################################### LIMITS ####################################
91
+
92
+ # Set the max number of connected clients at the same time. By default there
93
+ # is no limit, and it's up to the number of file descriptors the Redis process
94
+ # is able to open. The special value '0' means no limts.
95
+ # Once the limit is reached Redis will close all the new connections sending
96
+ # an error 'max number of clients reached'.
97
+
98
+ # maxclients 128
99
+
100
+ # Don't use more memory than the specified amount of bytes.
101
+ # When the memory limit is reached Redis will try to remove keys with an
102
+ # EXPIRE set. It will try to start freeing keys that are going to expire
103
+ # in little time and preserve keys with a longer time to live.
104
+ # Redis will also try to remove objects from free lists if possible.
105
+ #
106
+ # If all this fails, Redis will start to reply with errors to commands
107
+ # that will use more memory, like SET, LPUSH, and so on, and will continue
108
+ # to reply to most read-only commands like GET.
109
+ #
110
+ # WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
111
+ # 'state' server or cache, not as a real DB. When Redis is used as a real
112
+ # database the memory usage will grow over the weeks, it will be obvious if
113
+ # it is going to use too much memory in the long run, and you'll have the time
114
+ # to upgrade. With maxmemory after the limit is reached you'll start to get
115
+ # errors for write operations, and this may even lead to DB inconsistency.
116
+
117
+ # maxmemory <bytes>
118
+
119
+ ############################### ADVANCED CONFIG ###############################
120
+
121
+ # Glue small output buffers together in order to send small replies in a
122
+ # single TCP packet. Uses a bit more CPU but most of the times it is a win
123
+ # in terms of number of queries per second. Use 'yes' if unsure.
124
+ glueoutputbuf yes
125
+
126
+ # Use object sharing. Can save a lot of memory if you have many common
127
+ # string in your dataset, but performs lookups against the shared objects
128
+ # pool so it uses more CPU and can be a bit slower. Usually it's a good
129
+ # idea.
130
+ #
131
+ # When object sharing is enabled (shareobjects yes) you can use
132
+ # shareobjectspoolsize to control the size of the pool used in order to try
133
+ # object sharing. A bigger pool size will lead to better sharing capabilities.
134
+ # In general you want this value to be at least the double of the number of
135
+ # very common strings you have in your dataset.
136
+ #
137
+ # WARNING: object sharing is experimental, don't enable this feature
138
+ # in production before of Redis 1.0-stable. Still please try this feature in
139
+ # your development environment so that we can test it better.
140
+ shareobjects no
141
+ shareobjectspoolsize 1024
@@ -0,0 +1,4 @@
1
+
2
+ redis_db_dir: /mnt/redis
3
+
4
+ gems: [redis]
@@ -0,0 +1 @@
1
+ description: The redis module
@@ -0,0 +1,15 @@
1
+ require 'yaml'
2
+ require 'resque'
3
+
4
+ rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
5
+ rails_env = ENV['RAILS_ENV'] || 'development'
6
+
7
+ redis_host = 'localhost:6379'
8
+
9
+ resque_yml = rails_root + '/config/resque.yml'
10
+ if File.exist? resque_yml
11
+ resque_config = YAML.load_file(resque_yml)
12
+ redis_host = resque_config[rails_env]
13
+ end
14
+
15
+ Resque.redis = redis_host
@@ -0,0 +1,5 @@
1
+ <%
2
+ @path = "#{RUBBER_ROOT}/config/resque.yml"
3
+ %>
4
+
5
+ <%= RUBBER_ENV %>: <%= rubber_instances.for_role('redis').first.full_name rescue 'localhost' %>:6379
@@ -0,0 +1,58 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :resque do
5
+
6
+ rubber.allow_optional_tasks(self)
7
+
8
+ namespace :worker do
9
+
10
+ rubber.allow_optional_tasks(self)
11
+
12
+ before "deploy:stop", "rubber:resque:worker:stop"
13
+ after "deploy:start", "rubber:resque:worker:start"
14
+ after "deploy:restart", "rubber:resque:worker:restart"
15
+
16
+ desc "Starts resque workers"
17
+ task :start, :roles => :resque_worker do
18
+ rsudo "cd #{current_path} && RUBBER_ENV=#{rails_env} ./script/resque_worker_management.rb start", :as => rubber_env.app_user
19
+ end
20
+
21
+ desc "Stops resque workers"
22
+ task :stop, :roles => :resque_worker do
23
+ rsudo "cd #{current_path} && RUBBER_ENV=#{rails_env} ./script/resque_worker_management.rb stop", :as => rubber_env.app_user
24
+ end
25
+
26
+ desc "Restarts resque workers"
27
+ task :restart, :roles => :resque_worker do
28
+ rsudo "cd #{current_path} && RUBBER_ENV=#{rails_env} ./script/resque_worker_management.rb restart", :as => rubber_env.app_user
29
+ end
30
+ end
31
+
32
+ namespace :web do
33
+ rubber.allow_optional_tasks(self)
34
+
35
+ before "deploy:stop", "rubber:resque:web:stop"
36
+ after "deploy:start", "rubber:resque:web:start"
37
+ after "deploy:restart", "rubber:resque:web:restart"
38
+
39
+ desc "Starts resque web tools"
40
+ task :start, :roles => :resque_web do
41
+ rsudo "RAILS_ENV=#{RUBBER_ENV} resque-web --pid-file /var/run/resque_web.pid --port #{rubber_env.resque_web_port} --no-launch #{current_path}/config/initializers/resque.rb"
42
+ end
43
+
44
+ desc "Stops resque web tools"
45
+ task :stop, :roles => :resque_web do
46
+ rsudo "RAILS_ENV=#{RUBBER_ENV} resque-web --pid-file /var/run/resque_web.pid --kill"
47
+ end
48
+
49
+ desc "Restarts resque web tools"
50
+ task :restart, :roles => :resque_web do
51
+ rubber.resque.web.stop
52
+ rubber.resque.web.start
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,14 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-resque_web.conf'
3
+
4
+ PIDFILE = "/var/run/resque_web.pid"
5
+ start_program = "HOME=/root resque-web --pid-file #{PIDFILE} --port #{rubber_env.resque_web_port} --no-launch #{RUBBER_ROOT}/config/initializers/resque.rb"
6
+ stop_program = "HOME=/root resque-web --pid-file #{PIDFILE} --kill"
7
+ %>
8
+
9
+ check process resque_web with pidfile <%= PIDFILE %>
10
+ group resque_web
11
+ start program = "/bin/bash -l -c '<%= start_program %>'"
12
+ stop program = "/bin/bash -l -c '<%= stop_program %>'"
13
+
14
+ if totalmem > 350.0 MB for 15 cycles then restart
@@ -0,0 +1,19 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-resque_worker.conf'
3
+ %>
4
+
5
+ <% rubber_env.resque_workers.each_with_index do |worker, i| %>
6
+ <%
7
+ PIDFILE = "#{RUBBER_ROOT}/tmp/pids/resque_worker_#{i}.pid"
8
+
9
+ start_program = "/usr/bin/sudo -H -u #{rubber_env.app_user} bash -l -c 'cd #{RUBBER_ROOT} && ./script/resque_worker_management.rb start #{i}'"
10
+ stop_program = "/usr/bin/sudo -H -u #{rubber_env.app_user} bash -l -c 'cd #{RUBBER_ROOT} && ./script/resque_worker_management.rb stop #{i} TERM'"
11
+ %>
12
+
13
+ check process resque_worker_<%= i %> with pidfile <%= PIDFILE %>
14
+ group resque_worker
15
+ start program = "<%= start_program %>"
16
+ stop program = "<%= stop_program %>"
17
+
18
+ if totalmem > 350.0 MB for 15 cycles then restart
19
+ <% end %>
@@ -0,0 +1,18 @@
1
+ resque_web_port: 5678
2
+
3
+ # list of workers with the queues to be run on each - on each worker instance,
4
+ # a worker is run for each item in this list to handle the queues specified
5
+ #
6
+ resque_workers:
7
+ -
8
+ queues: *
9
+ poll_interval: 1
10
+ -
11
+ queues: *
12
+ poll_interval: 1
13
+
14
+ gems: [yajl-ruby resque]
15
+
16
+ role_dependencies:
17
+ web_tools: [resque_web]
18
+
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ STDOUT.sync = true
4
+ STDERR.sync = true
5
+
6
+ def load_env(rubber_only=true)
7
+ env = ENV["RUBBER_ENV"] ||= "development"
8
+ root = File.expand_path('../..', __FILE__)
9
+ rails_env_file = File.join(root, 'config', 'environment.rb')
10
+
11
+ if ! rubber_only && File.exists?(rails_env_file)
12
+ require(rails_env_file)
13
+ else
14
+ require "bundler/setup" if File.exist?(File.join(root, "Gemfile"))
15
+ require "rubber"
16
+ Rubber::initialize(root, env)
17
+ end
18
+ end
19
+
20
+
21
+ def start_all(workers)
22
+ puts "Starting all workers"
23
+ # fork then load rails env so script runs quick, yet we don't overload
24
+ # machine by loading env for each worker
25
+ daemonize(log_file('all')) do
26
+ load_env(false)
27
+ puts "Preloaded environment for all workers"
28
+
29
+ workers.each_with_index do |worker, i|
30
+ start(worker, i)
31
+ end
32
+ end
33
+ end
34
+
35
+ def start(worker, index)
36
+ puts "Starting worker #{index}/#{worker.queues}"
37
+
38
+ log_file = log_file(index)
39
+ pid_file = pid_file(index)
40
+
41
+ queues = worker.queues.to_s.split(',')
42
+
43
+ daemonize(log_file, pid_file) do
44
+ # load env for each worker, if starting multiple, this will be a no-op due
45
+ # to start_all preloading the env
46
+ load_env(false)
47
+ resque_worker = Resque::Worker.new(*queues)
48
+ resque_worker.verbose = ENV['LOGGING'] || ENV['VERBOSE']
49
+ resque_worker.very_verbose = ENV['VVERBOSE']
50
+
51
+ puts "*** Starting worker #{resque_worker}"
52
+ resque_worker.work(worker.poll_interval.to_i || 5) # interval, will block
53
+ end
54
+
55
+ end
56
+
57
+ def stop_all(workers, signal)
58
+ puts "Stopping all workers"
59
+ workers.size.times do |i|
60
+ stop(i, signal)
61
+ end
62
+ end
63
+
64
+ # Resque workers respond to a few different signals:
65
+ #
66
+ # QUIT - Wait for child to finish processing then exit
67
+ # TERM / INT - Immediately kill child then exit
68
+ # USR1 - Immediately kill child but don't exit
69
+ # USR2 - Don't start to process any new jobs
70
+ # CONT - Start to process new jobs again after a USR2
71
+ def stop(index, signal)
72
+ puts "Stopping worker #{index}"
73
+
74
+ pid_file = pid_file(index)
75
+ pid = File.read(pid_file).to_i rescue nil
76
+ if pid
77
+ puts "Killing worker #{index}: pid #{pid} - #{signal}"
78
+ begin
79
+ Process.kill(signal, pid)
80
+ rescue Exception => e
81
+ puts e
82
+ end
83
+ File.delete(pid_file) if File.exist?(pid_file)
84
+ else
85
+ puts "No pid file for worker #{index}: #{pid_file}"
86
+ end
87
+ end
88
+
89
+ def daemonize(log_file, pid_file=nil)
90
+ return if fork
91
+ Process::setsid
92
+ exit!(0) if fork
93
+ Dir::chdir(Rubber.root)
94
+ File.umask 0000
95
+ FileUtils.touch log_file
96
+ STDIN.reopen log_file
97
+ STDOUT.reopen log_file, "a"
98
+ STDERR.reopen log_file, "a"
99
+ STDOUT.sync = true
100
+ STDERR.sync = true
101
+
102
+ File.open(pid_file, 'w') {|f| f.write("#{Process.pid}") } if pid_file
103
+
104
+ yield if block_given?
105
+ exit(0)
106
+ end
107
+
108
+ def pid_file(index)
109
+ File.expand_path "#{Rubber.root}/tmp/pids/resque_worker_#{index}.pid"
110
+ end
111
+
112
+ def log_file(index)
113
+ File.expand_path "#{Rubber.root}/log/resque_worker_#{index}.log"
114
+ end
115
+
116
+ action = ARGV[0]
117
+ worker_index = ARGV[1] ? ARGV[1].to_i : nil
118
+ signal = ARGV[2] || "QUIT"
119
+ if action.nil? || ! %w[start stop restart].include?(action)
120
+ puts "Usage: script/resque_worker_management.rb [start|stop|restart]"
121
+ end
122
+
123
+ # load just the rubber env so things run quickly
124
+ load_env(true)
125
+ workers = Rubber.config.resque_workers
126
+
127
+ case action
128
+ when 'start'
129
+ worker_index ? start(workers[worker_index], worker_index) : start_all(workers)
130
+ # sleep a bit to allow daemonization to complete
131
+ sleep 0.5
132
+ when 'stop'
133
+ worker_index ? stop(worker_index, signal) : stop_all(workers, signal)
134
+ when 'restart'
135
+ if worker_index
136
+ stop(worker_index, signal)
137
+ start(workers[worker_index], worker_index)
138
+ else
139
+ stop_all(workers, signal)
140
+ start_all(workers)
141
+ end
142
+ # sleep a bit to allow daemonization to complete
143
+ sleep 0.5
144
+ end