sml-rubber 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +339 -0
- data/README +6 -0
- data/TODO +9 -0
- data/VERSION +1 -0
- data/generators/vulcanize/USAGE +6 -0
- data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +45 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web/deflate.conf +10 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web/expires.conf +9 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web/headers.conf +6 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web/setenvif.conf +52 -0
- data/generators/vulcanize/templates/apache/config/rubber/role/web/vhost.conf +27 -0
- data/generators/vulcanize/templates/apache/config/rubber/rubber-apache.yml +15 -0
- data/generators/vulcanize/templates/apache/templates.yml +1 -0
- data/generators/vulcanize/templates/base/Capfile +17 -0
- data/generators/vulcanize/templates/base/config/deploy.rb +77 -0
- data/generators/vulcanize/templates/base/config/rubber/common/crontab +16 -0
- data/generators/vulcanize/templates/base/config/rubber/common/profile.rc +9 -0
- data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +56 -0
- data/generators/vulcanize/templates/base/config/rubber/rubber.yml +221 -0
- data/generators/vulcanize/templates/base/lib/tasks/rubber.rake +18 -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.yml +1 -0
- data/generators/vulcanize/templates/complete_mysql/templates.yml +6 -0
- data/generators/vulcanize/templates/complete_passenger_mysql/templates.yml +8 -0
- data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +74 -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-default.conf +8 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/haproxy.conf +44 -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 +6 -0
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +17 -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 +12 -0
- data/generators/vulcanize/templates/haproxy/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/app/mongrel_cluster.yml +12 -0
- data/generators/vulcanize/templates/mongrel/config/rubber/role/app/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 +251 -0
- data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +32 -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/deploy-munin.rb +30 -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 +80 -0
- data/generators/vulcanize/templates/munin/config/rubber/rubber-munin.yml +8 -0
- data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +57 -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 +11 -0
- data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +178 -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 +167 -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 +38 -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 +173 -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/web/crontab +9 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web/monit-nginx.conf +9 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web/nginx.conf +133 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/index.html +23 -0
- data/generators/vulcanize/templates/nginx/config/rubber/role/web_tools/nginx-tools.conf +74 -0
- data/generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml +33 -0
- data/generators/vulcanize/templates/nginx/templates.yml +1 -0
- data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +27 -0
- data/generators/vulcanize/templates/passenger/config/rubber/role/web/passenger.conf +8 -0
- data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +4 -0
- data/generators/vulcanize/templates/passenger/templates.yml +1 -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 +10 -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 +67 -0
- data/lib/capistrano/hostcmd.rb +12 -0
- data/lib/rubber.rb +37 -0
- data/lib/rubber/capistrano.rb +1 -0
- data/lib/rubber/cloud.rb +13 -0
- data/lib/rubber/cloud/aws.rb +261 -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 +69 -0
- data/lib/rubber/dns/dyndns.rb +63 -0
- data/lib/rubber/dns/nettica.rb +56 -0
- data/lib/rubber/dns/zerigo.rb +121 -0
- data/lib/rubber/environment.rb +161 -0
- data/lib/rubber/generator.rb +197 -0
- data/lib/rubber/instance.rb +113 -0
- data/lib/rubber/recipes/rubber.rb +88 -0
- data/lib/rubber/recipes/rubber/bundles.rb +28 -0
- data/lib/rubber/recipes/rubber/deploy.rb +66 -0
- data/lib/rubber/recipes/rubber/instances.rb +298 -0
- data/lib/rubber/recipes/rubber/security_groups.rb +149 -0
- data/lib/rubber/recipes/rubber/setup.rb +285 -0
- data/lib/rubber/recipes/rubber/static_ips.rb +107 -0
- data/lib/rubber/recipes/rubber/utils.rb +195 -0
- data/lib/rubber/recipes/rubber/volumes.rb +263 -0
- data/lib/rubber/tasks/rubber.rb +218 -0
- data/lib/rubber/util.rb +33 -0
- data/test/environment_test.rb +118 -0
- data/test/generator_test.rb +323 -0
- data/test/instance_test.rb +38 -0
- data/test/test_helper.rb +4 -0
- data/test/util_test.rb +16 -0
- metadata +246 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = "/etc/apache2/sites-available/#{rubber_env.app_name}"
|
|
3
|
+
@post = "a2enmod rewrite && a2ensite #{rubber_env.app_name} && /etc/init.d/apache2 reload"
|
|
4
|
+
%>
|
|
5
|
+
<VirtualHost *:80>
|
|
6
|
+
ServerName <%= rubber_env.domain %>
|
|
7
|
+
ServerAlias <%= rubber_env.web_aliases.join(" ") %>
|
|
8
|
+
DocumentRoot <%= RUBBER_ROOT + "/public" %>
|
|
9
|
+
|
|
10
|
+
ErrorDocument 404 /404.html
|
|
11
|
+
ErrorDocument 500 /500.html
|
|
12
|
+
|
|
13
|
+
SetEnvIf User-Agent "^(.*MSIE.*)|(.*AppleWebKit.*)$" nokeepalive
|
|
14
|
+
|
|
15
|
+
RailsEnv <%= RUBBER_ENV %>
|
|
16
|
+
RailsAllowModRewrite on
|
|
17
|
+
|
|
18
|
+
RewriteEngine On
|
|
19
|
+
RewriteCond %{HTTP_HOST} ^<%= rubber_env.domain %>$
|
|
20
|
+
RewriteRule ^(.*)$ http://www.<%= rubber_env.domain %>$1 [R,L]
|
|
21
|
+
|
|
22
|
+
# Include <%= RUBBER_ROOT + "/public" %>/config/apache/rewrites.conf
|
|
23
|
+
|
|
24
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
|
25
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
|
26
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
|
27
|
+
</VirtualHost>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
web_aliases: [www.foo.com *.foo.com]
|
|
2
|
+
|
|
3
|
+
security_groups:
|
|
4
|
+
web:
|
|
5
|
+
description: To open up port 80 for http server on web role
|
|
6
|
+
rules:
|
|
7
|
+
- protocol: tcp
|
|
8
|
+
from_port: 80
|
|
9
|
+
to_port: 80
|
|
10
|
+
source_ips: [0.0.0.0/0]
|
|
11
|
+
|
|
12
|
+
roles:
|
|
13
|
+
web:
|
|
14
|
+
packages: [apache2]
|
|
15
|
+
assigned_security_groups: [web]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
description: The apache module
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
|
2
|
+
|
|
3
|
+
env = ENV['RUBBER_ENV'] ||= (ENV['RAILS_ENV'] || 'production')
|
|
4
|
+
root = File.dirname(__FILE__)
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
# first try as a rails plugin
|
|
8
|
+
require 'vendor/plugins/rubber/lib/rubber.rb'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
# then try as a gem
|
|
11
|
+
require 'rubber'
|
|
12
|
+
end
|
|
13
|
+
Rubber::initialize(root, env)
|
|
14
|
+
require 'rubber/capistrano'
|
|
15
|
+
|
|
16
|
+
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
|
17
|
+
load 'config/deploy'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# This is a sample Capistrano config file for rubber
|
|
2
|
+
|
|
3
|
+
set :rails_env, RUBBER_ENV
|
|
4
|
+
|
|
5
|
+
on :load do
|
|
6
|
+
set :application, rubber_cfg.environment.bind().app_name
|
|
7
|
+
set :deploy_to, "/mnt/#{application}-#{rails_env}"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Use a simple directory tree copy here to make demo easier.
|
|
11
|
+
# You probably want to use your own repository for a real app
|
|
12
|
+
set :scm, :none
|
|
13
|
+
set :repository, "."
|
|
14
|
+
set :deploy_via, :copy
|
|
15
|
+
|
|
16
|
+
# Easier to do system level config as root - probably should do it through
|
|
17
|
+
# sudo in the future. We use ssh keys for access, so no passwd needed
|
|
18
|
+
set :user, 'root'
|
|
19
|
+
set :password, nil
|
|
20
|
+
|
|
21
|
+
# Use sudo with user rails for cap deploy:[stop|start|restart]
|
|
22
|
+
# This way exposed services (mongrel) aren't running as a privileged user
|
|
23
|
+
set :use_sudo, true
|
|
24
|
+
set :runner, 'rails'
|
|
25
|
+
|
|
26
|
+
# How many old releases should be kept around when running "cleanup" task
|
|
27
|
+
set :keep_releases, 3
|
|
28
|
+
|
|
29
|
+
# Lets us work with staging instances without having to checkin config files
|
|
30
|
+
# (instance*.yml + rubber*.yml) for a deploy. This gives us the
|
|
31
|
+
# convenience of not having to checkin files for staging, as well as
|
|
32
|
+
# the safety of forcing it to be checked in for production.
|
|
33
|
+
set :push_instance_config, rails_env != 'production'
|
|
34
|
+
|
|
35
|
+
# Allows the tasks defined to fail gracefully if there are no hosts for them.
|
|
36
|
+
# Comment out or use "required_task" for default cap behavior of a hard failure
|
|
37
|
+
rubber.allow_optional_tasks(self)
|
|
38
|
+
# Wrap tasks in the deploy namespace that have roles so that we can use FILTER
|
|
39
|
+
# with something like a deploy:cold which tries to run deploy:migrate but can't
|
|
40
|
+
# because we filtered out the :db role
|
|
41
|
+
namespace :deploy do
|
|
42
|
+
rubber.allow_optional_tasks(self)
|
|
43
|
+
tasks.values.each do |t|
|
|
44
|
+
if t.options[:roles]
|
|
45
|
+
task t.name, t.options, &t.body
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# =============================================================================
|
|
51
|
+
# TASKS
|
|
52
|
+
# =============================================================================
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Dir["#{File.dirname(__FILE__)}/rubber/deploy-*.rb"].each do |deploy_file|
|
|
56
|
+
load deploy_file
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Don't want to do rubber:config for update_code as that tree isn't official
|
|
60
|
+
# until it is 'committed' by the symlink task (and doing so causes it to run
|
|
61
|
+
# for bootstrap_db which should only config the db config file). However,
|
|
62
|
+
# deploy:migrations doesn't call update, so we need an additional trigger for
|
|
63
|
+
# it
|
|
64
|
+
after "deploy:update", "rubber:config"
|
|
65
|
+
after "deploy:rollback_code", "rubber:config"
|
|
66
|
+
before "deploy:migrate", "rubber:config"
|
|
67
|
+
|
|
68
|
+
before "rubber:pre_start", "setup_perms"
|
|
69
|
+
before "rubber:pre_restart", "setup_perms"
|
|
70
|
+
after "deploy", "deploy:cleanup"
|
|
71
|
+
|
|
72
|
+
# Fix perms because we start server as rails user, but migrate as root,
|
|
73
|
+
# server needs to be able to write logs, etc.
|
|
74
|
+
task :setup_perms do
|
|
75
|
+
run "find #{shared_path} -name cached-copy -prune -o -print | xargs chown #{runner}:#{runner}"
|
|
76
|
+
run "chown -R #{runner}:#{runner} #{current_path}/tmp"
|
|
77
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@read_cmd = 'crontab -l'
|
|
3
|
+
@write_cmd = 'crontab -'
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/sbin:/usr/sbin
|
|
7
|
+
MAILTO=<%= rubber_env.admin_email %>
|
|
8
|
+
# don't need to set RUBBER_ENV for each script since we set it for all cron here
|
|
9
|
+
RUBBER_ENV=<%= RUBBER_ENV %>
|
|
10
|
+
RAILS_ENV=<%= RUBBER_ENV %>
|
|
11
|
+
|
|
12
|
+
# Roll all rails logs at midnight
|
|
13
|
+
0 0 * * * LOG_DIR=<%= RUBBER_ROOT %>/log <%= RUBBER_ROOT %>/script/cron-rake rubber:rotate_logs
|
|
14
|
+
|
|
15
|
+
# Automatically set the clock for all machines
|
|
16
|
+
<%= rand(60) %> 4 * * * <%= RUBBER_ROOT %>/script/cron-sh -- ntpdate pool.ntp.org
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = "/root/.profile"
|
|
3
|
+
@additive = ["# rubber-common-start", "# rubber-common-end"]
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
# convenience to simply running rails console, etc with correct env
|
|
7
|
+
export RUBBER_ENV=<%= RUBBER_ENV %>
|
|
8
|
+
export RAILS_ENV=<%= RUBBER_ENV %>
|
|
9
|
+
alias current="cd <%= RUBBER_ROOT %>"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
namespace :rubber do
|
|
2
|
+
namespace :base do
|
|
3
|
+
|
|
4
|
+
rubber.allow_optional_tasks(self)
|
|
5
|
+
|
|
6
|
+
# The ubuntu rubygem package is woefully out of date, so install it manually
|
|
7
|
+
after "rubber:install_packages", "rubber:base:install_rubygems"
|
|
8
|
+
task :install_rubygems do
|
|
9
|
+
ver = "1.3.1"
|
|
10
|
+
src_url = "http://rubyforge.org/frs/download.php/45905/rubygems-#{ver}.tgz"
|
|
11
|
+
rubber.sudo_script 'install_rubygems', <<-ENDSCRIPT
|
|
12
|
+
if [ ! -f /usr/bin/gem ]; then
|
|
13
|
+
wget -qP /tmp #{src_url}
|
|
14
|
+
tar -C /tmp -xzf /tmp/rubygems-#{ver}.tgz
|
|
15
|
+
ruby -C /tmp/rubygems-#{ver} setup.rb
|
|
16
|
+
ln -sf /usr/bin/gem1.8 /usr/bin/gem
|
|
17
|
+
rm -rf /tmp/rubygems*
|
|
18
|
+
gem source -l > /dev/null
|
|
19
|
+
gem sources -a http://gems.github.com
|
|
20
|
+
fi
|
|
21
|
+
ENDSCRIPT
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# git in ubuntu 7.0.4 is very out of date and doesn't work well with capistrano
|
|
25
|
+
after "rubber:install_packages", "rubber:base:install_git" if scm == "git"
|
|
26
|
+
task :install_git do
|
|
27
|
+
rubber.run_script 'install_git', <<-ENDSCRIPT
|
|
28
|
+
if ! git --version &> /dev/null; then
|
|
29
|
+
arch=`uname -m`
|
|
30
|
+
if [ "$arch" = "x86_64" ]; then
|
|
31
|
+
src="http://mirrors.kernel.org/ubuntu/pool/main/g/git-core/git-core_1.5.4.5-1~dapper1_amd64.deb"
|
|
32
|
+
else
|
|
33
|
+
src="http://mirrors.kernel.org/ubuntu/pool/main/g/git-core/git-core_1.5.4.5-1~dapper1_i386.deb"
|
|
34
|
+
fi
|
|
35
|
+
apt-get install liberror-perl libdigest-sha1-perl
|
|
36
|
+
wget -qO /tmp/git.deb ${src}
|
|
37
|
+
dpkg -i /tmp/git.deb
|
|
38
|
+
fi
|
|
39
|
+
ENDSCRIPT
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# We need a rails user for safer permissions used by deploy.rb
|
|
43
|
+
after "rubber:install_packages", "rubber:base:custom_install"
|
|
44
|
+
task :custom_install do
|
|
45
|
+
rubber.sudo_script 'custom_install', <<-ENDSCRIPT
|
|
46
|
+
# add the rails user for running app server with
|
|
47
|
+
appuser="rails"
|
|
48
|
+
if ! id ${appuser} &> /dev/null; then adduser --system --group ${appuser}; fi
|
|
49
|
+
|
|
50
|
+
# add ssh keys for root
|
|
51
|
+
if [[ ! -f /root/.ssh/id_dsa ]]; then ssh-keygen -q -t dsa -N '' -f /root/.ssh/id_dsa; fi
|
|
52
|
+
ENDSCRIPT
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# All variables can also be overridden on the role and/or host level by creating
|
|
2
|
+
# a sub level to the config under roles and hosts
|
|
3
|
+
# e.g. to install mysql only on db role, and awstats only on web01:
|
|
4
|
+
#
|
|
5
|
+
# packages: [ruby]
|
|
6
|
+
# roles:
|
|
7
|
+
# db:
|
|
8
|
+
# packages: [mysql]
|
|
9
|
+
# hosts:
|
|
10
|
+
# web01:
|
|
11
|
+
# packages: [awstats]
|
|
12
|
+
|
|
13
|
+
# REQUIRED: The name of your application
|
|
14
|
+
app_name: your_app_name
|
|
15
|
+
|
|
16
|
+
# REQUIRED: Notification emails (e.g. monit) get sent to this address
|
|
17
|
+
#
|
|
18
|
+
admin_email: root@localhost
|
|
19
|
+
|
|
20
|
+
# REQUIRED: The timezone the server should be in
|
|
21
|
+
timezone: US/Eastern
|
|
22
|
+
|
|
23
|
+
# REQUIRED: the domain all the instances should be associated with
|
|
24
|
+
#
|
|
25
|
+
domain: foo.com
|
|
26
|
+
|
|
27
|
+
# OPTIONAL: The configuration for each dns provider (nettica|zerigo|dyndns)
|
|
28
|
+
# This lets rubber updatea dynamic dns service with the instance alias and ip
|
|
29
|
+
#
|
|
30
|
+
dns_providers:
|
|
31
|
+
nettica:
|
|
32
|
+
user: joe
|
|
33
|
+
password: sekret
|
|
34
|
+
record_type: A
|
|
35
|
+
ttl: 300
|
|
36
|
+
zerigo:
|
|
37
|
+
customer_id: 1234
|
|
38
|
+
email: foo@bar.com
|
|
39
|
+
token: hexxy
|
|
40
|
+
record_type: A
|
|
41
|
+
ttl: 300
|
|
42
|
+
dyndns:
|
|
43
|
+
user: joe
|
|
44
|
+
password: sekret
|
|
45
|
+
update_url: https://members.dyndns.org/nic/update?hostname=%host%&myip=%ip%'
|
|
46
|
+
|
|
47
|
+
# OPTIONAL: The dns provider to use
|
|
48
|
+
# dns_provider: nettica
|
|
49
|
+
|
|
50
|
+
# OPTIONAL: Additional rubber file to pull config from if it exists. This file will
|
|
51
|
+
# also be pushed to remote host at RUBBER_ROOT/config/rubber/rubber-secret.yml
|
|
52
|
+
#
|
|
53
|
+
# rubber_secret: "#{File.expand_path('~') + '/.ec2' + (RUBBER_ENV == 'production' ? '' : '_dev') + '/rubber-secret.yml' rescue ''}"
|
|
54
|
+
|
|
55
|
+
# REQUIRED All known cloud providers with the settings needed to configure them
|
|
56
|
+
# There's only one coud provider right now - Amazon Web Services
|
|
57
|
+
# To implement another, clone lib/rubber/cloud/aws.rb
|
|
58
|
+
#
|
|
59
|
+
cloud_providers:
|
|
60
|
+
aws:
|
|
61
|
+
# REQUIRED The amazon keys and account ID (digits only, no dashes) used to access the AWS API
|
|
62
|
+
#
|
|
63
|
+
access_key: XXX
|
|
64
|
+
secret_access_key: YYY
|
|
65
|
+
account: ZZZ
|
|
66
|
+
|
|
67
|
+
# REQUIRED: The name of the amazon keypair and location of its private key
|
|
68
|
+
#
|
|
69
|
+
# NOTE: for some reason Capistrano requires you to have both the public and
|
|
70
|
+
# the private key in the same folder, the public key should have the
|
|
71
|
+
# extension ".pub". The easiest (only?) way to get your hand on this is to
|
|
72
|
+
# create an instance, ssh into it, and copy the file /mnt/openssh_id.pub
|
|
73
|
+
#
|
|
74
|
+
key_name: gsg-keypair
|
|
75
|
+
key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"
|
|
76
|
+
|
|
77
|
+
# OPTIONAL: Needed for bundling a running instance using rubber:bundle
|
|
78
|
+
#
|
|
79
|
+
# pk_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/pk-*'].first}"
|
|
80
|
+
# cert_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/cert-*'].first}"
|
|
81
|
+
# image_bucket: "#{app_name}_images"
|
|
82
|
+
|
|
83
|
+
# OPTIONAL: Needed for backing up database to s3
|
|
84
|
+
# backup_bucket: "#{app_name}_backups"
|
|
85
|
+
|
|
86
|
+
# REQUIRED: the ami and instance type for creating instances
|
|
87
|
+
# The Ubuntu images at http://alestic.com/ work well
|
|
88
|
+
# Ubuntu 9.04 Jaunty base install 32-bit 2.6.21.7-2.fc8xen ami-bf5eb9d6
|
|
89
|
+
# Ubuntu 9.04 Jaunty base install 64-bit 2.6.21.7-2.fc8xen ami-bc5eb9d5
|
|
90
|
+
#
|
|
91
|
+
image_id: ami-bf5eb9d6
|
|
92
|
+
# m1.small or m1.large or m1.xlarge
|
|
93
|
+
image_type: m1.small
|
|
94
|
+
|
|
95
|
+
# REQUIRED the cloud provider to use
|
|
96
|
+
#
|
|
97
|
+
cloud_provider: aws
|
|
98
|
+
|
|
99
|
+
# OPTIONAL: Define security groups
|
|
100
|
+
# Each security group is a name associated with a sequence of maps where the
|
|
101
|
+
# keys are the parameters to the ec2 AuthorizeSecurityGroupIngress API
|
|
102
|
+
# source_security_group_name, source_security_group_owner_id
|
|
103
|
+
# ip_protocol, from_port, to_port, cidr_ip
|
|
104
|
+
#
|
|
105
|
+
security_groups:
|
|
106
|
+
default:
|
|
107
|
+
description: The default security group
|
|
108
|
+
rules:
|
|
109
|
+
- source_group_name: default
|
|
110
|
+
source_group_account: "#{cloud_providers.aws.account}"
|
|
111
|
+
- protocol: tcp
|
|
112
|
+
from_port: 22
|
|
113
|
+
to_port: 22
|
|
114
|
+
source_ips: [0.0.0.0/0]
|
|
115
|
+
|
|
116
|
+
# OPTIONAL: The default security groups to create instances with
|
|
117
|
+
assigned_security_groups: [default]
|
|
118
|
+
|
|
119
|
+
# OPTIONAL: Automatically create security groups for each host and role
|
|
120
|
+
# EC2 doesn't allow one to change what groups an instance belongs to after
|
|
121
|
+
# creation, so its good to have some empty ones predefined.
|
|
122
|
+
auto_security_groups: true
|
|
123
|
+
|
|
124
|
+
# OPTIONAL: The packages to install on all instances
|
|
125
|
+
# You can install a specific version of a package by using a sub-array of pkg, version
|
|
126
|
+
# For example, packages: [[rake, 0.7.1], irb]
|
|
127
|
+
packages: [build-essential, ruby-full, ruby1.8-dev, rake, irb, subversion]
|
|
128
|
+
|
|
129
|
+
# OPTIONAL: The gems to install on all instances
|
|
130
|
+
# You can install a specific version of a gem by using a sub-array of gem, version
|
|
131
|
+
# For example, gem: [[rails, 2.2.2], open4, aws-s3]
|
|
132
|
+
gems: [wr0ngway-rubber, rails, open4, aws-s3]
|
|
133
|
+
|
|
134
|
+
# OPTIONAL: A string prepended to shell command strings that cause multi
|
|
135
|
+
# statement shell commands to fail fast. You may need to comment this out
|
|
136
|
+
# on some platforms, but it works for me on linux/osx with a bash shell
|
|
137
|
+
#
|
|
138
|
+
stop_on_error_cmd: "function error_exit { exit 99; }; trap error_exit ERR"
|
|
139
|
+
|
|
140
|
+
# OPTIONAL: The default set of roles to use when creating a staging instance
|
|
141
|
+
# with "cap rubber:create_staging". By default this uses all the known roles,
|
|
142
|
+
# but this is not always desired for staging, so you can specify a different
|
|
143
|
+
# set here
|
|
144
|
+
#
|
|
145
|
+
staging_roles: "web,haproxy,app,mysql_master"
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# OPTIONAL: Lets one assign amazon elastic IPs (static IPs) to your instances
|
|
149
|
+
# You should typically set this on the role/host level rather than
|
|
150
|
+
# globally , unless you really do want all instances to have a
|
|
151
|
+
# static IP
|
|
152
|
+
#
|
|
153
|
+
# use_static_ip: true
|
|
154
|
+
|
|
155
|
+
# OPTIONAL: Specifies an instance to be created in the given availability zone
|
|
156
|
+
# Availability zones are sepcified by amazon to be somewhat isolated
|
|
157
|
+
# from each other so that hardware failures in one zone shouldn't
|
|
158
|
+
# affect instances in another. As such, it is good to specify these
|
|
159
|
+
# for instances that need to be redundant to reduce your chance of
|
|
160
|
+
# downtime. You should typically set this on the role/host level
|
|
161
|
+
# rather than globally. Use rubber describe:zones to see the list
|
|
162
|
+
# of zones
|
|
163
|
+
# availability_zone: us-east-1a
|
|
164
|
+
|
|
165
|
+
# OPTIONAL: If you want t use Elastic Block Store (EBS) persistent
|
|
166
|
+
# volumes, add them to host specific overrides and they will get created
|
|
167
|
+
# and assigned to the instance. On initial creation, the volume will get
|
|
168
|
+
# attached _and_ formatted, but if your host disapears and you recreate
|
|
169
|
+
# it, the volume will only get remounted thereby preserving your data
|
|
170
|
+
#
|
|
171
|
+
# hosts:
|
|
172
|
+
# my_host:
|
|
173
|
+
# availability_zone: us-east-1a
|
|
174
|
+
# volumes:
|
|
175
|
+
# - size: 100 # size of vol in GBs
|
|
176
|
+
# zone: us-east-1a # zone to create volume in, needs to match host's zone
|
|
177
|
+
# device: /dev/sdh # OS device to attach volume to
|
|
178
|
+
# mount: /mnt/mysql # The directory to mount this volume to
|
|
179
|
+
# filesystem: ext3 # the filesystem to create on volume
|
|
180
|
+
# - size: 10 # size of vol in GBs
|
|
181
|
+
# zone: us-east-1a # zone to create volume in, needs to match host's zone
|
|
182
|
+
# device: /dev/sdi # OS device to attach volume to
|
|
183
|
+
# mount: /mnt/logs # The directory to mount this volume to
|
|
184
|
+
# filesystem: ext3 # the filesystem to create on volume
|
|
185
|
+
#
|
|
186
|
+
# # volumes without mount/filesystem can be used in raid arrays
|
|
187
|
+
#
|
|
188
|
+
# - size: 50 # size of vol in GBs
|
|
189
|
+
# zone: us-east-1a # zone to create volume in, needs to match host's zone
|
|
190
|
+
# device: /dev/sdx # OS device to attach volume to
|
|
191
|
+
# - size: 50 # size of vol in GBs
|
|
192
|
+
# zone: us-east-1a # zone to create volume in, needs to match host's zone
|
|
193
|
+
# device: /dev/sdy # OS device to attach volume to
|
|
194
|
+
#
|
|
195
|
+
# # for raid array, you'll need to add mdadm to packages. Likewise,
|
|
196
|
+
# # xfsprogs is needed for xfs filesystem support
|
|
197
|
+
# packages: [xfsprogs, mdadm]
|
|
198
|
+
# raid_volumes:
|
|
199
|
+
# - device: /dev/md0 # OS device to to create raid array on
|
|
200
|
+
# mount: /mnt/fast # The directory to mount this array to
|
|
201
|
+
# filesystem: xfs # the filesystem to create on array
|
|
202
|
+
# raid_level: 0 # the raid level to use for the array
|
|
203
|
+
# source_devices: [/dev/sdx, /dev/sdy] # the source EBS devices we are creating raid array from
|
|
204
|
+
|
|
205
|
+
# OPTIONAL: You can also define your own variables here for use when
|
|
206
|
+
# transforming config files, and they will be available in your config
|
|
207
|
+
# templates as <%= rubber_env.var_name %>
|
|
208
|
+
#
|
|
209
|
+
# var_name: var_value
|
|
210
|
+
|
|
211
|
+
# OPTIONAL: Role specific overrides
|
|
212
|
+
# roles:
|
|
213
|
+
# somerole:
|
|
214
|
+
# packages: []
|
|
215
|
+
# somerole2:
|
|
216
|
+
# myconfig: someval
|
|
217
|
+
|
|
218
|
+
# OPTIONAL: Host specific overrides
|
|
219
|
+
# hosts:
|
|
220
|
+
# somehost:
|
|
221
|
+
# packages: []
|