brightbox 2.0.3 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/brightbox CHANGED
@@ -29,15 +29,14 @@ require 'optparse'
29
29
  require 'brightbox/version'
30
30
 
31
31
  @options = {}
32
- @progname = File.basename($0)
33
32
 
34
33
  def has_required_options?
35
34
  [@server].all?
36
35
  end
37
36
 
38
- OptionParser.new do |opts|
37
+ opts = OptionParser.new do |opts|
39
38
  opts.banner = "Set up your Rails application for deployment\n"
40
- opts.banner << "Usage: #{@progname} [options] <directory_name>\n\n"
39
+ opts.banner << "Usage: #{opts.program_name} [options] <directory_name>\n\n"
41
40
 
42
41
  opts.on("-n APPLICATION_NAME", "--name APPLICATION_NAME",
43
42
  "Name of application (a short useful",
@@ -57,16 +56,6 @@ OptionParser.new do |opts|
57
56
  "(e.g: example-001.vm.brightbox.net)\n"
58
57
  ) { |value| @server = value }
59
58
 
60
- opts.on_tail("-h", "--help", "Displays this help page") do
61
- puts opts
62
- exit 0
63
- end
64
-
65
- opts.on_tail("-v", "--version", "Displays the version number") do
66
- puts "#{@progname}: version #{Brightbox::VERSION}"
67
- exit 0
68
- end
69
-
70
59
  begin
71
60
  opts.parse!(ARGV)
72
61
  raise OptionParser::ParseError,
@@ -79,7 +68,7 @@ OptionParser.new do |opts|
79
68
  end
80
69
 
81
70
 
82
- abort "Please specify the directory containing the Rails app, e.g. '#{@progname} .'" if ARGV.empty?
71
+ abort "Please specify the directory containing the Rails app, e.g. '#{opts.program_name} .'" if ARGV.empty?
83
72
  abort "Too many arguments; please provide a single directory name." unless ARGV.length == 1
84
73
  abort "'#{ARGV.first}' does not exist." unless File.exists?(ARGV.first)
85
74
  abort "'#{ARGV.first}' is not a directory." unless File.directory?(ARGV.first)
@@ -94,14 +83,14 @@ end
94
83
 
95
84
  files = {
96
85
  "Capfile" => unindent(<<-FILE),
97
- # Generated with '#{@progname}' on #{Time.now}
86
+ # Generated with '#{opts.program_name}' on #{Time.now}
98
87
  load 'deploy' if respond_to?(:namespace) # cap2 differentiator
99
88
  Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
100
89
  load 'config/deploy'
101
90
  FILE
102
91
 
103
92
  "lib/tasks/bbgem.rake" => unindent(<<-FILE),
104
- # Generated with '#{@progname}' on #{Time.now}
93
+ # Generated with '#{opts.program_name}' on #{Time.now}
105
94
  unless Rake::Task.task_defined?("gems:install")
106
95
  def install_gems
107
96
  gems={
@@ -187,7 +176,7 @@ end
187
176
  FILE
188
177
 
189
178
  "config/deploy.rb" => unindent(<<-FILE),
190
- ## Generated with '#{@progname}' on #{Time.now}
179
+ ## Generated with '#{opts.program_name}' on #{Time.now}
191
180
  gem 'brightbox', '>=#{Brightbox::VERSION}'
192
181
  require 'brightbox/recipes'
193
182
 
@@ -216,16 +205,44 @@ end
216
205
 
217
206
  ## Local Shared Area
218
207
  # These are the list of files and directories that you want
219
- # to share between all the releases of your application.
208
+ # to share between the releases of your application on a particular
209
+ # server. It uses the same shared area as the log files.
210
+ #
211
+ # NOTE: local areas trump global areas, allowing you to have some
212
+ # servers using local assets if required.
213
+ #
220
214
  # So if you have an 'upload' directory in public, add 'public/upload'
221
215
  # to the :local_shared_dirs array.
222
216
  # If you want to share the database.yml add 'config/database.yml'
223
217
  # to the :local_shared_files array.
218
+ #
224
219
  # The shared area is prepared with 'deploy:setup' and all the shared
225
220
  # items are symlinked in when the code is updated.
226
221
  # set :local_shared_dirs, %w(public/upload)
227
222
  # set :local_shared_files, %w(config/database.yml)
228
223
 
224
+ ## Global Shared Area
225
+ # These are the list of files and directories that you want
226
+ # to share between all releases of your application across all servers.
227
+ # For it to work you need a directory on a network file server shared
228
+ # between all your servers. Specify the path to the root of that area
229
+ # in :global_shared_path. Defaults to the same value as :shared_path.
230
+ # set :global_shared_path, "/srv/share/myapp"
231
+ #
232
+ # NOTE: local areas trump global areas, allowing you to have some
233
+ # servers using local assets if required.
234
+ #
235
+ # Beyond that it is the same as the local shared area.
236
+ # So if you have an 'upload' directory in public, add 'public/upload'
237
+ # to the :global_shared_dirs array.
238
+ # If you want to share the database.yml add 'config/database.yml'
239
+ # to the :global_shared_files array.
240
+ #
241
+ # The shared area is prepared with 'deploy:setup' and all the shared
242
+ # items are symlinked in when the code is updated.
243
+ # set :global_shared_dirs, %w(public/upload)
244
+ # set :global_shared_files, %w(config/database.yml)
245
+
229
246
  # SSL Certificates. If you specify an SSL certificate name then
230
247
  # the gem will create an 'https' configuration for this application
231
248
  # TODO: Upload and install the keys on the server
@@ -234,6 +251,15 @@ end
234
251
  # or
235
252
  # set :ssl_certificate, "name_of_installed_certificate"
236
253
 
254
+ ## Static asset caching.
255
+ # By default static assets served directly by the web server are
256
+ # cached by the client web browser for 10 years, and cache invalidation
257
+ # of static assets is handled by the Rails helpers using asset
258
+ # timestamping.
259
+ # You may need to adjust this value if you have hard coded static
260
+ # assets, or other special cache requirements. The value is in seconds.
261
+ # set :max_age, 315360000
262
+
237
263
  # SSH options. The forward agent option is used so that loopback logins
238
264
  # with keys work properly
239
265
  # ssh_options[:forward_agent] = true
@@ -261,12 +287,26 @@ end
261
287
  # set :scm, :subversion
262
288
 
263
289
  ## Mongrel settings
264
- # Host where mongrel lives. Defaults to the app server
265
- # set :mongrel_host, "127.0.0.1"
290
+ # Addresses that Mongrel listens on. Defaults to :local
291
+ # Use :remote if your mongrels are on a different host to the web
292
+ # server.
293
+ # set :mongrel_host, :local
294
+ # set :mongrel_host, :remote
295
+ # set :mongrel_host, "192.168.1.1"
266
296
  # Port number where mongrel starts. Defaults to 9200
267
297
  # set :mongrel_port, 9200
268
298
  # Number of mongrel servers to start. Defaults to 2
269
299
  # set :mongrel_servers, 2
300
+
301
+ ## Mongrel monitoring settings
302
+ # Url to check to make sure application is working.
303
+ # Defaults to "http://localhost"
304
+ # set :mongrel_check_url, "http://localhost"
305
+ # set :mongrel_check_url, "http://user:password@localhost/path/to/check"
306
+ # Maximum amount of memory to use per mongrel instance. Default 110Mb
307
+ # set :mongrel_max_memory, 110
308
+ # Maximum cpu allowable per mongrel. Defaults to 80%
309
+ # set :mongrel_max_cpu, 80
270
310
 
271
311
  ## Deployment settings
272
312
  # The brightbox gem deploys as the user 'rails' by default and
data/brightbox-gemspec.rb CHANGED
@@ -30,7 +30,7 @@ end
30
30
  @server = Gem::Specification.new do |s|
31
31
  add_common(s)
32
32
  s.name = "brightbox-server-tools"
33
- s.files = FileList["LICENSE", "Rakefile", "*.rb", "bin/railsapp-*","{lib,spec}/**/*.rb"].exclude(/recipe/).to_a
33
+ s.files = FileList["LICENSE", "Rakefile", "*.rb", "bin/railsapp-*","lib/**/*.{rb,gz}"].exclude(/recipe/).to_a
34
34
  s.summary = "Brightbox Server configuration scripts"
35
35
  s.executables = FileList["bin/railsapp-*"].sub(/bin\//,'')
36
36
  end
@@ -39,7 +39,7 @@ end
39
39
  add_common(s)
40
40
  s.name = "brightbox"
41
41
  s.files = FileList["LICENSE", "Rakefile", "*.rb", "lib/**/*.rb","bin/brightbox"].exclude("lib/brightbox/webserver-common.rb").to_a
42
- s.add_dependency("capistrano", ">= 2.3")
42
+ s.add_dependency("capistrano", ">= 2.5")
43
43
  s.summary = "Brightbox rails deployment scripts for Capistrano"
44
44
  s.executable = 'brightbox'
45
45
  end
@@ -0,0 +1,24 @@
1
+ # Brightbox - Easy Ruby Web Application Deployment
2
+ # Copyright (C) 2008, Neil Wilson, 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
+
21
+ def deploy_maintenance_page(system_directory)
22
+ maintenance_site = File.join(File.dirname(__FILE__),"maintenance-site.tar.gz")
23
+ system ("tar --directory #{system_directory} --extract --gzip --file #{maintenance_site}")
24
+ end
@@ -20,7 +20,9 @@
20
20
  # Hook tasks into the standard deployment system
21
21
 
22
22
  after "deploy:setup",
23
+ "deploy:shared:global:setup",
23
24
  "deploy:shared:local:setup",
25
+ "configure:maintenance",
24
26
  "configure:logrotation",
25
27
  "configure:monit",
26
28
  "configure:mongrel",
@@ -31,15 +33,13 @@ after "deploy:cold",
31
33
  "deploy:monit:reload"
32
34
 
33
35
  after "deploy:finalize_update",
36
+ "deploy:shared:global:symlink",
34
37
  "deploy:shared:local:symlink",
35
- "gems:install"
38
+ "deploy:rake_tasks"
36
39
 
37
40
  after "deploy:update",
38
41
  "deploy:cleanup"
39
42
 
40
- before "deploy:migrate",
41
- "db:check:config",
42
- "db:create"
43
43
 
44
44
  after "deploy:start",
45
45
  "deploy:web:reload_if_new"
@@ -19,34 +19,34 @@
19
19
  #
20
20
 
21
21
  def monit_setup
22
- "/usr/bin/railsapp-monit"
22
+ "railsapp-monit"
23
23
  end
24
24
  depend :remote, :command, monit_setup
25
25
 
26
26
  def apache_setup
27
- "/usr/bin/railsapp-apache"
27
+ "railsapp-apache"
28
28
  end
29
29
  depend :remote, :command, apache_setup
30
30
 
31
31
  def nginx_setup
32
- "/usr/bin/railsapp-nginx"
32
+ "railsapp-nginx"
33
33
  end
34
34
  depend :remote, :command, nginx_setup
35
35
 
36
36
  def mongrel_setup
37
- "/usr/bin/railsapp-mongrel"
37
+ "railsapp-mongrel"
38
38
  end
39
39
  depend :remote, :command, mongrel_setup
40
40
 
41
41
  def logrotate_setup
42
- "/usr/bin/railsapp-logrotate"
42
+ "railsapp-logrotate"
43
43
  end
44
44
  depend :remote, :command, logrotate_setup
45
45
 
46
- def mysql_setup
47
- "/usr/bin/railsapp-check"
46
+ def maintenance_setup
47
+ "railsapp-maintenance"
48
48
  end
49
- depend :remote, :command, mysql_setup
49
+ depend :remote, :command, maintenance_setup
50
50
 
51
51
  namespace :configure do
52
52
 
@@ -66,15 +66,24 @@ namespace :configure do
66
66
 
67
67
  }
68
68
  task webserver, :roles => :web, :except => {:no_release => true} do
69
+ app_hosts = case mongrel_host
70
+ when :local
71
+ "localhost"
72
+ when :remote
73
+ roles[:app].servers.join(",")
74
+ else
75
+ mongrel_host
76
+ end
69
77
  sudo on_one_line( <<-END
70
78
  #{send(webserver.to_s + "_setup")}
71
79
  -n #{application}
72
80
  -d #{domain}
73
81
  #{'-a '+domain_aliases if domain_aliases}
74
82
  -w #{File.join(current_path, 'public')}
75
- -h #{mongrel_host}
83
+ -h #{app_hosts}
76
84
  -p #{mongrel_port}
77
85
  -s #{mongrel_servers}
86
+ #{'-m '+max_age if max_age}
78
87
  #{'-c '+ssl_certificate if ssl_certificate}
79
88
  #{'-k '+ssl_key if ssl_key}
80
89
  END
@@ -87,22 +96,31 @@ end
87
96
  on the specified ports of the application server(s).
88
97
 
89
98
  :application Name of the application
90
- :mongrel_host Name of application layer host (default localhost)
99
+ :mongrel_host Address for mongrels to listen to (default localhost)
91
100
  :mongrel_port Start port of the mongrel cluster (default 8000)
92
101
  :mongrel_servers Number of servers on app host (default 2)
93
102
  :mongrel_pid_file The name of the file containing the mongrel PID
94
103
 
95
104
  }
96
105
  task :mongrel, :roles => :app, :except => {:no_release => true} do
106
+ listen_address = case mongrel_host
107
+ when :local
108
+ "localhost"
109
+ when :remote
110
+ "0.0.0.0"
111
+ else
112
+ mongrel_host
113
+ end
97
114
  sudo on_one_line( <<-END
98
115
  #{mongrel_setup}
99
116
  -n #{application}
100
117
  -r #{current_path}
101
118
  -p #{mongrel_port}
102
119
  -s #{mongrel_servers}
103
- -h #{mongrel_host}
120
+ -h #{listen_address}
104
121
  -C #{mongrel_config_file}
105
122
  -P #{mongrel_pid_file}
123
+ -e #{rails_env}
106
124
  END
107
125
  )
108
126
  end
@@ -117,17 +135,26 @@ end
117
135
  :mongrel_servers Number of servers on app host (default 2)
118
136
 
119
137
  }
120
- task :monit, :except => {:no_release => true} do
138
+ task :monit, :roles => :app, :except => {:no_release => true} do
139
+ listen_address = case mongrel_host
140
+ when :local, :remote
141
+ "localhost"
142
+ else
143
+ mongrel_host
144
+ end
121
145
  sudo on_one_line( <<-END
122
146
  #{monit_setup}
123
147
  -n #{application}
124
148
  -u #{user}
125
149
  -r #{current_path}
126
- -h #{mongrel_host}
150
+ -h #{listen_address}
127
151
  -p #{mongrel_port}
128
152
  -s #{mongrel_servers}
129
153
  -C #{mongrel_config_file}
130
154
  -P #{mongrel_pid_file}
155
+ -U #{mongrel_check_url}
156
+ -m #{mongrel_max_memory}
157
+ -c #{mongrel_max_cpu}
131
158
  END
132
159
  )
133
160
  end
@@ -152,6 +179,13 @@ end
152
179
  )
153
180
  end
154
181
 
182
+ desc %Q{
183
+ [internal]Create the default maintenance website on the appropriate web servers in the shared area.
184
+ }
185
+ task :maintenance, :roles => :web, :except => {:no_release => true} do
186
+ run "#{maintenance_setup} #{shared_path}/system"
187
+ end
188
+
155
189
  desc %Q{
156
190
  [internal]Run the check command if this application hasn't been
157
191
  deployed yet
@@ -167,12 +201,5 @@ end
167
201
  end
168
202
  end
169
203
 
170
- desc %Q{
171
- [internal]Check the current database.yml file and update the
172
- details from the .my.cnf file on the server if it exists.
173
- }
174
- task :mysql, :roles => :db, :only => {:primary => true} do
175
- try_sudo "#{mysql_setup} -n #{application} #{latest_release}/config/database.yml"
176
- end
177
204
 
178
205
  end
@@ -66,10 +66,15 @@ namespace :deploy do
66
66
  namespace :web do
67
67
 
68
68
  desc %Q{
69
- Reload the apache webserver
69
+ Reload the webserver
70
70
  }
71
71
  task :reload, :roles => :web, :except => {:no_release => true } do
72
- sudo "/usr/sbin/invoke-rc.d apache2 reload"
72
+ %w(apache2 nginx).each do |webserver|
73
+ initscript = "/etc/init.d/#{webserver}"
74
+ sudo %Q{
75
+ sh -c '[ -f #{initscript} ] && #{initscript} reload || true'
76
+ }
77
+ end
73
78
  end
74
79
 
75
80
  desc %Q{
@@ -80,6 +85,30 @@ namespace :deploy do
80
85
  reload if releases.length == 1
81
86
  end
82
87
 
88
+ def maintenance_page
89
+ "#{current_path}/public/system/maintenance.html"
90
+ end
91
+
92
+ desc %Q{
93
+ Return a 503 Service Temporarily Unavailable error code and display \
94
+ the 'system maintenance' page.
95
+ }
96
+ task :disable, :roles => :web, :except => { :no_release => true } do
97
+ on_rollback {
98
+ run "rm #{maintenance_page}"
99
+ }
100
+ run "ln -s #{File.dirname(maintenance_page)}/index.html #{maintenance_page}"
101
+ end
102
+
103
+ desc %Q{
104
+ Makes the application web-accessible again. Removes the link \
105
+ to the maintenance area.
106
+ }
107
+ task :enable, :roles => :web, :except => { :no_release => true } do
108
+ run "rm #{maintenance_page}"
109
+ end
110
+
111
+
83
112
  end
84
113
 
85
114
  namespace :monit do
@@ -101,4 +130,30 @@ namespace :deploy do
101
130
  cold
102
131
  end
103
132
 
133
+ namespace :rake_tasks do
134
+
135
+ desc %Q{
136
+ Execute Rake tasks that need to be run once per system
137
+ }
138
+ task :singleton, :roles => :db, :only => {:primary => true} do
139
+ run rake_task("db:check:config")
140
+ run rake_task("db:create")
141
+ end
142
+
143
+ desc %Q{
144
+ Execute Rake tasks that need to be run on all deployments
145
+ }
146
+ task :global, :except => {:no_release => true} do
147
+ gems.install
148
+ end
149
+
150
+ desc %Q{
151
+ Execute Rake tasks
152
+ }
153
+ task :default do
154
+ singleton
155
+ global
156
+ end
157
+ end
158
+
104
159
  end
@@ -20,11 +20,32 @@
20
20
 
21
21
  namespace :gems do
22
22
 
23
+ def gem_dependencies?
24
+ (fetch(:dependencies,{})[:remote]||{})[:gem]
25
+ end
26
+
27
+ def install_gems
28
+ deps = gem_dependencies?
29
+ deps.each do |gemspec|
30
+ gem = gemspec[0]
31
+ version = gemspec[1]
32
+ puts "Checking for #{gem} at #{version}"
33
+ sudo %Q{sh -c "
34
+ gem spec #{gem} --version '#{version}' 2>/dev/null|egrep -q '^name:' ||
35
+ sudo gem install -y --no-ri --no-rdoc --version '#{version}' #{gem}"
36
+ }
37
+ end
38
+ end
39
+
23
40
  desc %Q{
24
41
  [internal]Run the gems install task in the application.
25
42
  }
26
- task :install, :roles => :app do
27
- sudo rake_task("gems:install")
43
+ task :install, :except => {:no_release => true} do
44
+ if gem_dependencies?
45
+ install_gems
46
+ else
47
+ sudo rake_task("gems:install")
48
+ end
28
49
  end
29
50
 
30
51
  end
@@ -17,16 +17,44 @@
17
17
  # Public License along with this program. If not, see
18
18
  # <http://www.gnu.org/licenses/>.
19
19
  #
20
- # Manage the local shared area
20
+ # Manage the shared areas
21
21
 
22
22
  namespace :deploy do
23
23
  namespace :shared do
24
+
25
+ def fetch_shared_dirs(shared_files, shared_dirs, shared_path)
26
+ dirs = shared_files.to_a.collect do |file|
27
+ File.join(shared_path, File.dirname(file))
28
+ end
29
+ dirs += shared_dirs.to_a.collect do |dir|
30
+ File.join(shared_path, dir)
31
+ end
32
+ end
33
+
34
+ def setup_shared_dirs(shared_files, shared_dirs, shared_path)
35
+ dirs = fetch_shared_dirs(shared_files, shared_dirs, shared_path)
36
+ dir_list = dirs.join(' ')
37
+ run "#{try_sudo} mkdir -p #{dir_list} && #{try_sudo} chmod g+w #{dir_list}" unless dirs.empty?
38
+ end
39
+
40
+ def create_shared_links(shared_files, shared_dirs, shared_path)
41
+ resources = shared_dirs.to_a+shared_files.to_a
42
+ run %Q{
43
+ cd #{latest_release} &&
44
+ rm -rf #{resources.join(' ')}
45
+ }
46
+ links = resources.collect do |resource|
47
+ "ln -sf #{File.join(shared_path,resource)} #{File.join(latest_release, resource)}"
48
+ end.join(" && ")
49
+ run links unless links.empty?
50
+ end
51
+
24
52
  namespace :local do
25
53
 
26
54
  desc %Q(
27
55
  [internal] Creates shared directories. This is called by the setup
28
- routine to create the directory structure within the shared area. It
29
- references two arrays.
56
+ routine to create the directory structure within the shared area
57
+ referenced by :shared_path. It references two arrays.
30
58
 
31
59
  :local_shared_files - the list of files that should be shared
32
60
  between releases.
@@ -34,13 +62,7 @@ namespace :deploy do
34
62
  shared between releases.
35
63
  )
36
64
  task :setup, :except => {:no_release => true} do
37
- dirs = local_shared_files.collect do |file|
38
- File.join(shared_path, File.dirname(file))
39
- end
40
- dirs += local_shared_dirs.collect do |dir|
41
- File.join(shared_path, dir)
42
- end
43
- try_sudo "umask 02 && mkdir -p #{dirs.join(' ')}" unless dirs.empty?
65
+ setup_shared_dirs(local_shared_files, local_shared_dirs, shared_path)
44
66
  end
45
67
 
46
68
  desc %Q{
@@ -49,16 +71,36 @@ namespace :deploy do
49
71
  :local_shared_files
50
72
  }
51
73
  task :symlink, :except => {:no_release => true} do
52
- resources = local_shared_dirs+local_shared_files
53
- run %Q{
54
- cd #{latest_release} &&
55
- rm -rf #{resources.join(' ')}
56
- }
57
- links = resources.collect do |resource|
58
- "ln -sf #{File.join(shared_path,resource)} #{File.join(latest_release, resource)}"
59
- end.join(" && ")
60
- run links unless links.empty?
74
+ create_shared_links(local_shared_files, local_shared_dirs, shared_path)
61
75
  end
76
+ end
77
+
78
+ namespace :global do
79
+
80
+ desc %Q(
81
+ [internal] Creates shared directories in the global area referenced
82
+ by :global_shared_path. This is called by the setup routine to
83
+ create the directory structure within the shared area. It references
84
+ two arrays.
85
+
86
+ :global_shared_files - the list of files that should be shared
87
+ between all releases on all servers.
88
+ :global_shared_dirs - the list of directories that should be
89
+ shared between all releases on all servers.
90
+ )
91
+ task :setup, :except => {:no_release => true} do
92
+ setup_shared_dirs(global_shared_files, global_shared_dirs, global_shared_path)
93
+ end
94
+
95
+ desc %Q{
96
+ [internal] Sets up the symlinks between the latest release and all
97
+ the shared items described in :global_shared_dirs and
98
+ :global_shared_files
99
+ }
100
+ task :symlink, :except => {:no_release => true} do
101
+ create_shared_links(global_shared_files, global_shared_dirs, global_shared_path)
102
+ end
103
+
62
104
 
63
105
  end
64
106
  end
@@ -22,23 +22,35 @@ _cset :mongrel_pid_file, "tmp/pids/mongrel.pid" #Stores Process ID for Mongrels
22
22
  _cset :log_max_size, "100M" #Size at which to rotate log
23
23
  _cset :log_keep, "10" #Keep this many compressed logs
24
24
  _cset(:log_dir) {File.join(current_path, 'log')}
25
- _cset :mongrel_host, "localhost"
25
+ _cset :mongrel_host, :local
26
26
  _cset :mongrel_port, 9200
27
27
  _cset :mongrel_servers, 2
28
28
  _cset(:mongrel_config_file) {File.join(deploy_to, "#{application}_mongrel_config.yml")}
29
+ case mongrel_host
30
+ when :local, :remote
31
+ _cset :mongrel_check_url, "http://localhost"
32
+ else
33
+ _cset :mongrel_check_url, "http://#{mongrel_host}"
34
+ end
35
+ _cset :mongrel_max_memory, 110
36
+ _cset :mongrel_max_cpu, 80
29
37
  _cset(:domain) { abort "You need to set the :domain variable, e.g set :domain 'www.example.com'" }
30
38
  _cset :domain_aliases, nil
39
+ _cset :max_age, nil
31
40
  _cset :user, "rails"
32
41
  _cset :runner, user
33
42
  _cset :use_sudo, false
34
43
  _cset :ssl_certificate, nil
35
44
  _cset :ssl_key, nil
45
+ _cset :rails_env, "production"
36
46
  ssh_options[:forward_agent] = true
37
47
 
38
48
  # Default system dependencies
39
- depend :remote, :gem, "rails", ">=2"
40
49
  depend :remote, :command, "mongrel_rails"
41
50
 
42
51
  # Default shared areas
43
52
  _cset :local_shared_dirs, []
44
53
  _cset :local_shared_files, []
54
+ _cset :global_shared_dirs, []
55
+ _cset :global_shared_files, []
56
+ _cset(:global_shared_path) { shared_path }
@@ -1,3 +1,5 @@
1
1
  module Brightbox
2
- VERSION = "2.0.3"
2
+ VERSION = "2.1.2"
3
3
  end
4
+ # Set global scope version so that OptionParser picks it up.
5
+ ::Version = Brightbox::VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -10,17 +10,18 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-06-16 00:00:00 +01:00
13
+ date: 2008-10-08 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: capistrano
18
+ type: :runtime
18
19
  version_requirement:
19
20
  version_requirements: !ruby/object:Gem::Requirement
20
21
  requirements:
21
22
  - - ">="
22
23
  - !ruby/object:Gem::Version
23
- version: "2.3"
24
+ version: "2.5"
24
25
  version:
25
26
  description:
26
27
  email: support@brightbox.co.uk
@@ -38,12 +39,13 @@ files:
38
39
  - lib/brightbox/recipes/variables.rb
39
40
  - lib/brightbox/recipes/gems.rb
40
41
  - lib/brightbox/recipes/helpers.rb
42
+ - lib/brightbox/recipes/shared_assets.rb
41
43
  - lib/brightbox/recipes/callbacks.rb
42
44
  - lib/brightbox/recipes/database.rb
43
45
  - lib/brightbox/recipes/deploy.rb
44
- - lib/brightbox/recipes/shared_local.rb
45
46
  - lib/brightbox/version.rb
46
47
  - lib/brightbox/recipes.rb
48
+ - lib/brightbox/maintenance.rb
47
49
  - bin/brightbox
48
50
  has_rdoc: false
49
51
  homepage: http://wiki.brightbox.co.uk/docs:thebrightboxgem
@@ -67,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
69
  requirements: []
68
70
 
69
71
  rubyforge_project: brightbox
70
- rubygems_version: 1.1.1
72
+ rubygems_version: 1.2.0
71
73
  signing_key:
72
74
  specification_version: 2
73
75
  summary: Brightbox rails deployment scripts for Capistrano