brightbox 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/brightbox +25 -37
- data/lib/brightbox/recipes/bundler.rb +70 -0
- data/lib/brightbox/recipes/helpers.rb +6 -3
- data/lib/brightbox/version.rb +1 -1
- metadata +37 -21
- data/Rakefile +0 -28
- data/brightbox-gemspec.rb +0 -46
data/bin/brightbox
CHANGED
@@ -30,6 +30,8 @@ require 'brightbox/version'
|
|
30
30
|
|
31
31
|
@options = {}
|
32
32
|
|
33
|
+
@app_server = :passenger
|
34
|
+
|
33
35
|
def has_required_options?
|
34
36
|
[@server].all?
|
35
37
|
end
|
@@ -57,7 +59,7 @@ opts = OptionParser.new do |opts|
|
|
57
59
|
) { |value| @server = value }
|
58
60
|
|
59
61
|
opts.on("-a TYPE", "--app TYPE", [:mongrel, :passenger],
|
60
|
-
"App server type, mongrel or passenger"
|
62
|
+
"App server type, mongrel or passenger (default is passenger)"
|
61
63
|
) { |value| @app_server = value }
|
62
64
|
|
63
65
|
begin
|
@@ -106,37 +108,7 @@ files = {
|
|
106
108
|
|
107
109
|
"lib/tasks/bbgem.rake" => unindent(<<-FILE),
|
108
110
|
# Generated with '#{opts.program_name}' on #{Time.now}
|
109
|
-
unless Rake::Task.task_defined?("gems:install")
|
110
|
-
def install_gems
|
111
|
-
gems={
|
112
|
-
"ferret" => "~> 0.11",
|
113
|
-
"will_paginate" => "> 0"
|
114
|
-
}
|
115
|
-
gems.each_pair do |gem, version|
|
116
|
-
puts "Checking for \#{gem} at \#{version}"
|
117
|
-
system("gem spec \#{gem} --version '\#{version}' 2>/dev/null|egrep -q '^name:' ||
|
118
|
-
sudo gem install -y --no-ri --no-rdoc --version '\#{version}' \#{gem}")
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def gems_upgrade_notice
|
123
|
-
puts "This is a dummy task installed by the Brightbox command"
|
124
|
-
puts "If you need gems to make your application work"
|
125
|
-
puts "Uncomment the install command and alter the gems on the list"
|
126
|
-
puts "... or upgrade to Rails >= 2.1 and use the inbuilt facilities"
|
127
|
-
end
|
128
|
-
|
129
|
-
namespace(:gems) do
|
130
|
-
desc "Installs all required gems for this application."
|
131
|
-
task :install do
|
132
|
-
gems_upgrade_notice
|
133
|
-
#install_gems
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
111
|
unless Rake::Task.task_defined?("db:create")
|
139
|
-
|
140
112
|
namespace(:db) do
|
141
113
|
task :create do
|
142
114
|
puts "This is a dummy task installed by the Brightbox command"
|
@@ -148,8 +120,18 @@ unless Rake::Task.task_defined?("db:create")
|
|
148
120
|
end
|
149
121
|
unless Rake::Task.task_defined?("db:check:config")
|
150
122
|
|
123
|
+
def rails_env
|
124
|
+
if defined?(Rails) and Rails.respond_to? :env
|
125
|
+
Rails.env
|
126
|
+
elsif defined?(RAILS_ENV)
|
127
|
+
RAILS_ENV
|
128
|
+
else
|
129
|
+
"production"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
151
133
|
def pe(message)
|
152
|
-
p "\#{
|
134
|
+
p "\#{rails_env}: \#{message}"
|
153
135
|
end
|
154
136
|
|
155
137
|
def brightbox_sanity_checks(config)
|
@@ -158,8 +140,8 @@ unless Rake::Task.task_defined?("db:check:config")
|
|
158
140
|
end
|
159
141
|
db=config['database']
|
160
142
|
host=config['host']
|
161
|
-
if host && host
|
162
|
-
pe "
|
143
|
+
if host && host !~ /^.*(sqlreadwrite|mysql\.vm)\.brightbox.net$/
|
144
|
+
pe "'\#{host}' does not look like one of the Brightbox MySQL clusters"
|
163
145
|
elsif db && db !~ /\\A\#{config['username']}/
|
164
146
|
pe "database name should start with '\#{config['username']}' if using cluster"
|
165
147
|
end
|
@@ -181,7 +163,7 @@ unless Rake::Task.task_defined?("db:check:config")
|
|
181
163
|
desc "Check database.yml config"
|
182
164
|
task :config do
|
183
165
|
p "Checking database mysql configuration..."
|
184
|
-
if config=read_database_yml[
|
166
|
+
if config=read_database_yml[rails_env]
|
185
167
|
case config['adapter']
|
186
168
|
when nil
|
187
169
|
pe "adapter entry missing."
|
@@ -218,8 +200,10 @@ unless Rake::Task.task_defined?("db:check:config")
|
|
218
200
|
# Target directory for the application on the web and app servers.
|
219
201
|
set(:deploy_to) { File.join("", "home", user, application) }
|
220
202
|
|
221
|
-
# URL of your source repository.
|
222
|
-
#
|
203
|
+
# URL of your source repository. By default this will just upload
|
204
|
+
# the local directory. You should probably change this if you use
|
205
|
+
# another repository, like git or subversion.
|
206
|
+
|
223
207
|
set :repository, "."
|
224
208
|
set :scm, :none
|
225
209
|
set :deploy_via, :copy
|
@@ -232,6 +216,10 @@ unless Rake::Task.task_defined?("db:check:config")
|
|
232
216
|
# Set the commands and gems that your application requires. e.g.
|
233
217
|
# depend :remote, :gem, "will_paginate", ">=2.2.2"
|
234
218
|
# depend :remote, :command, "brightbox"
|
219
|
+
#
|
220
|
+
# If you're using Bundler, then you don't need to specify your
|
221
|
+
# gems here as well as there (and the bundler gem is installed for
|
222
|
+
# you automatically)
|
235
223
|
#
|
236
224
|
# Gem with a source (such as github)
|
237
225
|
# depend :remote, :gem, "tmm1-amqp", ">=0.6.0", :source => "http://gems.github.com"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Brightbox - Easy Ruby Web Application Deployment
|
2
|
+
# Copyright (C) 2010 John Leach
|
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
|
+
after "gems:install", "bundler:install"
|
22
|
+
depend :remote, :gem, "bundler", ">=1.0.0"
|
23
|
+
|
24
|
+
namespace :bundler do
|
25
|
+
|
26
|
+
_cset(:bundle_dir) { File.join(shared_path, "bundle") }
|
27
|
+
_cset(:bundle_gemfile) { File.join(latest_release, "Gemfile") }
|
28
|
+
_cset(:bundle_without, "development test")
|
29
|
+
_cset(:bundle_flags, "--deployment")
|
30
|
+
# Set :bundle_disable to true to prevent us from running bundler,
|
31
|
+
# even if we detect a Gemfile
|
32
|
+
_cset(:bundle_disable, false)
|
33
|
+
# Set :bundle_force to true to run bundler even if we can't see a
|
34
|
+
# Gemfile
|
35
|
+
_cset(:bundle_force, false)
|
36
|
+
_cset(:bundle_symlink, true)
|
37
|
+
|
38
|
+
desc "[internal]Install the bundler gem on the server"
|
39
|
+
task :install_bundler, :except => {:no_release => true} do
|
40
|
+
puts "Checking for bundler gem"
|
41
|
+
gems.install_gem("bundler", ">= 1.0.0" )
|
42
|
+
end
|
43
|
+
|
44
|
+
desc %Q{
|
45
|
+
[internal]Install the gems specified by the Gemfile or Gemfile.lock using bundler
|
46
|
+
}
|
47
|
+
task :install, :except => {:no_release => true} do
|
48
|
+
install_cmd = "(bundle install --gemfile #{bundle_gemfile} "
|
49
|
+
install_cmd << "--path #{bundle_dir} #{bundle_flags} "
|
50
|
+
install_cmd << "--without #{bundle_without} "
|
51
|
+
install_cmd << "&& ln -sf #{bundle_dir} #{File.join(latest_release, "vendor")}" if fetch(:bundle_symlink)
|
52
|
+
install_cmd << ")"
|
53
|
+
if fetch(:bundle_disable)
|
54
|
+
puts "Skipping bundler install as :bundle_enable is set to false"
|
55
|
+
elsif fetch(:bundle_force)
|
56
|
+
puts "Forcing bundler install as :bundle_force is set to true"
|
57
|
+
run install_cmd
|
58
|
+
else
|
59
|
+
run "if [ -e #{bundle_gemfile} ] ; then #{install_cmd} ; else true ; fi"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc %Q{
|
64
|
+
[internal]Determine whether the requirements for your application are installed and available to bundler
|
65
|
+
}
|
66
|
+
task :check, :except => {:no_release => true} do
|
67
|
+
run "bundle check --gemfile #{bundle_gemfile}"
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -19,11 +19,14 @@
|
|
19
19
|
#
|
20
20
|
def rake_task(taskname)
|
21
21
|
rake = fetch(:rake, "rake")
|
22
|
-
rails_env = fetch(:rails_env, "production")
|
23
22
|
rake_env = fetch(:rake_env, "")
|
24
|
-
|
23
|
+
in_rails_root("#{rake} #{rake_env} #{taskname}")
|
24
|
+
end
|
25
25
|
|
26
|
-
|
26
|
+
def in_rails_root(taskname)
|
27
|
+
rails_env = fetch(:rails_env, "production")
|
28
|
+
directory = current_release
|
29
|
+
%Q{sh -c 'cd #{directory}; RAILS_ENV=#{rails_env} #{taskname}'}
|
27
30
|
end
|
28
31
|
|
29
32
|
def on_one_line(cmd_list)
|
data/lib/brightbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 3
|
9
|
+
- 7
|
10
|
+
version: 2.3.7
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- John Leach
|
@@ -12,19 +18,24 @@ autorequire:
|
|
12
18
|
bindir: bin
|
13
19
|
cert_chain: []
|
14
20
|
|
15
|
-
date: 2010-
|
21
|
+
date: 2010-09-07 00:00:00 +01:00
|
16
22
|
default_executable:
|
17
23
|
dependencies:
|
18
24
|
- !ruby/object:Gem::Dependency
|
19
25
|
name: capistrano
|
20
|
-
|
21
|
-
|
22
|
-
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
23
29
|
requirements:
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
32
|
+
hash: 9
|
33
|
+
segments:
|
34
|
+
- 2
|
35
|
+
- 5
|
26
36
|
version: "2.5"
|
27
|
-
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
28
39
|
description:
|
29
40
|
email: support@brightbox.co.uk
|
30
41
|
executables:
|
@@ -35,25 +46,24 @@ extra_rdoc_files: []
|
|
35
46
|
|
36
47
|
files:
|
37
48
|
- LICENSE
|
38
|
-
- Rakefile
|
39
|
-
- brightbox-gemspec.rb
|
40
|
-
- lib/brightbox/maintenance.rb
|
41
|
-
- lib/brightbox/version.rb
|
42
49
|
- lib/brightbox/recipes.rb
|
43
|
-
- lib/brightbox/
|
44
|
-
- lib/brightbox/
|
45
|
-
- lib/brightbox/recipes/helpers.rb
|
46
|
-
- lib/brightbox/recipes/deploy.rb
|
47
|
-
- lib/brightbox/recipes/packages.rb
|
50
|
+
- lib/brightbox/version.rb
|
51
|
+
- lib/brightbox/passenger.rb
|
48
52
|
- lib/brightbox/recipes/variables.rb
|
49
|
-
- lib/brightbox/recipes/
|
53
|
+
- lib/brightbox/recipes/helpers.rb
|
50
54
|
- lib/brightbox/recipes/configure/mongrel.rb
|
51
55
|
- lib/brightbox/recipes/configure/passenger.rb
|
56
|
+
- lib/brightbox/recipes/database.rb
|
57
|
+
- lib/brightbox/recipes/deploy.rb
|
52
58
|
- lib/brightbox/recipes/deploy/mongrel.rb
|
53
59
|
- lib/brightbox/recipes/deploy/passenger.rb
|
54
|
-
- lib/brightbox/recipes/gems.rb
|
55
60
|
- lib/brightbox/recipes/callbacks.rb
|
56
|
-
- lib/brightbox/
|
61
|
+
- lib/brightbox/recipes/packages.rb
|
62
|
+
- lib/brightbox/recipes/gems.rb
|
63
|
+
- lib/brightbox/recipes/bundler.rb
|
64
|
+
- lib/brightbox/recipes/shared_assets.rb
|
65
|
+
- lib/brightbox/recipes/configure.rb
|
66
|
+
- lib/brightbox/maintenance.rb
|
57
67
|
- bin/brightbox
|
58
68
|
has_rdoc: true
|
59
69
|
homepage: http://wiki.brightbox.co.uk/docs:gemv2:start
|
@@ -65,21 +75,27 @@ rdoc_options: []
|
|
65
75
|
require_paths:
|
66
76
|
- lib
|
67
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
68
79
|
requirements:
|
69
80
|
- - ">="
|
70
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
71
85
|
version: "0"
|
72
|
-
version:
|
73
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
74
88
|
requirements:
|
75
89
|
- - ">="
|
76
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
77
94
|
version: "0"
|
78
|
-
version:
|
79
95
|
requirements: []
|
80
96
|
|
81
97
|
rubyforge_project: brightbox
|
82
|
-
rubygems_version: 1.3.
|
98
|
+
rubygems_version: 1.3.7
|
83
99
|
signing_key:
|
84
100
|
specification_version: 3
|
85
101
|
summary: Brightbox rails deployment scripts for Capistrano
|
data/Rakefile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rake/gempackagetask'
|
2
|
-
require "brightbox-gemspec.rb"
|
3
|
-
|
4
|
-
namespace :client do
|
5
|
-
Rake::GemPackageTask.new(@client).define
|
6
|
-
|
7
|
-
task :default => [:reinstall, :clobber_package]
|
8
|
-
|
9
|
-
desc "Reinstall the client gem locally"
|
10
|
-
task :reinstall => [:repackage] do
|
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}
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
namespace :server do
|
23
|
-
Rake::GemPackageTask.new(@server).define
|
24
|
-
end
|
25
|
-
|
26
|
-
task :clobber_package => "client:clobber_package"
|
27
|
-
task :package => ["client:package", "server:package"]
|
28
|
-
task :repackage => ["client:repackage", "server:package"]
|
data/brightbox-gemspec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
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
|
-
require File.join(File.dirname(__FILE__),"lib/brightbox/version")
|
21
|
-
def add_common(spec)
|
22
|
-
spec.version = Brightbox::VERSION
|
23
|
-
spec.authors = ["John Leach","Neil Wilson","David Smalley", "Caius Durling"]
|
24
|
-
spec.email = "support@brightbox.co.uk"
|
25
|
-
spec.homepage = "http://wiki.brightbox.co.uk/docs:gemv2:start"
|
26
|
-
spec.rubyforge_project = 'brightbox'
|
27
|
-
spec.has_rdoc = false
|
28
|
-
end
|
29
|
-
|
30
|
-
@server = Gem::Specification.new do |s|
|
31
|
-
add_common(s)
|
32
|
-
s.name = "brightbox-server-tools"
|
33
|
-
s.files = FileList["LICENSE", "Rakefile", "*.rb", "bin/railsapp-*","lib/**/*.{rb,gz}"].exclude(/recipe/).to_a
|
34
|
-
s.summary = "Brightbox Server configuration scripts"
|
35
|
-
s.executables = FileList["bin/railsapp-*"].sub(/bin\//,'')
|
36
|
-
end
|
37
|
-
|
38
|
-
@client = Gem::Specification.new do |s|
|
39
|
-
add_common(s)
|
40
|
-
s.name = "brightbox"
|
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.5")
|
43
|
-
s.summary = "Brightbox rails deployment scripts for Capistrano"
|
44
|
-
s.executable = 'brightbox'
|
45
|
-
end
|
46
|
-
|