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
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'find'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
if defined?(Rails) && Rails::VERSION::MAJOR == 2
|
5
|
+
require 'fileutils'
|
6
|
+
require 'commands/generate'
|
7
|
+
|
8
|
+
class VulcanizeGenerator < Rails::Generator::NamedBase
|
9
|
+
|
10
|
+
TEMPLATE_ROOT = File.dirname(__FILE__) + "/templates" unless defined?(TEMPLATE_ROOT)
|
11
|
+
TEMPLATE_FILE = "templates.yml" unless defined?(TEMPLATE_FILE)
|
12
|
+
|
13
|
+
def manifest
|
14
|
+
record do |m|
|
15
|
+
templates = [file_name] + actions
|
16
|
+
templates.each do |t|
|
17
|
+
apply_template(m, t)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def apply_template(m, name)
|
23
|
+
sp = source_path("#{name}/")
|
24
|
+
unless File.directory?(sp)
|
25
|
+
raise Rails::Generator::UsageError.new("Invalid template #{name}, use one of #{valid_templates.join(', ')}")
|
26
|
+
end
|
27
|
+
|
28
|
+
templ_conf = load_template_config(sp)
|
29
|
+
deps = templ_conf['dependent_templates'] || []
|
30
|
+
deps.each do |dep|
|
31
|
+
apply_template(m, dep)
|
32
|
+
end
|
33
|
+
|
34
|
+
Find.find(sp) do |f|
|
35
|
+
Find.prune if File.basename(f) =~ /^(CVS|\.svn)$/
|
36
|
+
Find.prune if f == "#{sp}#{TEMPLATE_FILE}"
|
37
|
+
|
38
|
+
rel = f.gsub(/#{source_root}\//, '')
|
39
|
+
dest_rel = rel.gsub(/^#{name}\//, '')
|
40
|
+
m.directory(dest_rel) if File.directory?(f)
|
41
|
+
if File.file?(f)
|
42
|
+
# force scripts to be executable
|
43
|
+
opts = (File.read(f) =~ /^#!/) ? {:chmod => 0755} : {}
|
44
|
+
m.file(rel, dest_rel, opts)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
def valid_templates
|
52
|
+
valid = Dir.entries(TEMPLATE_ROOT).delete_if {|e| e =~ /(^\.)|svn|CVS/ }
|
53
|
+
end
|
54
|
+
|
55
|
+
def load_template_config(template_dir)
|
56
|
+
templ_file = "#{template_dir}/templates.yml"
|
57
|
+
templ_conf = YAML.load(File.read(templ_file)) rescue {}
|
58
|
+
return templ_conf
|
59
|
+
end
|
60
|
+
|
61
|
+
def banner
|
62
|
+
usage = "Usage: #{$0} vulcanize template_name ...\n"
|
63
|
+
usage << "where template_name is one of:\n\n"
|
64
|
+
valid_templates.each do |t|
|
65
|
+
templ_conf = load_template_config("#{TEMPLATE_ROOT}/#{t}")
|
66
|
+
desc = templ_conf['description']
|
67
|
+
usage << " #{t}: #{desc}\n"
|
68
|
+
end
|
69
|
+
return usage
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
else
|
74
|
+
require 'rails/generators'
|
75
|
+
|
76
|
+
class VulcanizeGenerator < Rails::Generators::NamedBase
|
77
|
+
|
78
|
+
def self.source_root
|
79
|
+
File.join(File.dirname(__FILE__), 'templates')
|
80
|
+
end
|
81
|
+
|
82
|
+
def copy_template_files
|
83
|
+
@template_dependencies = find_dependencies(file_name)
|
84
|
+
([file_name] + @template_dependencies).each do |template|
|
85
|
+
apply_template(template)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
protected
|
90
|
+
|
91
|
+
# helper to test for rails for optional templates
|
92
|
+
def rails?
|
93
|
+
Rubber::Util::is_rails?
|
94
|
+
end
|
95
|
+
|
96
|
+
def find_dependencies(name)
|
97
|
+
template_dir = File.join(self.class.source_root, name, '')
|
98
|
+
unless File.directory?(template_dir)
|
99
|
+
raise Rails::Generators::Error.new("Invalid template #{name}, use one of #{valid_templates.join(', ')}")
|
100
|
+
end
|
101
|
+
|
102
|
+
template_conf = load_template_config(template_dir)
|
103
|
+
template_dependencies = template_conf['dependent_templates'] || []
|
104
|
+
|
105
|
+
template_dependencies.clone.each do |dep|
|
106
|
+
template_dependencies.concat(find_dependencies(dep))
|
107
|
+
end
|
108
|
+
|
109
|
+
return template_dependencies.uniq
|
110
|
+
end
|
111
|
+
|
112
|
+
def apply_template(name)
|
113
|
+
template_dir = File.join(self.class.source_root, name, '')
|
114
|
+
unless File.directory?(template_dir)
|
115
|
+
raise Rails::Generators::Error.new("Invalid template #{name}, use one of #{valid_templates.join(', ')}")
|
116
|
+
end
|
117
|
+
|
118
|
+
template_conf = load_template_config(template_dir)
|
119
|
+
|
120
|
+
extra_generator_steps_file = File.join(template_dir, 'templates.rb')
|
121
|
+
if File.exist? extra_generator_steps_file
|
122
|
+
eval File.read(extra_generator_steps_file), binding, extra_generator_steps_file
|
123
|
+
end
|
124
|
+
|
125
|
+
Find.find(template_dir) do |f|
|
126
|
+
Find.prune if f == File.join(template_dir, 'templates.yml') # don't copy over templates.yml
|
127
|
+
Find.prune if f == extra_generator_steps_file # don't copy over templates.rb
|
128
|
+
|
129
|
+
template_rel = f.gsub(/#{template_dir}/, '')
|
130
|
+
source_rel = f.gsub(/#{self.class.source_root}\//, '')
|
131
|
+
dest_rel = source_rel.gsub(/^#{name}\//, '')
|
132
|
+
|
133
|
+
# Only include optional files when their conditions eval to true
|
134
|
+
optional = template_conf['optional'][template_rel] rescue nil
|
135
|
+
Find.prune if optional && ! eval(optional)
|
136
|
+
|
137
|
+
if File.directory?(f)
|
138
|
+
empty_directory(dest_rel)
|
139
|
+
else
|
140
|
+
copy_file(source_rel, dest_rel)
|
141
|
+
src_mode = File.stat(f).mode
|
142
|
+
dest_mode = File.stat(File.join(destination_root, dest_rel)).mode
|
143
|
+
chmod(dest_rel, src_mode) if src_mode != dest_mode
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def valid_templates
|
149
|
+
valid = Dir.entries(self.class.source_root).delete_if {|e| e =~ /(^\.)|svn|CVS/ }
|
150
|
+
end
|
151
|
+
|
152
|
+
def load_template_config(template_dir)
|
153
|
+
YAML.load(File.read(File.join(template_dir, 'templates.yml'))) rescue {}
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
data/lib/rubber/cloud/aws.rb
CHANGED
@@ -22,7 +22,7 @@ module Rubber
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def create_spot_instance_request(spot_price, ami, ami_type, security_groups, availability_zone)
|
25
|
-
response = @ec2.
|
25
|
+
response = @ec2.request_spot_instances(:spot_price => spot_price, :image_id => ami, :key_name => @aws_env.key_name, :instance_type => ami_type, :security_group => security_groups, :availability_zone => availability_zone)
|
26
26
|
request_id = response.spotInstanceRequestSet.item[0].spotInstanceRequestId
|
27
27
|
return request_id
|
28
28
|
end
|
@@ -42,6 +42,7 @@ module Rubber
|
|
42
42
|
instance[:internal_host] = item.privateDnsName
|
43
43
|
instance[:state] = item.instanceState.name
|
44
44
|
instance[:zone] = item.placement.availabilityZone
|
45
|
+
instance[:platform] = item.platform || 'linux'
|
45
46
|
instances << instance
|
46
47
|
end
|
47
48
|
end if response.reservationSet
|
@@ -223,7 +224,9 @@ module Rubber
|
|
223
224
|
arch = case arch when /i\d86/ then "i386" else arch end
|
224
225
|
|
225
226
|
capistrano.sudo_script "create_bundle", <<-CMD
|
227
|
+
rvm use system
|
226
228
|
export RUBYLIB=/usr/lib/site_ruby/
|
229
|
+
unset RUBYOPT
|
227
230
|
nohup ec2-bundle-vol --batch -d /mnt -k #{ec2_pk_dest} -c #{ec2_cert_dest} -u #{@aws_env.account} -p #{image_name} -r #{arch} &> /tmp/ec2-bundle-vol.log &
|
228
231
|
echo "Creating image from instance volume..."
|
229
232
|
while true; do
|
@@ -234,7 +237,9 @@ module Rubber
|
|
234
237
|
CMD
|
235
238
|
|
236
239
|
capistrano.sudo_script "register_bundle", <<-CMD
|
240
|
+
rvm use system
|
237
241
|
export RUBYLIB=/usr/lib/site_ruby/
|
242
|
+
unset RUBYOPT
|
238
243
|
echo "Uploading image to S3..."
|
239
244
|
ec2-upload-bundle --batch -b #{@aws_env.image_bucket} -m /mnt/#{image_name}.manifest.xml -a #{@aws_env.access_key} -s #{@aws_env.secret_access_key}
|
240
245
|
CMD
|
@@ -277,7 +282,7 @@ module Rubber
|
|
277
282
|
end
|
278
283
|
|
279
284
|
def destroy_spot_instance_request(request_id)
|
280
|
-
@ec2.
|
285
|
+
@ec2.cancel_spot_instance_requests :spot_instance_request_id => request_id
|
281
286
|
end
|
282
287
|
|
283
288
|
def describe_load_balancers(name=nil)
|
data/lib/rubber/dns/zerigo.rb
CHANGED
@@ -1,170 +1,105 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'zerigo_dns'
|
3
3
|
|
4
4
|
module Rubber
|
5
5
|
module Dns
|
6
6
|
|
7
|
+
class Zerigo < Base
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
format :xml
|
11
|
-
|
12
|
-
@@zones = {}
|
13
|
-
def self.get_zone(domain, provider_env)
|
14
|
-
@@zones[domain] ||= Zone.new(provider_env.customer_id, provider_env.email, provider_env.token, domain)
|
15
|
-
end
|
9
|
+
def initialize(env)
|
10
|
+
super(env, "zerigo")
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
self.class.base_uri "https://ns.zerigo.com/accounts/#{customer_id}"
|
20
|
-
@domain = domain
|
21
|
-
refresh()
|
12
|
+
::Zerigo::DNS::Base.user = provider_env.email
|
13
|
+
::Zerigo::DNS::Base.password = provider_env.token
|
22
14
|
end
|
23
15
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
def host_to_opts(host)
|
17
|
+
opts = {}
|
18
|
+
opts[:id] = host.id
|
19
|
+
opts[:host] = host.hostname || ''
|
20
|
+
opts[:type] = host.host_type
|
21
|
+
opts[:data] = host.data if host.data
|
22
|
+
opts[:ttl] = host.ttl if host.ttl
|
23
|
+
opts[:priority] = host.priority if host.priority
|
24
|
+
return opts
|
32
25
|
end
|
33
26
|
|
34
|
-
def
|
35
|
-
host =
|
36
|
-
|
27
|
+
def opts_to_host(opts, host={})
|
28
|
+
host['hostname'] = opts[:host]
|
29
|
+
host['host_type'] = opts[:type]
|
30
|
+
host['data'] = opts[:data] if opts[:data]
|
31
|
+
host['ttl'] = opts[:ttl] if opts[:ttl]
|
32
|
+
host['priority'] = opts[:priority] if opts[:priority]
|
33
|
+
return host
|
37
34
|
end
|
38
35
|
|
39
|
-
def
|
36
|
+
def find_hosts(opts = {})
|
37
|
+
opts = setup_opts(opts, [:host, :domain])
|
40
38
|
result = []
|
39
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
40
|
+
params = { :zone_id => zone.id }
|
41
|
+
|
41
42
|
hn = opts[:host]
|
42
43
|
ht = opts[:type]
|
43
44
|
hd = opts[:data]
|
44
45
|
has_host = hn && hn != '*'
|
45
|
-
|
46
|
-
url = "/zones/#{@zone['id']}/hosts.xml"
|
47
46
|
if has_host
|
48
|
-
url
|
47
|
+
url = ""
|
49
48
|
url << "#{hn}." if hn.strip.size > 0
|
50
|
-
url << "#{
|
49
|
+
url << "#{opts[:domain]}"
|
50
|
+
params[:fqdn] = url
|
51
51
|
end
|
52
|
-
hosts = self.class.get(url)
|
53
|
-
|
54
|
-
# returns 404 on not found, so don't check status
|
55
|
-
hosts = check_status hosts unless has_host
|
56
|
-
|
57
|
-
hosts['hosts'].each do |h|
|
58
|
-
keep = true
|
59
|
-
if ht && h['host_type'] != ht && ht != '*'
|
60
|
-
keep = false
|
61
|
-
end
|
62
|
-
if hd && h['data'] != hd
|
63
|
-
keep = false
|
64
|
-
end
|
65
|
-
result << host_to_opts(h) if keep
|
66
|
-
end if hosts['hosts']
|
67
|
-
|
68
|
-
return result
|
69
|
-
end
|
70
|
-
|
71
|
-
def update_host(host_id, opts)
|
72
|
-
host = opts_to_host(opts, new_host())
|
73
|
-
check_status self.class.put("/zones/#{@zone['id']}/hosts/#{host_id}.xml", :body => {:host => host})
|
74
|
-
end
|
75
52
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
53
|
+
begin
|
54
|
+
hosts = ::Zerigo::DNS::Host.find(:all, :params=> params)
|
55
|
+
|
56
|
+
hosts.each do |h|
|
57
|
+
keep = true
|
58
|
+
if ht && h.host_type != ht && ht != '*'
|
59
|
+
keep = false
|
60
|
+
end
|
61
|
+
if hd && h.data != hd
|
62
|
+
keep = false
|
63
|
+
end
|
64
|
+
result << h if keep
|
65
|
+
end if hosts
|
66
|
+
rescue ActiveResource::ResourceNotFound => e
|
87
67
|
end
|
88
|
-
if ! @zone
|
89
|
-
zone = new_zone()
|
90
|
-
zone['domain'] = @domain
|
91
|
-
zones = check_status self.class.post('/zones.xml', :body => {:zone => zone})
|
92
|
-
@zone = zones['zone']
|
93
|
-
end
|
94
|
-
end
|
95
68
|
|
96
|
-
|
97
|
-
return @zone
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def new_host
|
103
|
-
check_status(self.class.get("/zones/#{@zone['id']}/hosts/new.xml"))['host']
|
104
|
-
end
|
105
|
-
|
106
|
-
def new_zone
|
107
|
-
check_status(self.class.get("/zones/new.xml"))['zone']
|
108
|
-
end
|
109
|
-
|
110
|
-
def opts_to_host(opts, host={})
|
111
|
-
host['hostname'] = opts[:host]
|
112
|
-
host['host_type'] = opts[:type]
|
113
|
-
host['data'] = opts[:data] if opts[:data]
|
114
|
-
host['ttl'] = opts[:ttl] if opts[:ttl]
|
115
|
-
host['priority'] = opts[:priority] if opts[:priority]
|
116
|
-
return host
|
117
|
-
end
|
118
|
-
|
119
|
-
def host_to_opts(host)
|
120
|
-
opts = {}
|
121
|
-
opts[:id] = host['id']
|
122
|
-
opts[:domain] = @domain
|
123
|
-
opts[:host] = host['hostname'] || ''
|
124
|
-
opts[:type] = host['host_type']
|
125
|
-
opts[:data] = host['data'] if host['data']
|
126
|
-
opts[:ttl] = host['ttl'] if host['ttl']
|
127
|
-
opts[:priority] = host['priority'] if host['priority']
|
128
|
-
return opts
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
class Zerigo < Base
|
133
|
-
|
134
|
-
def initialize(env)
|
135
|
-
super(env, "zerigo")
|
69
|
+
return result
|
136
70
|
end
|
137
71
|
|
138
72
|
def find_host_records(opts = {})
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
zone.find_host_records(opts)
|
73
|
+
hosts = find_hosts(opts)
|
74
|
+
result = hosts.collect {|h| host_to_opts(h).merge(:domain => opts[:domain]) }
|
75
|
+
return result
|
143
76
|
end
|
144
77
|
|
145
78
|
def create_host_record(opts = {})
|
146
79
|
opts = setup_opts(opts, [:host, :data, :domain, :type, :ttl])
|
147
|
-
zone = Zone.
|
148
|
-
|
149
|
-
zone.create_host(opts)
|
80
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
81
|
+
::Zerigo::DNS::Host.create(opts_to_host(opts).merge(:zone_id => zone.id))
|
150
82
|
end
|
151
83
|
|
152
84
|
def destroy_host_record(opts = {})
|
153
85
|
opts = setup_opts(opts, [:host, :domain])
|
154
|
-
zone = Zone.
|
86
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
155
87
|
|
156
|
-
|
157
|
-
|
88
|
+
find_hosts(opts).each do |h|
|
89
|
+
h.destroy || raise("Failed to destroy #{h.hostname}")
|
158
90
|
end
|
159
91
|
end
|
160
92
|
|
161
93
|
def update_host_record(old_opts={}, new_opts={})
|
162
94
|
old_opts = setup_opts(old_opts, [:host, :domain])
|
163
|
-
new_opts = setup_opts(new_opts
|
164
|
-
zone = Zone.
|
95
|
+
new_opts = setup_opts(new_opts, [:host, :domain, :type, :data])
|
96
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(old_opts[:domain])
|
165
97
|
|
166
|
-
|
167
|
-
|
98
|
+
find_hosts(old_opts).each do |h|
|
99
|
+
opts_to_host(new_opts).each do |k, v|
|
100
|
+
h.send("#{k}=", v)
|
101
|
+
end
|
102
|
+
h.save || raise("Failed to update host #{h.hostname}, #{h.errors.full_messages.join(', ')}")
|
168
103
|
end
|
169
104
|
end
|
170
105
|
|
data/lib/rubber/environment.rb
CHANGED
@@ -22,7 +22,7 @@ module Rubber
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def read_config(file)
|
25
|
-
|
25
|
+
Rubber.logger.debug{"Reading rubber configuration from #{file}"}
|
26
26
|
if File.exist?(file)
|
27
27
|
@items = Environment.combine(@items, YAML.load_file(file) || {})
|
28
28
|
end
|
@@ -145,14 +145,14 @@ module Rubber
|
|
145
145
|
global = global.clone()
|
146
146
|
role_overrides = global.delete("roles") || {}
|
147
147
|
host_overrides = global.delete("hosts") || {}
|
148
|
-
roles.
|
149
|
-
role_overrides[role].each do |k, v|
|
148
|
+
Array(roles).each do |role|
|
149
|
+
Array(role_overrides[role]).each do |k, v|
|
150
150
|
global[k] = Environment.combine(global[k], v)
|
151
|
-
end
|
151
|
+
end
|
152
152
|
end
|
153
|
-
host_overrides[host].each do |k, v|
|
153
|
+
Array(host_overrides[host]).each do |k, v|
|
154
154
|
global[k] = Environment.combine(global[k], v)
|
155
|
-
end
|
155
|
+
end
|
156
156
|
return global
|
157
157
|
end
|
158
158
|
|
data/lib/rubber/generator.rb
CHANGED
@@ -33,13 +33,13 @@ module Rubber
|
|
33
33
|
Dir[dir].sort.each do |f|
|
34
34
|
next if f =~ /\/(CVS|\.svn)\//
|
35
35
|
if File.file?(f) && (! pat || pat.match(f))
|
36
|
-
|
36
|
+
Rubber.logger.info{"Transforming #{f}"}
|
37
37
|
begin
|
38
38
|
transform(IO.read(f), @options)
|
39
39
|
rescue Exception => e
|
40
40
|
lines = e.backtrace.grep(/^\(erb\):([0-9]+)/) {|b| Regexp.last_match(1) }
|
41
|
-
|
42
|
-
|
41
|
+
Rubber.logger.error{"Transformation failed for #{f}#{':' + lines.first if lines.first}"}
|
42
|
+
Rubber.logger.error e.message
|
43
43
|
exit 1
|
44
44
|
end
|
45
45
|
end
|
@@ -113,7 +113,7 @@ module Rubber
|
|
113
113
|
FileUtils.mkdir_p(File.dirname(config_path)) if config_path
|
114
114
|
|
115
115
|
# Write a backup of original
|
116
|
-
open("#{config_path}.bak", 'w') { |f| f.write(orig) } if config_path
|
116
|
+
open("#{config_path}.bak", 'w') { |f| f.write(orig) } if config_path && config.backup
|
117
117
|
|
118
118
|
# Write out transformed file
|
119
119
|
writer = config_path || "|#{config.write_cmd}"
|
@@ -130,21 +130,23 @@ module Rubber
|
|
130
130
|
|
131
131
|
# Run post transform command if needed
|
132
132
|
if config.post
|
133
|
-
if
|
134
|
-
|
133
|
+
if fake_root
|
134
|
+
Rubber.logger.info("Not running post command as a fake root was given: #{config.post}")
|
135
135
|
elsif no_post
|
136
|
-
|
137
|
-
elsif fake_root
|
138
|
-
LOGGER.info("Not running post command as a fake root was given: #{config.post}")
|
136
|
+
Rubber.logger.info("Not running post command as no post specified")
|
139
137
|
else
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
138
|
+
if orig != result || force
|
139
|
+
# this lets us abort a script if a command in the middle of it errors out
|
140
|
+
# stop_on_error_cmd = "function error_exit { exit 99; }; trap error_exit ERR"
|
141
|
+
config.post = "#{stop_on_error_cmd}\n#{config.post}" if stop_on_error_cmd
|
142
|
+
|
143
|
+
Rubber.logger.info{"Transformation executing post config command: #{config.post}"}
|
144
|
+
Rubber.logger.info `#{config.post}`
|
145
|
+
if $?.exitstatus != 0
|
146
|
+
raise "Post command failed execution: #{config.post}"
|
147
|
+
end
|
148
|
+
else
|
149
|
+
Rubber.logger.info("Nothing to do, not running post command")
|
148
150
|
end
|
149
151
|
end
|
150
152
|
end
|
@@ -174,22 +176,28 @@ module Rubber
|
|
174
176
|
attr_accessor :additive
|
175
177
|
# Lets one dynamically determine if a given file gets skipped during transformation
|
176
178
|
attr_accessor :skip
|
179
|
+
# Backup file when transforming, defaults to true, set to false to prevent backup
|
180
|
+
attr_accessor :backup
|
177
181
|
# use sudo to write the output file
|
178
182
|
# attr_accessor :sudo
|
179
183
|
# options passed in through code
|
180
184
|
attr_accessor :options
|
181
185
|
|
186
|
+
def initialize
|
187
|
+
@backup = true
|
188
|
+
end
|
189
|
+
|
182
190
|
def get_binding
|
183
191
|
binding
|
184
|
-
|
192
|
+
end
|
185
193
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
194
|
+
def rubber_env()
|
195
|
+
Rubber::Configuration.rubber_env
|
196
|
+
end
|
197
|
+
|
198
|
+
def rubber_instances()
|
199
|
+
Rubber::Configuration.rubber_instances
|
200
|
+
end
|
193
201
|
|
194
202
|
end
|
195
203
|
|
data/lib/rubber/instance.rb
CHANGED
@@ -10,7 +10,7 @@ module Rubber
|
|
10
10
|
include Enumerable
|
11
11
|
|
12
12
|
def initialize(file)
|
13
|
-
|
13
|
+
Rubber.logger.debug{"Reading rubber instances from #{file}"}
|
14
14
|
@file = file
|
15
15
|
@items = {}
|
16
16
|
@artifacts = {'volumes' => {}, 'static_ips' => {}}
|
@@ -82,6 +82,7 @@ module Rubber
|
|
82
82
|
attr_accessor :internal_host, :internal_ip
|
83
83
|
attr_accessor :static_ip, :volumes, :partitions
|
84
84
|
attr_accessor :spot_instance_request_id
|
85
|
+
attr_accessor :platform
|
85
86
|
|
86
87
|
def initialize(name, domain, roles, instance_id, security_group_list=[])
|
87
88
|
@name = name
|
@@ -98,6 +99,15 @@ module Rubber
|
|
98
99
|
def role_names()
|
99
100
|
roles.collect {|r| r.name}
|
100
101
|
end
|
102
|
+
|
103
|
+
def platform
|
104
|
+
# Deal with old instance configurations that don't have a platform value persisted.
|
105
|
+
@platform || 'linux'
|
106
|
+
end
|
107
|
+
|
108
|
+
def windows?
|
109
|
+
platform == 'windows'
|
110
|
+
end
|
101
111
|
end
|
102
112
|
|
103
113
|
# The configuration for a single role contained in the list
|
@@ -59,8 +59,8 @@ namespace :rubber do
|
|
59
59
|
Sets permissions of files in application directory to be owned by app_user.
|
60
60
|
DESC
|
61
61
|
task :setup_app_permissions do
|
62
|
-
|
63
|
-
|
62
|
+
rsudo "find #{shared_path} -name cached-copy -prune -o -print | xargs chown #{rubber_env.app_user}:#{rubber_env.app_user}"
|
63
|
+
rsudo "chown -R #{rubber_env.app_user}:#{rubber_env.app_user} #{current_path}/tmp"
|
64
64
|
end
|
65
65
|
|
66
66
|
def run_config(options={})
|
@@ -84,7 +84,7 @@ namespace :rubber do
|
|
84
84
|
put(File.read(secret), File.join(path, base, File.basename(secret)), :mode => "+r")
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
rsudo "cd #{path} && #{extra_env} rake rubber:config"
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
@@ -225,8 +225,12 @@ namespace :rubber do
|
|
225
225
|
instance_item.external_ip = instance[:external_ip]
|
226
226
|
instance_item.internal_host = instance[:internal_host]
|
227
227
|
instance_item.zone = instance[:zone]
|
228
|
+
instance_item.platform = instance[:platform]
|
228
229
|
rubber_instances.save()
|
229
230
|
|
231
|
+
# turn back on root ssh access if we are using root as the capistrano user for connecting
|
232
|
+
enable_root_ssh(instance_item.external_ip, fetch(:initial_ssh_user, 'ubuntu')) if user == 'root'
|
233
|
+
|
230
234
|
# setup amazon elastic ips if configured to do so
|
231
235
|
setup_static_ips
|
232
236
|
|
@@ -241,7 +245,14 @@ namespace :rubber do
|
|
241
245
|
# so that we can update all aliases
|
242
246
|
|
243
247
|
task :_get_ip, :hosts => instance_item.external_ip do
|
244
|
-
|
248
|
+
# There's no good way to get the internal IP for a Windows host, so just set it to the external
|
249
|
+
# and let the router handle mapping to the internal network.
|
250
|
+
if instance_item.windows?
|
251
|
+
instance_item.internal_ip = instance_item.external_ip
|
252
|
+
else
|
253
|
+
instance_item.internal_ip = capture(print_ip_command).strip
|
254
|
+
end
|
255
|
+
|
245
256
|
rubber_instances.save()
|
246
257
|
end
|
247
258
|
|