golden_brindle 0.0.6 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +20 -12
- data/Rakefile +2 -3
- data/golden_brindle.gemspec +27 -37
- data/lib/golden_brindle/command.rb +1 -1
- data/lib/golden_brindle/configure.rb +1 -0
- data/lib/golden_brindle/const.rb +2 -2
- data/lib/golden_brindle/start.rb +17 -2
- data/resources/{golden_brindle_cluster → golden_brindle} +3 -3
- data/test/test_golden_brindle.rb +1 -1
- metadata +15 -51
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -4,26 +4,34 @@
|
|
4
4
|
|
5
5
|
Tool to help start/stop/restart multiple unicorn servers to use behind a web servers like nginx. This app adds an option to specify a number of Unicorn worker processes to launch, a range of ports, and a configuration file for the cluster. Use "-h" to see command syntax.
|
6
6
|
|
7
|
-
Configure cluster and
|
7
|
+
Configure cluster and save configuration file to config/brindle.yml:
|
8
8
|
golden_brindle brindle::configure
|
9
9
|
|
10
|
-
|
11
|
-
golden_brindle brindle::start
|
10
|
+
You must copy this configuration file to the /etc/brindles directory to autostart on system boot.
|
12
11
|
|
13
|
-
|
14
|
-
golden_brindle
|
12
|
+
Start by hand to test proper start:
|
13
|
+
golden_brindle start
|
15
14
|
|
16
|
-
|
17
|
-
golden_brindle
|
15
|
+
Reload source code after deploy or code update:
|
16
|
+
golden_brindle restart
|
18
17
|
|
18
|
+
Stop:
|
19
|
+
golden_brindle stop
|
20
|
+
|
21
|
+
== Using applications with bundler
|
22
|
+
|
23
|
+
Open brindle config file for the application and set bundler option to true:
|
24
|
+
bundler: true
|
25
|
+
And update you Gemfile adding this line:
|
26
|
+
gem 'golden_brindle'
|
19
27
|
|
20
28
|
== Starting clusters at boot
|
21
29
|
|
22
|
-
1. Create golden_brindle
|
30
|
+
1. Create golden_brindle configuration directory (/etc/brindles).
|
23
31
|
2. Assign ownership to your Capistrano user.
|
24
|
-
3. Copy the init.d script from this gem's resouces directory /etc/init.d.
|
32
|
+
3. Copy the init.d script from this gem's resouces directory to /etc/init.d.
|
25
33
|
4. chmod +x /etc/init.d/golden_brindles_cluster
|
26
|
-
5. Add to init.d startup. On RHEL/CentOS use: /sbin/chkconfig --level 345
|
34
|
+
5. Add to init.d startup. On RHEL/CentOS use: /sbin/chkconfig --level 345 golden_brindles on
|
27
35
|
|
28
36
|
== Note on Patches/Pull Requests
|
29
37
|
|
@@ -31,13 +39,13 @@ Stop cluster:
|
|
31
39
|
* Make your feature addition or bug fix.
|
32
40
|
* Add tests for it. This is important so I don't break it in a
|
33
41
|
future version unintentionally.
|
34
|
-
* Commit, do not mess with
|
42
|
+
* Commit, do not mess with Rakefile, version, or history.
|
35
43
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
36
44
|
* Send me a pull request. Bonus points for topic branches.
|
37
45
|
|
38
46
|
== Copyright
|
39
47
|
|
40
|
-
Copyright (c) 2010 Alexander Simonov. See LICENSE for details.
|
48
|
+
Copyright (c) 2010-2011 Alexander Simonov. See LICENSE for details.
|
41
49
|
|
42
50
|
Copyright (c) 2007 Zed A. Shaw
|
43
51
|
|
data/Rakefile
CHANGED
@@ -6,12 +6,11 @@ begin
|
|
6
6
|
require File.dirname(__FILE__) + "/lib/golden_brindle/const.rb"
|
7
7
|
Jeweler::Tasks.new do |gem|
|
8
8
|
gem.name = "golden_brindle"
|
9
|
-
gem.summary = %Q{Unicorn HTTP server
|
10
|
-
gem.description = %Q{Unicorn HTTP server
|
9
|
+
gem.summary = %Q{Unicorn HTTP server multiple application runner tool}
|
10
|
+
gem.description = %Q{Unicorn HTTP server multiple application runner tool}
|
11
11
|
gem.email = "alex@simonov.me"
|
12
12
|
gem.homepage = "http://github.com/simonoff/golden_brindle"
|
13
13
|
gem.authors = ["Alexander Simonov"]
|
14
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
15
14
|
gem.add_dependency "gem_plugin", ">= 0.2.3"
|
16
15
|
gem.add_dependency "unicorn", ">= 1.00"
|
17
16
|
gem.version = GoldenBrindle::Const::VERSION
|
data/golden_brindle.gemspec
CHANGED
@@ -1,72 +1,62 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{golden_brindle}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexander Simonov"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-05-04}
|
13
13
|
s.default_executable = %q{golden_brindle}
|
14
|
-
s.description = %q{Unicorn HTTP server
|
14
|
+
s.description = %q{Unicorn HTTP server multiple application runner tool}
|
15
15
|
s.email = %q{alex@simonov.me}
|
16
16
|
s.executables = ["golden_brindle"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
20
|
-
|
19
|
+
"README.rdoc",
|
20
|
+
"TODO"
|
21
21
|
]
|
22
22
|
s.files = [
|
23
23
|
".document",
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"test/test_golden_brindle.rb"
|
24
|
+
"COPYING",
|
25
|
+
"LICENSE",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"TODO",
|
29
|
+
"VERSION",
|
30
|
+
"bin/golden_brindle",
|
31
|
+
"golden_brindle.gemspec",
|
32
|
+
"lib/golden_brindle.rb",
|
33
|
+
"lib/golden_brindle/cluster.rb",
|
34
|
+
"lib/golden_brindle/command.rb",
|
35
|
+
"lib/golden_brindle/configure.rb",
|
36
|
+
"lib/golden_brindle/const.rb",
|
37
|
+
"lib/golden_brindle/restart.rb",
|
38
|
+
"lib/golden_brindle/start.rb",
|
39
|
+
"lib/golden_brindle/stop.rb",
|
40
|
+
"resources/golden_brindle",
|
41
|
+
"test/helper.rb",
|
42
|
+
"test/test_golden_brindle.rb"
|
44
43
|
]
|
45
44
|
s.homepage = %q{http://github.com/simonoff/golden_brindle}
|
46
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
47
45
|
s.require_paths = ["lib"]
|
48
|
-
s.rubygems_version = %q{1.
|
49
|
-
s.summary = %q{Unicorn HTTP server
|
50
|
-
s.test_files = [
|
51
|
-
"test/helper.rb",
|
52
|
-
"test/test_golden_brindle.rb"
|
53
|
-
]
|
46
|
+
s.rubygems_version = %q{1.6.2}
|
47
|
+
s.summary = %q{Unicorn HTTP server multiple application runner tool}
|
54
48
|
|
55
49
|
if s.respond_to? :specification_version then
|
56
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
57
50
|
s.specification_version = 3
|
58
51
|
|
59
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
61
53
|
s.add_runtime_dependency(%q<gem_plugin>, [">= 0.2.3"])
|
62
54
|
s.add_runtime_dependency(%q<unicorn>, [">= 1.00"])
|
63
55
|
else
|
64
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
65
56
|
s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
|
66
57
|
s.add_dependency(%q<unicorn>, [">= 1.00"])
|
67
58
|
end
|
68
59
|
else
|
69
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
70
60
|
s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
|
71
61
|
s.add_dependency(%q<unicorn>, [">= 1.00"])
|
72
62
|
end
|
@@ -68,7 +68,7 @@ module GoldenBrindle
|
|
68
68
|
|
69
69
|
def config_keys
|
70
70
|
@config_keys ||=
|
71
|
-
%w(address host port cwd log_file pid_file environment servers daemon debug config_script workers timeout user group prefix preload listen)
|
71
|
+
%w(address host port cwd log_file pid_file environment servers daemon debug config_script workers timeout user group prefix preload listen bundler)
|
72
72
|
end
|
73
73
|
|
74
74
|
def load_config
|
@@ -7,6 +7,7 @@ module Brindle
|
|
7
7
|
options [
|
8
8
|
["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
|
9
9
|
["-d", "--daemonize", "Run daemonized in the background", :@daemon, false],
|
10
|
+
["-b", "--bundler", "Use bundler to start unicorn instances", :@bundler, false],
|
10
11
|
['', "--preload", "Preload application", :@preload, false],
|
11
12
|
['-p', '--port PORT', "Which port to bind to (if set numbers of servers - start port number)", :@port, Unicorn::Const::DEFAULT_PORT],
|
12
13
|
['-a', '--address ADDR', "Address to bind to", :@address, Unicorn::Const::DEFAULT_HOST],
|
data/lib/golden_brindle/const.rb
CHANGED
data/lib/golden_brindle/start.rb
CHANGED
@@ -7,6 +7,7 @@ module Brindle
|
|
7
7
|
def configure
|
8
8
|
options [
|
9
9
|
["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
|
10
|
+
["-b", "--bundler", "Use bundler to start unicorn instances", :@bundler, false],
|
10
11
|
["-d", "--daemonize", "Run daemonized in the background", :@daemon, false],
|
11
12
|
['', "--preload", "Preload application", :@preload, false],
|
12
13
|
['-p', '--port PORT', "Which port to bind to (if set numbers of servers - start port number)", :@port, Unicorn::Const::DEFAULT_PORT],
|
@@ -61,8 +62,6 @@ module Brindle
|
|
61
62
|
abort "#$0 must be run inside RAILS_ROOT: #{err.inspect}"
|
62
63
|
end
|
63
64
|
|
64
|
-
require 'config/environment'
|
65
|
-
|
66
65
|
defined?(::Rails::VERSION::STRING) or
|
67
66
|
abort "Rails::VERSION::STRING not defined by config/{boot,environment}"
|
68
67
|
# it seems Rails >=2.2 support Rack, but only >=2.3 requires it
|
@@ -115,6 +114,12 @@ module Brindle
|
|
115
114
|
valid_exists?(@config_script, "Unicorn-specific config file not there: #@config_script")
|
116
115
|
return false unless @valid
|
117
116
|
end
|
117
|
+
|
118
|
+
if @bundler
|
119
|
+
valid_exists?('Gemfile', "Cannot use Bundler - no Gemfile in your application root dir")
|
120
|
+
return false unless @valid
|
121
|
+
end
|
122
|
+
|
118
123
|
@cwd = File.expand_path(@cwd)
|
119
124
|
valid_dir? @cwd, "Invalid path to change to during daemon mode: #{@cwd}"
|
120
125
|
valid?(@prefix[0] == ?/ && @prefix[-1] != ?/, "Prefix must begin with / and not end in /") if @prefix
|
@@ -128,6 +133,16 @@ module Brindle
|
|
128
133
|
def run
|
129
134
|
# Change there to start, then we'll have to come back after daemonize
|
130
135
|
Dir.chdir(@cwd)
|
136
|
+
if @bundler
|
137
|
+
puts "Using Bundler"
|
138
|
+
puts "reexec via bundle exec"
|
139
|
+
require 'pp'
|
140
|
+
cmd_for_exec = "bundle exec #{@opt.program_name}"
|
141
|
+
@original_args.each_slice(2) do |arg_key,value|
|
142
|
+
cmd_for_exec << " #{arg_key} #{value}" if arg_key != "-b"
|
143
|
+
end
|
144
|
+
exec(cmd_for_exec)
|
145
|
+
end
|
131
146
|
options = {
|
132
147
|
:listeners => [],
|
133
148
|
:pid => @pid_file,
|
@@ -2,10 +2,10 @@
|
|
2
2
|
#
|
3
3
|
# Copyright (c) 2010 Alexander Simonov, alex@simonov.me
|
4
4
|
#
|
5
|
-
#
|
5
|
+
# golden_brindle Startup script for GoldenBrindle.
|
6
6
|
#
|
7
7
|
# chkconfig: - 85 15
|
8
|
-
# description:
|
8
|
+
# description: golden_brindle manages multiple Unicorn/GoldenBrindle processes for use \
|
9
9
|
# behind a cluster.
|
10
10
|
#
|
11
11
|
|
@@ -33,7 +33,7 @@ case "$1" in
|
|
33
33
|
RETVAL=$?
|
34
34
|
;;
|
35
35
|
*)
|
36
|
-
echo "Usage:
|
36
|
+
echo "Usage: golden_brindle {start|stop|restart|status}"
|
37
37
|
exit 1
|
38
38
|
;;
|
39
39
|
esac
|
data/test/test_golden_brindle.rb
CHANGED
@@ -2,6 +2,6 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class TestGoldenBrindle < Test::Unit::TestCase
|
4
4
|
should "probably rename this file and start testing for real" do
|
5
|
-
flunk "hey buddy, you should probably rename this file and start testing for real"
|
5
|
+
#flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
6
|
end
|
7
7
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golden_brindle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 0.0.6
|
4
|
+
prerelease:
|
5
|
+
version: "0.1"
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Alexander Simonov
|
@@ -15,55 +10,32 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-05-04 00:00:00 +03:00
|
19
14
|
default_executable: golden_brindle
|
20
15
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: thoughtbot-shoulda
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
35
16
|
- !ruby/object:Gem::Dependency
|
36
17
|
name: gem_plugin
|
37
18
|
prerelease: false
|
38
|
-
requirement: &
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
20
|
none: false
|
40
21
|
requirements:
|
41
22
|
- - ">="
|
42
23
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 17
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 2
|
47
|
-
- 3
|
48
24
|
version: 0.2.3
|
49
25
|
type: :runtime
|
50
|
-
version_requirements: *
|
26
|
+
version_requirements: *id001
|
51
27
|
- !ruby/object:Gem::Dependency
|
52
28
|
name: unicorn
|
53
29
|
prerelease: false
|
54
|
-
requirement: &
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
31
|
none: false
|
56
32
|
requirements:
|
57
33
|
- - ">="
|
58
34
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 15
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 0
|
63
35
|
version: "1.00"
|
64
36
|
type: :runtime
|
65
|
-
version_requirements: *
|
66
|
-
description: Unicorn HTTP server
|
37
|
+
version_requirements: *id002
|
38
|
+
description: Unicorn HTTP server multiple application runner tool
|
67
39
|
email: alex@simonov.me
|
68
40
|
executables:
|
69
41
|
- golden_brindle
|
@@ -75,7 +47,6 @@ extra_rdoc_files:
|
|
75
47
|
- TODO
|
76
48
|
files:
|
77
49
|
- .document
|
78
|
-
- .gitignore
|
79
50
|
- COPYING
|
80
51
|
- LICENSE
|
81
52
|
- README.rdoc
|
@@ -92,7 +63,7 @@ files:
|
|
92
63
|
- lib/golden_brindle/restart.rb
|
93
64
|
- lib/golden_brindle/start.rb
|
94
65
|
- lib/golden_brindle/stop.rb
|
95
|
-
- resources/
|
66
|
+
- resources/golden_brindle
|
96
67
|
- test/helper.rb
|
97
68
|
- test/test_golden_brindle.rb
|
98
69
|
has_rdoc: true
|
@@ -100,8 +71,8 @@ homepage: http://github.com/simonoff/golden_brindle
|
|
100
71
|
licenses: []
|
101
72
|
|
102
73
|
post_install_message:
|
103
|
-
rdoc_options:
|
104
|
-
|
74
|
+
rdoc_options: []
|
75
|
+
|
105
76
|
require_paths:
|
106
77
|
- lib
|
107
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -109,26 +80,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
80
|
requirements:
|
110
81
|
- - ">="
|
111
82
|
- !ruby/object:Gem::Version
|
112
|
-
hash: 3
|
113
|
-
segments:
|
114
|
-
- 0
|
115
83
|
version: "0"
|
116
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
85
|
none: false
|
118
86
|
requirements:
|
119
87
|
- - ">="
|
120
88
|
- !ruby/object:Gem::Version
|
121
|
-
hash: 3
|
122
|
-
segments:
|
123
|
-
- 0
|
124
89
|
version: "0"
|
125
90
|
requirements: []
|
126
91
|
|
127
92
|
rubyforge_project:
|
128
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.6.2
|
129
94
|
signing_key:
|
130
95
|
specification_version: 3
|
131
|
-
summary: Unicorn HTTP server
|
132
|
-
test_files:
|
133
|
-
|
134
|
-
- test/test_golden_brindle.rb
|
96
|
+
summary: Unicorn HTTP server multiple application runner tool
|
97
|
+
test_files: []
|
98
|
+
|