nogara-rubber 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +448 -0
- data/COPYING +339 -0
- data/README +6 -0
- data/TODO +11 -0
- data/VERSION +1 -0
- data/bin/vulcanize +25 -0
- data/generators/vulcanize/USAGE +6 -0
- data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +51 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/deflate.conf +10 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/expires.conf +9 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/headers.conf +6 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/monit-apache.conf +8 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/ports.conf +8 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/apache/setenvif.conf +52 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +79 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-apache.auth +7 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +34 -0
- data/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +6 -0
- data/generators/vulcanize/templates/apache/templates.yml +1 -0
- data/generators/vulcanize/templates/base/Capfile +14 -0
- data/generators/vulcanize/templates/base/Rakefile +23 -0
- data/generators/vulcanize/templates/base/config/deploy.rb +56 -0
- data/generators/vulcanize/templates/base/config/rubber/common/crontab +22 -0
- data/generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf +8 -0
- data/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +13 -0
- data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +92 -0
- data/generators/vulcanize/templates/base/config/rubber/deploy-util.rb +97 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +78 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber-rvm.yml +33 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber.yml +233 -0
- data/generators/vulcanize/templates/base/lib/tasks/rubber.rake +15 -0
- data/generators/vulcanize/templates/base/script/cron-rake +18 -0
- data/generators/vulcanize/templates/base/script/cron-runner +18 -0
- data/generators/vulcanize/templates/base/script/cron-sh +67 -0
- data/generators/vulcanize/templates/base/templates.rb +11 -0
- data/generators/vulcanize/templates/base/templates.yml +6 -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 +60 -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 +23 -0
- data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/nginx/nginx-mongrel.conf +113 -0
- data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/rubber-complete.yml +41 -0
- data/generators/vulcanize/templates/complete_mongrel_mysql/templates.yml +6 -0
- data/generators/vulcanize/templates/complete_passenger/config/rubber/role/haproxy/haproxy-passenger.conf +21 -0
- data/generators/vulcanize/templates/complete_passenger/config/rubber/rubber-complete.yml +40 -0
- 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 +4 -0
- data/generators/vulcanize/templates/complete_passenger_postgresql/templates.yml +4 -0
- data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +72 -0
- data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/cruise +40 -0
- data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/my.cnf +165 -0
- data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/production.rb +8 -0
- data/generators/vulcanize/templates/cruise/config/rubber/role/cruise/site_config.rb +76 -0
- data/generators/vulcanize/templates/cruise/config/rubber/role/web_tools/cruise-nginx.conf +11 -0
- data/generators/vulcanize/templates/cruise/config/rubber/rubber-cruise.yml +18 -0
- data/generators/vulcanize/templates/cruise/templates.yml +1 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +45 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-base.conf +26 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy-default.conf +8 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/monit-haproxy.conf +9 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +11 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +21 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf +10 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml +7 -0
- data/generators/vulcanize/templates/haproxy/templates.yml +1 -0
- data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +59 -0
- data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.sh +589 -0
- data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
- data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
- data/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +10 -0
- data/generators/vulcanize/templates/jetty/templates.yml +1 -0
- data/generators/vulcanize/templates/memcached/config/memcached.yml +28 -0
- data/generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml +14 -0
- data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf +52 -0
- data/generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached_munin_plugin +249 -0
- data/generators/vulcanize/templates/memcached/config/rubber/rubber-memcached.yml +7 -0
- data/generators/vulcanize/templates/memcached/templates.yml +1 -0
- data/generators/vulcanize/templates/minimal_mysql/templates.yml +7 -0
- data/generators/vulcanize/templates/minimal_nodb/templates.yml +6 -0
- data/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +75 -0
- data/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/mongrel_cluster.yml +12 -0
- data/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +20 -0
- data/generators/vulcanize/templates/mongrel/config/rubber/rubber-mongrel.yml +9 -0
- data/generators/vulcanize/templates/mongrel/templates.yml +1 -0
- data/generators/vulcanize/templates/monit/config/rubber/common/monit-default.conf +15 -0
- data/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +252 -0
- data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +33 -0
- data/generators/vulcanize/templates/monit/config/rubber/role/web_tools/monit-admin-nginx.conf +10 -0
- data/generators/vulcanize/templates/monit/config/rubber/rubber-monit.yml +6 -0
- data/generators/vulcanize/templates/monit/templates.yml +1 -0
- data/generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf +8 -0
- data/generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf +48 -0
- data/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +11 -0
- data/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +46 -0
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf +8 -0
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +31 -0
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin.conf +115 -0
- data/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
- data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +55 -0
- data/generators/vulcanize/templates/munin/script/munin/example_simple.rb +24 -0
- data/generators/vulcanize/templates/munin/templates.yml +1 -0
- data/generators/vulcanize/templates/mysql/config/rubber/common/database.yml +12 -0
- data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +169 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/crontab +14 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf +10 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +163 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/mysql_slave/mysql_slave_munin_plugin +51 -0
- data/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +47 -0
- data/generators/vulcanize/templates/mysql/templates.yml +1 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/common/mysql_cluster_migrations.rb +13 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +177 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_data/my.cnf +15 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_mgm/ndb_mgmd.cnf +39 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/monit-mysql_cluster_sql.cnf +10 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +23 -0
- data/generators/vulcanize/templates/mysql_cluster/config/rubber/rubber-mysql_cluster.yml +32 -0
- data/generators/vulcanize/templates/mysql_cluster/templates.yml +1 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/database.yml +16 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/monit-mysql_proxy.cnf +10 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy +153 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.conf +10 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/common/mysql-proxy.lua +5 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/deploy-mysql_proxy.rb +52 -0
- data/generators/vulcanize/templates/mysql_proxy/config/rubber/rubber-mysql_proxy.yml +11 -0
- data/generators/vulcanize/templates/mysql_proxy/templates.yml +1 -0
- data/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +45 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/crontab +9 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/monit-nginx.conf +8 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/nginx/nginx.conf +42 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +55 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-index.html +30 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/tools-nginx.auth +7 -0
- data/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +10 -0
- data/generators/vulcanize/templates/nginx/templates.yml +1 -0
- data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +46 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +7 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +47 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +46 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger.conf +35 -0
- data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +15 -0
- data/generators/vulcanize/templates/passenger/templates.yml +3 -0
- 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 +37 -0
- data/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +8 -0
- data/generators/vulcanize/templates/redis/config/rubber/role/redis/monit-redis.conf +9 -0
- data/generators/vulcanize/templates/redis/config/rubber/role/redis/redis.conf +141 -0
- data/generators/vulcanize/templates/redis/config/rubber/rubber-redis.yml +4 -0
- data/generators/vulcanize/templates/redis/templates.yml +1 -0
- 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 +58 -0
- 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 +18 -0
- data/generators/vulcanize/templates/resque/script/resque_worker_management.rb +144 -0
- data/generators/vulcanize/templates/resque/templates.rb +1 -0
- data/generators/vulcanize/templates/resque/templates.yml +3 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/common/sphinx.yml +46 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +112 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +11 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +13 -0
- data/generators/vulcanize/templates/sphinx/config/rubber/rubber-sphinx.yml +6 -0
- data/generators/vulcanize/templates/sphinx/templates.yml +1 -0
- data/generators/vulcanize/vulcanize_generator.rb +184 -0
- data/lib/capistrano/hostcmd.rb +12 -0
- 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 +23 -0
- data/lib/generators/vulcanize/templates/base/config/deploy.rb +56 -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 +92 -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 +33 -0
- data/lib/generators/vulcanize/templates/base/config/rubber/rubber.yml +233 -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 +11 -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 +60 -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 +115 -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 +144 -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 +184 -0
- data/lib/rubber.rb +76 -0
- data/lib/rubber/capistrano.rb +1 -0
- data/lib/rubber/cloud.rb +13 -0
- data/lib/rubber/cloud/aws.rb +355 -0
- data/lib/rubber/cloud/base.rb +16 -0
- data/lib/rubber/configuration.rb +47 -0
- data/lib/rubber/dns.rb +13 -0
- data/lib/rubber/dns/base.rb +84 -0
- data/lib/rubber/dns/dyndns.rb +77 -0
- data/lib/rubber/dns/nettica.rb +117 -0
- data/lib/rubber/dns/zerigo.rb +115 -0
- data/lib/rubber/environment.rb +177 -0
- data/lib/rubber/generator.rb +209 -0
- data/lib/rubber/instance.rb +176 -0
- data/lib/rubber/railtie.rb +14 -0
- data/lib/rubber/recipes/rubber.rb +96 -0
- data/lib/rubber/recipes/rubber/bundles.rb +30 -0
- data/lib/rubber/recipes/rubber/deploy.rb +90 -0
- data/lib/rubber/recipes/rubber/instances.rb +445 -0
- data/lib/rubber/recipes/rubber/load_balancers.rb +44 -0
- data/lib/rubber/recipes/rubber/security_groups.rb +189 -0
- data/lib/rubber/recipes/rubber/setup.rb +534 -0
- data/lib/rubber/recipes/rubber/spot_requests.rb +23 -0
- data/lib/rubber/recipes/rubber/static_ips.rb +190 -0
- data/lib/rubber/recipes/rubber/utils.rb +226 -0
- data/lib/rubber/recipes/rubber/volumes.rb +264 -0
- data/lib/rubber/tasks/rubber.rb +279 -0
- data/lib/rubber/util.rb +72 -0
- data/rails/init.rb +6 -0
- data/test/environment_test.rb +144 -0
- data/test/generator_test.rb +370 -0
- data/test/instance_test.rb +96 -0
- data/test/test_helper.rb +14 -0
- data/test/util_test.rb +19 -0
- data/test/zerigo_test.rb +88 -0
- metadata +494 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
module Rubber
|
2
|
+
module Dns
|
3
|
+
|
4
|
+
class Base
|
5
|
+
|
6
|
+
attr_reader :env, :provider_env, :provider_name
|
7
|
+
|
8
|
+
def initialize(env, provider_name)
|
9
|
+
@env = env
|
10
|
+
@provider_name = provider_name
|
11
|
+
@provider_env = @env.dns_providers[provider_name]
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(host, ip)
|
15
|
+
if up_to_date(host, ip)
|
16
|
+
puts "IP has not changed for #{host}, not updating dynamic DNS"
|
17
|
+
else
|
18
|
+
if find_host_records(:host => host).size == 0
|
19
|
+
puts "Creating dynamic DNS: #{host} => #{ip}"
|
20
|
+
create_host_record(:host => host, :data => ip)
|
21
|
+
else
|
22
|
+
puts "Updating dynamic DNS: #{host} => #{ip}"
|
23
|
+
update_host_record({:host => host}, {:host => host, :data => ip})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy(host)
|
29
|
+
if find_host_records(:host => host).size != 0
|
30
|
+
puts "Destroying dynamic DNS record: #{host}"
|
31
|
+
destroy_host_record(:host => host)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def up_to_date(host, ip)
|
36
|
+
find_host_records(:host => host).any? {|host| host[:data] == ip}
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_host_record(opts = {})
|
40
|
+
raise "create_host_record not implemented"
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_host_records(opts = {})
|
44
|
+
raise "find_host_records not implemented"
|
45
|
+
end
|
46
|
+
|
47
|
+
def update_host_record(old_opts={}, new_opts={})
|
48
|
+
raise "update_host_record not implemented"
|
49
|
+
end
|
50
|
+
|
51
|
+
def destroy_host_record(opts = {})
|
52
|
+
raise "destroy_host_record not implemented"
|
53
|
+
end
|
54
|
+
|
55
|
+
def host_records_equal?(lhs_opts = {}, rhs_opts = {})
|
56
|
+
lhs = setup_opts(lhs_opts)
|
57
|
+
rhs = setup_opts(rhs_opts)
|
58
|
+
[lhs, rhs].each {|h| h.delete(:id); h.delete(:priority) if h[:priority] == 0}
|
59
|
+
lhs == rhs
|
60
|
+
end
|
61
|
+
|
62
|
+
def setup_opts(opts, required=[])
|
63
|
+
default_opts = {:domain => @env.domain,
|
64
|
+
:type => @provider_env['type'] || @provider_env.record_type || 'A',
|
65
|
+
:ttl => @provider_env.ttl || 300}
|
66
|
+
|
67
|
+
if opts.delete(:no_defaults)
|
68
|
+
actual_opts = Rubber::Util::symbolize_keys(opts)
|
69
|
+
else
|
70
|
+
actual_opts = default_opts.merge(Rubber::Util::symbolize_keys(opts))
|
71
|
+
end
|
72
|
+
|
73
|
+
required.each do |r|
|
74
|
+
raise "Missing required options: #{r}" unless actual_opts[r]
|
75
|
+
end
|
76
|
+
|
77
|
+
return actual_opts
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Rubber
|
2
|
+
module Dns
|
3
|
+
|
4
|
+
class Dyndns < Base
|
5
|
+
|
6
|
+
def initialize(env)
|
7
|
+
super(env, 'dyndns')
|
8
|
+
@user, @pass, @nameserver = provider_env.user, provider_env.password, provider_env.nameserver
|
9
|
+
@update_url = provider_env.update_url || 'https://members.dyndns.org/nic/update?hostname=%host%&myip=%ip%'
|
10
|
+
@update_url = @update_url.gsub(/%([^%]+)%/, '#{\1}')
|
11
|
+
end
|
12
|
+
|
13
|
+
# def nameserver
|
14
|
+
# "ns1.mydyndns.org"
|
15
|
+
# end
|
16
|
+
|
17
|
+
def up_to_date(host, ip)
|
18
|
+
# This queries dns server directly instead of using hosts file
|
19
|
+
current_ip = nil
|
20
|
+
Resolv::DNS.open(:nameserver => [@nameserver], :search => [], :ndots => 1) do |dns|
|
21
|
+
current_ip = dns.getaddress("#{host}.#{provider_env.domain}").to_s rescue nil
|
22
|
+
end
|
23
|
+
return ip == current_ip
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_host_records(opts={})
|
27
|
+
opts = setup_opts(opts, [:host, :domain])
|
28
|
+
hostname = "#{opts[:host]}.#{opts[:domain]}"
|
29
|
+
begin
|
30
|
+
Resolv::DNS.open(:nameserver => [@nameserver], :search => [], :ndots => 1) do |dns|
|
31
|
+
r = dns.getresource(hostname, Resolv::DNS::Resource::IN::A)
|
32
|
+
result = [{:host =>opts[:host], :data => r.address}]
|
33
|
+
end
|
34
|
+
rescue Exception => e
|
35
|
+
puts "Rescue #{e} #{e.message}"
|
36
|
+
raise "Domain needs to exist in dyndns as an A record before record can be updated"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_host_record(opts={})
|
41
|
+
puts "WARNING: No create record available for dyndns, you need to do so manually"
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy_host_record(opts={})
|
45
|
+
puts "WARNING: No destroy record available for dyndns, you need to do so manually"
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_host_record(old_opts={}, new_opts={})
|
49
|
+
old_opts = setup_opts(old_opts, [:host, :domain])
|
50
|
+
|
51
|
+
host = "#{old_opts[:host]}.#{old_opts[:domain]}"
|
52
|
+
ip = new_opts[:data]
|
53
|
+
update_url = eval('%Q{' + @update_url + '}')
|
54
|
+
# puts update_url
|
55
|
+
# This header is required by dyndns.org
|
56
|
+
headers = {
|
57
|
+
"User-Agent" => "Capistrano - Rubber - 0.1"
|
58
|
+
}
|
59
|
+
|
60
|
+
uri = URI.parse(update_url)
|
61
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
62
|
+
# switch on SSL
|
63
|
+
http.use_ssl = true if uri.scheme == "https"
|
64
|
+
# suppress verification warning
|
65
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
66
|
+
req = Net::HTTP::Get.new(update_url.gsub(/.*:\/\/[^\/]*/, ''), headers)
|
67
|
+
# authentication details
|
68
|
+
req.basic_auth @user, @pass
|
69
|
+
resp = http.request(req)
|
70
|
+
# print out the response for the update
|
71
|
+
puts "DynDNS Update result: #{resp.body}"
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'nettica/client'
|
2
|
+
module Rubber
|
3
|
+
module Dns
|
4
|
+
|
5
|
+
class Nettica < Base
|
6
|
+
|
7
|
+
def initialize(env)
|
8
|
+
super(env, "nettica")
|
9
|
+
@client = ::Nettica::Client.new(provider_env.user, provider_env.password)
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_status(response)
|
13
|
+
code = case
|
14
|
+
when response.respond_to?(:status)
|
15
|
+
response.status
|
16
|
+
when response.respond_to?(:result)
|
17
|
+
response.result.status
|
18
|
+
else
|
19
|
+
500
|
20
|
+
end
|
21
|
+
if code < 200 || code > 299
|
22
|
+
msg = "Failed to access nettica api (http_status=#{code})"
|
23
|
+
msg += ", check dns_providers.nettica.user/password in rubber.yml" if code == 401
|
24
|
+
raise msg
|
25
|
+
end
|
26
|
+
return response
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_host_records(opts = {})
|
30
|
+
opts = setup_opts(opts, [:host, :domain])
|
31
|
+
|
32
|
+
result = []
|
33
|
+
hn = opts[:host]
|
34
|
+
ht = opts[:type]
|
35
|
+
hd = opts[:data]
|
36
|
+
|
37
|
+
domain_info = find_or_create_zone(opts[:domain])
|
38
|
+
|
39
|
+
domain_info.record.each do |h|
|
40
|
+
keep = true
|
41
|
+
if hn && h.hostName != hn && hn != '*'
|
42
|
+
keep = false
|
43
|
+
end
|
44
|
+
if ht && h.recordType != ht && ht != '*'
|
45
|
+
keep = false
|
46
|
+
end
|
47
|
+
if hd && h.data != hd
|
48
|
+
keep = false
|
49
|
+
end
|
50
|
+
result << record_to_opts(h) if keep
|
51
|
+
end
|
52
|
+
|
53
|
+
return result
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_host_record(opts = {})
|
57
|
+
opts = setup_opts(opts, [:host, :data, :domain, :type, :ttl])
|
58
|
+
find_or_create_zone(opts[:domain])
|
59
|
+
record = opts_to_record(opts)
|
60
|
+
check_status @client.add_record(record)
|
61
|
+
end
|
62
|
+
|
63
|
+
def destroy_host_record(opts = {})
|
64
|
+
find_host_records(opts).each do |h|
|
65
|
+
record = opts_to_record(h)
|
66
|
+
check_status @client.delete_record(record)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def update_host_record(old_opts = {}, new_opts = {})
|
71
|
+
old_opts = setup_opts(old_opts, [:host, :domain])
|
72
|
+
new_opts = setup_opts(new_opts.merge(:no_defaults =>true), [])
|
73
|
+
find_host_records(old_opts).each do |h|
|
74
|
+
old_record = opts_to_record(h)
|
75
|
+
new_record = opts_to_record(h.merge(new_opts))
|
76
|
+
check_status @client.update_record(old_record, new_record)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def find_or_create_zone(domain)
|
83
|
+
domain_info = @client.list_domain(domain)
|
84
|
+
if domain_info.record
|
85
|
+
check_status domain_info
|
86
|
+
else
|
87
|
+
check_status @client.create_zone(domain)
|
88
|
+
domain_info = check_status @client.list_domain(domain)
|
89
|
+
raise "Could not create zone in nettica: #{domain}" unless domain_info.record
|
90
|
+
end
|
91
|
+
return domain_info
|
92
|
+
end
|
93
|
+
|
94
|
+
def opts_to_record(opts)
|
95
|
+
record = @client.create_domain_record(opts[:domain],
|
96
|
+
opts[:host],
|
97
|
+
opts[:type],
|
98
|
+
opts[:data],
|
99
|
+
opts[:ttl],
|
100
|
+
opts[:priority] || 0)
|
101
|
+
return record
|
102
|
+
end
|
103
|
+
|
104
|
+
def record_to_opts(record)
|
105
|
+
opts = {}
|
106
|
+
opts[:host] = record.hostName || ''
|
107
|
+
opts[:domain] = record.domainName
|
108
|
+
opts[:type] = record.recordType
|
109
|
+
opts[:data] = record.data if record.data
|
110
|
+
opts[:ttl] = record.tTL if record.tTL
|
111
|
+
opts[:priority] = record.priority if record.priority
|
112
|
+
return opts
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'zerigo_dns'
|
5
|
+
rescue LoadError
|
6
|
+
puts "Missing the zerigo_dns gem. Install with `sudo gem install zerigo_dns`."
|
7
|
+
exit(-1)
|
8
|
+
end
|
9
|
+
|
10
|
+
module Rubber
|
11
|
+
module Dns
|
12
|
+
|
13
|
+
class Zerigo < Base
|
14
|
+
|
15
|
+
def initialize(env)
|
16
|
+
super(env, "zerigo")
|
17
|
+
|
18
|
+
::Zerigo::DNS::Base.user = provider_env.email
|
19
|
+
::Zerigo::DNS::Base.password = provider_env.token
|
20
|
+
end
|
21
|
+
|
22
|
+
def host_to_opts(host)
|
23
|
+
opts = {}
|
24
|
+
opts[:id] = host.id
|
25
|
+
opts[:host] = host.hostname || ''
|
26
|
+
opts[:type] = host.host_type
|
27
|
+
opts[:data] = host.data if host.data
|
28
|
+
opts[:ttl] = host.ttl if host.ttl
|
29
|
+
opts[:priority] = host.priority if host.priority
|
30
|
+
return opts
|
31
|
+
end
|
32
|
+
|
33
|
+
def opts_to_host(opts, host={})
|
34
|
+
host['hostname'] = opts[:host]
|
35
|
+
host['host_type'] = opts[:type]
|
36
|
+
host['data'] = opts[:data] if opts[:data]
|
37
|
+
host['ttl'] = opts[:ttl] if opts[:ttl]
|
38
|
+
host['priority'] = opts[:priority] if opts[:priority]
|
39
|
+
return host
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_hosts(opts = {})
|
43
|
+
opts = setup_opts(opts, [:host, :domain])
|
44
|
+
result = []
|
45
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
46
|
+
params = { :zone_id => zone.id }
|
47
|
+
|
48
|
+
hn = opts[:host]
|
49
|
+
ht = opts[:type]
|
50
|
+
hd = opts[:data]
|
51
|
+
has_host = hn && hn != '*'
|
52
|
+
if has_host
|
53
|
+
url = ""
|
54
|
+
url << "#{hn}." if hn.strip.size > 0
|
55
|
+
url << "#{opts[:domain]}"
|
56
|
+
params[:fqdn] = url
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
hosts = ::Zerigo::DNS::Host.find(:all, :params=> params)
|
61
|
+
|
62
|
+
hosts.each do |h|
|
63
|
+
keep = true
|
64
|
+
if ht && h.host_type != ht && ht != '*'
|
65
|
+
keep = false
|
66
|
+
end
|
67
|
+
if hd && h.data != hd
|
68
|
+
keep = false
|
69
|
+
end
|
70
|
+
result << h if keep
|
71
|
+
end if hosts
|
72
|
+
rescue ActiveResource::ResourceNotFound => e
|
73
|
+
end
|
74
|
+
|
75
|
+
return result
|
76
|
+
end
|
77
|
+
|
78
|
+
def find_host_records(opts = {})
|
79
|
+
hosts = find_hosts(opts)
|
80
|
+
result = hosts.collect {|h| host_to_opts(h).merge(:domain => opts[:domain]) }
|
81
|
+
return result
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_host_record(opts = {})
|
85
|
+
opts = setup_opts(opts, [:host, :data, :domain, :type, :ttl])
|
86
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
87
|
+
::Zerigo::DNS::Host.create(opts_to_host(opts).merge(:zone_id => zone.id))
|
88
|
+
end
|
89
|
+
|
90
|
+
def destroy_host_record(opts = {})
|
91
|
+
opts = setup_opts(opts, [:host, :domain])
|
92
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(opts[:domain])
|
93
|
+
|
94
|
+
find_hosts(opts).each do |h|
|
95
|
+
h.destroy || raise("Failed to destroy #{h.hostname}")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def update_host_record(old_opts={}, new_opts={})
|
100
|
+
old_opts = setup_opts(old_opts, [:host, :domain])
|
101
|
+
new_opts = setup_opts(new_opts, [:host, :domain, :type, :data])
|
102
|
+
zone = ::Zerigo::DNS::Zone.find_or_create(old_opts[:domain])
|
103
|
+
|
104
|
+
find_hosts(old_opts).each do |h|
|
105
|
+
opts_to_host(new_opts).each do |k, v|
|
106
|
+
h.send("#{k}=", v)
|
107
|
+
end
|
108
|
+
h.save || raise("Failed to update host #{h.hostname}, #{h.errors.full_messages.join(', ')}")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'socket'
|
3
|
+
require 'delegate'
|
4
|
+
|
5
|
+
module Rubber
|
6
|
+
module Configuration
|
7
|
+
# Contains the configuration defined in rubber.yml
|
8
|
+
# Handles selecting of correct config values based on
|
9
|
+
# the host/role passed into bind
|
10
|
+
class Environment
|
11
|
+
attr_reader :config_root
|
12
|
+
attr_reader :config_files
|
13
|
+
attr_reader :config_secret
|
14
|
+
|
15
|
+
def initialize(config_root)
|
16
|
+
@config_root = config_root
|
17
|
+
@config_files = ["#{@config_root}/rubber.yml"]
|
18
|
+
@config_files += Dir["#{@config_root}/rubber-*.yml"].sort
|
19
|
+
|
20
|
+
# add a config file for current env only so that you can override
|
21
|
+
#things for specific envs
|
22
|
+
@config_files -= Dir["#{@config_root}/rubber-*-env.yml"]
|
23
|
+
env_yml = "#{@config_root}/rubber-#{Rubber.env}-env.yml"
|
24
|
+
@config_files << env_yml if File.exist?(env_yml)
|
25
|
+
|
26
|
+
@items = {}
|
27
|
+
@config_files.each { |file| read_config(file) }
|
28
|
+
@config_secret = bind().rubber_secret
|
29
|
+
read_config(@config_secret) if @config_secret
|
30
|
+
end
|
31
|
+
|
32
|
+
def read_config(file)
|
33
|
+
Rubber.logger.debug{"Reading rubber configuration from #{file}"}
|
34
|
+
if File.exist?(file)
|
35
|
+
@items = Environment.combine(@items, YAML.load_file(file) || {})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def known_roles
|
40
|
+
roles_dir = File.join(@config_root, "role")
|
41
|
+
roles = Dir.entries(roles_dir)
|
42
|
+
roles.delete_if {|d| d =~ /(^\..*)/}
|
43
|
+
roles += @items['roles'].keys
|
44
|
+
return roles.compact.uniq
|
45
|
+
end
|
46
|
+
|
47
|
+
def current_host
|
48
|
+
Socket::gethostname.gsub(/\..*/, '')
|
49
|
+
end
|
50
|
+
|
51
|
+
def current_full_host
|
52
|
+
Socket::gethostname
|
53
|
+
end
|
54
|
+
|
55
|
+
def bind(roles = nil, host = nil)
|
56
|
+
BoundEnv.new(@items, roles, host)
|
57
|
+
end
|
58
|
+
|
59
|
+
# combine old and new into a single value:
|
60
|
+
# non-nil wins if other is nil
|
61
|
+
# arrays just get unioned
|
62
|
+
# hashes also get unioned, but the values of conflicting keys get combined
|
63
|
+
# All else, the new value wins
|
64
|
+
def self.combine(old, new)
|
65
|
+
return old if new.nil?
|
66
|
+
return new if old.nil?
|
67
|
+
value = old
|
68
|
+
if old.is_a?(Hash) && new.is_a?(Hash)
|
69
|
+
value = old.clone
|
70
|
+
new.each do |nk, nv|
|
71
|
+
value[nk] = combine(value[nk], nv)
|
72
|
+
end
|
73
|
+
elsif old.is_a?(Array) && new.is_a?(Array)
|
74
|
+
value = old | new
|
75
|
+
else
|
76
|
+
value = new
|
77
|
+
end
|
78
|
+
return value
|
79
|
+
end
|
80
|
+
|
81
|
+
class HashValueProxy < Hash
|
82
|
+
attr_reader :global
|
83
|
+
|
84
|
+
def initialize(global, receiver)
|
85
|
+
@global = global
|
86
|
+
super()
|
87
|
+
replace(receiver)
|
88
|
+
end
|
89
|
+
|
90
|
+
def rubber_instances
|
91
|
+
@rubber_instances ||= Rubber::Configuration::rubber_instances
|
92
|
+
end
|
93
|
+
|
94
|
+
def [](name)
|
95
|
+
value = super(name)
|
96
|
+
value = global[name] if global && !value
|
97
|
+
return expand(value)
|
98
|
+
end
|
99
|
+
|
100
|
+
def each
|
101
|
+
each_key do |key|
|
102
|
+
yield key, self[key]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def method_missing(method_id)
|
107
|
+
key = method_id.id2name
|
108
|
+
return self[key]
|
109
|
+
end
|
110
|
+
|
111
|
+
def expand_string(val)
|
112
|
+
while val =~ /\#\{[^\}]+\}/
|
113
|
+
val = eval('%Q{' + val + '}', binding)
|
114
|
+
end
|
115
|
+
val = true if val =="true"
|
116
|
+
val = false if val == "false"
|
117
|
+
return val
|
118
|
+
end
|
119
|
+
|
120
|
+
def expand(value)
|
121
|
+
val = case value
|
122
|
+
when Hash
|
123
|
+
HashValueProxy.new(global || self, value)
|
124
|
+
when String
|
125
|
+
expand_string(value)
|
126
|
+
when Enumerable
|
127
|
+
value.collect {|v| expand(v) }
|
128
|
+
else
|
129
|
+
value
|
130
|
+
end
|
131
|
+
return val
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
class BoundEnv < HashValueProxy
|
137
|
+
attr_reader :roles
|
138
|
+
attr_reader :host
|
139
|
+
|
140
|
+
def initialize(global, roles, host)
|
141
|
+
@roles = roles
|
142
|
+
@host = host
|
143
|
+
bound_global = bind_config(global)
|
144
|
+
super(nil, bound_global)
|
145
|
+
end
|
146
|
+
|
147
|
+
def full_host
|
148
|
+
@full_host ||= "#{host}.#{domain}" rescue nil
|
149
|
+
end
|
150
|
+
|
151
|
+
# Forces role/host overrides into config
|
152
|
+
def bind_config(global)
|
153
|
+
global = global.clone()
|
154
|
+
role_overrides = global.delete("roles") || {}
|
155
|
+
host_overrides = global.delete("hosts") || {}
|
156
|
+
Array(roles).each do |role|
|
157
|
+
Array(role_overrides[role]).each do |k, v|
|
158
|
+
global[k] = Environment.combine(global[k], v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
Array(host_overrides[host]).each do |k, v|
|
162
|
+
global[k] = Environment.combine(global[k], v)
|
163
|
+
end
|
164
|
+
return global
|
165
|
+
end
|
166
|
+
|
167
|
+
def method_missing(method_id)
|
168
|
+
key = method_id.id2name
|
169
|
+
return self[key]
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|