rubber 1.1.5 → 1.1.6

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.
Files changed (29) hide show
  1. data/CHANGELOG +25 -0
  2. data/VERSION +1 -1
  3. data/generators/vulcanize/templates/apache/config/rubber/role/web_tools/tools-index.html +2 -2
  4. data/generators/vulcanize/templates/base/config/rubber/common/crontab +1 -1
  5. data/generators/vulcanize/templates/base/config/rubber/common/rubber.profile +14 -0
  6. data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +21 -23
  7. data/generators/vulcanize/templates/base/config/rubber/rubber.yml +7 -3
  8. data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +56 -0
  9. data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml +199 -0
  10. data/generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf +9 -0
  11. data/generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml +8 -0
  12. data/generators/vulcanize/templates/jetty/templates.yml +1 -0
  13. data/generators/vulcanize/templates/mongrel/config/rubber/role/mongrel/monit-mongrel.conf +2 -2
  14. data/generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf +9 -0
  15. data/generators/vulcanize/templates/munin/script/munin/example_mysql_query.rb +3 -3
  16. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf +34 -0
  17. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf +2 -1
  18. data/generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf +1 -1
  19. data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +0 -1
  20. data/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +1 -1
  21. data/generators/vulcanize/templates/redis/config/rubber/role/redis/crontab +1 -1
  22. data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/crontab +2 -2
  23. data/generators/vulcanize/templates/sphinx/config/rubber/role/sphinx/monit-sphinx.conf +2 -2
  24. data/lib/rubber.rb +1 -1
  25. data/lib/rubber/environment.rb +4 -4
  26. data/lib/rubber/recipes/rubber/instances.rb +2 -0
  27. data/lib/rubber/recipes/rubber/utils.rb +2 -2
  28. metadata +10 -3
  29. data/generators/vulcanize/templates/base/config/rubber/common/profile.rc +0 -9
data/CHANGELOG CHANGED
@@ -1,3 +1,28 @@
1
+ 1.1.6
2
+ -----
3
+
4
+ stop using helper method to install ree as it uses different path for 64bit pkg <fbdeab3> [Matt Conway]
5
+ remind about bootstrap <fd2e593> [Matt Conway]
6
+ fix setting of rails vars <cd7206d> [Matt Conway]
7
+ Merge remote branch 'nirvdrum/master' into pull <b902618> [Matt Conway]
8
+ add passenger memory stats munin plugin <de6bb9a> [Matt Conway]
9
+ setup path so that we select correct ruby globally <8365a70> [Matt Conway]
10
+ sort display order of tools <4a7a9a0> [Matt Conway]
11
+ fix arithmetic for server slicing in serial_task <4bbd9e7> [Matt Conway]
12
+ Upgraded to the latest version of redis. <a62955f> [Kevin Menard]
13
+ Merge branch 'wr0ngway/master' <09046af> [Kevin Menard]
14
+ escape percents in crontab <a299c3b> [Matt Conway]
15
+ fix ruby prefix path for passenger munin plugin <af9488d> [Matt Conway]
16
+ fix config reference in munin example <50e563d> [Matt Conway]
17
+ enable rubygems at system level for munin plugins <df32e3e> [Matt Conway]
18
+ env should use rubygems by default <c2467cc> [Matt Conway]
19
+ make default bucket name be dns friendly <b58fbbe> [Matt Conway]
20
+ fix sphinx crontab to sudo using configured user <3fe8b6f> [Matt Conway]
21
+ fix being able to reference cluster config (instance.yml) from within rubber.yml <08fecec> [Matt Conway]
22
+ Fixed monit conf file. <d84d287> [Kevin Menard]
23
+ git-core is fine on modern Ubuntu AMIs. <16eda00> [Kevin Menard]
24
+ Added a jetty generator. <5c18774> [Kevin Menard]
25
+
1
26
  1.1.5
2
27
  -----
3
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.5
1
+ 1.1.6
@@ -17,11 +17,11 @@
17
17
  <li><a href="http://<%= cruise_host %>/cruise/">CruiseControl</a></li>
18
18
  <% end %>
19
19
 
20
- <% rubber_instances.for_role('haproxy').each do |ic| %>
20
+ <% rubber_instances.for_role('haproxy').sort {|a,b| a.name <=> b.name }.each do |ic| %>
21
21
  <li><a href="/haproxy_<%= ic.name %>/">HAProxy <%= ic.name %></a></li>
22
22
  <% end %>
23
23
 
24
- <% rubber_instances.each do |ic| %>
24
+ <% rubber_instances.sort {|a,b| a.name <=> b.name }.each do |ic| %>
25
25
  <li><a href="/monit_<%= ic.name %>/">Monit <%= ic.name %></a></li>
26
26
  <% end %>
27
27
 
@@ -3,7 +3,7 @@
3
3
  @write_cmd = 'crontab -'
4
4
  %>
5
5
 
6
- PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/sbin:/usr/sbin
6
+ PATH=/sbin:/usr/sbin:/usr/local/sbin:<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:/usr/bin:/bin
7
7
  MAILTO=<%= rubber_env.admin_email %>
8
8
  # don't need to set RUBBER_ENV for each script since we set it for all cron here
9
9
  RUBBER_ENV=<%= RUBBER_ENV %>
@@ -0,0 +1,14 @@
1
+ <%
2
+ @path = "/etc/profile.d/rubber.sh"
3
+ %>
4
+
5
+ # convenience to simply running rails console, etc with correct env
6
+ export RUBBER_ENV=<%= RUBBER_ENV %>
7
+ export RAILS_ENV=<%= RUBBER_ENV %>
8
+ alias current="cd <%= RUBBER_ROOT %>"
9
+
10
+ # make sure we use the right ruby since REE installs into /usr/local
11
+ export PATH=<%= rubber_env.ruby_prefix %>/bin:$PATH
12
+
13
+ # Always use rubygems
14
+ export RUBYOPT="rubygems"
@@ -19,9 +19,20 @@ namespace :rubber do
19
19
 
20
20
  if ent_ruby_hosts.size > 0
21
21
  task :_install_enterprise_ruby, :hosts => ent_ruby_hosts do
22
- custom_package('http://rubyforge.org/frs/download.php/66164',
23
- 'ruby-enterprise', '1.8.7-2009.10',
24
- '! `ruby --version 2> /dev/null` =~ "Ruby Enterprise Edition 2009.10"')
22
+ ver = "1.8.7-2009.10"
23
+ rubber.run_script "install_ruby-enterprise", <<-ENDSCRIPT
24
+ if [[ ! `ruby --version 2> /dev/null` =~ "Ruby Enterprise Edition 2009.10" ]]; then
25
+ arch=`uname -m`
26
+ if [ "$arch" = "x86_64" ]; then
27
+ src="http://rubyforge.org/frs/download.php/66163/ruby-enterprise_#{ver}_amd64.deb"
28
+ else
29
+ src="http://rubyforge.org/frs/download.php/66164/ruby-enterprise_#{ver}_i386.deb"
30
+ fi
31
+ src_file="${src##*/}"
32
+ wget -qP /tmp ${src}
33
+ dpkg -i /tmp/${src_file}
34
+ fi
35
+ ENDSCRIPT
25
36
  end
26
37
 
27
38
  _install_enterprise_ruby
@@ -46,26 +57,13 @@ namespace :rubber do
46
57
  ENDSCRIPT
47
58
  end
48
59
 
49
- # git in ubuntu 7.0.4 is very out of date and doesn't work well with capistrano
50
- after "rubber:install_packages", "rubber:base:install_git" if scm == "git"
51
- task :install_git do
52
- rubber.run_script 'install_git', <<-ENDSCRIPT
53
- if ! git --version &> /dev/null; then
54
- arch=`uname -m`
55
- if [ "$arch" = "x86_64" ]; then
56
- src="http://mirrors.kernel.org/ubuntu/pool/main/g/git-core/git-core_1.5.4.5-1~dapper1_amd64.deb"
57
- else
58
- src="http://mirrors.kernel.org/ubuntu/pool/main/g/git-core/git-core_1.5.4.5-1~dapper1_i386.deb"
59
- fi
60
- apt-get install liberror-perl libdigest-sha1-perl
61
- wget -qO /tmp/git.deb ${src}
62
- dpkg -i /tmp/git.deb
63
-
64
- if [[ "#{repository}" =~ "@" ]]; then
65
- # Get host key for src machine to prevent ssh from failing
66
- rm -f ~/.ssh/known_hosts
67
- ! ssh -o 'StrictHostKeyChecking=no' #{repository.gsub(/:.*/, '')} &> /dev/null
68
- fi
60
+ after "rubber:install_packages", "rubber:base:configure_git" if scm == "git"
61
+ task :configure_git do
62
+ rubber.run_script 'configure_git', <<-ENDSCRIPT
63
+ if [[ "#{repository}" =~ "@" ]]; then
64
+ # Get host key for src machine to prevent ssh from failing
65
+ rm -f ~/.ssh/known_hosts
66
+ ! ssh -o 'StrictHostKeyChecking=no' #{repository.gsub(/:.*/, '')} &> /dev/null
69
67
  fi
70
68
  ENDSCRIPT
71
69
  end
@@ -68,10 +68,10 @@ cloud_providers:
68
68
  #
69
69
  # pk_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/pk-*'].first}"
70
70
  # cert_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/cert-*'].first}"
71
- # image_bucket: "#{app_name}_images"
71
+ # image_bucket: "#{app_name}-images"
72
72
 
73
73
  # OPTIONAL: Needed for backing up database to s3
74
- # backup_bucket: "#{app_name}_backups"
74
+ # backup_bucket: "#{app_name}-backups"
75
75
 
76
76
  # REQUIRED: the ami and instance type for creating instances
77
77
  # The Ubuntu images at http://alestic.com/ work well
@@ -120,10 +120,14 @@ isolate_security_groups: true
120
120
  # OPTIONAL: Set if you want to use Ruby Enterprise Edition instead of the standard ubuntu one
121
121
  use_enterprise_ruby: false
122
122
 
123
+ # REE installs into /usr/local, so this lets us setup environment to use it globally
124
+ # instead of system ruby
125
+ ruby_prefix: "#{use_enterprise_ruby ? '/usr/local' : '/usr'}"
126
+
123
127
  # OPTIONAL: The packages to install on all instances
124
128
  # You can install a specific version of a package by using a sub-array of pkg, version
125
129
  # For example, packages: [[rake, 0.7.1], irb]
126
- packages: [postfix, build-essential, ruby-full, ruby1.8-dev, rake, irb]
130
+ packages: [postfix, build-essential, ruby-full, ruby1.8-dev, rake, irb, git-core]
127
131
 
128
132
  # OPTIONAL: gem sources to setup for rubygems
129
133
  gemsources: ["http://gemcutter.org", "http://gems.rubyforge.org/", "http://gems.github.com"]
@@ -0,0 +1,56 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :jetty do
5
+
6
+ rubber.allow_optional_tasks(self)
7
+
8
+ after "rubber:install_packages", "rubber:jetty:custom_install"
9
+
10
+ task :custom_install, :roles => :jetty do
11
+ rubber.sudo_script 'install_jetty', <<-ENDSCRIPT
12
+ if [[ -z `ls #{rubber_env.jetty_dir} 2> /dev/null` ]]; then
13
+ wget -q http://ftp.osuosl.org/pub/eclipse/jetty/#{rubber_env.jetty_version}/dist/jetty-distribution-#{rubber_env.jetty_version}.tar.gz
14
+ tar -zxf jetty-distribution-#{rubber_env.jetty_version}.tar.gz
15
+
16
+ # Install to appropriate location.
17
+ mv jetty-distribution-#{rubber_env.jetty_version} #{rubber_env.jetty_prefix}
18
+ ln -s #{rubber_env.jetty_prefix}/jetty-distribution-#{rubber_env.jetty_version} #{rubber_env.jetty_dir}
19
+ chmod 744 #{rubber_env.jetty_dir}/bin/*.sh
20
+
21
+ # Cleanup the jetty distribution
22
+ rm #{rubber_env.jetty_dir}/webapps/*
23
+ rm -r #{rubber_env.jetty_dir}/contexts/test.d/
24
+ mv #{rubber_env.jetty_dir}/contexts/demo.xml #{rubber_env.jetty_dir}/contexts/demo.xml.example
25
+ mv #{rubber_env.jetty_dir}/contexts/javadoc.xml #{rubber_env.jetty_dir}/contexts/javadoc.xml.example
26
+
27
+ # Cleanup after ourselves.
28
+ rm jetty-distribution-#{rubber_env.jetty_version}.tar.gz
29
+ fi
30
+ ENDSCRIPT
31
+ end
32
+
33
+ after "rubber:setup_app_permissions", "rubber:jetty:setup_jetty_permissions"
34
+
35
+ task :setup_jetty_permissions, :roles => :jetty do
36
+ run "chown -R #{rubber_env.app_user}:#{rubber_env.app_user} #{rubber_env.jetty_dir}"
37
+ end
38
+
39
+ before "deploy:stop", "rubber:jetty:stop"
40
+ after "deploy:start", "rubber:jetty:start"
41
+ after "deploy:restart", "rubber:jetty:restart"
42
+
43
+ task :restart, :roles => :jetty do
44
+ run "#{rubber_env.jetty_dir}/bin/jetty.sh restart"
45
+ end
46
+
47
+ task :stop, :roles => :jetty do
48
+ run "#{rubber_env.jetty_dir}/bin/jetty.sh stop"
49
+ end
50
+
51
+ task :start, :roles => :jetty do
52
+ run "#{rubber_env.jetty_dir}/bin/jetty.sh start"
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,199 @@
1
+ <%-
2
+ @path = "#{rubber_env.jetty_dir}/etc/jetty.xml"
3
+ %><?xml version="1.0"?>
4
+ <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
5
+
6
+ <!-- =============================================================== -->
7
+ <!-- Configure the Jetty Server -->
8
+ <!-- -->
9
+ <!-- Documentation of this file format can be found at: -->
10
+ <!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
11
+ <!-- -->
12
+ <!-- =============================================================== -->
13
+
14
+
15
+ <Configure id="Server" class="org.eclipse.jetty.server.Server">
16
+
17
+ <!-- =========================================================== -->
18
+ <!-- Server Thread Pool -->
19
+ <!-- =========================================================== -->
20
+ <Set name="ThreadPool">
21
+ <!-- Default queued blocking threadpool
22
+ -->
23
+ <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
24
+ <Set name="minThreads">10</Set>
25
+ <Set name="maxThreads">200</Set>
26
+ </New>
27
+
28
+ <!-- Optional Java 5 bounded threadpool with job queue
29
+ <New class="org.eclipse.thread.concurrent.ThreadPool">
30
+ <Set name="corePoolSize">50</Set>
31
+ <Set name="maximumPoolSize">50</Set>
32
+ </New>
33
+ -->
34
+ </Set>
35
+
36
+
37
+
38
+ <!-- =========================================================== -->
39
+ <!-- Set connectors -->
40
+ <!-- =========================================================== -->
41
+
42
+ <Call name="addConnector">
43
+ <Arg>
44
+ <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
45
+ <Set name="host"><SystemProperty name="jetty.host" /></Set>
46
+ <Set name="port"><SystemProperty name="jetty.port" default="<%= rubber_env.jetty_port %>"/></Set>
47
+ <Set name="maxIdleTime">300000</Set>
48
+ <Set name="Acceptors">2</Set>
49
+ <Set name="statsOn">false</Set>
50
+ <Set name="confidentialPort">8443</Set>
51
+ <Set name="lowResourcesConnections">20000</Set>
52
+ <Set name="lowResourcesMaxIdleTime">5000</Set>
53
+ </New>
54
+ </Arg>
55
+ </Call>
56
+
57
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
58
+ <!-- To add a HTTPS SSL connector -->
59
+ <!-- mixin jetty-ssl.xml: -->
60
+ <!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
61
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
62
+
63
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
64
+ <!-- To add a HTTP blocking connector -->
65
+ <!-- mixin jetty-bio.xml: -->
66
+ <!-- java -jar start.jar etc/jetty.xml etc/jetty-bio.xml -->
67
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
68
+
69
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
70
+ <!-- To allow Jetty to be started from xinetd -->
71
+ <!-- mixin jetty-xinetd.xml: -->
72
+ <!-- java -jar start.jar etc/jetty.xml etc/jetty-xinetd.xml -->
73
+ <!-- -->
74
+ <!-- See jetty-xinetd.xml for further instructions. -->
75
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
76
+
77
+ <!-- =========================================================== -->
78
+ <!-- Set handler Collection Structure -->
79
+ <!-- =========================================================== -->
80
+ <Set name="handler">
81
+ <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
82
+ <Set name="handlers">
83
+ <Array type="org.eclipse.jetty.server.Handler">
84
+ <Item>
85
+ <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
86
+ </Item>
87
+ <Item>
88
+ <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
89
+ </Item>
90
+ <Item>
91
+ <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
92
+ </Item>
93
+ </Array>
94
+ </Set>
95
+ </New>
96
+ </Set>
97
+
98
+ <!-- =========================================================== -->
99
+ <!-- Configure the context deployer -->
100
+ <!-- A context deployer will deploy contexts described in -->
101
+ <!-- configuration files discovered in a directory. -->
102
+ <!-- The configuration directory can be scanned for hot -->
103
+ <!-- deployments at the configured scanInterval. -->
104
+ <!-- -->
105
+ <!-- This deployer is configured to deploy contexts configured -->
106
+ <!-- in the $JETTY_HOME/contexts directory -->
107
+ <!-- -->
108
+ <!-- =========================================================== -->
109
+ <Call name="addBean">
110
+ <Arg>
111
+ <New class="org.eclipse.jetty.deploy.ContextDeployer">
112
+ <Set name="contexts"><Ref id="Contexts"/></Set>
113
+ <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
114
+ <Set name="scanInterval">5</Set>
115
+ <Call name="setAttribute">
116
+ <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
117
+ <Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
118
+ </Call>
119
+ </New>
120
+ </Arg>
121
+ </Call>
122
+
123
+ <!-- =========================================================== -->
124
+ <!-- Configure the webapp deployer. -->
125
+ <!-- A webapp deployer will deploy standard webapps discovered -->
126
+ <!-- in a directory at startup, without the need for additional -->
127
+ <!-- configuration files. It does not support hot deploy or -->
128
+ <!-- non standard contexts (see ContextDeployer above). -->
129
+ <!-- -->
130
+ <!-- This deployer is configured to deploy webapps from the -->
131
+ <!-- $JETTY_HOME/webapps directory -->
132
+ <!-- -->
133
+ <!-- Normally only one type of deployer need be used. -->
134
+ <!-- -->
135
+ <!-- =========================================================== -->
136
+ <Call name="addBean">
137
+ <Arg>
138
+ <New class="org.eclipse.jetty.deploy.WebAppDeployer">
139
+ <Set name="contexts"><Ref id="Contexts"/></Set>
140
+ <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
141
+ <Set name="parentLoaderPriority">false</Set>
142
+ <Set name="extract">true</Set>
143
+ <Set name="allowDuplicates">false</Set>
144
+ <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
145
+ <Call name="setAttribute">
146
+ <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
147
+ <Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
148
+ </Call>
149
+ </New>
150
+ </Arg>
151
+ </Call>
152
+
153
+ <!-- =========================================================== -->
154
+ <!-- Configure Authentication Login Service -->
155
+ <!-- Realms may be configured for the entire server here, or -->
156
+ <!-- they can be configured for a specific web app in a context -->
157
+ <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
158
+ <!-- example). -->
159
+ <!-- =========================================================== -->
160
+ <Call name="addBean">
161
+ <Arg>
162
+ <New class="org.eclipse.jetty.security.HashLoginService">
163
+ <Set name="name">Test Realm</Set>
164
+ <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
165
+ <Set name="refreshInterval">0</Set>
166
+ </New>
167
+ </Arg>
168
+ </Call>
169
+
170
+ <!-- =========================================================== -->
171
+ <!-- Configure Request Log -->
172
+ <!-- Request logs may be configured for the entire server here, -->
173
+ <!-- or they can be configured for a specific web app in a -->
174
+ <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
175
+ <!-- for an example). -->
176
+ <!-- =========================================================== -->
177
+ <Ref id="RequestLog">
178
+ <Set name="requestLog">
179
+ <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
180
+ <Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
181
+ <Set name="filenameDateFormat">yyyy_MM_dd</Set>
182
+ <Set name="retainDays">90</Set>
183
+ <Set name="append">true</Set>
184
+ <Set name="extended">false</Set>
185
+ <Set name="logCookies">false</Set>
186
+ <Set name="LogTimeZone">GMT</Set>
187
+ </New>
188
+ </Set>
189
+ </Ref>
190
+
191
+ <!-- =========================================================== -->
192
+ <!-- extra options -->
193
+ <!-- =========================================================== -->
194
+ <Set name="stopAtShutdown">true</Set>
195
+ <Set name="sendServerVersion">true</Set>
196
+ <Set name="sendDateHeader">true</Set>
197
+ <Set name="gracefulShutdown">1000</Set>
198
+
199
+ </Configure>
@@ -0,0 +1,9 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-jetty.conf'
3
+ %>
4
+ <% PIDFILE = "/var/run/jetty.pid" %>
5
+ check process jetty with pidfile <%= PIDFILE %>
6
+ group jetty-<%= RUBBER_ENV %>
7
+ start program = "<%= rubber_env.jetty_dir %>/bin/jetty.sh start"
8
+ stop program = "<%= rubber_env.jetty_dir %>/bin/jetty.sh stop"
9
+ if failed host <%= rubber_env.host %> port <%= rubber_env.jetty_port %> with timeout 10 seconds for 10 cycles then restart
@@ -0,0 +1,8 @@
1
+ jetty_version: 7.0.0.v20091005
2
+ jetty_prefix: /opt
3
+ jetty_dir: "#{jetty_prefix}/jetty"
4
+ jetty_port: 8080
5
+
6
+ roles:
7
+ jetty:
8
+ packages: [openjdk-6-jdk]
@@ -0,0 +1 @@
1
+ description: Jetty HTTP server and servlet container module
@@ -8,12 +8,12 @@
8
8
  <% PIDFILE = "#{RUBBER_ROOT}/tmp/pids/mongrel.#{PORT}.pid" %>
9
9
  check process mongrel-<%= PORT %> with pidfile <%= PIDFILE %>
10
10
  group mongrel-<%= RUBBER_ENV %>
11
- start program = "/bin/sh -c 'cd <%= RUBBER_ROOT %> && PATH=/usr/local/bin:$PATH && mongrel_rails cluster::start --clean --only <%= PORT %>'"
11
+ start program = "/bin/sh -c 'cd <%= RUBBER_ROOT %> && PATH=<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:$PATH && mongrel_rails cluster::start --clean --only <%= PORT %>'"
12
12
  <%
13
13
  # Stop gracefully - monit waits for stop to complete (since below process exits immediately, it must
14
14
  # wait for pid to disappear) before trying to start
15
15
  %>
16
- stop program = "/bin/sh -c 'cd <%= RUBBER_ROOT %> && PATH=/usr/local/bin:$PATH && mongrel_rails cluster::stop --clean --only <%= PORT %> && sleep 30 && mongrel_rails cluster::stop --clean --force --only <%= PORT %>'"
16
+ stop program = "/bin/sh -c 'cd <%= RUBBER_ROOT %> && PATH=<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:$PATH && mongrel_rails cluster::stop --clean --only <%= PORT %> && sleep 30 && mongrel_rails cluster::stop --clean --force --only <%= PORT %>'"
17
17
  if totalmem > 200.0 MB for 3 cycles then restart
18
18
  <%# monit needs to test on same same interface that mongrel is listening on (see mongrel_cluster.yml) %>
19
19
  if failed host <%= rubber_env.host %> port <%= PORT %> protocol http with timeout 10 seconds for 10 cycles then restart
@@ -0,0 +1,9 @@
1
+ <%
2
+ @path = '/etc/munin/plugin-conf.d/rubber'
3
+ %>
4
+
5
+ # munin-node clears out enviroment variables, so we need to add these in
6
+ # to make sure we are running the correct ruby (REE vs regular)
7
+ [*]
8
+ env.PATH /sbin:/usr/sbin:/usr/local/sbin:<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:/usr/bin:/bin
9
+ env.RUBYOPT rubygems
@@ -43,10 +43,10 @@ source ||= RUBBER_INSTANCES.for_role("mysql_slave").first
43
43
  source ||= RUBBER_INSTANCES.for_role("mysql_master").first
44
44
  db_host = source ? source.full_name : 'localhost'
45
45
 
46
- command = "mysql -u #{RUBBER_ENV.db_slave_user}"
47
- command << " --password=#{RUBBER_ENV.db_pass}"
46
+ command = "mysql -u #{RUBBER_CONFIG.db_slave_user}"
47
+ command << " --password=#{RUBBER_CONFIG.db_pass}"
48
48
  command << " -h #{db_host}"
49
- command << " #{RUBBER_ENV.db_name} --skip-column-names"
49
+ command << " #{RUBBER_CONFIG.db_name} --skip-column-names"
50
50
 
51
51
  # execute a sql query to get some data
52
52
  data = `echo "#{query}" | #{command}`
@@ -0,0 +1,34 @@
1
+ <%
2
+ @path = "/etc/munin/plugins/passenger_memory_status"
3
+ @perms = 0755
4
+ %>#!/usr/bin/env ruby
5
+ # put in /etc/munin/plugins and restart munin-node
6
+ # by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin
7
+ # NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats
8
+
9
+ def output_config
10
+ puts <<-END
11
+ graph_category App
12
+ graph_title Passenger memory stats
13
+ graph_vlabel megabytes
14
+
15
+ memory.label memory
16
+ END
17
+ exit 0
18
+ end
19
+
20
+ def output_values
21
+ status = `sudo <%= rubber_env.ruby_prefix %>/bin/passenger-memory-stats | tail -1`
22
+ unless $?.success?
23
+ $stderr.puts "failed executing passenger-memory-stats"
24
+ exit 1
25
+ end
26
+ status =~ /(\d+\.\d+)/
27
+ puts "memory.value #{$1}"
28
+ end
29
+
30
+ if ARGV[0] == "config"
31
+ output_config
32
+ else
33
+ output_values
34
+ end
@@ -3,4 +3,5 @@
3
3
  @additive = ["# munin passenger start", "# munin passenger end"]
4
4
  %>
5
5
 
6
- nobody ALL=(ALL) NOPASSWD: /usr/bin/passenger-status
6
+ nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_prefix %>/bin/passenger-status
7
+ nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_prefix %>/bin/passenger-memory-stats
@@ -21,7 +21,7 @@ END
21
21
  end
22
22
 
23
23
  def output_values
24
- status = `sudo /usr/bin/passenger-status`
24
+ status = `sudo <%= rubber_env.ruby_prefix %>/bin/passenger-status`
25
25
  unless $?.success?
26
26
  $stderr.puts "failed executing passenger-status"
27
27
  exit 1
@@ -1,5 +1,4 @@
1
1
  passenger_version: 2.2.5
2
- ruby_prefix: "#{use_enterprise_ruby ? '/usr/local' : '/usr'}"
3
2
  passenger_root: "#{ruby_prefix}/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}"
4
3
  passenger_ruby: "#{ruby_prefix}/bin/ruby"
5
4
  passenger_lib: "#{passenger_root}/ext/apache2/mod_passenger.so"
@@ -8,7 +8,7 @@ namespace :rubber do
8
8
  after "rubber:install_packages", "rubber:redis:custom_install"
9
9
 
10
10
  task :custom_install, :roles => :redis do
11
- custom_package('http://ftp.us.debian.org/debian/pool/main/r/redis/', 'redis-server', '1.01-1', '! -x /usr/bin/redis-server')
11
+ custom_package('http://ftp.us.debian.org/debian/pool/main/r/redis/', 'redis-server', '1.02-1', '! -x /usr/bin/redis-server')
12
12
  end
13
13
 
14
14
  desc "Stops the redis server"
@@ -5,4 +5,4 @@
5
5
  %>
6
6
 
7
7
  # backup redis DBs every hour
8
- 0 * * * * BACKUP_DIR=/mnt/redis_backups BACKUP_NAME=redis BACKUP_CMD="tar -czf %dir%/redis_%time_stamp%.tgz <%= rubber_env.redis_db_dir %>" <%= RUBBER_ROOT %>/script/cron-rake rubber:backup
8
+ 0 * * * * BACKUP_DIR=/mnt/redis_backups BACKUP_NAME=redis BACKUP_CMD="tar -czf \%dir\%/redis_\%time_stamp\%.tgz <%= rubber_env.redis_db_dir %>" <%= RUBBER_ROOT %>/script/cron-rake rubber:backup
@@ -5,7 +5,7 @@
5
5
  %>
6
6
 
7
7
  # incremental index once every 10 minutes
8
- */10 * * * * sudo -u rails <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:in:delta
8
+ */10 * * * * sudo -u <%= rubber_env.app_user %> <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:in:delta
9
9
 
10
10
  # full reindex daily at 4:35
11
- 35 4 * * * sudo -u rails <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:index
11
+ 35 4 * * * sudo -u <%= rubber_env.app_user %> <%= RUBBER_ROOT %>/script/cron-rake RUBBER_ENV=<%= RUBBER_ENV %> ts:index
@@ -4,7 +4,7 @@
4
4
 
5
5
  check process sphinx with pidfile <%= RUBBER_ROOT %>/log/searchd.<%= RUBBER_ENV %>.pid
6
6
  group sphinx-<%= RUBBER_ENV %>
7
- start program = "/usr/bin/sudo -u rails sh -c 'cd <%= RUBBER_ROOT %> && PATH=/usr/local/bin:$PATH RAILS_ENV=<%= RUBBER_ENV %> rake ts:start'"
8
- stop program = "/usr/bin/sudo -u rails sh -c 'cd <%= RUBBER_ROOT %> && PATH=/usr/local/bin:$PATH RAILS_ENV=<%= RUBBER_ENV %> rake ts:stop'"
7
+ start program = "/usr/bin/sudo -u rails sh -c 'cd <%= RUBBER_ROOT %> && PATH=<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:$PATH RAILS_ENV=<%= RUBBER_ENV %> rake ts:start'"
8
+ stop program = "/usr/bin/sudo -u rails sh -c 'cd <%= RUBBER_ROOT %> && PATH=<%= rubber_env.ruby_prefix %>/bin:/usr/local/bin:$PATH RAILS_ENV=<%= RUBBER_ENV %> rake ts:stop'"
9
9
  if failed host <%= rubber_env.host %> port 3312 with timeout 5 seconds for 5 cycles then restart
10
10
 
data/lib/rubber.rb CHANGED
@@ -14,7 +14,7 @@ module Rubber
14
14
  # We actually do NOT want the entire rails environment because it
15
15
  # complicates bootstrap (i.e. can't run config to create db because full
16
16
  # rails env needs db to exist as some plugin accesses model or something)
17
- rails_boot_file = File.join(RUBBER_ROOT, 'config', 'boot')
17
+ rails_boot_file = File.join(RUBBER_ROOT, 'config', 'boot.rb')
18
18
  require(rails_boot_file) if File.exists? rails_boot_file
19
19
 
20
20
  if defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER
@@ -79,6 +79,10 @@ module Rubber
79
79
  replace(receiver)
80
80
  end
81
81
 
82
+ def rubber_instances
83
+ @rubber_instances ||= Rubber::Configuration::rubber_instances
84
+ end
85
+
82
86
  def [](name)
83
87
  value = super(name)
84
88
  value = global[name] if global && !value
@@ -136,10 +140,6 @@ module Rubber
136
140
  @full_host ||= "#{host}.#{domain}" rescue nil
137
141
  end
138
142
 
139
- def rubber_instances
140
- @rubber_instances ||= Rubber::Configuration::rubber_instances
141
- end
142
-
143
143
  # Forces role/host overrides into config
144
144
  def bind_config(global)
145
145
  global = global.clone()
@@ -89,6 +89,8 @@ namespace :rubber do
89
89
  rubber_instances.save()
90
90
  logger.info "Roles for #{instance_alias} are now:"
91
91
  logger.info instance.role_names.sort.join("\n")
92
+ logger.info ''
93
+ logger.info "Run 'cap rubber:bootstrap' if done adding roles"
92
94
  end
93
95
 
94
96
  desc <<-DESC
@@ -105,8 +105,8 @@ namespace :rubber do
105
105
  slices = []
106
106
  servers.each do |rolename, svrs|
107
107
  next if svrs.size == 0
108
- # figure out size of each slice by deviding server count by # of groups
109
- slice_size = svrs.size / (options.delete(:groups) || 2)
108
+ # figure out size of each slice by dividing server count by # of groups
109
+ slice_size = (Float(svrs.size) / (options.delete(:groups) || 2)).round
110
110
  slice_size = 1 if slice_size == 0
111
111
  slice_idx = 0
112
112
  svrs.each_slice(slice_size) do |srv_slice|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-06 00:00:00 -05:00
12
+ date: 2009-11-13 00:00:00 -05:00
13
13
  default_executable: vulcanize
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -104,7 +104,7 @@ files:
104
104
  - generators/vulcanize/templates/base/config/deploy.rb
105
105
  - generators/vulcanize/templates/base/config/rubber/common/crontab
106
106
  - generators/vulcanize/templates/base/config/rubber/common/monit-postfix.conf
107
- - generators/vulcanize/templates/base/config/rubber/common/profile.rc
107
+ - generators/vulcanize/templates/base/config/rubber/common/rubber.profile
108
108
  - generators/vulcanize/templates/base/config/rubber/deploy-setup.rb
109
109
  - generators/vulcanize/templates/base/config/rubber/rubber-dns.yml
110
110
  - generators/vulcanize/templates/base/config/rubber/rubber.yml
@@ -137,6 +137,11 @@ files:
137
137
  - generators/vulcanize/templates/haproxy/config/rubber/role/web_tools/haproxy-nginx.conf
138
138
  - generators/vulcanize/templates/haproxy/config/rubber/rubber-haproxy.yml
139
139
  - generators/vulcanize/templates/haproxy/templates.yml
140
+ - generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb
141
+ - generators/vulcanize/templates/jetty/config/rubber/role/jetty/jetty.xml
142
+ - generators/vulcanize/templates/jetty/config/rubber/role/jetty/monit-jetty.conf
143
+ - generators/vulcanize/templates/jetty/config/rubber/rubber-jetty.yml
144
+ - generators/vulcanize/templates/jetty/templates.yml
140
145
  - generators/vulcanize/templates/memcached/config/memcached.yml
141
146
  - generators/vulcanize/templates/memcached/config/rubber/common/memcached.yml
142
147
  - generators/vulcanize/templates/memcached/config/rubber/role/memcached/memcached.conf
@@ -158,6 +163,7 @@ files:
158
163
  - generators/vulcanize/templates/monit/templates.yml
159
164
  - generators/vulcanize/templates/munin/config/rubber/common/monit-munin.conf
160
165
  - generators/vulcanize/templates/munin/config/rubber/common/munin-node.conf
166
+ - generators/vulcanize/templates/munin/config/rubber/common/munin-plugins.conf
161
167
  - generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb
162
168
  - generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-nginx.conf
163
169
  - generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf
@@ -200,6 +206,7 @@ files:
200
206
  - generators/vulcanize/templates/nginx/config/rubber/rubber-nginx.yml
201
207
  - generators/vulcanize/templates/nginx/templates.yml
202
208
  - generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb
209
+ - generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-memory.conf
203
210
  - generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger-sudoers.conf
204
211
  - generators/vulcanize/templates/passenger/config/rubber/role/passenger/munin-passenger.conf
205
212
  - generators/vulcanize/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf
@@ -1,9 +0,0 @@
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 %>"