brightbox 0.23 → 0.24

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.
@@ -42,6 +42,7 @@ end
42
42
  @balancer_members = (@port..@port+@mongrels-1).collect {|i| " BalancerMember http://#{@mongrelhost}:#{i}" }.join("\n")
43
43
 
44
44
  TEMPLATE = <<EOT
45
+ # Created by the Brightbox Capistrano GEM at <%= Time.now %>
45
46
  <VirtualHost *:80>
46
47
  ServerName <%= @domain %>
47
48
  DocumentRoot <%= @webroot %>
@@ -58,16 +59,26 @@ TEMPLATE = <<EOT
58
59
  <%= @balancer_members %>
59
60
  </Proxy>
60
61
 
61
- ErrorLog /var/log/apache2/<%= @application %>_error_log
62
- CustomLog /var/log/apache2/<%= @application %>_log combined
62
+ ErrorLog /var/log/web/<%= @application %>.err
63
+ CustomLog /var/log/web/<%= @application %>.log combined
63
64
 
64
65
  # Rails specific rewrite rules
65
66
  Include /etc/apache2/brightbox-common
67
+
68
+ # Add any access limit directives here
69
+ <Location />
70
+ Allow from all
71
+ </Location>
66
72
  </VirtualHost>
67
73
  EOT
68
74
 
69
75
  template = ERB.new(TEMPLATE)
70
76
  config = template.result
77
+ filename = "/etc/apache2/sites-available/rails-#{@application}"
78
+ if File.exists?(filename)
79
+ FileUtils.mkdir_p("/etc/apache2/sites-archived")
80
+ FileUtils.cp filename, "/etc/apache2/sites-archived/rails-#{@application}.#{Time.now.strftime('%y%m%d%H%M%S')}"
81
+ end
71
82
 
72
- File.open("/etc/apache2/sites-available/rails-#{@application}", "w") { |f| f.write config }
73
- FileUtils.ln_s("/etc/apache2/sites-available/rails-#{@application}", "/etc/apache2/sites-enabled/rails-#{@application}", :force => true)
83
+ File.open(filename, "w") { |f| f.write config }
84
+ FileUtils.ln_s(filename, "/etc/apache2/sites-enabled/rails-#{@application}", :force => true)
@@ -54,9 +54,9 @@ check process mongrel_<%= @application %>_<%= port %> with pidfile <%= pidfile %
54
54
  with timeout 30 seconds
55
55
  then restart
56
56
 
57
- if totalmem > 110 Mb then restart
57
+ if mem > 110 Mb then restart
58
58
  #if cpu is greater than 60% for 2 cycles then alert
59
- if cpu > 90% for 5 cycles then restart
59
+ #if cpu > 90% for 5 cycles then restart
60
60
  #if loadavg(5min) greater than 10 for 8 cycles then restart
61
61
  if 3 restarts within 5 cycles then timeout
62
62
  <% end %>
@@ -47,6 +47,7 @@ end
47
47
  desc "Reload the monit daemon"
48
48
  task :monit_reload, :roles => :app do
49
49
  sudo "/usr/sbin/monit reload"
50
+ sleep 5
50
51
  end
51
52
 
52
53
  desc "Deploy the app to your Brightbox servers for the FIRST TIME. Sets up apache config starts mongrel."
@@ -56,8 +57,8 @@ task :cold_deploy do
56
57
  symlink
57
58
  end
58
59
 
59
- create_mysql_database
60
- load_schema
60
+ create_mysql_database # Fails if already exist to prevent data loss later
61
+ load_schema # WARNING: This wipes the tables
61
62
  migrate
62
63
  configure_mongrel_cluster
63
64
  monit_reload
@@ -66,6 +67,15 @@ task :cold_deploy do
66
67
  reload_apache
67
68
  end
68
69
 
70
+ desc "Rewrite the Apache and Monit configs and reloads the services"
71
+ task :reconfigure do
72
+ configure_mongrel_cluster
73
+ monit_reload
74
+ restart_mongrel_cluster
75
+ setup_apache
76
+ reload_apache
77
+ end
78
+
69
79
  desc "Deploy the app to your Brightbox servers"
70
80
  task :deploy do
71
81
  transaction do
@@ -83,7 +93,7 @@ desc "Create the mysql database named in the database.yml on the primary db serv
83
93
  task :create_mysql_database, :roles => :db, :primary => true do
84
94
  read_db_config
85
95
  if db_adapter == 'mysql'
86
- run "mysql -h #{db_host} --user=#{db_user} -p --execute=\"CREATE DATABASE #{db_name}\" || true" do |channel, stream, data|
96
+ run "mysql -h #{db_host} --user=#{db_user} -p --execute=\"CREATE DATABASE #{db_name}\"" do |channel, stream, data|
87
97
  if data =~ /^Enter password:/
88
98
  logger.info data, "[database on #{channel[:host]} asked for password]"
89
99
  channel.send_data "#{db_password}\n"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: brightbox
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.23"
7
- date: 2007-08-07 00:00:00 +01:00
6
+ version: "0.24"
7
+ date: 2007-11-02 00:00:00 +00:00
8
8
  summary: Brightbox rails deployment scripts for Capistrano
9
9
  require_paths:
10
10
  - lib
@@ -29,14 +29,14 @@ post_install_message:
29
29
  authors:
30
30
  - John Leach
31
31
  files:
32
- - bin/brightbox
33
32
  - bin/brightbox-apache
34
33
  - bin/brightbox-monit
34
+ - bin/brightbox
35
35
  - lib/brightbox
36
- - lib/brightbox/generators
37
36
  - lib/brightbox/recipes.rb
38
- - lib/brightbox/generators/brightbox
37
+ - lib/brightbox/generators
39
38
  - lib/brightbox/generators/loader.rb
39
+ - lib/brightbox/generators/brightbox
40
40
  - lib/brightbox/generators/brightbox/brightboxapache_generator.rb
41
41
  - lib/brightbox/generators/brightbox/brightbox_generator.rb
42
42
  - lib/brightbox/generators/brightbox/templates
@@ -63,7 +63,10 @@ dependencies:
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: "1.4"
66
+ version: 1.4.1
67
+ - - <
68
+ - !ruby/object:Gem::Version
69
+ version: "1.9"
67
70
  version:
68
71
  - !ruby/object:Gem::Dependency
69
72
  name: mongrel_cluster
@@ -72,5 +75,5 @@ dependencies:
72
75
  requirements:
73
76
  - - ">="
74
77
  - !ruby/object:Gem::Version
75
- version: 0.2.1
78
+ version: 1.0.2
76
79
  version: