brightbox-server-tools 2.1.2 → 2.2

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.
@@ -32,7 +32,7 @@ def standard_server_contents
32
32
  ServerName #{@domain}
33
33
  ServerAlias #{local_app_alias} #{@aliases}
34
34
  DocumentRoot #{@webroot}
35
-
35
+ #{rails_env_if_passenger}
36
36
  <Directory "#{@webroot}">
37
37
  Header set Cache-Control "max-age=#{@maxage}"
38
38
  Options FollowSymLinks
@@ -44,12 +44,7 @@ def standard_server_contents
44
44
  <Directory "#{@webroot}/system">
45
45
  Header set Cache-Control "no-cache"
46
46
  </Directory>
47
-
48
- # Configure mongrel_cluster
49
- <Proxy balancer://mongrel_cluster>
50
- #{balancer_members}
51
- </Proxy>
52
-
47
+ #{mongrel_balancer_configuration}
53
48
  ErrorLog /var/log/web/#{@application}.err
54
49
  CustomLog /var/log/web/#{@application}.log combined
55
50
 
@@ -64,15 +59,10 @@ def standard_server_contents
64
59
 
65
60
  # Rewrite index to check for static
66
61
  RewriteRule ^/$ /index.html [QSA]
67
-
62
+
68
63
  # Rewrite to check for Rails cached page
69
64
  RewriteRule ^([^.]+)$ $1.html [QSA]
70
-
71
- # Redirect all non-static requests to cluster
72
- RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
73
- RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)
74
- RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
75
-
65
+ #{mongrel_rewrite_configuration}
76
66
  # Deflate
77
67
  AddOutputFilterByType DEFLATE text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript
78
68
  BrowserMatch ^Mozilla/4 gzip-only-text/html
@@ -86,6 +76,43 @@ def standard_server_contents
86
76
  @
87
77
  end
88
78
 
79
+ def mongrel_balancer_configuration
80
+ unless @passenger
81
+ %Q@
82
+
83
+ # Configure mongrel_cluster
84
+ <Proxy balancer://mongrel_cluster>
85
+ #{balancer_members}
86
+ </Proxy>
87
+
88
+ @
89
+ end
90
+ end
91
+
92
+ def mongrel_rewrite_configuration
93
+ unless @passenger
94
+ %Q@
95
+
96
+ # Redirect all non-static requests to cluster
97
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
98
+ RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)
99
+ RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
100
+
101
+ @
102
+ end
103
+ end
104
+
105
+ def rails_env_if_passenger
106
+ if @passenger && @rails_env
107
+ %Q{RailsEnv #{@rails_env}}
108
+ end
109
+ end
110
+
111
+ def mongrel_ssl_header
112
+ unless @passenger
113
+ %Q{RequestHeader set X_FORWARDED_PROTO "https"}
114
+ end
115
+ end
89
116
 
90
117
  def http_config
91
118
  %Q@
@@ -103,12 +130,31 @@ def https_config
103
130
  SSLEngine On
104
131
  SSLCertificateFile #{@certificate_file}
105
132
  #{ssl_certificate_key}
106
- RequestHeader set X_FORWARDED_PROTO "https"
133
+ #{mongrel_ssl_header}
107
134
  #{standard_server_contents}
108
135
  </VirtualHost>
109
136
  @
110
137
  end
111
138
 
139
+ def apt_update
140
+ system %Q{sudo apt-get update}
141
+ end
142
+
143
+ def install_ree
144
+ system %Q{sudo apt-get install libruby1.8 --assume-yes}
145
+ end
146
+
147
+ def install_passenger
148
+ system %Q{sudo apt-get install libapache2-mod-passenger --assume-yes}
149
+ end
150
+
151
+ def brightbox_passenger_install
152
+ apt_update
153
+ unless use_ree
154
+ install_ree # For now - don't install Ruby Enterprise Edition unless told to
155
+ end
156
+ install_passenger
157
+ end
112
158
 
113
159
  def activate_modules(modules)
114
160
  enmod="/usr/sbin/a2enmod"
@@ -137,6 +183,10 @@ end
137
183
  #MAIN PROGRAM
138
184
  @apache_http_modules = %w(proxy_balancer proxy_http rewrite headers deflate)
139
185
  @apache_https_modules = %w(ssl)
186
+ if @passenger
187
+ brightbox_passenger_install
188
+ @apache_http_modules << "passenger"
189
+ end
140
190
 
141
191
  #Create a normal HTTP config
142
192
  @config=http_config
@@ -20,7 +20,7 @@
20
20
  require File.join(File.dirname(__FILE__),"lib/brightbox/version")
21
21
  def add_common(spec)
22
22
  spec.version = Brightbox::VERSION
23
- spec.authors = ["John Leach","Neil Wilson"]
23
+ spec.authors = ["John Leach","Neil Wilson","David Smalley"]
24
24
  spec.email = "support@brightbox.co.uk"
25
25
  spec.homepage = "http://wiki.brightbox.co.uk/docs:thebrightboxgem"
26
26
  spec.rubyforge_project = 'brightbox'
@@ -0,0 +1,21 @@
1
+ # Brightbox - Easy Ruby Web Application Deployment
2
+ # Copyright (C) 2008, David Smalley, Brightbox Systems
3
+ #
4
+ # This file is part of the Brightbox deployment system
5
+ #
6
+ # Brightbox gem is free software: you can redistribute it and/or modify it
7
+ # under the terms of the GNU Affero General Public License as published
8
+ # by the Free Software Foundation, either version 3 of the License,
9
+ # or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Affero General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Affero General
17
+ # Public License along with this program. If not, see
18
+ # <http://www.gnu.org/licenses/>.
19
+ #
20
+ Capistrano::Configuration.instance(true).load File.join(File.dirname(__FILE__), "recipes", "deploy", "passenger.rb")
21
+ Capistrano::Configuration.instance(true).load File.join(File.dirname(__FILE__), "recipes", "configure", "passenger.rb")
@@ -1,5 +1,5 @@
1
1
  module Brightbox
2
- VERSION = "2.1.2"
2
+ VERSION = "2.2"
3
3
  end
4
4
  # Set global scope version so that OptionParser picks it up.
5
5
  ::Version = Brightbox::VERSION
@@ -91,6 +91,19 @@ end
91
91
  "(e.g: www.example.org,www.example.net)"
92
92
  ) { |value| @aliases = value.to_s.split(',').join(' ')}
93
93
 
94
+ if WEBSERVER == "apache2"
95
+
96
+ opts.on("-r", "--passenger",
97
+ "Use phusion passenger (Apache only)",
98
+ "(Will ignore any mongrel values passed)"
99
+ ) { |value| @passenger = value }
100
+
101
+ opts.on("-e", "--railsenv ENV",
102
+ "Set RailsEnv for passenger (Apache only)"
103
+ ) { |value| @rails_env = value }
104
+
105
+ end
106
+
94
107
  opts.on("-p", "--port MONGREL_PORT", Integer,
95
108
  "Port of the first mongrel service",
96
109
  "(default: #{@port})"
metadata CHANGED
@@ -1,28 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-server-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: "2.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
8
8
  - Neil Wilson
9
+ - David Smalley
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2008-10-08 00:00:00 +01:00
14
+ date: 2009-01-09 00:00:00 +00:00
14
15
  default_executable:
15
16
  dependencies: []
16
17
 
17
18
  description:
18
19
  email: support@brightbox.co.uk
19
20
  executables:
20
- - railsapp-nginx
21
- - railsapp-maintenance
22
21
  - railsapp-apache
23
22
  - railsapp-logrotate
24
- - railsapp-monit
23
+ - railsapp-maintenance
25
24
  - railsapp-mongrel
25
+ - railsapp-monit
26
+ - railsapp-nginx
26
27
  extensions: []
27
28
 
28
29
  extra_rdoc_files: []
@@ -31,15 +32,16 @@ files:
31
32
  - LICENSE
32
33
  - Rakefile
33
34
  - brightbox-gemspec.rb
34
- - bin/railsapp-nginx
35
- - bin/railsapp-maintenance
36
35
  - bin/railsapp-apache
37
36
  - bin/railsapp-logrotate
38
- - bin/railsapp-monit
37
+ - bin/railsapp-maintenance
39
38
  - bin/railsapp-mongrel
39
+ - bin/railsapp-monit
40
+ - bin/railsapp-nginx
41
+ - lib/brightbox/maintenance.rb
42
+ - lib/brightbox/passenger.rb
40
43
  - lib/brightbox/version.rb
41
44
  - lib/brightbox/webserver-common.rb
42
- - lib/brightbox/maintenance.rb
43
45
  - lib/brightbox/maintenance-site.tar.gz
44
46
  has_rdoc: false
45
47
  homepage: http://wiki.brightbox.co.uk/docs:thebrightboxgem
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
65
  requirements: []
64
66
 
65
67
  rubyforge_project: brightbox
66
- rubygems_version: 1.2.0
68
+ rubygems_version: 1.3.1
67
69
  signing_key:
68
70
  specification_version: 2
69
71
  summary: Brightbox Server configuration scripts