brightbox 0.25 → 2.0.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.
@@ -0,0 +1,44 @@
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
+ # Provide default settings for variables
21
+ _cset :mongrel_pid_file, "tmp/pids/mongrel.pid" #Stores Process ID for Mongrels
22
+ _cset :log_max_size, "100M" #Size at which to rotate log
23
+ _cset :log_keep, "10" #Keep this many compressed logs
24
+ _cset(:log_dir) {File.join(current_path, 'log')}
25
+ _cset :mongrel_host, "localhost"
26
+ _cset :mongrel_port, 9200
27
+ _cset :mongrel_servers, 2
28
+ _cset(:mongrel_config_file) {File.join(deploy_to, "#{application}_mongrel_config.yml")}
29
+ _cset(:domain) { abort "You need to set the :domain variable, e.g set :domain 'www.example.com'" }
30
+ _cset :domain_aliases, nil
31
+ _cset :user, "rails"
32
+ _cset :runner, user
33
+ _cset :use_sudo, false
34
+ _cset :ssl_certificate, nil
35
+ _cset :ssl_key, nil
36
+ ssh_options[:forward_agent] = true
37
+
38
+ # Default system dependencies
39
+ depend :remote, :gem, "rails", ">=2"
40
+ depend :remote, :command, "mongrel_rails"
41
+
42
+ # Default shared areas
43
+ _cset :local_shared_dirs, []
44
+ _cset :local_shared_files, []
@@ -0,0 +1,3 @@
1
+ module Brightbox
2
+ VERSION = "2.0.1"
3
+ end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.25"
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
8
- autorequire: name
8
+ - Neil Wilson
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2007-12-28 00:00:00 +00:00
13
- default_executable: brightbox
13
+ date: 2008-06-10 00:00:00 +01:00
14
+ default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: capistrano
@@ -19,45 +20,33 @@ dependencies:
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.4.1
23
- - - <
24
- - !ruby/object:Gem::Version
25
- version: "1.9"
26
- version:
27
- - !ruby/object:Gem::Dependency
28
- name: mongrel_cluster
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 1.0.2
23
+ version: "2.3"
35
24
  version:
36
25
  description:
37
- email: john@brightbox.co.uk
26
+ email: support@brightbox.co.uk
38
27
  executables:
39
28
  - brightbox
40
- - brightbox-apache
41
- - brightbox-monit
42
29
  extensions: []
43
30
 
44
31
  extra_rdoc_files: []
45
32
 
46
33
  files:
47
- - bin/brightbox-apache
48
- - bin/brightbox-monit
49
- - bin/brightbox
50
- - lib/brightbox
34
+ - LICENSE
35
+ - Rakefile
36
+ - brightbox-gemspec.rb
37
+ - lib/brightbox/recipes/configure.rb
38
+ - lib/brightbox/recipes/variables.rb
39
+ - lib/brightbox/recipes/gems.rb
40
+ - lib/brightbox/recipes/helpers.rb
41
+ - lib/brightbox/recipes/callbacks.rb
42
+ - lib/brightbox/recipes/database.rb
43
+ - lib/brightbox/recipes/deploy.rb
44
+ - lib/brightbox/recipes/shared_local.rb
45
+ - lib/brightbox/version.rb
51
46
  - lib/brightbox/recipes.rb
52
- - lib/brightbox/generators
53
- - lib/brightbox/generators/loader.rb
54
- - lib/brightbox/generators/brightbox
55
- - lib/brightbox/generators/brightbox/brightboxapache_generator.rb
56
- - lib/brightbox/generators/brightbox/brightbox_generator.rb
57
- - lib/brightbox/generators/brightbox/templates
58
- - lib/brightbox/generators/brightbox/templates/deploy.rb
47
+ - bin/brightbox
59
48
  has_rdoc: false
60
- homepage: http://rubyforge.org/projects/brightbox/
49
+ homepage: http://wiki.brightbox.co.uk/docs:thebrightboxgem
61
50
  post_install_message:
62
51
  rdoc_options: []
63
52
 
@@ -77,8 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
66
  version:
78
67
  requirements: []
79
68
 
80
- rubyforge_project:
81
- rubygems_version: 0.9.5
69
+ rubyforge_project: brightbox
70
+ rubygems_version: 1.1.1
82
71
  signing_key:
83
72
  specification_version: 2
84
73
  summary: Brightbox rails deployment scripts for Capistrano
data/bin/brightbox-apache DELETED
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'optparse'
5
- require 'erb'
6
- require 'fileutils'
7
-
8
- @mongrelhost = "127.0.0.1"
9
- @port = 9200
10
- @mongrels = 2
11
-
12
- OptionParser.new do |opts|
13
- opts.banner = "Usage: #{$0} [options] [args]"
14
-
15
- opts.on("-n", "--name APPLICATION_NAME",
16
- "Name of application."
17
- ) { |value| @application = value }
18
- opts.on("-w", "--webroot WEB_ROOT",
19
- "path to web root"
20
- ) { |value| @webroot = value }
21
- opts.on("-d", "--domain DOMAIN_NAME",
22
- "Domain name for application."
23
- ) { |value| @domain = value }
24
- opts.on("-p", "--port MONGREL_PORT",
25
- "Port of the first mongrel sevuce"
26
- ) { |value| @port = value.to_i }
27
- opts.on("-s", "--servers MONGRELS",
28
- "Number of mongrel servers running"
29
- ) { |value| @mongrels = value.to_i }
30
- opts.on("-h", "--mongrelhost MONGREL_HOST",
31
- "ip/host where mongrel is running"
32
- ) { |value| @mongrelhost = value }
33
-
34
- if ARGV.empty?
35
- puts opts
36
- exit
37
- else
38
- opts.parse!(ARGV)
39
- end
40
- end
41
-
42
- @balancer_members = (@port..@port+@mongrels-1).collect {|i| " BalancerMember http://#{@mongrelhost}:#{i}" }.join("\n")
43
-
44
- TEMPLATE = <<EOT
45
- # Created by the Brightbox Capistrano GEM at <%= Time.now %>
46
- <VirtualHost *:80>
47
- ServerName <%= @domain %>
48
- DocumentRoot <%= @webroot %>
49
-
50
- <Directory "<%= @webroot %>">
51
- Options FollowSymLinks
52
- AllowOverride None
53
- Order allow,deny
54
- Allow from all
55
- </Directory>
56
-
57
- # Configure mongrel_cluster
58
- <Proxy balancer://mongrel_cluster>
59
- <%= @balancer_members %>
60
- </Proxy>
61
-
62
- ErrorLog /var/log/web/<%= @application %>.err
63
- CustomLog /var/log/web/<%= @application %>.log combined
64
-
65
- # Rails specific rewrite rules
66
- Include /etc/apache2/brightbox-common
67
-
68
- # Add any access limit directives here
69
- <Location />
70
- Allow from all
71
- </Location>
72
- </VirtualHost>
73
- EOT
74
-
75
- template = ERB.new(TEMPLATE)
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
82
-
83
- File.open(filename, "w") { |f| f.write config }
84
- FileUtils.ln_s(filename, "/etc/apache2/sites-enabled/rails-#{@application}", :force => true)
data/bin/brightbox-monit DELETED
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'optparse'
5
- require 'erb'
6
-
7
- @mongrelhost = "127.0.0.1"
8
- @port = 9200
9
- @mongrels = 2
10
- @railsenv = "production"
11
-
12
- OptionParser.new do |opts|
13
- opts.banner = "Usage: #{$0} [options] [args]"
14
-
15
- opts.on("-n", "--name APPLICATION_NAME",
16
- "Name of application."
17
- ) { |value| @application = value }
18
- opts.on("-r", "--railsroot RAILS_ROOT",
19
- "path to rails root"
20
- ) { |value| @railsroot = value }
21
- opts.on("-e", "--railsenv RAILS_ENV",
22
- "rails environment"
23
- ) { |value| @railsenv = value }
24
- opts.on("-p", "--port MONGREL_PORT",
25
- "Port of the first mongrel sevuce"
26
- ) { |value| @port = value.to_i }
27
- opts.on("-s", "--servers MONGRELS",
28
- "Number of mongrel servers running"
29
- ) { |value| @mongrels = value.to_i }
30
- opts.on("-h", "--mongrelhost MONGREL_HOST",
31
- "ip/host where mongrel is running"
32
- ) { |value| @mongrelhost = value }
33
-
34
- if ARGV.empty?
35
- puts opts
36
- exit
37
- else
38
- opts.parse!(ARGV)
39
- end
40
- end
41
-
42
- @mongrel_instances = (@port..@port+@mongrels-1).collect { |port| [port, "#{@railsroot}/log/mongrel.#{port}.pid"] }
43
-
44
- TEMPLATE = <<EOT
45
- <% @mongrel_instances.each do |port, pidfile| %>
46
- check process mongrel_<%= @application %>_<%= port %> with pidfile <%= pidfile %>
47
- group <%= @application %>
48
- start program = "/usr/bin/mongrel_rails start -d -c <%= @railsroot %> -p <%= port %> -e <%= @railsenv %> -P <%= pidfile %>"
49
- as uid rails and gid rails
50
- stop program = "/usr/bin/mongrel_rails stop -c <%= @railsroot %> -P <%= pidfile %> -w 20"
51
- as uid rails and gid rails
52
-
53
- if failed host <%= @mongrelhost %> port <%= port %> protocol http
54
- with timeout 30 seconds
55
- then restart
56
-
57
- if mem > 110 Mb then restart
58
- #if cpu is greater than 60% for 2 cycles then alert
59
- #if cpu > 90% for 5 cycles then restart
60
- #if loadavg(5min) greater than 10 for 8 cycles then restart
61
- if 3 restarts within 5 cycles then timeout
62
- <% end %>
63
- EOT
64
-
65
- template = ERB.new(TEMPLATE)
66
- config = template.result
67
-
68
- File.open("/etc/monit/conf.d/rails-#{@application}.monitrc", "w") { |f| f.write config }
@@ -1,26 +0,0 @@
1
- class BrightboxGenerator < Rails::Generator::NamedBase
2
- attr_reader :application_name
3
- attr_reader :domain_name
4
- attr_reader :server
5
-
6
- def initialize(runtime_args, runtime_options = {})
7
- super
8
- @application_name = self.file_name
9
- @domain_name = @args[0]
10
- @server = @args[1]
11
- end
12
-
13
- def manifest
14
- record do |m|
15
- m.directory "config"
16
- m.template "deploy.rb", File.join("config", "deploy.rb")
17
- end
18
- end
19
-
20
- protected
21
-
22
- # Override with your own usage banner.
23
- def banner
24
- "Usage: #{$0} brightbox ApplicationName DomainName BrightboxServer"
25
- end
26
- end
@@ -1,27 +0,0 @@
1
- class BrightboxapacheGenerator < Rails::Generator::NamedBase
2
- attr_reader :application_name
3
- attr_reader :domain_name
4
- attr_reader :port
5
- attr_reader :mongrels
6
-
7
- def initialize(runtime_args, runtime_options = {})
8
- super
9
- @application_name = self.file_name
10
- @domain_name = @args[0]
11
- @port = @args[1]
12
- @mongrels = @args[2]
13
- end
14
-
15
- def manifest
16
- record do |m|
17
- m.template "apache_config", @application_name
18
- end
19
- end
20
-
21
- protected
22
-
23
- # Override with your own usage banner.
24
- def banner
25
- "Usage: #{$0} brightbox_apache ApplicationName DomainName MongrelPort NumberOfMongrels"
26
- end
27
- end
@@ -1,41 +0,0 @@
1
- require 'brightbox/recipes'
2
-
3
- # The name of your application. Used for deployment directory and filenames
4
- # and apache configs
5
- set :application, "<%= singular_name %>"
6
-
7
- # Target directory for the application on the web and app servers.
8
- set :deploy_to, "/home/rails/#{application}"
9
-
10
- # Primary domain name of your application. Used in the Apache configs
11
- set :domain, "<%= domain_name %>"
12
-
13
- # Login user for ssh on your Brightbox server
14
- set :user, "rails"
15
-
16
- # URL of your source repository - there i
17
- set :repository, "svn+ssh://rails@<%= server %>/home/rails/subversion/<%= singular_name %>/trunk"
18
-
19
- role :web, "<%= server %>"
20
- role :app, "<%= server %>"
21
- role :db, "<%= server %>", :primary => true
22
-
23
- set :use_sudo, false
24
-
25
- set :mongrel_host, "127.0.0.1"
26
- set :mongrel_port, 9200
27
- set :mongrel_servers, 2
28
- set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml"
29
-
30
- # set :scm, :darcs # defaults to :subversion
31
- # set :svn, "/path/to/svn" # defaults to searching the PATH
32
- # set :darcs, "/path/to/darcs" # defaults to searching the PATH
33
- # set :cvs, "/path/to/cvs" # defaults to searching the PATH
34
- # set :gateway, "gate.host.com" # default to no gateway
35
-
36
- # =============================================================================
37
- # SSH OPTIONS
38
- # =============================================================================
39
- # ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key)
40
- # ssh_options[:port] = 25
41
-
@@ -1,40 +0,0 @@
1
- module Brightbox
2
- module Generators
3
- class RailsLoader
4
- def self.load!(options)
5
- require "#{options[:apply_to]}/config/environment"
6
- require "rails_generator"
7
- require "rails_generator/scripts/generate"
8
-
9
- Rails::Generator::Base.sources << Rails::Generator::PathSource.new(
10
- :brightbox, File.dirname(__FILE__))
11
-
12
- args = ["brightbox"]
13
- args << (options[:application] || "Application")
14
- args << (options[:domain] || "application.boxname.username.brightbox.co.uk")
15
- args << (options[:server] || "87.237.63.??")
16
-
17
- Rails::Generator::Scripts::Generate.new.run(args)
18
- end
19
- end
20
- class ApacheLoader
21
- def self.load!(options)
22
- require "/home/john/devel/reflex/capistrano-setup/cap-test2/config/environment"
23
- require "rails_generator"
24
- require "rails_generator/scripts/generate"
25
-
26
- Rails::Generator::Base.sources << Rails::Generator::PathSource.new(
27
- :brightboxapache, "/etc/apache2/sites-available")
28
-
29
- args = ["brightboxapache"]
30
- args << (options[:application] || "application").downcase
31
- args << (options[:web_root] || "/home/rails/#{options[:application]}/current/public")
32
- args << (options[:domain] || "application.boxname.username.brightbox.co.uk")
33
- args << (options[:port] || 9200)
34
- args << (options[:mongrels] || 2)
35
-
36
- Rails::Generator::Scripts::Generate.new.run(args)
37
- end
38
- end
39
- end
40
- end