cdb-mongrel_cluster_rolling_restart 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +9 -0
- data/README.txt +48 -0
- data/Rakefile +12 -0
- data/lib/mongrel_cluster_rolling_restart.rb +3 -0
- data/recipes/mongrel_cluster_rolling_restart.rb +50 -0
- data/tasks/mongrel_cluster_rolling_restart.rake +4 -0
- data/test/test_mongrel_cluster_rolling_restart.rb +0 -0
- metadata +89 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/mongrel_cluster_rolling_restart.rb
|
6
|
+
mongrel_cluster_rolling_restart.gemspec
|
7
|
+
recipes/mongrel_cluster_rolling_restart.rb
|
8
|
+
tasks/mongrel_cluster_rolling_restart.rake
|
9
|
+
test/test_mongrel_cluster_rolling_restart.rb
|
data/README.txt
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= MongrelClusterRollingRestart
|
2
|
+
|
3
|
+
by Cameron D Booth
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
This is intended to let you restart a cluster of mongrels in a rolling fashion so that you don't have to take down a site with a maintenance page in order to release a simple fix. If you have a migration to run, or any other reason that you might not want people accessing your site to get different versions for a short period, then you don't want to be running a rolling restart. But for those times when you just want to deploy a super quick bug fix, hopefully this will be useful.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* This is super alpha, untested and only barely used at this stage. I'm just learning how to create a gem right now.
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
TODO
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* mongrel and mongrel_cluster gems
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* sudo gem install cdb-mongrel_cluster_rolling_restart
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2008 Cameron D Booth
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/mongrel_cluster_rolling_restart.rb'
|
6
|
+
|
7
|
+
Hoe.new('MongrelClusterRollingRestart', MongrelClusterRollingRestart::VERSION) do |p|
|
8
|
+
# p.rubyforge_name = 'MongrelClusterRollingRestartx' # if different than lowercase project name
|
9
|
+
p.developer('Cameron D Booth', 'cameron@cdbdesign.net')
|
10
|
+
end
|
11
|
+
|
12
|
+
# vim: syntax=Ruby
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'mongrel_cluster'
|
2
|
+
|
3
|
+
module Cluster
|
4
|
+
class RollingRestart < GemPlugin::Plugin "/commands"
|
5
|
+
include ExecBase
|
6
|
+
|
7
|
+
def configure
|
8
|
+
options [
|
9
|
+
['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
|
10
|
+
['-f', '--force', "Force the shutdown.", :@force, false],
|
11
|
+
['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
|
12
|
+
['', '--clean', "Call stop and start with --clean", :@clean, false],
|
13
|
+
['', '--only PORT', "Port number of cluster member", :@only, nil]
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
read_options
|
19
|
+
log "Rolling restart on ports #{@ports.join(', ')}"
|
20
|
+
|
21
|
+
@force, @clean = [false, true]
|
22
|
+
|
23
|
+
@ports.each do |port|
|
24
|
+
@only = port
|
25
|
+
stop
|
26
|
+
check_wait(@options["kill_time"] || 5)
|
27
|
+
start
|
28
|
+
if @options["startup_time"]
|
29
|
+
log "Allowing #{@options["startup_time"]} seconds for mongrel process to boot"
|
30
|
+
sleep @options["startup_time"]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def check_wait(wait_time)
|
37
|
+
wait_time.times do
|
38
|
+
return unless check_process(@only)
|
39
|
+
sleep 1
|
40
|
+
end
|
41
|
+
log " * Slept #{wait_time} seconds, but still not dead, force killing in 10 more."
|
42
|
+
sleep 10
|
43
|
+
@force = true
|
44
|
+
stop
|
45
|
+
@force = false
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cdb-mongrel_cluster_rolling_restart
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cameron Booth
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-09-24 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mongrel
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.1.4
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: mongrel_cluster
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.0.5
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: hoe
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.0
|
41
|
+
version:
|
42
|
+
description: Mongrel Cluster Rolling Restart allows for a mongrel cluster to be restarted in a rolling fashion, one mongrel at a time
|
43
|
+
email: cameron@cdbdesign.net
|
44
|
+
executables: []
|
45
|
+
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files:
|
49
|
+
- History.txt
|
50
|
+
- Manifest.txt
|
51
|
+
- README.txt
|
52
|
+
files:
|
53
|
+
- History.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- README.txt
|
56
|
+
- Rakefile
|
57
|
+
- lib/mongrel_cluster_rolling_restart.rb
|
58
|
+
- recipes/mongrel_cluster_rolling_restart.rb
|
59
|
+
- tasks/mongrel_cluster_rolling_restart.rake
|
60
|
+
- test/test_mongrel_cluster_rolling_restart.rb
|
61
|
+
has_rdoc: true
|
62
|
+
homepage: http://github.com/cdb/mongrel_cluster_rolling_restart
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- --main
|
66
|
+
- README.txt
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: "0"
|
74
|
+
version:
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.2.0
|
85
|
+
signing_key:
|
86
|
+
specification_version: 2
|
87
|
+
summary: Allows for a mongrel cluster to be restarted in a rolling fashion
|
88
|
+
test_files:
|
89
|
+
- test/test_mongrel_cluster_rolling_restart.rb
|