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.
- data/CHANGELOG +82 -0
- data/VERSION +1 -1
- data/bin/vulcanize +10 -33
- data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +6 -6
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +2 -2
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +3 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +29 -16
- data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +1 -1
- data/generators/vulcanize/templates/base/Rakefile +19 -0
- data/generators/vulcanize/templates/base/config/rubber/common/crontab +6 -1
- data/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +2 -2
- data/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +3 -4
- data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +28 -49
- data/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +0 -1
- data/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +25 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber.yml +21 -13
- data/generators/vulcanize/templates/base/script/cron-runner +1 -1
- data/generators/vulcanize/templates/base/templates.rb +1 -0
- data/generators/vulcanize/templates/base/templates.yml +5 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +58 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
- data/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
- data/generators/vulcanize/templates/cassandra/templates.yml +1 -0
- data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +2 -2
- data/generators/vulcanize/templates/{complete_passenger_mysql → complete_passenger}/config/rubber/role/haproxy/haproxy-passenger.conf +2 -2
- data/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
- data/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
- data/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +1 -7
- data/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
- data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +3 -3
- data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +1 -1
- data/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +5 -5
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +2 -2
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +8 -3
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +4 -0
- data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +5 -5
- data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +1 -1
- data/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +4 -4
- data/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +2 -1
- data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +5 -4
- data/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +2 -2
- data/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +1 -1
- data/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +4 -2
- data/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +5 -5
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +1 -1
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +1 -0
- data/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +1 -1
- data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +6 -8
- data/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +1 -0
- data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +40 -27
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +2 -2
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +2 -6
- data/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +2 -1
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +19 -15
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +2 -2
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +2 -2
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +3 -3
- data/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +5 -5
- data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +2 -2
- data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +10 -1
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +1 -1
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +2 -2
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +1 -1
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +28 -3
- data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +3 -3
- data/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
- data/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
- data/generators/vulcanize/templates/postgresql/templates.yml +1 -0
- data/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +8 -7
- data/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
- data/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
- data/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +46 -27
- data/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
- data/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
- data/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +14 -6
- data/generators/vulcanize/templates/resque/script/resque_worker_management.rb +112 -0
- data/generators/vulcanize/templates/resque/templates.rb +1 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +8 -8
- data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +7 -4
- data/generators/vulcanize/vulcanize_generator.rb +139 -49
- data/lib/generators/vulcanize/USAGE +6 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +51 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/deflate.conf +10 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/expires.conf +9 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/headers.conf +6 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +8 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +8 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/apache/setenvif.conf +52 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +79 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache.auth +7 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +34 -0
- data/lib/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +6 -0
- data/lib/generators/vulcanize/templates/apache/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/base/Capfile +14 -0
- data/lib/generators/vulcanize/templates/base/Rakefile +19 -0
- data/lib/generators/vulcanize/templates/base/config/deploy.rb +55 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/common/crontab +22 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +8 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +13 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +63 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +78 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +25 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/rubber.yml +235 -0
- data/lib/generators/vulcanize/templates/base/lib/tasks/rubber.rake +15 -0
- data/lib/generators/vulcanize/templates/base/script/cron-rake +18 -0
- data/lib/generators/vulcanize/templates/base/script/cron-runner +18 -0
- data/lib/generators/vulcanize/templates/base/script/cron-sh +67 -0
- data/lib/generators/vulcanize/templates/base/templates.rb +1 -0
- data/lib/generators/vulcanize/templates/base/templates.yml +6 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/deploy-cassandra.rb +88 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.in.sh +58 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/cassandra.yaml +210 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/log4j-server.properties +45 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/role/cassandra/monit-cassandra.conf +8 -0
- data/lib/generators/vulcanize/templates/cassandra/config/rubber/rubber-cassandra.yml +18 -0
- data/lib/generators/vulcanize/templates/cassandra/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +23 -0
- data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/nginx/nginx-mongrel.conf +113 -0
- data/lib/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/rubber-complete.yml +41 -0
- data/lib/generators/vulcanize/templates/complete_mongrel_mysql/templates.yml +6 -0
- data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/role/haproxy/haproxy-passenger.conf +21 -0
- data/lib/generators/vulcanize/templates/complete_passenger/config/rubber/rubber-complete.yml +40 -0
- data/lib/generators/vulcanize/templates/complete_passenger/templates.rb +9 -0
- data/lib/generators/vulcanize/templates/complete_passenger/templates.yml +9 -0
- data/lib/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +4 -0
- data/lib/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +72 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/cruise +40 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +165 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/production.rb +8 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/role/cruise/site_config.rb +76 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/role/web_tools/cruise-nginx.conf +11 -0
- data/lib/generators/vulcanize/templates/cruise/config/rubber/rubber-cruise.yml +18 -0
- data/lib/generators/vulcanize/templates/cruise/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +45 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-base.conf +26 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-default.conf +8 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +9 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +11 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +21 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf +10 -0
- data/lib/generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml +7 -0
- data/lib/generators/vulcanize/templates/haproxy/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +59 -0
- data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.sh +589 -0
- data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
- data/lib/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
- data/lib/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +10 -0
- data/lib/generators/vulcanize/templates/jetty/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/memcached/config/memcached.yml +28 -0
- data/lib/generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml +14 -0
- data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +52 -0
- data/lib/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached_munin_plugin +249 -0
- data/lib/generators/vulcanize/templates/memcached/config/rubber/rubber-memcached.yml +7 -0
- data/lib/generators/vulcanize/templates/memcached/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/minimal_mysql/templates.yml +7 -0
- data/lib/generators/vulcanize/templates/minimal_nodb/templates.yml +6 -0
- data/lib/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +75 -0
- data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/mongrel_cluster.yml +12 -0
- data/lib/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +20 -0
- data/lib/generators/vulcanize/templates/mongrel/config/rubber/rubber-mongrel.yml +9 -0
- data/lib/generators/vulcanize/templates/mongrel/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit-default.conf +15 -0
- data/lib/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +252 -0
- data/lib/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +33 -0
- data/lib/generators/vulcanize/templates/monit/config/rubber/role/web_tools/monit-admin-nginx.conf +10 -0
- data/lib/generators/vulcanize/templates/monit/config/rubber/rubber-monit.yml +6 -0
- data/lib/generators/vulcanize/templates/monit/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +8 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +48 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +11 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +46 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf +8 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +31 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +81 -0
- data/lib/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
- data/lib/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +55 -0
- data/lib/generators/vulcanize/templates/munin/script/munin/example_simple.rb +24 -0
- data/lib/generators/vulcanize/templates/munin/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +12 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +169 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/crontab +14 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +10 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +163 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/role/mysql_slave/mysql_slave_munin_plugin +51 -0
- data/lib/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +47 -0
- data/lib/generators/vulcanize/templates/mysql/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/common/mysql_cluster_migrations.rb +13 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +177 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_data/my.cnf +15 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_mgm/ndb_mgmd.cnf +39 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +10 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +23 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/config/rubber/rubber-mysql_cluster.yml +32 -0
- data/lib/generators/vulcanize/templates/mysql_cluster/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/database.yml +16 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +10 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy +153 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.conf +10 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.lua +5 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +52 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/config/rubber/rubber-mysql_proxy.yml +11 -0
- data/lib/generators/vulcanize/templates/mysql_proxy/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +45 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/crontab +9 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +8 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/nginx/nginx.conf +42 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +55 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-index.html +30 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-nginx.auth +7 -0
- data/lib/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +10 -0
- data/lib/generators/vulcanize/templates/nginx/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +46 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +7 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +47 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +46 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +35 -0
- data/lib/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +15 -0
- data/lib/generators/vulcanize/templates/passenger/templates.yml +3 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/common/database.yml +12 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/deploy-postgresql.rb +131 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/crontab +14 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/monit-postgresql.conf +10 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/pg_hba.conf +89 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql-sysctl.conf +6 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/role/db/postgresql.conf +504 -0
- data/lib/generators/vulcanize/templates/postgresql/config/rubber/rubber-postgresql.yml +45 -0
- data/lib/generators/vulcanize/templates/postgresql/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +37 -0
- data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +8 -0
- data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/monit-redis.conf +9 -0
- data/lib/generators/vulcanize/templates/redis/config/rubber/role/redis/redis.conf +141 -0
- data/lib/generators/vulcanize/templates/redis/config/rubber/rubber-redis.yml +4 -0
- data/lib/generators/vulcanize/templates/redis/templates.yml +1 -0
- data/lib/generators/vulcanize/templates/resque/config/initializers/resque.rb +15 -0
- data/lib/generators/vulcanize/templates/resque/config/rubber/common/resque.yml +5 -0
- data/lib/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +58 -0
- data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_web/monit-resque_web.conf +14 -0
- data/lib/generators/vulcanize/templates/resque/config/rubber/role/resque_worker/monit-resque_worker.conf +19 -0
- data/lib/generators/vulcanize/templates/resque/config/rubber/rubber-resque.yml +18 -0
- data/lib/generators/vulcanize/templates/resque/script/resque_worker_management.rb +112 -0
- data/lib/generators/vulcanize/templates/resque/templates.rb +1 -0
- data/lib/generators/vulcanize/templates/resque/templates.yml +3 -0
- data/lib/generators/vulcanize/templates/sphinx/config/rubber/common/sphinx.yml +46 -0
- data/lib/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +112 -0
- data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +11 -0
- data/lib/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +13 -0
- data/lib/generators/vulcanize/templates/sphinx/config/rubber/rubber-sphinx.yml +6 -0
- data/lib/generators/vulcanize/templates/sphinx/templates.yml +1 -0
- data/lib/generators/vulcanize/vulcanize_generator.rb +157 -0
- data/lib/rubber/cloud/aws.rb +7 -2
- data/lib/rubber/dns/zerigo.rb +60 -125
- data/lib/rubber/environment.rb +6 -6
- data/lib/rubber/generator.rb +33 -25
- data/lib/rubber/instance.rb +11 -1
- data/lib/rubber/railtie.rb +14 -0
- data/lib/rubber/recipes/rubber/deploy.rb +3 -3
- data/lib/rubber/recipes/rubber/instances.rb +12 -1
- data/lib/rubber/recipes/rubber/setup.rb +96 -55
- data/lib/rubber/recipes/rubber/spot_requests.rb +6 -0
- data/lib/rubber/recipes/rubber/static_ips.rb +83 -0
- data/lib/rubber/recipes/rubber/utils.rb +39 -16
- data/lib/rubber/recipes/rubber/volumes.rb +4 -4
- data/lib/rubber/recipes/rubber.rb +16 -9
- data/lib/rubber/util.rb +28 -1
- data/lib/rubber.rb +47 -7
- data/rails/init.rb +1 -4
- data/test/environment_test.rb +3 -0
- data/test/generator_test.rb +47 -0
- data/test/instance_test.rb +3 -0
- data/test/test_helper.rb +6 -0
- data/test/util_test.rb +3 -0
- data/test/zerigo_test.rb +87 -0
- metadata +275 -50
- data/generators/vulcanize/templates/resque/config/rubber/deploy-resque-worker-default.rb +0 -38
- data/generators/vulcanize/templates/resque/config/rubber/role/resque_worker_default/monit-resque_worker_default.conf +0 -19
- /data/generators/vulcanize/templates/{complete_passenger_mysql → complete_passenger}/config/rubber/rubber-complete.yml +0 -0
@@ -4,8 +4,9 @@ namespace :rubber do
|
|
4
4
|
Bootstraps instances by setting timezone, installing packages and gems
|
5
5
|
DESC
|
6
6
|
task :bootstrap do
|
7
|
-
set_timezone
|
8
7
|
link_bash
|
8
|
+
set_timezone
|
9
|
+
enable_multiverse
|
9
10
|
upgrade_packages
|
10
11
|
install_packages
|
11
12
|
setup_volumes
|
@@ -14,6 +15,33 @@ namespace :rubber do
|
|
14
15
|
deploy.setup
|
15
16
|
end
|
16
17
|
|
18
|
+
# Sets up instance to allow root access (e.g. recent canonical AMIs)
|
19
|
+
def enable_root_ssh(ip, initial_ssh_user)
|
20
|
+
old_user = user
|
21
|
+
begin
|
22
|
+
set :user, initial_ssh_user
|
23
|
+
|
24
|
+
task :_allow_root_ssh, :hosts => ip do
|
25
|
+
rsudo "cp /home/#{initial_ssh_user}/.ssh/authorized_keys /root/.ssh/"
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
_allow_root_ssh
|
30
|
+
rescue ConnectionError => e
|
31
|
+
if e.message =~ /Net::SSH::AuthenticationFailed/
|
32
|
+
logger.info "Can't connect as user #{initial_ssh_user} to #{ip}, assuming root allowed"
|
33
|
+
else
|
34
|
+
sleep 2
|
35
|
+
logger.info "Failed to connect to #{ip}, retrying"
|
36
|
+
retry
|
37
|
+
end
|
38
|
+
end
|
39
|
+
ensure
|
40
|
+
set :user, old_user
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
17
45
|
desc <<-DESC
|
18
46
|
Sets up aliases for instance hostnames based on contents of instance.yml.
|
19
47
|
Generates /etc/hosts for local/remote machines and sets hostname on
|
@@ -164,7 +192,9 @@ namespace :rubber do
|
|
164
192
|
put filtered, hosts_file
|
165
193
|
|
166
194
|
# Setup hostname on instance so shell, etcs have nice display
|
167
|
-
|
195
|
+
rsudo "echo $CAPISTRANO:HOST$ > /etc/hostname && hostname $CAPISTRANO:HOST$"
|
196
|
+
# Newer ubuntus ec2-init script always resets hostname, so prevent it
|
197
|
+
rsudo "mkdir -p /etc/ec2-init && echo compat=0 > /etc/ec2-init/is-compat-env"
|
168
198
|
end
|
169
199
|
|
170
200
|
# TODO
|
@@ -219,11 +249,11 @@ namespace :rubber do
|
|
219
249
|
end
|
220
250
|
|
221
251
|
desc <<-DESC
|
222
|
-
Install ruby gems defined in
|
252
|
+
Install ruby gems defined in Gemfile
|
223
253
|
DESC
|
224
|
-
after "
|
225
|
-
task :
|
226
|
-
|
254
|
+
after "deploy:update_code", "rubber:install_bundler_gems" if Rubber::Util.is_bundler?
|
255
|
+
task :install_bundler_gems do
|
256
|
+
rsudo "cd #{current_release} && RAILS_ENV=#{RUBBER_ENV} bundle install"
|
227
257
|
end
|
228
258
|
|
229
259
|
desc <<-DESC
|
@@ -245,46 +275,43 @@ namespace :rubber do
|
|
245
275
|
|
246
276
|
logger.info "Installing gems:#{expanded_gem_list}"
|
247
277
|
open("/tmp/gem_helper", "w") {|f| f.write(gem_helper_script)}
|
248
|
-
system "
|
278
|
+
system "ruby /tmp/gem_helper install #{expanded_gem_list}"
|
249
279
|
end
|
250
280
|
|
281
|
+
set :gem_sources_helper_script, <<-'ENDSCRIPT'
|
282
|
+
sources = ARGV
|
283
|
+
|
284
|
+
installed = []
|
285
|
+
`gem sources -l`.each_line do |line|
|
286
|
+
line = line.strip
|
287
|
+
installed << line if line.size > 0 && line =~ /^[^*]/
|
288
|
+
end
|
289
|
+
|
290
|
+
to_install = sources - installed
|
291
|
+
to_remove = installed - sources
|
292
|
+
|
293
|
+
if to_install.size > 0
|
294
|
+
to_install.each do |source|
|
295
|
+
system "gem sources -a #{source}"
|
296
|
+
fail "Unable to add gem sources" if $?.exitstatus > 0
|
297
|
+
end
|
298
|
+
end
|
299
|
+
if to_remove.size > 0
|
300
|
+
to_remove.each do |source|
|
301
|
+
system "gem sources -r #{source}"
|
302
|
+
fail "Unable to remove gem sources" if $?.exitstatus > 0
|
303
|
+
end
|
304
|
+
end
|
305
|
+
ENDSCRIPT
|
306
|
+
|
251
307
|
desc <<-DESC
|
252
308
|
Setup ruby gems sources. Set 'gemsources' in rubber.yml to \
|
253
309
|
be an array of URI strings.
|
254
310
|
DESC
|
255
311
|
task :setup_gem_sources do
|
256
312
|
if rubber_env.gemsources
|
257
|
-
script = prepare_script 'gem_sources_helper',
|
258
|
-
|
259
|
-
|
260
|
-
sources = ARGV
|
261
|
-
|
262
|
-
installed = []
|
263
|
-
`gem sources -l`.grep(/^[^*]/) do |line|
|
264
|
-
line = line.strip
|
265
|
-
installed << line if line.size > 0
|
266
|
-
end
|
267
|
-
|
268
|
-
to_install = sources - installed
|
269
|
-
to_remove = installed - sources
|
270
|
-
|
271
|
-
if to_install.size > 0
|
272
|
-
to_install.each do |source|
|
273
|
-
system "gem sources -a #{source}"
|
274
|
-
fail "Unable to add gem sources" if $?.exitstatus > 0
|
275
|
-
end
|
276
|
-
end
|
277
|
-
if to_remove.size > 0
|
278
|
-
to_remove.each do |source|
|
279
|
-
system "gem sources -r #{source}"
|
280
|
-
fail "Unable to remove gem sources" if $?.exitstatus > 0
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
|
-
'EOF'
|
285
|
-
ENDSCRIPT
|
286
|
-
|
287
|
-
sudo "sh #{script} #{rubber_env.gemsources.join(' ')}"
|
313
|
+
script = prepare_script 'gem_sources_helper', gem_sources_helper_script, nil
|
314
|
+
rsudo "ruby #{script} #{rubber_env.gemsources.join(' ')}"
|
288
315
|
end
|
289
316
|
end
|
290
317
|
|
@@ -293,7 +320,7 @@ namespace :rubber do
|
|
293
320
|
You can override this task if you don't want this to happen
|
294
321
|
DESC
|
295
322
|
task :link_bash do
|
296
|
-
|
323
|
+
rsudo "ln -sf /bin/bash /bin/sh"
|
297
324
|
end
|
298
325
|
|
299
326
|
desc <<-DESC
|
@@ -307,10 +334,28 @@ namespace :rubber do
|
|
307
334
|
DESC
|
308
335
|
task :set_timezone do
|
309
336
|
opts = get_host_options('timezone')
|
310
|
-
|
311
|
-
|
337
|
+
rsudo "echo $CAPISTRANO:VAR$ > /etc/timezone", opts
|
338
|
+
rsudo "cp /usr/share/zoneinfo/$CAPISTRANO:VAR$ /etc/localtime", opts
|
312
339
|
# restart syslog so that times match timezone
|
313
|
-
|
340
|
+
sudo_script 'restart_syslog', <<-ENDSCRIPT
|
341
|
+
if [[ -x /etc/init.d/sysklogd ]]; then
|
342
|
+
/etc/init.d/sysklogd restart
|
343
|
+
elif [[ -x /etc/init.d/rsyslog ]]; then
|
344
|
+
service rsyslog restart
|
345
|
+
fi
|
346
|
+
ENDSCRIPT
|
347
|
+
end
|
348
|
+
|
349
|
+
desc <<-DESC
|
350
|
+
Enable the ubuntu multiverse source for getting packages like
|
351
|
+
ec2-ami-tools used for bundling images
|
352
|
+
DESC
|
353
|
+
task :enable_multiverse do
|
354
|
+
sudo_script 'enable_multiverse', <<-ENDSCRIPT
|
355
|
+
if ! grep -qc multiverse /etc/apt/sources.list /etc/apt/sources.list.d/* &> /dev/null; then
|
356
|
+
cat /etc/apt/sources.list | sed 's/main universe/multiverse/' > /etc/apt/sources.list.d/rubber-multiverse-source.list
|
357
|
+
fi
|
358
|
+
ENDSCRIPT
|
314
359
|
end
|
315
360
|
|
316
361
|
def update_dyndns(instance_item)
|
@@ -342,16 +387,16 @@ namespace :rubber do
|
|
342
387
|
expanded_pkg_list.join(' ')
|
343
388
|
end
|
344
389
|
|
345
|
-
|
390
|
+
rsudo "apt-get -q update"
|
346
391
|
if upgrade
|
347
|
-
|
392
|
+
rsudo "export DEBIAN_FRONTEND=noninteractive; apt-get -q -y --force-yes dist-upgrade"
|
348
393
|
else
|
349
|
-
|
394
|
+
rsudo "export DEBIAN_FRONTEND=noninteractive; apt-get -q -y --force-yes install $CAPISTRANO:VAR$", opts
|
350
395
|
end
|
351
396
|
end
|
352
397
|
|
353
398
|
def custom_package(url_base, name, ver, install_test)
|
354
|
-
rubber.
|
399
|
+
rubber.sudo_script "install_#{name}", <<-ENDSCRIPT
|
355
400
|
if [[ #{install_test} ]]; then
|
356
401
|
arch=`uname -m`
|
357
402
|
if [ "$arch" = "x86_64" ]; then
|
@@ -360,7 +405,7 @@ namespace :rubber do
|
|
360
405
|
src="#{url_base}/#{name}_#{ver}_i386.deb"
|
361
406
|
fi
|
362
407
|
src_file="${src##*/}"
|
363
|
-
wget -
|
408
|
+
wget -qNP /tmp ${src}
|
364
409
|
dpkg -i /tmp/${src_file}
|
365
410
|
fi
|
366
411
|
ENDSCRIPT
|
@@ -386,8 +431,6 @@ namespace :rubber do
|
|
386
431
|
# calls to rubygems
|
387
432
|
#
|
388
433
|
set :gem_helper_script, <<-'ENDSCRIPT'
|
389
|
-
ruby - $@ <<-'EOF'
|
390
|
-
|
391
434
|
gem_cmd = ARGV[0]
|
392
435
|
gems = ARGV[1..-1]
|
393
436
|
cmd = "gem #{gem_cmd} --no-rdoc --no-ri"
|
@@ -405,7 +448,7 @@ namespace :rubber do
|
|
405
448
|
end
|
406
449
|
|
407
450
|
installed = {}
|
408
|
-
`gem list --local`.
|
451
|
+
`gem list --local`.each_line do |line|
|
409
452
|
parts = line.scan(/(.*) \((.*)\)/).first
|
410
453
|
next unless parts && parts.size == 2
|
411
454
|
installed[parts[0]] = parts[1].split(",")
|
@@ -426,8 +469,6 @@ namespace :rubber do
|
|
426
469
|
system "#{cmd} #{gem_list}"
|
427
470
|
fail "Unable to install gems" if $?.exitstatus > 0
|
428
471
|
end
|
429
|
-
|
430
|
-
'EOF'
|
431
472
|
ENDSCRIPT
|
432
473
|
|
433
474
|
# Helper for installing gems,allows one to respond to prompts
|
@@ -447,11 +488,11 @@ namespace :rubber do
|
|
447
488
|
end
|
448
489
|
|
449
490
|
if opts.size > 0
|
450
|
-
script = prepare_script('gem_helper', gem_helper_script)
|
451
|
-
|
491
|
+
script = prepare_script('gem_helper', gem_helper_script, nil)
|
492
|
+
rsudo "ruby #{script} #{cmd} $CAPISTRANO:VAR$", opts do |ch, str, data|
|
452
493
|
handle_gem_prompt(ch, data, str)
|
453
494
|
end
|
454
495
|
end
|
455
496
|
end
|
456
497
|
|
457
|
-
end
|
498
|
+
end
|
@@ -14,4 +14,10 @@ namespace :rubber do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
desc "Cancel the spot instances request for the given id"
|
18
|
+
required_task :cancel_spot_instances_request do
|
19
|
+
request_id = get_env('SPOT_INSTANCE_REQUEST_ID', 'The id of the spot instances request to cancel', true)
|
20
|
+
cloud.destroy_spot_instance_request(request_id)
|
21
|
+
end
|
22
|
+
|
17
23
|
end
|
@@ -80,6 +80,89 @@ namespace :rubber do
|
|
80
80
|
destroy_static_ip(ip)
|
81
81
|
end
|
82
82
|
|
83
|
+
desc 'Move a static IP address from DONOR machine to RECEIVER machine.'
|
84
|
+
task :move_static_ip do
|
85
|
+
donor_alias = get_env 'DONOR', 'Instance alias to get the IP from (e.g., web01)', true
|
86
|
+
receiver_alias = get_env 'RECEIVER', 'Instance alias to assign the IP to (e.g., web02)', true
|
87
|
+
|
88
|
+
# Sanity checks
|
89
|
+
donor = rubber_instances[donor_alias]
|
90
|
+
fatal "Instance does not exist: #{donor_alias}" unless donor
|
91
|
+
|
92
|
+
static_ip = donor.static_ip
|
93
|
+
fatal 'No static IP address to move exists' unless static_ip && static_ip != ''
|
94
|
+
|
95
|
+
receiver = rubber_instances[receiver_alias]
|
96
|
+
fatal "Instance does not exist: #{receiver_alias}" unless receiver
|
97
|
+
|
98
|
+
# Temporary removal of the instances.
|
99
|
+
old_donor = rubber_instances.remove(donor_alias)
|
100
|
+
old_receiver = rubber_instances.remove(receiver_alias)
|
101
|
+
|
102
|
+
rubber_instances.save
|
103
|
+
|
104
|
+
# Getting rid of alias->IP mappings and SSH's known_hosts records.
|
105
|
+
load_roles
|
106
|
+
setup_aliases
|
107
|
+
cleanup_known_hosts(old_donor)
|
108
|
+
cleanup_known_hosts(old_receiver)
|
109
|
+
|
110
|
+
# Detachment of EIPA.
|
111
|
+
success = cloud.detach_static_ip(static_ip)
|
112
|
+
fatal "Failed to detach static IP address #{static_ip}" unless success
|
113
|
+
rubber_instances.artifacts['static_ips'].delete(old_donor.name)
|
114
|
+
|
115
|
+
rubber_instances.save
|
116
|
+
|
117
|
+
# Attachment of EIPA.
|
118
|
+
success = cloud.attach_static_ip(static_ip, old_receiver.instance_id)
|
119
|
+
fatal "Failed to associate static IP address #{static_ip}" unless success
|
120
|
+
|
121
|
+
print "Waiting for #{receiver_alias} to get the address"
|
122
|
+
while true do
|
123
|
+
print '.'
|
124
|
+
sleep 3
|
125
|
+
instance = cloud.describe_instances(old_receiver.instance_id).first
|
126
|
+
break if instance[:external_ip] == static_ip
|
127
|
+
end
|
128
|
+
|
129
|
+
# Partial cleanup of static IP records.
|
130
|
+
rubber_instances.artifacts['static_ips'][old_receiver.name] = static_ip
|
131
|
+
|
132
|
+
rubber_instances.save
|
133
|
+
|
134
|
+
# First half of the sync.
|
135
|
+
new_receiver = Rubber::Configuration::InstanceItem.new(old_receiver.name,
|
136
|
+
old_receiver.domain, old_receiver.roles, old_receiver.instance_id,
|
137
|
+
old_receiver.security_groups)
|
138
|
+
new_receiver.static_ip = static_ip
|
139
|
+
rubber_instances.add(new_receiver)
|
140
|
+
|
141
|
+
rubber_instances.save
|
142
|
+
|
143
|
+
refresh_instance(receiver_alias)
|
144
|
+
|
145
|
+
print "Waiting for #{donor_alias} to get a new address"
|
146
|
+
while true do
|
147
|
+
print '.'
|
148
|
+
sleep 3
|
149
|
+
instance = cloud.describe_instances(old_donor.instance_id).first
|
150
|
+
break if instance[:external_ip] && instance[:external_ip] != ''
|
151
|
+
end
|
152
|
+
|
153
|
+
# Second half of the sync.
|
154
|
+
new_donor = Rubber::Configuration::InstanceItem.new(old_donor.name,
|
155
|
+
old_donor.domain, old_donor.roles, old_donor.instance_id,
|
156
|
+
old_donor.security_groups)
|
157
|
+
rubber_instances.add(new_donor)
|
158
|
+
|
159
|
+
rubber_instances.save
|
160
|
+
|
161
|
+
refresh_instance(donor_alias)
|
162
|
+
|
163
|
+
logger.info "Run 'cap rubber:describe_static_ips' to check the allocated ones"
|
164
|
+
end
|
165
|
+
|
83
166
|
def allocate_static_ip()
|
84
167
|
ip = cloud.create_static_ip()
|
85
168
|
fatal "Failed to allocate static ip" if ip.nil?
|
@@ -16,23 +16,26 @@ namespace :rubber do
|
|
16
16
|
default_roles = rubber_env.staging_roles || "*"
|
17
17
|
roles = ENV['ROLES'] = rubber.get_env("ROLES", "Roles to use for staging instance", true, default_roles)
|
18
18
|
|
19
|
-
# some bootstraps update code (bootstrap_db) but if you don't have that role, need to do it here
|
20
|
-
# Since release directory variable gets reused by cap, we have to just do the symlink here - doing
|
21
|
-
# a update again will fail
|
22
|
-
set :rubber_code_was_updated, false
|
23
|
-
after "deploy:update_code" do
|
24
|
-
set :rubber_code_was_updated, true
|
25
|
-
end
|
26
|
-
|
27
19
|
if rubber_instances[instance_alias]
|
28
20
|
logger.info "Instance already exists, skipping to bootstrap"
|
29
21
|
else
|
30
22
|
rubber.create
|
31
23
|
end
|
24
|
+
|
25
|
+
# stop everything before so monit doesn't start stuff during bootstrapping
|
26
|
+
# if its already installed due to a bundled instance
|
27
|
+
deploy.stop rescue nil
|
28
|
+
|
32
29
|
rubber.bootstrap
|
33
|
-
|
30
|
+
|
31
|
+
# stop everything after in case package upgrades during bootstrap start up
|
32
|
+
# services - we should be able to safely do a deploy:start below
|
34
33
|
deploy.stop rescue nil
|
35
|
-
|
34
|
+
|
35
|
+
# some bootstraps update code (bootstrap_db) but if you don't have that role, need to do it here
|
36
|
+
# Since release directory variable gets reused by cap, we have to just do the symlink here - doing
|
37
|
+
# a update again will fail
|
38
|
+
if ! fetch(:rubber_code_was_updated, false)
|
36
39
|
deploy.update_code
|
37
40
|
end
|
38
41
|
deploy.symlink
|
@@ -147,22 +150,30 @@ namespace :rubber do
|
|
147
150
|
return local_alias
|
148
151
|
end
|
149
152
|
|
150
|
-
def prepare_script(name, contents)
|
153
|
+
def prepare_script(name, contents, stop_on_error_cmd=rubber_env.stop_on_error_cmd)
|
151
154
|
script = "/tmp/#{name}"
|
152
155
|
# this lets us abort a script if a command in the middle of it errors out
|
153
|
-
contents = "#{
|
156
|
+
contents = "#{stop_on_error_cmd}\n#{contents}" if stop_on_error_cmd
|
154
157
|
put(contents, script)
|
155
158
|
return script
|
156
159
|
end
|
157
160
|
|
158
|
-
def run_script(name, contents)
|
161
|
+
def run_script(name, contents, opts = {})
|
162
|
+
args = opts.delete(:script_args)
|
159
163
|
script = prepare_script(name, contents)
|
160
|
-
run "
|
164
|
+
run "bash #{script} #{args}", opts
|
161
165
|
end
|
162
166
|
|
163
|
-
def sudo_script(name, contents)
|
167
|
+
def sudo_script(name, contents, opts = {})
|
168
|
+
args = opts.delete(:script_args)
|
164
169
|
script = prepare_script(name, contents)
|
165
|
-
|
170
|
+
run "#{sudo} bash -l #{script} #{args}", opts
|
171
|
+
end
|
172
|
+
|
173
|
+
def top.rsudo(command, opts = {}, &block)
|
174
|
+
user = opts.delete(:as)
|
175
|
+
args = "-H -u #{user}" if user
|
176
|
+
run "#{sudo opts} #{args} bash -l -c '#{command}'", opts, &block
|
166
177
|
end
|
167
178
|
|
168
179
|
def get_env(name, desc, required=false, default=nil)
|
@@ -200,4 +211,16 @@ namespace :rubber do
|
|
200
211
|
return opts
|
201
212
|
end
|
202
213
|
|
214
|
+
# some bootstraps update code (bootstrap_db), so keep track so we don't do it multiple times
|
215
|
+
after "deploy:update_code" do
|
216
|
+
set :rubber_code_was_updated, true
|
217
|
+
end
|
218
|
+
|
219
|
+
def update_code_for_bootstrap
|
220
|
+
unless (fetch(:rubber_code_was_updated, false))
|
221
|
+
deploy.setup
|
222
|
+
deploy.update_code
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
203
226
|
end
|
@@ -104,7 +104,7 @@ namespace :rubber do
|
|
104
104
|
if vol_spec['mount'] && vol_spec['filesystem']
|
105
105
|
# then format/mount/etc if we don't have an entry in hosts file
|
106
106
|
task :_setup_volume, :hosts => ic.external_ip do
|
107
|
-
rubber.
|
107
|
+
rubber.sudo_script 'setup_volume', <<-ENDSCRIPT
|
108
108
|
if ! grep -q '#{vol_spec['mount']}' /etc/fstab; then
|
109
109
|
if mount | grep -q '#{vol_spec['mount']}'; then
|
110
110
|
umount '#{vol_spec['mount']}'
|
@@ -135,7 +135,7 @@ namespace :rubber do
|
|
135
135
|
if ! ic.partitions.include?(part_id)
|
136
136
|
# then format/mount/etc if we don't have an entry in hosts file
|
137
137
|
task :_setup_partition, :hosts => ic.external_ip do
|
138
|
-
rubber.
|
138
|
+
rubber.sudo_script 'setup_partition', <<-ENDSCRIPT
|
139
139
|
if ! fdisk -l 2>&1 | grep -q '#{partition_spec['partition_device']}'; then
|
140
140
|
if grep -q '#{partition_spec['disk_device']}\\b' /etc/fstab; then
|
141
141
|
umount #{partition_spec['disk_device']}
|
@@ -175,7 +175,7 @@ namespace :rubber do
|
|
175
175
|
end
|
176
176
|
# then format/mount/etc if we don't have an entry in hosts file
|
177
177
|
task :_zero_partitions, :hosts => ic.external_ip do
|
178
|
-
rubber.
|
178
|
+
rubber.sudo_script 'zero_partitions', <<-ENDSCRIPT
|
179
179
|
# zero out parition for performance (see amazon DevGuide)
|
180
180
|
echo "Zeroing out raid partitions to improve performance, this way take a while"
|
181
181
|
#{zero_script}
|
@@ -200,7 +200,7 @@ namespace :rubber do
|
|
200
200
|
end
|
201
201
|
|
202
202
|
task :_setup_raid_volume, :hosts => ic.external_ip do
|
203
|
-
rubber.
|
203
|
+
rubber.sudo_script 'setup_raid_volume', <<-ENDSCRIPT
|
204
204
|
if ! grep -q '#{raid_spec['device']}' /etc/fstab; then
|
205
205
|
if mount | grep -q '#{raid_spec['mount']}'; then
|
206
206
|
umount '#{raid_spec['mount']}'
|
@@ -10,7 +10,13 @@ require 'rubber'
|
|
10
10
|
|
11
11
|
namespace :rubber do
|
12
12
|
|
13
|
-
#
|
13
|
+
# Disable connecting to any Windows instance.
|
14
|
+
alias :original_task :task
|
15
|
+
def task(name, options={}, &block)
|
16
|
+
original_task(name, options.merge(:except => { :platform => 'windows' }), &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
# advise capistrano's task method so that tasks for non-existent roles don't
|
14
20
|
# fail when roles isn't defined due to using a FILTER for load_roles
|
15
21
|
# If you have a task you need to execute even when there are no
|
16
22
|
# roles, you have to use required_task instead of task - see rubber:create
|
@@ -19,7 +25,8 @@ namespace :rubber do
|
|
19
25
|
class << ns
|
20
26
|
alias :required_task :task
|
21
27
|
def task(name, options={}, &block)
|
22
|
-
|
28
|
+
# Disable connecting to any Windows instance.
|
29
|
+
required_task(name, options.merge(:except => { :platform => 'windows' })) do
|
23
30
|
# define empty roles for the case when a task has a role that we don't define anywhere
|
24
31
|
[*options[:roles]].each do |r|
|
25
32
|
roles[r] ||= []
|
@@ -39,16 +46,15 @@ namespace :rubber do
|
|
39
46
|
on :load, "rubber:init"
|
40
47
|
|
41
48
|
required_task :init do
|
42
|
-
# Require cap 2.4 since we depend on bugs that have been fixed
|
43
|
-
require 'capistrano/version'
|
44
|
-
if Capistrano::Version::MAJOR < 2 || Capistrano::Version::MINOR < 4
|
45
|
-
fatal "rubber requires capistrano 2.4.0 or greater"
|
46
|
-
end
|
47
|
-
|
48
49
|
set :rubber_cfg, Rubber::Configuration.get_configuration(RUBBER_ENV)
|
49
50
|
set :rubber_env, rubber_cfg.environment.bind()
|
50
51
|
set :rubber_instances, rubber_cfg.instance
|
51
52
|
|
53
|
+
# Disable connecting to any Windows instance.
|
54
|
+
# pass -l to bash in :shell to that run also gets full env
|
55
|
+
# use a pty so we don't get "stdin: is not a tty" error output
|
56
|
+
set :default_run_options, :pty => true, :shell => "/bin/bash -l", :except => { :platform => 'windows' }
|
57
|
+
|
52
58
|
set :cloud, Rubber::Cloud::get_provider(rubber_env.cloud_provider || "aws", rubber_env, self)
|
53
59
|
|
54
60
|
load_roles() unless rubber_env.disable_auto_roles
|
@@ -56,6 +62,7 @@ namespace :rubber do
|
|
56
62
|
# the private key in the same folder, the public key should have the
|
57
63
|
# extension ".pub".
|
58
64
|
ssh_options[:keys] = rubber_env.cloud_providers[rubber_env.cloud_provider].key_file
|
65
|
+
ssh_options[:timeout] = fetch(:ssh_timeout, 5)
|
59
66
|
end
|
60
67
|
|
61
68
|
|
@@ -73,7 +80,7 @@ namespace :rubber do
|
|
73
80
|
# define capistrano host => role mapping for all instances
|
74
81
|
rubber_instances.filtered.each do |ic|
|
75
82
|
ic.roles.each do |role|
|
76
|
-
opts = Rubber::Util::symbolize_keys(role.options)
|
83
|
+
opts = Rubber::Util::symbolize_keys(role.options).merge(:platform => ic.platform)
|
77
84
|
msg = "Auto role: #{role.name.to_sym} => #{ic.full_name}"
|
78
85
|
msg << ", #{opts.inspect}" if opts.inspect.size > 0
|
79
86
|
logger.info msg
|
data/lib/rubber/util.rb
CHANGED
@@ -30,8 +30,35 @@ module Rubber
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.is_rails?
|
33
|
-
File.exist?(File.join(RUBBER_ROOT, 'config', '
|
33
|
+
File.exist?(File.join(RUBBER_ROOT, 'config', 'boot.rb'))
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.is_bundler?
|
37
|
+
File.exist?(File.join(RUBBER_ROOT, 'Gemfile'))
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.rubber_as_plugin?
|
41
|
+
File.exist?(File.join(RUBBER_ROOT, 'vendor/plugins/rubber'))
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.prompt(name, desc, required=false, default=nil)
|
45
|
+
value = ENV.delete(name)
|
46
|
+
msg = "#{desc}"
|
47
|
+
msg << " [#{default}]" if default
|
48
|
+
msg << ": "
|
49
|
+
unless value
|
50
|
+
print msg
|
51
|
+
value = gets
|
52
|
+
end
|
53
|
+
value = value.size == 0 ? default : value
|
54
|
+
self.fatal "#{name} is required, pass using environment or enter at prompt" if required && ! value
|
55
|
+
return value
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.fatal(msg, code=1)
|
59
|
+
puts msg
|
60
|
+
exit code
|
61
|
+
end
|
62
|
+
|
36
63
|
end
|
37
64
|
end
|
data/lib/rubber.rb
CHANGED
@@ -2,11 +2,13 @@ $:.unshift(File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
module Rubber
|
4
4
|
|
5
|
-
|
5
|
+
@@version = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp
|
6
6
|
|
7
7
|
def self.initialize(project_root, project_env)
|
8
8
|
return if defined?(RUBBER_ROOT) && defined?(RUBBER_ENV)
|
9
9
|
|
10
|
+
@@root = project_root
|
11
|
+
@@env = project_env
|
10
12
|
Object.const_set('RUBBER_ENV', project_env)
|
11
13
|
Object.const_set('RUBBER_ROOT', File.expand_path(project_root))
|
12
14
|
|
@@ -15,17 +17,49 @@ module Rubber
|
|
15
17
|
# complicates bootstrap (i.e. can't run config to create db because full
|
16
18
|
# rails env needs db to exist as some plugin accesses model or something)
|
17
19
|
rails_boot_file = File.join(RUBBER_ROOT, 'config', 'boot.rb')
|
18
|
-
require(rails_boot_file) if File.exists? rails_boot_file
|
19
20
|
|
20
|
-
if
|
21
|
-
|
21
|
+
if File.exists? rails_boot_file
|
22
|
+
ARGV.insert(0, 'vulcanize') unless ARGV[0] == 'vulcanize' # Need for Rails 2 generator.
|
23
|
+
require(rails_boot_file)
|
24
|
+
end
|
25
|
+
|
26
|
+
if defined?(Rails.logger) && Rails.logger
|
27
|
+
@@logger = Rails.logger
|
22
28
|
else
|
23
|
-
|
24
|
-
|
25
|
-
|
29
|
+
@@logger = Logger.new($stdout)
|
30
|
+
@@logger.level = Logger::INFO
|
31
|
+
@@logger.formatter = lambda {|severity, time, progname, msg| "Rubber[%s]: %s\n" % [severity, msg.to_s.lstrip]}
|
26
32
|
end
|
33
|
+
|
34
|
+
# conveniences for backwards compatibility with old names
|
35
|
+
Object.const_set('RUBBER_CONFIG', self.config)
|
36
|
+
Object.const_set('RUBBER_INSTANCES', self.instances)
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.root
|
41
|
+
@@root
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.env
|
45
|
+
@@env
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.version
|
49
|
+
@@version
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.logger
|
53
|
+
@@logger
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.config
|
57
|
+
Rubber::Configuration.rubber_env
|
27
58
|
end
|
28
59
|
|
60
|
+
def self.instances
|
61
|
+
Rubber::Configuration.rubber_instances
|
62
|
+
end
|
29
63
|
end
|
30
64
|
|
31
65
|
|
@@ -36,3 +70,9 @@ require 'rubber/instance'
|
|
36
70
|
require 'rubber/util'
|
37
71
|
require 'rubber/cloud'
|
38
72
|
require 'rubber/dns'
|
73
|
+
|
74
|
+
if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
75
|
+
module Rubber
|
76
|
+
require 'rubber/railtie'
|
77
|
+
end
|
78
|
+
end
|
data/rails/init.rb
CHANGED