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,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 = "bash -l -c '<%= start_program %>'"
12
+ stop program = "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 = "cd #{RUBBER_ROOT} && ./script/resque_worker_management.rb start #{i}"
10
+ stop_program = "cd #{RUBBER_ROOT} && ./script/resque_worker_management.rb stop #{i}"
11
+ %>
12
+
13
+ check process resque_worker_<%= i %> with pidfile <%= PIDFILE %>
14
+ group resque_worker
15
+ start program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> bash -l -c '<%= start_program %>'"
16
+ stop program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> bash -l -c '<%= 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,112 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ env = ENV["RUBBER_ENV"] ||= "development"
4
+ root = File.join(File.dirname(__FILE__), '..')
5
+ rails_env_file = File.join(root, 'config', 'environment.rb')
6
+
7
+ if File.exists? rails_env_file
8
+ require(rails_env_file)
9
+ else
10
+ require "rubber"
11
+ Rubber::initialize(root, env)
12
+ require 'resque'
13
+ require "#{root}/config/initializers/resque.rb"
14
+ end
15
+
16
+ def start_all(workers)
17
+ puts "Starting all workers"
18
+ workers.each_with_index do |worker, i|
19
+ start(worker, i)
20
+ end
21
+ end
22
+
23
+ def start(worker, index)
24
+ puts "Starting worker #{index}/#{worker.queues}"
25
+
26
+ log_file = log_file(index)
27
+ pid_file = pid_file(index)
28
+
29
+ queues = worker.queues.to_s.split(',')
30
+
31
+ daemonize(log_file, pid_file) do
32
+ resque_worker = Resque::Worker.new(*queues)
33
+ resque_worker.verbose = ENV['LOGGING'] || ENV['VERBOSE']
34
+ resque_worker.very_verbose = ENV['VVERBOSE']
35
+
36
+ puts "*** Starting worker #{resque_worker}"
37
+ resque_worker.work(worker.poll_interval.to_i || 5) # interval, will block
38
+ end
39
+ end
40
+
41
+ def stop_all(workers)
42
+ puts "Stopping all workers"
43
+ workers.size.times do |i|
44
+ stop(i)
45
+ end
46
+ end
47
+
48
+ def stop(index)
49
+ puts "Stopping worker #{index}"
50
+
51
+ pid_file = pid_file(index)
52
+ pid = File.read(pid_file).to_i rescue nil
53
+ if pid
54
+ puts "Killing worker #{index}: pid #{pid}"
55
+ begin
56
+ Process.kill("QUIT", pid)
57
+ rescue Exception => e
58
+ puts e
59
+ end
60
+ File.delete(pid_file) if File.exist?(pid_file)
61
+ else
62
+ puts "No pid file for worker #{index}: #{pid_file}"
63
+ end
64
+ end
65
+
66
+ def daemonize(log_file, pid_file)
67
+ return if fork
68
+ Process::setsid
69
+ exit!(0) if fork
70
+ Dir::chdir("/")
71
+ File.umask 0000
72
+ FileUtils.touch log_file
73
+ STDIN.reopen log_file
74
+ STDOUT.reopen log_file, "a"
75
+ STDERR.reopen log_file, "a"
76
+
77
+ File.open(pid_file, 'w') {|f| f.write("#{Process.pid}") }
78
+
79
+ yield if block_given?
80
+ exit(0)
81
+ end
82
+
83
+ def pid_file(index)
84
+ File.expand_path "#{Rubber.root}/tmp/pids/resque_worker_#{index}.pid"
85
+ end
86
+
87
+ def log_file(index)
88
+ File.expand_path "#{Rubber.root}/log/resque_worker_#{index}.log"
89
+ end
90
+
91
+ action = ARGV[0]
92
+ worker_index = ARGV[1] ? ARGV[1].to_i : nil
93
+ if action.nil? || ! %w[start stop restart].include?(action)
94
+ puts "Usage: script/resque_worker_management.rb [start|stop|restart]"
95
+ end
96
+
97
+ workers = Rubber.config.resque_workers
98
+
99
+ case action
100
+ when 'start'
101
+ worker_index ? start(workers[worker_index], worker_index) : start_all(workers)
102
+ when 'stop'
103
+ worker_index ? stop(worker_index) : stop_all(workers)
104
+ when 'restart'
105
+ if worker_index
106
+ stop(worker_index)
107
+ start(workers[worker_index], worker_index)
108
+ else
109
+ stop_all(workers)
110
+ start_all(workers)
111
+ end
112
+ end
@@ -0,0 +1 @@
1
+ gem "resque"if Rubber::Util::is_bundler?
@@ -0,0 +1,3 @@
1
+ description: The resque background queue system
2
+ dependent_templates:
3
+ - redis
@@ -0,0 +1,46 @@
1
+ <%
2
+ @path = "#{RUBBER_ROOT}/config/sphinx.yml"
3
+ %>
4
+
5
+ # Taken from: http://ts.freelancing-gods.com/rdoc/classes/ThinkingSphinx/Configuration.html
6
+ #
7
+ # Here are the default settings, relative to RUBBER_ROOT where relevant:
8
+ #
9
+ # config file:: config/#{environment}.sphinx.conf
10
+ # searchd log file:: log/searchd.log
11
+ # query log file:: log/searchd.query.log
12
+ # pid file:: log/searchd.#{environment}.pid
13
+ # searchd files:: db/sphinx/#{environment}/
14
+ # address:: 127.0.0.1
15
+ # port:: 3312
16
+ # allow star:: false
17
+ # min prefix length:: 1
18
+ # min infix length:: 1
19
+ # mem limit:: 64M
20
+ # max matches:: 1000
21
+ # morphology:: stem_en
22
+ # charset type:: utf-8
23
+ # charset table:: nil
24
+ # ignore chars:: nil
25
+ # html strip:: false
26
+ # html remove elements:: ''
27
+ #
28
+ # If you want to change these settings, create a YAML file at
29
+ # config/sphinx.yml with settings for each environment, in a similar
30
+ # fashion to database.yml - using the following keys: config_file,
31
+ # searchd_log_file, query_log_file, pid_file, searchd_file_path, port,
32
+ # allow_star, enable_star, min_prefix_len, min_infix_len, mem_limit,
33
+ # max_matches, # morphology, charset_type, charset_table, ignore_chars,
34
+ # html_strip, # html_remove_elements. I think you've got the idea.
35
+ #
36
+ # Each setting in the YAML file is optional - so only put in the ones you
37
+ # want to change.
38
+
39
+ <%= RUBBER_ENV %>:
40
+ address: <%= rubber_instances.for_role('sphinx').first.full_name rescue 'localhost' %>
41
+ mem_limit: <%= RUBBER_ENV == 'production' ? '1024M' : '64M' %>
42
+ config_file: sphinx/config/<%= RUBBER_ENV %>.sphinx.conf
43
+ searchd_file_path: sphinx/db/<%= RUBBER_ENV %>/
44
+ pid_file: <%= RUBBER_ROOT %>/log/searchd.<%= RUBBER_ENV %>.pid
45
+ searchd_log_file: <%= RUBBER_ROOT %>/log/searchd.log
46
+ query_log_file: <%= RUBBER_ROOT %>/log/searchd.query.log
@@ -0,0 +1,112 @@
1
+ # installs, starts and stops sphinx
2
+ #
3
+ # Please note that all tasks are executed as runner. So sphinx will run under
4
+ # the same userid as mongrel. This is important to allow delta indexes (mongrel
5
+ # has to send a sighup to searchd).
6
+ #
7
+ # * installation is ubuntu specific
8
+ # * start and stop tasks are using the thinking sphinx plugin
9
+
10
+ namespace :rubber do
11
+
12
+ namespace :sphinx do
13
+
14
+ rubber.allow_optional_tasks(self)
15
+
16
+ after "rubber:install_packages", "rubber:sphinx:custom_install"
17
+
18
+ task :custom_install, :roles => :sphinx do
19
+ # install sphinx from source
20
+ ver = "0.9.8.1"
21
+ rubber.sudo_script 'install_sphinx', <<-ENDSCRIPT
22
+ # check if already installed
23
+ if [ -x /usr/local/bin/searchd ]
24
+ then echo 'Found sphinx searchd on system'
25
+ if /usr/local/bin/searchd --help | grep 'Sphinx #{ver}'
26
+ then echo 'Sphinx version matches, no further steps needed'
27
+ exit 0
28
+ fi
29
+ fi
30
+
31
+ echo 'Installing / Upgrading sphinx #{ver}'
32
+ TMPDIR=`mktemp -d` || exit 1
33
+ cd $TMPDIR
34
+ echo 'Downloading'
35
+ wget -qN http://www.sphinxsearch.com/downloads/sphinx-#{ver}.tar.gz
36
+ echo 'Unpacking'
37
+ tar xf sphinx-#{ver}.tar.gz
38
+ cd sphinx-#{ver}
39
+ ./configure
40
+ make
41
+ make install
42
+ cd ; rm -rf $TMPDIR
43
+ ENDSCRIPT
44
+ end
45
+
46
+ set :sphinx_root, Proc.new {"#{shared_path}/sphinx"}
47
+ after "deploy:setup", "rubber:sphinx:setup"
48
+ after "deploy:symlink", "rubber:sphinx:config_dir"
49
+
50
+ before "deploy:stop", "rubber:sphinx:stop"
51
+ after "deploy:start", "rubber:sphinx:start"
52
+ after "deploy:restart", "rubber:sphinx:restart"
53
+ before "deploy:cold" do
54
+ before "rubber:sphinx:start", "rubber:sphinx:index"
55
+ end
56
+ before "rubber:create_staging" do
57
+ before "rubber:sphinx:start", "rubber:sphinx:index"
58
+ end
59
+
60
+ desc "Do sphinx setup tasks"
61
+ task :setup, :roles => :sphinx do
62
+ # Setup links to sphinx config/index as they need to persist between deploys
63
+ rsudo "mkdir -p #{sphinx_root} #{sphinx_root}/config #{sphinx_root}/db"
64
+ rsudo "chown -R #{runner}:#{runner} #{sphinx_root}"
65
+ end
66
+
67
+ desc "Setup paths for sphinx runtime"
68
+ task :config_dir, :roles => :sphinx do
69
+ rsudo "rm -rf #{current_path}/sphinx"
70
+ rsudo "ln -sf #{sphinx_root} #{current_path}/sphinx"
71
+ end
72
+
73
+ # runs the given ultrasphinx rake tasks
74
+ def run_sphinx task
75
+ rsudo "cd #{current_path} && RAILS_ENV=#{RUBBER_ENV} rake #{task}", :as => runner
76
+ end
77
+
78
+
79
+ desc "Stops sphinx searchd"
80
+ task :stop, :roles => :sphinx do
81
+ run_sphinx 'ts:stop; exit 0'
82
+ end
83
+
84
+ desc "Starts sphinx searchd"
85
+ task :start, :roles => :sphinx do
86
+ # rake tasks that load rails env can be slow, so
87
+ # do multiple here as a performance tweak
88
+ # config always needs to be run before start as
89
+ # rubber generates a sphinx config file with new paths
90
+ run_sphinx 'ts:config ts:start'
91
+ end
92
+
93
+ desc "Restarts sphinx searchd"
94
+ task :restart, :roles => :sphinx do
95
+ # rake tasks that load rails env can be slow, so
96
+ # do multiple here as a performance tweak
97
+ run_sphinx 'ts:config ts:stop ts:start'
98
+ end
99
+
100
+ desc "Configures sphinx index"
101
+ task :config, :roles => :sphinx do
102
+ run_sphinx 'ts:config'
103
+ end
104
+
105
+ desc "Builds sphinx index"
106
+ task :index, :roles => :sphinx do
107
+ run_sphinx 'ts:index'
108
+ end
109
+
110
+ end
111
+
112
+ end
@@ -0,0 +1,11 @@
1
+ <%
2
+ @read_cmd = 'crontab -l'
3
+ @write_cmd = 'crontab -'
4
+ @additive = ["# rubber-sphinx-start", "# rubber-sphinx-end"]
5
+ %>
6
+
7
+ # incremental index once every 10 minutes
8
+ */10 * * * * sudo -u <%= rubber_env.app_user %> <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:in:delta
9
+
10
+ # full reindex daily at 4:35
11
+ 35 4 * * * sudo -u <%= rubber_env.app_user %> <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:index
@@ -0,0 +1,13 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-sphinx.conf'
3
+
4
+ PIDFILE = "#{RUBBER_ROOT}/log/searchd.#{RUBBER_ENV}.pid"
5
+ start_program = "cd #{RUBBER_ROOT} && rake ts:start"
6
+ stop_program = "cd #{RUBBER_ROOT} && rake ts:stop"
7
+ %>
8
+
9
+ check process sphinx with pidfile <%= PIDFILE %>
10
+ group sphinx-<%= RUBBER_ENV %>
11
+ start program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> bash -l -c '<%= start_program %>'"
12
+ stop program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> bash -l -c '<%= stop_program %>'"
13
+ if failed host <%= rubber_env.host %> port 3312 with timeout 5 seconds for 5 cycles then restart
@@ -0,0 +1,6 @@
1
+ gems: []
2
+
3
+ roles:
4
+ sphinx:
5
+ packages: [bzr-builddeb, autotools-dev, dpatch, libpq-dev, autoconf,
6
+ libtool, automake, gawk, libmysqlclient15-dev]
@@ -0,0 +1 @@
1
+ description: The sphinx searchd / thinking sphinx module