mongrel_cluster 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/COPYING +1 -1
- data/LICENSE +1 -1
- data/Manifest +10 -0
- data/README +38 -26
- data/bin/mongrel_cluster_ctl +8 -5
- data/lib/mongrel_cluster/init.rb +37 -29
- data/mongrel_cluster.gemspec +58 -0
- metadata +75 -26
- metadata.gz.sig +0 -0
- data/Rakefile +0 -54
- data/lib/mongrel_cluster/init.rb~ +0 -351
- data/tools/rakehelp.rb +0 -105
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGELOG
ADDED
data/COPYING
CHANGED
data/LICENSE
CHANGED
data/Manifest
ADDED
data/README
CHANGED
@@ -3,45 +3,57 @@
|
|
3
3
|
Tool to help start/stop/restart multiple mongrel servers to use behind a load balancer like Apache 2.2 (mod_proxy_balancer), Lighttpd, Pound, Pen or Balance. This plugin adds an option to specify a number of Mongrel servers to launch, a range of ports, and a configuration file for the cluster. Use "-h" to see command syntax.
|
4
4
|
|
5
5
|
Configure cluster and write configuration file:
|
6
|
-
mongrel_rails cluster::configure
|
6
|
+
mongrel_rails cluster::configure
|
7
7
|
|
8
8
|
Start cluster:
|
9
|
-
mongrel_rails cluster::start
|
9
|
+
mongrel_rails cluster::start
|
10
10
|
|
11
11
|
Restart cluster:
|
12
|
-
mongrel_rails cluster::restart
|
12
|
+
mongrel_rails cluster::restart
|
13
13
|
|
14
14
|
Stop cluster:
|
15
|
-
mongrel_rails cluster::stop
|
15
|
+
mongrel_rails cluster::stop
|
16
16
|
|
17
|
-
Capistrano
|
17
|
+
== Capistrano 1.0 Recipes
|
18
18
|
|
19
19
|
Add to config/deploy.rb:
|
20
|
-
require 'mongrel_cluster/recipes'
|
20
|
+
require 'mongrel_cluster/recipes'
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
mongrel_conf: Path to conf file. Defaults to /etc/mongrel_cluster/app_name.conf
|
31
|
-
mongrel_user: User to run mongrels in cluster as. Unset by default
|
32
|
-
mongrel_group: Group to run mongrels in cluster as. Unset by default.
|
22
|
+
Variables:
|
23
|
+
mongrel_servers: Number of Mongrel servers to start.
|
24
|
+
mongrel_port: Starting port to bind to.
|
25
|
+
mongrel_address: Address to bind to.
|
26
|
+
mongrel_environment: Rails environment to run as.
|
27
|
+
mongrel_conf: Path to conf file. Defaults to /etc/mongrel_cluster/app_name.conf
|
28
|
+
mongrel_user: User to run mongrels in cluster as. Unset by default
|
29
|
+
mongrel_group: Group to run mongrels in cluster as. Unset by default.
|
33
30
|
|
34
31
|
Tasks (performed on :app role)
|
35
|
-
configure_mongrel_cluster: Configure the cluster with variables.
|
36
|
-
start_mongrel_cluster: Start Mongrel processes on the app server.
|
37
|
-
stop_mongrel_cluster: Stop the Mongrel processes on the app server.
|
38
|
-
restart_mongrel_cluster: Restart the Mongrel processes on the app server by starting and stopping mongrel_cluster.
|
39
|
-
restart: Calls restart_mongrel_cluster to allow Mongrel to be used with the standard Capistrano deploy task.
|
40
|
-
spinner: Calls start_mongrel_cluster to allow Mongrel to be used with the standard Capistrano cold_deploy task.
|
41
|
-
|
42
|
-
|
32
|
+
configure_mongrel_cluster: Configure the cluster with variables.
|
33
|
+
start_mongrel_cluster: Start Mongrel processes on the app server.
|
34
|
+
stop_mongrel_cluster: Stop the Mongrel processes on the app server.
|
35
|
+
restart_mongrel_cluster: Restart the Mongrel processes on the app server by starting and stopping mongrel_cluster.
|
36
|
+
restart: Calls restart_mongrel_cluster to allow Mongrel to be used with the standard Capistrano deploy task.
|
37
|
+
spinner: Calls start_mongrel_cluster to allow Mongrel to be used with the standard Capistrano cold_deploy task.
|
38
|
+
|
39
|
+
== Capistrano 2.0 Recipes
|
40
|
+
|
41
|
+
Add to config/deploy.rb:
|
42
|
+
require 'mongrel_cluster/recipes_2'
|
43
|
+
|
44
|
+
Capistrano 2.0 uses namespaced tasks. The new task names are:
|
45
|
+
mongrel:cluster:configure Configure the cluster with variables.
|
46
|
+
mongrel:cluster:start: Start Mongrel processes on the app server.
|
47
|
+
mongrel:cluster:stop: Stop the Mongrel processes on the app server.
|
48
|
+
mongrel:cluster:restart: Restart the Mongrel processes on the app server by starting and stopping mongrel_cluster.
|
49
|
+
deploy:restart: Calls mongrel:cluster:restart to allow Mongrel to be used with the standard Capistrano deploy task.
|
50
|
+
deploy:start: Calls mongrel:cluster:start to allow Mongrel to be used with the standard Capistrano deploy task.
|
51
|
+
deploy:stop: Calls mongrel:cluster:stop to allow Mongrel to be used with the standard Capistrano deploy task.
|
52
|
+
|
53
|
+
== Starting clusters at boot
|
54
|
+
|
43
55
|
1. Create mongrel_cluster conf directory (/etc/mongrel_cluster).
|
44
|
-
2. Assign ownership to your
|
56
|
+
2. Assign ownership to your Capistrano user.
|
45
57
|
3. Copy the init.d script from this gem's resouces directory /etc/init.d.
|
46
58
|
4. chmod +x /etc/init.d/mongrel_cluster
|
47
59
|
5. Add to init.d startup. On RHEL/CentOS use: /sbin/chkconfig --level 345 mongrel_cluster on
|
data/bin/mongrel_cluster_ctl
CHANGED
@@ -3,13 +3,14 @@
|
|
3
3
|
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
-
def run(command, verbose)
|
6
|
+
def run(command, verbose, clean=false)
|
7
7
|
Dir.chdir @options[:conf_path] do
|
8
8
|
confs = Dir.glob("*.yml")
|
9
9
|
confs += Dir.glob("*.conf")
|
10
10
|
confs.each do |conf|
|
11
11
|
cmd = "mongrel_rails cluster::#{command} -C #{conf}"
|
12
12
|
cmd += " -v" if verbose
|
13
|
+
cmd += " --clean" if clean
|
13
14
|
puts cmd if verbose || command == "status"
|
14
15
|
output = `#{cmd}`
|
15
16
|
puts output if verbose || command == "status"
|
@@ -21,12 +22,14 @@ end
|
|
21
22
|
@options = {}
|
22
23
|
@options[:conf_path] = "/etc/mongrel_cluster"
|
23
24
|
@options[:verbose] = false
|
25
|
+
@options[:clean] = false
|
24
26
|
|
25
27
|
OptionParser.new do |opts|
|
26
28
|
opts.banner = "Usage: #{$0} (start|stop|restart|status) [options]"
|
27
29
|
|
28
30
|
opts.on("-c", "--conf_path PATH", "Path to mongrel_cluster configuration files") { |value| @options[:conf_path] = value }
|
29
31
|
opts.on('-v', '--verbose', "Print all called commands and output.") { |value| @options[:verbose] = value }
|
32
|
+
opts.on('--clean', "Remove pid files if needed beforehand.") { |value| @options[:clean] = value }
|
30
33
|
|
31
34
|
if ARGV.empty?
|
32
35
|
puts opts
|
@@ -49,14 +52,14 @@ end
|
|
49
52
|
case @cmd[0]
|
50
53
|
when "start":
|
51
54
|
puts "Starting all mongrel_clusters..."
|
52
|
-
run "start", @options[:verbose]
|
55
|
+
run "start", @options[:verbose], @options[:clean]
|
53
56
|
when "stop":
|
54
57
|
puts "Stopping all mongrel_clusters..."
|
55
|
-
run "stop", @options[:verbose]
|
58
|
+
run "stop", @options[:verbose], @options[:clean]
|
56
59
|
when "restart":
|
57
60
|
puts "Restarting all mongrel_clusters..."
|
58
|
-
run "stop", @options[:verbose]
|
59
|
-
run "start", @options[:verbose]
|
61
|
+
run "stop", @options[:verbose], @options[:clean]
|
62
|
+
run "start", @options[:verbose], @options[:clean]
|
60
63
|
when "status":
|
61
64
|
puts "Checking all mongrel_clusters..."
|
62
65
|
run "status", @options[:verbose]
|
data/lib/mongrel_cluster/init.rb
CHANGED
@@ -11,7 +11,7 @@ module Cluster
|
|
11
11
|
|
12
12
|
def validate
|
13
13
|
valid_exists?(@config_file, "Configuration file does not exist. Run mongrel_rails cluster::configure.")
|
14
|
-
|
14
|
+
@valid
|
15
15
|
end
|
16
16
|
|
17
17
|
def read_options
|
@@ -62,25 +62,28 @@ module Cluster
|
|
62
62
|
argv = [ "mongrel_rails" ]
|
63
63
|
argv << "start"
|
64
64
|
argv << "-d"
|
65
|
-
argv << "-e #{@options[
|
66
|
-
argv << "-a #{@options[
|
67
|
-
argv << "-c #{@options[
|
68
|
-
argv << "-
|
69
|
-
argv << "-
|
70
|
-
argv << "-
|
71
|
-
argv << "-
|
72
|
-
argv << "-
|
73
|
-
argv << "-
|
74
|
-
argv << "
|
75
|
-
argv << "--
|
76
|
-
argv << "--
|
65
|
+
argv << "-e #{@options['environment']}" if @options['environment']
|
66
|
+
argv << "-a #{@options['address']}" if @options['address']
|
67
|
+
argv << "-c #{@options['cwd']}" if @options['cwd']
|
68
|
+
argv << "-o #{@options['timeout']}" if @options['timeout']
|
69
|
+
argv << "-t #{@options['throttle']}" if @options['throttle']
|
70
|
+
argv << "-m #{@options['mime_map']}" if @options['mime_map']
|
71
|
+
argv << "-r #{@options['docroot']}" if @options['docroot']
|
72
|
+
argv << "-n #{@options['num_procs']}" if @options['num_procs']
|
73
|
+
argv << "-B" if @options['debug']
|
74
|
+
argv << "-S #{@options['config_script']}" if @options['config_script']
|
75
|
+
argv << "--user #{@options['user']}" if @options['user']
|
76
|
+
argv << "--group #{@options['group']}" if @options['group']
|
77
|
+
argv << "--prefix #{@options['prefix']}" if @options['prefix']
|
77
78
|
cmd = argv.join " "
|
78
79
|
|
79
80
|
@ports.each do |port|
|
80
81
|
if @clean && pid_file_exists?(port) && !check_process(port)
|
81
82
|
pid_file = port_pid_file(port)
|
82
83
|
log "missing process: removing #{pid_file}"
|
83
|
-
|
84
|
+
chdir_cwd do
|
85
|
+
File.unlink(pid_file)
|
86
|
+
end
|
84
87
|
end
|
85
88
|
|
86
89
|
if pid_file_exists?(port) && check_process(port)
|
@@ -149,7 +152,7 @@ module Cluster
|
|
149
152
|
puts ""
|
150
153
|
end
|
151
154
|
|
152
|
-
|
155
|
+
status
|
153
156
|
end
|
154
157
|
|
155
158
|
def pid_file_exists?(port)
|
@@ -169,13 +172,17 @@ module Cluster
|
|
169
172
|
else
|
170
173
|
pid = find_pid(port)
|
171
174
|
end
|
172
|
-
|
175
|
+
pid
|
173
176
|
end
|
174
177
|
|
175
|
-
def cmd_name
|
176
|
-
RUBY_PLATFORM =~ /solaris/i ? "args" : "command"
|
178
|
+
def cmd_name
|
179
|
+
RUBY_PLATFORM =~ /solaris|aix/i ? "args" : "command"
|
177
180
|
end
|
178
|
-
|
181
|
+
|
182
|
+
def cmd_flags
|
183
|
+
RUBY_PLATFORM =~ /solaris|aix/i ? "-eo" : "-ewwo"
|
184
|
+
end
|
185
|
+
|
179
186
|
def chdir_cwd
|
180
187
|
pwd = Dir.pwd
|
181
188
|
Dir.chdir(@options["cwd"]) if @options["cwd"]
|
@@ -189,21 +196,20 @@ module Cluster
|
|
189
196
|
chdir_cwd do
|
190
197
|
pid = File.read(pid_file)
|
191
198
|
end
|
192
|
-
|
199
|
+
pid
|
193
200
|
end
|
194
201
|
|
195
202
|
def find_pid(port)
|
196
|
-
ps_cmd = "ps
|
197
|
-
ps_output = `#{ps_cmd}`
|
198
|
-
ps_output.each do |line|
|
199
|
-
if line =~ /-P #{Regexp.escape(port_pid_file(port))} /
|
203
|
+
ps_cmd = "ps #{cmd_flags} pid,#{cmd_name}"
|
204
|
+
ps_output = `#{ps_cmd}`
|
205
|
+
ps_output.each do |line|
|
206
|
+
if line =~ /-P #{Regexp.escape(port_pid_file(port))} /
|
200
207
|
pid = line.split[0]
|
201
208
|
return pid
|
202
209
|
end
|
203
210
|
end
|
204
|
-
return nil
|
205
211
|
end
|
206
|
-
|
212
|
+
|
207
213
|
def log_error(message)
|
208
214
|
log(message)
|
209
215
|
end
|
@@ -282,7 +288,8 @@ module Cluster
|
|
282
288
|
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
|
283
289
|
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"],
|
284
290
|
['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
|
285
|
-
['-
|
291
|
+
['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, nil],
|
292
|
+
['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, nil],
|
286
293
|
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
|
287
294
|
['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil],
|
288
295
|
['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil],
|
@@ -302,7 +309,7 @@ module Cluster
|
|
302
309
|
valid?(@servers > 0, "Must give a valid number of servers")
|
303
310
|
valid_dir? File.dirname(@config_file), "Path to config file not valid: #{@config_file}"
|
304
311
|
|
305
|
-
|
312
|
+
@valid
|
306
313
|
end
|
307
314
|
|
308
315
|
def run
|
@@ -315,9 +322,10 @@ module Cluster
|
|
315
322
|
@options["log_file"] = @log_file if @log_file
|
316
323
|
@options["debug"] = @debug if @debug
|
317
324
|
@options["num_procs"] = @num_procs if @num_procs
|
318
|
-
@options["docroot"] = @docroot if @
|
325
|
+
@options["docroot"] = @docroot if @docroot
|
319
326
|
@options["address"] = @address if @address
|
320
327
|
@options["timeout"] = @timeout if @timeout
|
328
|
+
@options["throttle"] = @throttle if @throttle
|
321
329
|
@options["environment"] = @environment if @environment
|
322
330
|
@options["mime_map"] = @mime_map if @mime_map
|
323
331
|
@options["config_script"] = @config_script if @config_script
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
# Gem::Specification for Mongrel_cluster-1.0.3
|
3
|
+
# Originally generated by Echoe
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{mongrel_cluster}
|
7
|
+
s.version = "1.0.3"
|
8
|
+
|
9
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Bradley Taylor"]
|
13
|
+
s.date = %q{2007-10-26}
|
14
|
+
s.default_executable = %q{mongrel_cluster_ctl}
|
15
|
+
s.description = %q{Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes.}
|
16
|
+
s.email = %q{}
|
17
|
+
s.executables = ["mongrel_cluster_ctl"]
|
18
|
+
s.files = ["resources/mongrel_cluster", "resources/defaults.yaml", "README", "Manifest", "LICENSE", "lib/mongrel_cluster/recipes.rb", "lib/mongrel_cluster/init.rb", "COPYING", "CHANGELOG", "bin/mongrel_cluster_ctl", "mongrel_cluster.gemspec"]
|
19
|
+
s.homepage = %q{}
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rubyforge_project = %q{mongrel}
|
22
|
+
s.rubygems_version = %q{0.9.4.6}
|
23
|
+
s.summary = %q{Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes.}
|
24
|
+
|
25
|
+
s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
|
26
|
+
s.add_dependency(%q<mongrel>, [">= 1.0.2"])
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
# # Original Rakefile source (requires the Echoe gem):
|
31
|
+
#
|
32
|
+
#
|
33
|
+
# require 'echoe'
|
34
|
+
#
|
35
|
+
# Echoe.new("mongrel_cluster") do |p|
|
36
|
+
# p.summary = "Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes."
|
37
|
+
# p.project = "mongrel"
|
38
|
+
# p.author="Bradley Taylor"
|
39
|
+
# p.dependencies = ['gem_plugin >=0.2.3', 'mongrel >=1.0.2']
|
40
|
+
# p.has_rdoc = false
|
41
|
+
#
|
42
|
+
# p.need_tar_gz = false
|
43
|
+
# p.need_tgz = true
|
44
|
+
# p.require_signed = true
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# # Is this still used?
|
48
|
+
# task :gem_source do
|
49
|
+
# mkdir_p "pkg/gems"
|
50
|
+
#
|
51
|
+
# FileList["**/*.gem"].each { |gem| mv gem, "pkg/gems" }
|
52
|
+
# FileList["pkg/*.tgz"].each {|tgz| rm tgz }
|
53
|
+
# rm_rf "pkg/#{name}-#{version}"
|
54
|
+
#
|
55
|
+
# sh %{ generate_yaml_index.rb -d pkg }
|
56
|
+
# sh %{ scp -r pkg/* #{ENV['SSH_USER']}@rubyforge.org:/var/www/gforge-projects/mongrel/releases/ }
|
57
|
+
# end
|
58
|
+
#
|
metadata
CHANGED
@@ -1,52 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
3
|
-
specification_version:
|
2
|
+
rubygems_version: 0.9.4.6
|
3
|
+
specification_version: 2
|
4
4
|
name: mongrel_cluster
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.3
|
7
|
+
date: 2007-10-26 00:00:00 -04:00
|
8
8
|
summary: Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email:
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
11
|
+
email: ""
|
12
|
+
homepage: ""
|
13
|
+
rubyforge_project: mongrel
|
14
14
|
description: Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes.
|
15
15
|
autorequire:
|
16
|
-
default_executable:
|
16
|
+
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: false
|
19
|
-
required_ruby_version: !ruby/object:Gem::
|
19
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: "0"
|
24
30
|
version:
|
25
31
|
platform: ruby
|
26
32
|
signing_key:
|
27
33
|
cert_chain:
|
34
|
+
- |
|
35
|
+
-----BEGIN CERTIFICATE-----
|
36
|
+
MIIDUDCCAjigAwIBAgIBADANBgkqhkiG9w0BAQUFADBOMRwwGgYDVQQDDBNtb25n
|
37
|
+
cmVsLWRldmVsb3BtZW50MRkwFwYKCZImiZPyLGQBGRYJcnVieWZvcmdlMRMwEQYK
|
38
|
+
CZImiZPyLGQBGRYDb3JnMB4XDTA3MDkxNjEwMzI0OVoXDTA4MDkxNTEwMzI0OVow
|
39
|
+
TjEcMBoGA1UEAwwTbW9uZ3JlbC1kZXZlbG9wbWVudDEZMBcGCgmSJomT8ixkARkW
|
40
|
+
CXJ1Ynlmb3JnZTETMBEGCgmSJomT8ixkARkWA29yZzCCASIwDQYJKoZIhvcNAQEB
|
41
|
+
BQADggEPADCCAQoCggEBAMb9v3B01eOHk3FyypbQgKXzJplUE5P6dXoG+xpPm0Lv
|
42
|
+
P7BQmeMncOwqQ7zXpVQU+lTpXtQFTsOE3vL7KnhQFJKGvUAkbh24VFyopu1I0yqF
|
43
|
+
mGu4nRqNXGXVj8TvLSj4S1WpSRLAa0acLPNyKhGmoV9+crqQypSjM6XKjBeppifo
|
44
|
+
4eBmWGjiJEYMIJBvJZPJ4rAVDDA8C6CM1m3gMBGNh8ELDhU8HI9AP3dMIkTI2Wx9
|
45
|
+
9xkJwHdroAaS0IFFtYChrwee4FbCF1FHDgoTosMwa47DrLHg4hZ6ojaKwK5QVWEV
|
46
|
+
XGb6ju5UqpktnSWF2W+Lvl/K0tI42OH2CAhebT1gEVUCAwEAAaM5MDcwCQYDVR0T
|
47
|
+
BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFGHChyMSZ16u9WOzKhgJSQ9lqDc5
|
48
|
+
MA0GCSqGSIb3DQEBBQUAA4IBAQA/lfeN2WdB1xN+82tT7vNS4HOjRQw6MUh5yktu
|
49
|
+
GQjaGqm0UB+aX0Z9y0B0qpfv9rj7nmIvEGiwBmDepNWYCGuW15JyqpN7QVVnG2xS
|
50
|
+
Mrame7VqgjM7A+VGDD5In5LtWbM/CHAATvvFlQ5Ph13YE1EdnVbZ65c+KQv+5sFY
|
51
|
+
Q+zEop74d878uaC/SAHHXS46TiXneocaLSYw1CEZs/MAIy+9c4Q5ESbGpgnfg1Ad
|
52
|
+
6lwl7k3hsNHO/+tZzx4HJtOXDI1yAl3+q6T9J0yI3z97EinwvAKhS1eyOI2Y5eeT
|
53
|
+
tbQaNYkU127B3l/VNpd8fQm3Jkl/PqCCmDBQjUszFrJEODug
|
54
|
+
-----END CERTIFICATE-----
|
55
|
+
|
56
|
+
- |
|
57
|
+
-----BEGIN CERTIFICATE-----
|
58
|
+
MIIDPzCCAiegAwIBAgIBADANBgkqhkiG9w0BAQUFADBOMRwwGgYDVQQDDBNtb25n
|
59
|
+
cmVsLWRldmVsb3BtZW50MRkwFwYKCZImiZPyLGQBGRYJcnVieWZvcmdlMRMwEQYK
|
60
|
+
CZImiZPyLGQBGRYDb3JnMB4XDTA3MDkxNjEwMzMwMFoXDTA4MDkxNTEwMzMwMFow
|
61
|
+
PTENMAsGA1UEAwwEZXZhbjEYMBYGCgmSJomT8ixkARkWCGNsb3VkYnVyMRIwEAYK
|
62
|
+
CZImiZPyLGQBGRYCc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDk
|
63
|
+
LQijz2fICmev4+9s0WB71WzJFYCUYFQQxqGlenbxWut9dlPSsBbskGjg+UITeOXi
|
64
|
+
cTh3MTqAB0i1LJyNOiyvDsAivn7GjKXhVvflp2/npMhBBe83P4HOWqeQBjkk3QJI
|
65
|
+
FFNBvqbFLeEXIP+HiqAOiyNHZEVXMepLEJLzGrg3Ly7M7A6L5fK7jDrt8jkm+c+8
|
66
|
+
zGquVHV5ohAebGd/vpHMLjpA7lCG5+MBgYZd33rRfNtCxDJMNRgnOu9PsB05+LJn
|
67
|
+
MpDKQq3x0SkOf5A+MVOcadNCaAkFflYk3SUcXaXWxu/eCHgqfW1m76RNSp5djpKE
|
68
|
+
CgNPK9lGIWpB3CHzDaVNAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSw
|
69
|
+
MB0GA1UdDgQWBBT5aonPfFBdJ5rWFG+8dZwgyB54LjANBgkqhkiG9w0BAQUFAAOC
|
70
|
+
AQEAiKbzWgMcvZs/TPwJxr8tJ+7mSGz7+zDkWcbBl8FpQq1DtRcATh1oyTkQT7t+
|
71
|
+
rFEBYMmb0FxbbUnojQp8hIFgFkUwFpStwWBL/okLSehntzI2iwjuEtfj4ac9Q3Y2
|
72
|
+
uSdbmZqsQTuu+lEUc5C4qLK7YKwToaul+cx7vWxyk1YendcVwRlFLIBqA5cPrwo3
|
73
|
+
yyGLTHlRYn2c9PSbM1B63Yg+LqSSAa4QSU3Wv9pNdffVpvwHPVEQpO7ZDo5slQFL
|
74
|
+
Gf6+gbD/eZAvhpvmn8JlXb+LxKaFVMs2Yvrk1xOuT76SsPjEGWxkr7jZCIpsYfgQ
|
75
|
+
ALN3mi/9z0Mf1YroliUgF0v5Yw==
|
76
|
+
-----END CERTIFICATE-----
|
77
|
+
|
28
78
|
post_install_message:
|
29
79
|
authors:
|
30
80
|
- Bradley Taylor
|
31
81
|
files:
|
32
|
-
-
|
33
|
-
-
|
82
|
+
- resources/mongrel_cluster
|
83
|
+
- resources/defaults.yaml
|
34
84
|
- README
|
35
|
-
-
|
36
|
-
-
|
37
|
-
- lib/mongrel_cluster
|
85
|
+
- Manifest
|
86
|
+
- LICENSE
|
38
87
|
- lib/mongrel_cluster/recipes.rb
|
39
|
-
- lib/mongrel_cluster/init.rb~
|
40
88
|
- lib/mongrel_cluster/init.rb
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
89
|
+
- COPYING
|
90
|
+
- CHANGELOG
|
91
|
+
- bin/mongrel_cluster_ctl
|
92
|
+
- mongrel_cluster.gemspec
|
44
93
|
test_files: []
|
45
94
|
|
46
95
|
rdoc_options: []
|
47
96
|
|
48
|
-
extra_rdoc_files:
|
49
|
-
|
97
|
+
extra_rdoc_files: []
|
98
|
+
|
50
99
|
executables:
|
51
100
|
- mongrel_cluster_ctl
|
52
101
|
extensions: []
|
@@ -57,18 +106,18 @@ dependencies:
|
|
57
106
|
- !ruby/object:Gem::Dependency
|
58
107
|
name: gem_plugin
|
59
108
|
version_requirement:
|
60
|
-
version_requirements: !ruby/object:Gem::
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
110
|
requirements:
|
62
111
|
- - ">="
|
63
112
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.2.
|
113
|
+
version: 0.2.3
|
65
114
|
version:
|
66
115
|
- !ruby/object:Gem::Dependency
|
67
116
|
name: mongrel
|
68
117
|
version_requirement:
|
69
|
-
version_requirements: !ruby/object:Gem::
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
119
|
requirements:
|
71
120
|
- - ">="
|
72
121
|
- !ruby/object:Gem::Version
|
73
|
-
version: 1.0.
|
122
|
+
version: 1.0.2
|
74
123
|
version:
|
metadata.gz.sig
ADDED
Binary file
|
data/Rakefile
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/clean'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
require 'tools/rakehelp'
|
7
|
-
require 'fileutils'
|
8
|
-
include FileUtils
|
9
|
-
|
10
|
-
setup_tests
|
11
|
-
setup_clean ["pkg", "lib/*.bundle", "*.gem", ".config"]
|
12
|
-
|
13
|
-
setup_rdoc ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
|
14
|
-
|
15
|
-
desc "Does a full compile, test run"
|
16
|
-
task :default => [:test, :package]
|
17
|
-
|
18
|
-
version="1.0.2"
|
19
|
-
name="mongrel_cluster"
|
20
|
-
|
21
|
-
setup_gem(name, version) do |spec|
|
22
|
-
spec.summary = "Mongrel plugin that provides commands and Capistrano tasks for managing multiple Mongrel processes."
|
23
|
-
spec.description = spec.summary
|
24
|
-
spec.author="Bradley Taylor"
|
25
|
-
spec.add_dependency('gem_plugin', '>= 0.2.2')
|
26
|
-
spec.add_dependency('mongrel', '>= 1.0.1')
|
27
|
-
spec.files += Dir.glob("resources/**/*")
|
28
|
-
spec.has_rdoc = false
|
29
|
-
spec.files += Dir.glob("bin/*")
|
30
|
-
spec.files += Dir.glob("examples/*")
|
31
|
-
spec.default_executable = "mongrel_cluster_ctl"
|
32
|
-
spec.executables = ["mongrel_cluster_ctl"]
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
task :install => [:test, :package] do
|
37
|
-
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
38
|
-
end
|
39
|
-
|
40
|
-
task :uninstall => [:clean] do
|
41
|
-
sh %{sudo gem uninstall #{name}}
|
42
|
-
end
|
43
|
-
|
44
|
-
task :gem_source do
|
45
|
-
mkdir_p "pkg/gems"
|
46
|
-
|
47
|
-
FileList["**/*.gem"].each { |gem| mv gem, "pkg/gems" }
|
48
|
-
FileList["pkg/*.tgz"].each {|tgz| rm tgz }
|
49
|
-
rm_rf "pkg/#{name}-#{version}"
|
50
|
-
|
51
|
-
sh %{ generate_yaml_index.rb -d pkg }
|
52
|
-
sh %{ scp -r pkg/* #{ENV['SSH_USER']}@rubyforge.org:/var/www/gforge-projects/mongrel/releases/ }
|
53
|
-
end
|
54
|
-
|
@@ -1,351 +0,0 @@
|
|
1
|
-
require 'gem_plugin'
|
2
|
-
require 'mongrel'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
module Cluster
|
6
|
-
module ExecBase
|
7
|
-
include Mongrel::Command::Base
|
8
|
-
|
9
|
-
STATUS_OK = 0
|
10
|
-
STATUS_ERROR = 2
|
11
|
-
|
12
|
-
def validate
|
13
|
-
valid_exists?(@config_file, "Configuration file does not exist. Run mongrel_rails cluster::configure.")
|
14
|
-
return @valid
|
15
|
-
end
|
16
|
-
|
17
|
-
def read_options
|
18
|
-
@options = {
|
19
|
-
"environment" => ENV['RAILS_ENV'] || "development",
|
20
|
-
"port" => 3000,
|
21
|
-
"pid_file" => "tmp/pids/mongrel.pid",
|
22
|
-
"log_file" => "log/mongrel.log",
|
23
|
-
"servers" => 2
|
24
|
-
}
|
25
|
-
conf = YAML.load_file(@config_file)
|
26
|
-
@options.merge! conf if conf
|
27
|
-
|
28
|
-
process_pid_file @options["pid_file"]
|
29
|
-
process_log_file @options["log_file"]
|
30
|
-
|
31
|
-
start_port = end_port = @only
|
32
|
-
start_port ||= @options["port"].to_i
|
33
|
-
end_port ||= start_port + @options["servers"] - 1
|
34
|
-
@ports = (start_port..end_port).to_a
|
35
|
-
end
|
36
|
-
|
37
|
-
def process_pid_file(pid_file)
|
38
|
-
@pid_file_ext = File.extname(pid_file)
|
39
|
-
@pid_file_base = File.basename(pid_file, @pid_file_ext)
|
40
|
-
@pid_file_dir = File.dirname(pid_file)
|
41
|
-
end
|
42
|
-
|
43
|
-
def process_log_file(log_file)
|
44
|
-
@log_file_ext = File.extname(log_file)
|
45
|
-
@log_file_base = File.basename(log_file, @log_file_ext)
|
46
|
-
@log_file_dir = File.dirname(log_file)
|
47
|
-
end
|
48
|
-
|
49
|
-
def port_pid_file(port)
|
50
|
-
pid_file = [@pid_file_base, port].join(".") + @pid_file_ext
|
51
|
-
File.join(@pid_file_dir, pid_file)
|
52
|
-
end
|
53
|
-
|
54
|
-
def port_log_file(port)
|
55
|
-
log_file = [@log_file_base, port].join(".") + @log_file_ext
|
56
|
-
File.join(@log_file_dir, log_file)
|
57
|
-
end
|
58
|
-
|
59
|
-
def start
|
60
|
-
read_options
|
61
|
-
|
62
|
-
argv = [ "mongrel_rails" ]
|
63
|
-
argv << "start"
|
64
|
-
argv << "-d"
|
65
|
-
argv << "-e #{@options["environment"]}" if @options["environment"]
|
66
|
-
argv << "-a #{@options["address"]}" if @options["address"]
|
67
|
-
argv << "-c #{@options["cwd"]}" if @options["cwd"]
|
68
|
-
argv << "-t #{@options["timeout"]}" if @options["timeout"]
|
69
|
-
argv << "-m #{@options["mime_map"]}" if @options["mime_map"]
|
70
|
-
argv << "-r #{@options["docroot"]}" if @options["docroot"]
|
71
|
-
argv << "-n #{@options["num_procs"]}" if @options["num_procs"]
|
72
|
-
argv << "-B" if @options["debug"]
|
73
|
-
argv << "-S #{@options["config_script"]}" if @options["config_script"]
|
74
|
-
argv << "--user #{@options["user"]}" if @options["user"]
|
75
|
-
argv << "--group #{@options["group"]}" if @options["group"]
|
76
|
-
argv << "--prefix #{@options["prefix"]}" if @options["prefix"]
|
77
|
-
cmd = argv.join " "
|
78
|
-
|
79
|
-
@ports.each do |port|
|
80
|
-
if @clean && pid_file_exists?(port) && !check_process(port)
|
81
|
-
pid_file = port_pid_file(port)
|
82
|
-
log "missing process: removing #{pid_file}"
|
83
|
-
File.unlink(pid_file)
|
84
|
-
end
|
85
|
-
|
86
|
-
if pid_file_exists?(port) && check_process(port)
|
87
|
-
log "already started port #{port}"
|
88
|
-
next
|
89
|
-
end
|
90
|
-
|
91
|
-
exec_cmd = cmd + " -p #{port} -P #{port_pid_file(port)}"
|
92
|
-
exec_cmd += " -l #{port_log_file(port)}"
|
93
|
-
log "starting port #{port}"
|
94
|
-
log_verbose exec_cmd
|
95
|
-
output = `#{exec_cmd}`
|
96
|
-
log_error output unless $?.success?
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def stop
|
101
|
-
read_options
|
102
|
-
|
103
|
-
argv = [ "mongrel_rails" ]
|
104
|
-
argv << "stop"
|
105
|
-
argv << "-c #{@options["cwd"]}" if @options["cwd"]
|
106
|
-
argv << "-f" if @force
|
107
|
-
cmd = argv.join " "
|
108
|
-
|
109
|
-
@ports.each do |port|
|
110
|
-
pid = check_process(port)
|
111
|
-
if @clean && pid && !pid_file_exists?(port)
|
112
|
-
log "missing pid_file: killing mongrel_rails port #{port}, pid #{pid}"
|
113
|
-
Process.kill("KILL", pid.to_i)
|
114
|
-
end
|
115
|
-
|
116
|
-
if !check_process(port)
|
117
|
-
log "already stopped port #{port}"
|
118
|
-
next
|
119
|
-
end
|
120
|
-
|
121
|
-
exec_cmd = cmd + " -P #{port_pid_file(port)}"
|
122
|
-
log "stopping port #{port}"
|
123
|
-
log_verbose exec_cmd
|
124
|
-
output = `#{exec_cmd}`
|
125
|
-
log_error output unless $?.success?
|
126
|
-
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def status
|
131
|
-
read_options
|
132
|
-
|
133
|
-
status = STATUS_OK
|
134
|
-
|
135
|
-
@ports.each do |port|
|
136
|
-
pid = check_process(port)
|
137
|
-
unless pid_file_exists?(port)
|
138
|
-
log "missing pid_file: #{port_pid_file(port)}"
|
139
|
-
status = STATUS_ERROR
|
140
|
-
else
|
141
|
-
log "found pid_file: #{port_pid_file(port)}"
|
142
|
-
end
|
143
|
-
if pid
|
144
|
-
log "found mongrel_rails: port #{port}, pid #{pid}"
|
145
|
-
else
|
146
|
-
log "missing mongrel_rails: port #{port}"
|
147
|
-
status = STATUS_ERROR
|
148
|
-
end
|
149
|
-
puts ""
|
150
|
-
end
|
151
|
-
|
152
|
-
return status
|
153
|
-
end
|
154
|
-
|
155
|
-
def pid_file_exists?(port)
|
156
|
-
pid_file = port_pid_file(port)
|
157
|
-
exists = false
|
158
|
-
chdir_cwd do
|
159
|
-
exists = File.exists?(pid_file)
|
160
|
-
end
|
161
|
-
exists
|
162
|
-
end
|
163
|
-
|
164
|
-
def check_process(port)
|
165
|
-
if pid_file_exists?(port)
|
166
|
-
pid = read_pid(port)
|
167
|
-
ps_output = `ps -o #{cmd_name}= -p #{pid}`
|
168
|
-
pid = ps_output =~ /mongrel_rails/ ? pid : nil
|
169
|
-
else
|
170
|
-
pid = find_pid(port)
|
171
|
-
end
|
172
|
-
return pid
|
173
|
-
end
|
174
|
-
|
175
|
-
def cmd_name
|
176
|
-
RUBY_PLATFORM =~ /solaris/i ? "args" : "command"
|
177
|
-
end
|
178
|
-
|
179
|
-
def chdir_cwd
|
180
|
-
pwd = Dir.pwd
|
181
|
-
Dir.chdir(@options["cwd"]) if @options["cwd"]
|
182
|
-
yield
|
183
|
-
Dir.chdir(pwd) if @options["cwd"]
|
184
|
-
end
|
185
|
-
|
186
|
-
def read_pid(port)
|
187
|
-
pid_file = port_pid_file(port)
|
188
|
-
pid = 0
|
189
|
-
chdir_cwd do
|
190
|
-
pid = File.read(pid_file)
|
191
|
-
end
|
192
|
-
return pid
|
193
|
-
end
|
194
|
-
|
195
|
-
def find_pid(port)
|
196
|
-
ps_cmd = "ps -ewwo pid,#{cmd_name}"
|
197
|
-
ps_output = `#{ps_cmd}`
|
198
|
-
ps_output.each do |line|
|
199
|
-
if line =~ /-P #{Regexp.escape(port_pid_file(port))} /
|
200
|
-
pid = line.split[0]
|
201
|
-
return pid
|
202
|
-
end
|
203
|
-
end
|
204
|
-
return nil
|
205
|
-
end
|
206
|
-
|
207
|
-
def log_error(message)
|
208
|
-
log(message)
|
209
|
-
end
|
210
|
-
|
211
|
-
def log_verbose(message)
|
212
|
-
log(message) if @verbose
|
213
|
-
end
|
214
|
-
|
215
|
-
def log(message)
|
216
|
-
puts message
|
217
|
-
end
|
218
|
-
end
|
219
|
-
class Start < GemPlugin::Plugin "/commands"
|
220
|
-
include ExecBase
|
221
|
-
|
222
|
-
def configure
|
223
|
-
options [
|
224
|
-
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
225
|
-
['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
|
226
|
-
['', '--clean', "Remove pid_file if needed before starting", :@clean, false],
|
227
|
-
['', '--only PORT', "Port number of cluster member", :@only, nil]
|
228
|
-
]
|
229
|
-
end
|
230
|
-
|
231
|
-
def run
|
232
|
-
start
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
class Stop < GemPlugin::Plugin "/commands"
|
237
|
-
include ExecBase
|
238
|
-
|
239
|
-
def configure
|
240
|
-
options [
|
241
|
-
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
242
|
-
['-f', '--force', "Force the shutdown.", :@force, false],
|
243
|
-
['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
|
244
|
-
['', '--clean', "Remove orphaned process if needed before stopping", :@clean, false],
|
245
|
-
['', '--only PORT', "Port number of cluster member", :@only, nil]
|
246
|
-
]
|
247
|
-
end
|
248
|
-
|
249
|
-
def run
|
250
|
-
stop
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
class Restart < GemPlugin::Plugin "/commands"
|
255
|
-
include ExecBase
|
256
|
-
|
257
|
-
def configure
|
258
|
-
options [
|
259
|
-
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
260
|
-
['-f', '--force', "Force the shutdown.", :@force, false],
|
261
|
-
['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
|
262
|
-
['', '--clean', "Call stop and start with --clean", :@clean, false],
|
263
|
-
['', '--only PORT', "Port number of cluster member", :@only, nil]
|
264
|
-
]
|
265
|
-
end
|
266
|
-
|
267
|
-
def run
|
268
|
-
stop
|
269
|
-
start
|
270
|
-
end
|
271
|
-
|
272
|
-
end
|
273
|
-
|
274
|
-
class Configure < GemPlugin::Plugin "/commands"
|
275
|
-
include ExecBase
|
276
|
-
|
277
|
-
def configure
|
278
|
-
options [
|
279
|
-
["-e", "--environment ENV", "Rails environment to run as", :@environment, nil],
|
280
|
-
['-p', '--port PORT', "Starting port to bind to", :@port, 3000],
|
281
|
-
['-a', '--address ADDR', "Address to bind to", :@address, nil],
|
282
|
-
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
|
283
|
-
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"],
|
284
|
-
['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
|
285
|
-
['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, nil],
|
286
|
-
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
|
287
|
-
['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil],
|
288
|
-
['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil],
|
289
|
-
['-B', '--debug', "Enable debugging mode", :@debug, nil],
|
290
|
-
['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
|
291
|
-
['-N', '--num-servers INT', "Number of Mongrel servers", :@servers, 2],
|
292
|
-
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
293
|
-
['', '--user USER', "User to run as", :@user, nil],
|
294
|
-
['', '--group GROUP', "Group to run as", :@group, nil],
|
295
|
-
['', '--prefix PREFIX', "Rails prefix to use", :@prefix, nil]
|
296
|
-
]
|
297
|
-
end
|
298
|
-
|
299
|
-
def validate
|
300
|
-
@servers = @servers.to_i
|
301
|
-
|
302
|
-
valid?(@servers > 0, "Must give a valid number of servers")
|
303
|
-
valid_dir? File.dirname(@config_file), "Path to config file not valid: #{@config_file}"
|
304
|
-
|
305
|
-
return @valid
|
306
|
-
end
|
307
|
-
|
308
|
-
def run
|
309
|
-
@options = {
|
310
|
-
"port" => @port,
|
311
|
-
"servers" => @servers,
|
312
|
-
"pid_file" => @pid_file
|
313
|
-
}
|
314
|
-
|
315
|
-
@options["log_file"] = @log_file if @log_file
|
316
|
-
@options["debug"] = @debug if @debug
|
317
|
-
@options["num_procs"] = @num_procs if @num_procs
|
318
|
-
@options["docroot"] = @docroot if @docroots
|
319
|
-
@options["address"] = @address if @address
|
320
|
-
@options["timeout"] = @timeout if @timeout
|
321
|
-
@options["environment"] = @environment if @environment
|
322
|
-
@options["mime_map"] = @mime_map if @mime_map
|
323
|
-
@options["config_script"] = @config_script if @config_script
|
324
|
-
@options["cwd"] = @cwd if @cwd
|
325
|
-
@options["user"] = @user if @user
|
326
|
-
@options["group"] = @group if @group
|
327
|
-
@options["prefix"] = @prefix if @prefix
|
328
|
-
|
329
|
-
log "Writing configuration file to #{@config_file}."
|
330
|
-
File.open(@config_file,"w") {|f| f.write(@options.to_yaml)}
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
class Status < GemPlugin::Plugin "/commands"
|
335
|
-
include ExecBase
|
336
|
-
|
337
|
-
def configure
|
338
|
-
options [
|
339
|
-
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
340
|
-
['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
|
341
|
-
['', '--only PORT', "Port number of cluster member", :@only, nil]
|
342
|
-
]
|
343
|
-
end
|
344
|
-
|
345
|
-
def run
|
346
|
-
status
|
347
|
-
end
|
348
|
-
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
data/tools/rakehelp.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
|
2
|
-
def make(makedir)
|
3
|
-
Dir.chdir(makedir) do
|
4
|
-
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
|
-
def extconf(dir)
|
10
|
-
Dir.chdir(dir) do ruby "extconf.rb" end
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
def setup_tests
|
15
|
-
Rake::TestTask.new do |t|
|
16
|
-
t.libs << "test"
|
17
|
-
t.test_files = FileList['test/test*.rb']
|
18
|
-
t.verbose = true
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
def setup_clean otherfiles
|
24
|
-
files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
|
25
|
-
CLEAN.include(files)
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
def setup_rdoc files
|
30
|
-
Rake::RDocTask.new do |rdoc|
|
31
|
-
rdoc.rdoc_dir = 'doc/rdoc'
|
32
|
-
rdoc.options << '--line-numbers'
|
33
|
-
rdoc.rdoc_files.add(files)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def setup_extension(dir, extension)
|
39
|
-
ext = "ext/#{dir}"
|
40
|
-
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
|
41
|
-
ext_files = FileList[
|
42
|
-
"#{ext}/*.c",
|
43
|
-
"#{ext}/*.h",
|
44
|
-
"#{ext}/extconf.rb",
|
45
|
-
"#{ext}/Makefile",
|
46
|
-
"lib"
|
47
|
-
]
|
48
|
-
|
49
|
-
task "lib" do
|
50
|
-
directory "lib"
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Builds just the #{extension} extension"
|
54
|
-
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
55
|
-
|
56
|
-
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
|
57
|
-
extconf "#{ext}"
|
58
|
-
end
|
59
|
-
|
60
|
-
file ext_so => ext_files do
|
61
|
-
make "#{ext}"
|
62
|
-
cp ext_so, "lib"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def base_gem_spec(pkg_name, pkg_version)
|
68
|
-
pkg_version = pkg_version
|
69
|
-
pkg_name = pkg_name
|
70
|
-
pkg_file_name = "#{pkg_name}-#{pkg_version}"
|
71
|
-
Gem::Specification.new do |s|
|
72
|
-
s.name = pkg_name
|
73
|
-
s.version = pkg_version
|
74
|
-
s.platform = Gem::Platform::RUBY
|
75
|
-
s.has_rdoc = true
|
76
|
-
s.extra_rdoc_files = [ "README" ]
|
77
|
-
|
78
|
-
s.files = %w(COPYING LICENSE README Rakefile) +
|
79
|
-
Dir.glob("{bin,doc/rdoc,test,lib}/**/*") +
|
80
|
-
Dir.glob("ext/**/*.{h,c,rb}") +
|
81
|
-
Dir.glob("examples/**/*.rb") +
|
82
|
-
Dir.glob("tools/*.rb")
|
83
|
-
|
84
|
-
s.require_path = "lib"
|
85
|
-
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
86
|
-
s.bindir = "bin"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def setup_gem(pkg_name, pkg_version)
|
91
|
-
spec = base_gem_spec(pkg_name, pkg_version)
|
92
|
-
yield spec if block_given?
|
93
|
-
|
94
|
-
Rake::GemPackageTask.new(spec) do |p|
|
95
|
-
p.gem_spec = spec
|
96
|
-
p.need_tar = true
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def setup_win32_gem(pkg_name, pkg_version)
|
101
|
-
spec = base_gem_spec(pkg_name, pkg_version)
|
102
|
-
yield spec if block_given?
|
103
|
-
|
104
|
-
Gem::Builder.new(spec).build
|
105
|
-
end
|