mongrel_cluster_recovery 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,55 @@
1
+ Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw
2
+ <zedshaw at zedshaw dot com> and contributors. You can redistribute it
3
+ and/or modify it under either the terms of the GPL2 or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise make them
13
+ Freely Available, such as by posting said modifications to Usenet or an
14
+ equivalent medium, or by allowing the author to include your
15
+ modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) rename any non-standard executables so the names do not conflict with
21
+ standard executables, which must also be provided.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or executable
26
+ form, provided that you do at least ONE of the following:
27
+
28
+ a) distribute the executables and library files of the software,
29
+ together with instructions (in the manual page or equivalent) on where
30
+ to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of the
33
+ software.
34
+
35
+ c) give non-standard executables non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under this terms.
43
+
44
+ 5. The scripts and library files supplied as input to or produced as
45
+ output from the software do not automatically fall under the
46
+ copyright of the software, but belong to whomever generated them,
47
+ and may be sold commercially, and may be aggregated with this
48
+ software.
49
+
50
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
51
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
52
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53
+ PURPOSE.
54
+
55
+
data/README ADDED
@@ -0,0 +1,7 @@
1
+ == Mongrel Cluster Plugin
2
+
3
+ Tool to help recovery 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
+
5
+ Recovery cluster:
6
+ mongrel_rails cluster::recovery
7
+
@@ -0,0 +1,63 @@
1
+ require 'mongrel'
2
+ require 'gem_plugin'
3
+
4
+ require 'net/http'
5
+
6
+ GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
7
+
8
+ module Cluster
9
+ class Recovery < GemPlugin::Plugin "/commands"
10
+ include Cluster::ExecBase
11
+
12
+ def configure
13
+ options [
14
+ ['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
15
+ ['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
16
+ ['', '--only PORT', "Port number of cluster member", :@only, nil],
17
+ ['', '--open_timeout sec', "Port test timeout of open", :@open_timeout, 3],
18
+ ['', '--read_timeout sec', "Port test timeout of read", :@read_timeout, 5],
19
+ ['', '--url URL', "Port test url", :@url, '/'],
20
+ ]
21
+ end
22
+
23
+ def run
24
+ read_options
25
+ @force = true
26
+ @clean = true
27
+ @_ports_ = @ports.dup
28
+ @_ports_.each do |_port_|
29
+ @only = _port_
30
+
31
+ if status != Cluster::ExecBase::STATUS_OK
32
+ stop && start
33
+ else
34
+ begin
35
+ Net::HTTP.version_1_2
36
+ http = Net::HTTP.new( 'localhost', _port_ )
37
+ http.open_timeout = @open_timeout
38
+ http.read_timeout = @read_timeout
39
+ http.start {|ac|
40
+ res = http.head(@url)
41
+ }
42
+ =begin
43
+ rescue Errno::ECONNREFUSED => e
44
+ log e
45
+ stop && start
46
+
47
+ rescue Timeout::Error => e
48
+ log e
49
+ stop && start
50
+ =end
51
+ rescue Exception => e
52
+ log e
53
+ stop && start
54
+
55
+ else
56
+ log "ok!"
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{mongrel_cluster_recovery}
3
+ s.version = "0.0.1"
4
+
5
+ s.specification_version = 2 if s.respond_to? :specification_version=
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["leno.ig"]
9
+ s.date = %q{2008-12-10}
10
+ s.description = %q{Mongrel plugin that provides command for recovery multiple Mongrel processes.}
11
+ s.email = %q{}
12
+ s.files = [ "lib/mongrel_cluster_recovery/init.rb", "LICENSE", "README", "mongrel_cluster_recovery.gemspec"]
13
+ s.homepage = %q{}
14
+ s.require_paths = ["lib"]
15
+ # s.rubyforge_project = %q{mongrel}
16
+ s.rubygems_version = %q{0.9.4.6}
17
+ s.summary = %q{Mongrel plugin that provides command for recovery multiple Mongrel processes.}
18
+
19
+ s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
20
+ s.add_dependency(%q<mongrel>, [">= 1.0.2"])
21
+ s.add_dependency(%q<mongrel_cluster>, [">= 1.0.5"])
22
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongrel_cluster_recovery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - leno.ig
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-10 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: gem_plugin
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.3
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: mongrel
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.0.2
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: mongrel_cluster
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.5
41
+ version:
42
+ description: Mongrel plugin that provides command for recovery multiple Mongrel processes.
43
+ email: ""
44
+ executables: []
45
+
46
+ extensions: []
47
+
48
+ extra_rdoc_files: []
49
+
50
+ files:
51
+ - lib/mongrel_cluster_recovery/init.rb
52
+ - LICENSE
53
+ - README
54
+ - mongrel_cluster_recovery.gemspec
55
+ has_rdoc: false
56
+ homepage: ""
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project:
77
+ rubygems_version: 1.1.1
78
+ signing_key:
79
+ specification_version: 2
80
+ summary: Mongrel plugin that provides command for recovery multiple Mongrel processes.
81
+ test_files: []
82
+