brightbox 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -2
- data/bin/brightbox +3 -0
- data/brightbox-gemspec.rb +2 -2
- data/lib/brightbox/recipes/callbacks.rb +3 -0
- data/lib/brightbox/recipes/configure/mongrel.rb +35 -22
- data/lib/brightbox/recipes/configure/passenger.rb +18 -13
- data/lib/brightbox/recipes/deploy.rb +5 -0
- data/lib/brightbox/recipes/helpers.rb +14 -1
- data/lib/brightbox/recipes/packages.rb +34 -0
- data/lib/brightbox/recipes/variables.rb +2 -0
- data/lib/brightbox/version.rb +1 -1
- metadata +17 -15
data/Rakefile
CHANGED
@@ -8,8 +8,13 @@ namespace :client do
|
|
8
8
|
|
9
9
|
desc "Reinstall the client gem locally"
|
10
10
|
task :reinstall => [:repackage] do
|
11
|
-
|
12
|
-
|
11
|
+
begin
|
12
|
+
sh %Q{sudo gem uninstall -x -v #{@client.version} #{@client.name} }
|
13
|
+
rescue RuntimeError => e
|
14
|
+
puts "Gem not installed, continuing."
|
15
|
+
end
|
16
|
+
|
17
|
+
sh %Q{sudo gem install pkg/#{@client.name}-#{@client.version}.gem}
|
13
18
|
end
|
14
19
|
|
15
20
|
end
|
data/bin/brightbox
CHANGED
@@ -238,6 +238,9 @@ unless Rake::Task.task_defined?("db:check:config")
|
|
238
238
|
#
|
239
239
|
# Specify your specific Rails version if it is not vendored
|
240
240
|
# depend :remote, :gem, "rails", "=2.2.2"
|
241
|
+
#
|
242
|
+
# Set the apt packages your application or gems require. e.g.
|
243
|
+
# depend :remote, :apt, "libxml2-dev"
|
241
244
|
|
242
245
|
## Local Shared Area
|
243
246
|
# These are the list of files and directories that you want
|
data/brightbox-gemspec.rb
CHANGED
@@ -20,9 +20,9 @@
|
|
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","David Smalley"]
|
23
|
+
spec.authors = ["John Leach","Neil Wilson","David Smalley", "Caius Durling"]
|
24
24
|
spec.email = "support@brightbox.co.uk"
|
25
|
-
spec.homepage = "http://wiki.brightbox.co.uk/docs:
|
25
|
+
spec.homepage = "http://wiki.brightbox.co.uk/docs:gemv2:start"
|
26
26
|
spec.rubyforge_project = 'brightbox'
|
27
27
|
spec.has_rdoc = false
|
28
28
|
end
|
@@ -27,6 +27,17 @@ after "deploy:cold",
|
|
27
27
|
|
28
28
|
namespace :configure do
|
29
29
|
|
30
|
+
# Runs the given block when generating webserver configuration is allowed.
|
31
|
+
#
|
32
|
+
# Basically, runs the block unless "set :generate_webserver_config, false" is in deploy.rb
|
33
|
+
def run_when_generating_webserver_config_allowed
|
34
|
+
if generate_webserver_config
|
35
|
+
yield if block_given?
|
36
|
+
else
|
37
|
+
logger.trace "Skipped - Not generating webserver config"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
30
41
|
[:nginx, :apache].each do |webserver|
|
31
42
|
desc %Q{
|
32
43
|
[internal]Create #{webserver.to_s} config. Creates a load balancing virtual host \
|
@@ -43,28 +54,30 @@ namespace :configure do
|
|
43
54
|
|
44
55
|
}
|
45
56
|
task webserver, :roles => :web, :except => {:no_release => true} do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
run_when_generating_webserver_config_allowed do
|
58
|
+
app_hosts = case mongrel_host
|
59
|
+
when :local
|
60
|
+
"localhost"
|
61
|
+
when :remote
|
62
|
+
roles[:app].servers.join(",")
|
63
|
+
else
|
64
|
+
mongrel_host
|
65
|
+
end
|
66
|
+
sudo on_one_line( <<-END
|
67
|
+
#{send(webserver.to_s + "_setup")}
|
68
|
+
-n #{application}
|
69
|
+
-d #{domain}
|
70
|
+
#{'-a '+domain_aliases if domain_aliases}
|
71
|
+
-w #{File.join(current_path, 'public')}
|
72
|
+
-h #{app_hosts}
|
73
|
+
-p #{mongrel_port}
|
74
|
+
-s #{mongrel_servers}
|
75
|
+
#{"-m #{max_age}" if max_age}
|
76
|
+
#{"-c #{ssl_certificate}" if ssl_certificate}
|
77
|
+
#{"-k #{ssl_key}" if ssl_key}
|
78
|
+
END
|
79
|
+
)
|
80
|
+
end
|
68
81
|
end
|
69
82
|
end
|
70
83
|
|
@@ -32,19 +32,24 @@ namespace :configure do
|
|
32
32
|
|
33
33
|
}
|
34
34
|
task :apache, :roles => :web, :except => {:no_release => true} do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
35
|
+
# Bail out if we don't want to generate config
|
36
|
+
run_when_generating_webserver_config_allowed do
|
37
|
+
# Create the configs
|
38
|
+
sudo on_one_line( <<-END
|
39
|
+
#{send("apache_setup")}
|
40
|
+
-n #{application}
|
41
|
+
-d #{domain}
|
42
|
+
#{'-a '+domain_aliases if domain_aliases}
|
43
|
+
-w #{File.join(current_path, 'public')}
|
44
|
+
--passenger
|
45
|
+
--railsenv #{rails_env}
|
46
|
+
#{"-m #{max_age}" if max_age}
|
47
|
+
#{"-c #{ssl_certificate}" if ssl_certificate}
|
48
|
+
#{"-k #{ssl_key}" if ssl_key}
|
49
|
+
#{"-i #{ssl_intermediate}" if ssl_intermediate}
|
50
|
+
END
|
51
|
+
)
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
task :mongrel, :roles => :app, :except => {:no_release => true} do
|
@@ -22,6 +22,10 @@
|
|
22
22
|
# By default we require mongrel. In future we can just switch the default to passenger
|
23
23
|
Capistrano::Configuration.instance(true).load File.join(File.dirname(__FILE__), 'deploy', 'mongrel.rb')
|
24
24
|
|
25
|
+
if File.exists?("config/deploy.local.rb")
|
26
|
+
Capistrano::Configuration.instance(true).load 'config/deploy.local.rb'
|
27
|
+
end
|
28
|
+
|
25
29
|
namespace :deploy do
|
26
30
|
|
27
31
|
namespace :web do
|
@@ -94,6 +98,7 @@ namespace :deploy do
|
|
94
98
|
Execute Rake tasks that need to be run on all deployments
|
95
99
|
}
|
96
100
|
task :global, :except => {:no_release => true} do
|
101
|
+
packages.install
|
97
102
|
gems.install
|
98
103
|
end
|
99
104
|
|
@@ -30,4 +30,17 @@ def on_one_line(cmd_list)
|
|
30
30
|
cmd_list.gsub!(/\n/m, ' ')
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
# Override cap's depend method so we can intercept any calls we want to
|
34
|
+
# ourselves and act upon them.
|
35
|
+
alias :cap_depend :depend
|
36
|
+
# Our depend method
|
37
|
+
def depend location, type, *args
|
38
|
+
# So far we only care about :remote, :apt. Intercept only that
|
39
|
+
if location == :remote && [:apt].include?(type)
|
40
|
+
# "Translate" this into a :match call cap can handle for us.
|
41
|
+
cap_depend(:remote, :match, "dpkg-query --show -f '${Status}' -- #{args.first}", /^install ok installed$/)
|
42
|
+
else
|
43
|
+
# we don't want to interfere with this, send it on it's merry way
|
44
|
+
cap_depend(location, type, *args)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
before "gems:install", "packages:install"
|
2
|
+
|
3
|
+
namespace :packages do
|
4
|
+
|
5
|
+
def install_package name
|
6
|
+
run %Q{dpkg-query --show -f '${Status}' #{name} 2>/dev/null|egrep -q "^install ok installed$" || sudo -p '#{sudo_prompt}' apt-get install -qy #{name}}
|
7
|
+
end
|
8
|
+
|
9
|
+
def package_dependencies?
|
10
|
+
matches = (fetch(:dependencies,{})[:remote]||{})[:match] || []
|
11
|
+
# Because we're given the entire dpkg-query command back, pull out just the package name
|
12
|
+
matches.select {|x| x.first[/dpkg-query --show -f '\$\{Status\}'/] }.map {|x| x.first[/\-\- (.+)$/, 1] }
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_packages
|
16
|
+
deps = package_dependencies?
|
17
|
+
puts "Updating apt-get"
|
18
|
+
sudo "apt-get update -qy >/dev/null"
|
19
|
+
deps.each do |pkg|
|
20
|
+
name = pkg
|
21
|
+
puts "Checking for #{name}"
|
22
|
+
install_package(name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc %Q{
|
27
|
+
[internal]Run the packages install task in the application.
|
28
|
+
}
|
29
|
+
task :install, :except => {:no_release => true} do
|
30
|
+
puts "Checking required packages are installed"
|
31
|
+
install_packages
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -42,7 +42,9 @@ _cset :runner, user
|
|
42
42
|
_cset :passenger_restart_strategy, :hard
|
43
43
|
_cset :use_sudo, false
|
44
44
|
_cset :ssl_certificate, nil
|
45
|
+
_cset :ssl_intermediate, nil
|
45
46
|
_cset :ssl_key, nil
|
47
|
+
_cset :generate_webserver_config, true
|
46
48
|
_cset :rails_env, "production"
|
47
49
|
ssh_options[:forward_agent] = true
|
48
50
|
|
data/lib/brightbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Leach
|
8
8
|
- Neil Wilson
|
9
9
|
- David Smalley
|
10
|
+
- Caius Durling
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
14
|
|
14
|
-
date:
|
15
|
+
date: 2010-01-26 00:00:00 +00:00
|
15
16
|
default_executable:
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
@@ -37,24 +38,25 @@ files:
|
|
37
38
|
- Rakefile
|
38
39
|
- brightbox-gemspec.rb
|
39
40
|
- lib/brightbox/maintenance.rb
|
40
|
-
- lib/brightbox/
|
41
|
-
- lib/brightbox/recipes
|
42
|
-
- lib/brightbox/recipes/configure/mongrel.rb
|
43
|
-
- lib/brightbox/recipes/configure/passenger.rb
|
41
|
+
- lib/brightbox/version.rb
|
42
|
+
- lib/brightbox/recipes.rb
|
44
43
|
- lib/brightbox/recipes/configure.rb
|
44
|
+
- lib/brightbox/recipes/shared_assets.rb
|
45
|
+
- lib/brightbox/recipes/helpers.rb
|
46
|
+
- lib/brightbox/recipes/deploy.rb
|
47
|
+
- lib/brightbox/recipes/packages.rb
|
48
|
+
- lib/brightbox/recipes/variables.rb
|
45
49
|
- lib/brightbox/recipes/database.rb
|
50
|
+
- lib/brightbox/recipes/configure/mongrel.rb
|
51
|
+
- lib/brightbox/recipes/configure/passenger.rb
|
46
52
|
- lib/brightbox/recipes/deploy/mongrel.rb
|
47
53
|
- lib/brightbox/recipes/deploy/passenger.rb
|
48
|
-
- lib/brightbox/recipes/deploy.rb
|
49
54
|
- lib/brightbox/recipes/gems.rb
|
50
|
-
- lib/brightbox/recipes/
|
51
|
-
- lib/brightbox/
|
52
|
-
- lib/brightbox/recipes/variables.rb
|
53
|
-
- lib/brightbox/recipes.rb
|
54
|
-
- lib/brightbox/version.rb
|
55
|
+
- lib/brightbox/recipes/callbacks.rb
|
56
|
+
- lib/brightbox/passenger.rb
|
55
57
|
- bin/brightbox
|
56
|
-
has_rdoc:
|
57
|
-
homepage: http://wiki.brightbox.co.uk/docs:
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://wiki.brightbox.co.uk/docs:gemv2:start
|
58
60
|
licenses: []
|
59
61
|
|
60
62
|
post_install_message:
|
@@ -77,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
79
|
requirements: []
|
78
80
|
|
79
81
|
rubyforge_project: brightbox
|
80
|
-
rubygems_version: 1.3.
|
82
|
+
rubygems_version: 1.3.5
|
81
83
|
signing_key:
|
82
84
|
specification_version: 3
|
83
85
|
summary: Brightbox rails deployment scripts for Capistrano
|