mutle-rackdapter 0.0.1 → 0.0.2
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/Manifest +0 -1
- data/Rakefile +1 -1
- data/lib/rackdapter/master.rb +3 -3
- data/lib/rackdapter/spawner.rb +17 -11
- data/rackdapter.gemspec +3 -3
- metadata +3 -3
data/Manifest
CHANGED
data/Rakefile
CHANGED
data/lib/rackdapter/master.rb
CHANGED
|
@@ -25,11 +25,11 @@ module Rackdapter
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def run
|
|
28
|
-
Signal.trap("INT") { all_apps(:stop);
|
|
29
|
-
Signal.trap("TERM") { all_apps(:stop);
|
|
28
|
+
Signal.trap("INT") { all_apps(:stop); EventMachine::stop_event_loop }
|
|
29
|
+
Signal.trap("TERM") { all_apps(:stop); EventMachine::stop_event_loop }
|
|
30
30
|
Signal.trap("HUP") { all_apps(:restart) }
|
|
31
31
|
EventMachine::run {
|
|
32
|
-
EventMachine::
|
|
32
|
+
EventMachine::add_periodic_timer(5) { all_apps(:ensure_running) }
|
|
33
33
|
}
|
|
34
34
|
end
|
|
35
35
|
end
|
data/lib/rackdapter/spawner.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Rackdapter
|
|
2
2
|
|
|
3
3
|
class Application
|
|
4
|
-
attr_accessor :name, :path, :environment, :backend, :port, :balancer, :base_port, :instances, :type, :log
|
|
4
|
+
attr_accessor :name, :path, :environment, :backend, :port, :balancer, :base_port, :instances, :type, :log, :ruby
|
|
5
5
|
|
|
6
6
|
def initialize(options={})
|
|
7
7
|
options.each do |k,v|
|
|
@@ -31,6 +31,10 @@ module Rackdapter
|
|
|
31
31
|
@ports
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def ruby
|
|
35
|
+
@ruby || "/usr/bin/ruby"
|
|
36
|
+
end
|
|
37
|
+
|
|
34
38
|
def all_instances(&block)
|
|
35
39
|
@app_instances.each do |port,instance|
|
|
36
40
|
instance.send(:instance_eval, &block)
|
|
@@ -61,34 +65,36 @@ module Rackdapter
|
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def self.app_options(app, port, options)
|
|
64
|
-
out = ''
|
|
65
68
|
log = app.log.gsub(/<port>/, port.to_s).gsub(/<environment>/, app.environment)
|
|
69
|
+
opts = []
|
|
66
70
|
options.each do |k,v|
|
|
67
|
-
|
|
71
|
+
unless v.blank?
|
|
72
|
+
opts << "-#{k.to_s}"
|
|
73
|
+
opts << v.to_s
|
|
74
|
+
end
|
|
68
75
|
end
|
|
69
|
-
|
|
70
|
-
out
|
|
76
|
+
opts
|
|
71
77
|
end
|
|
72
78
|
|
|
73
79
|
module RailsBackend
|
|
74
80
|
def self.spawn(app, port)
|
|
75
81
|
Dir.chdir(app.path)
|
|
76
|
-
options = Rackdapter.app_options(app, port, "e" => app.environment, "p" => port)
|
|
77
|
-
exec "mongrel_rails start
|
|
82
|
+
options = Rackdapter.app_options(app, port, "e" => app.environment, "p" => port, "c" => File.expand_path(app.path))
|
|
83
|
+
exec app.ruby, "/usr/bin/mongrel_rails", "start", *options
|
|
78
84
|
end
|
|
79
85
|
end
|
|
80
86
|
|
|
81
87
|
module MerbBackend
|
|
82
88
|
def self.spawn(app, port)
|
|
83
89
|
Dir.chdir(app.path)
|
|
84
|
-
options = Rackdapter.app_options(app, port, "e" => app.environment, "p" => port, "n" => app.name)
|
|
85
|
-
exec "merb
|
|
90
|
+
options = Rackdapter.app_options(app, port, "e" => app.environment, "p" => port, "n" => app.name, "m" => File.expand_path(app.path))
|
|
91
|
+
exec app.ruby, "/usr/bin/merb", *options
|
|
86
92
|
end
|
|
87
93
|
end
|
|
88
94
|
|
|
89
95
|
module ProxyBackend
|
|
90
96
|
def self.spawn(application, port=nil)
|
|
91
|
-
exec
|
|
97
|
+
exec app.ruby, File.join(File.dirname(__FILE__), '../../bin/rackdapter_proxy'), Rackdapter.config_path
|
|
92
98
|
end
|
|
93
99
|
end
|
|
94
100
|
|
|
@@ -142,7 +148,7 @@ module Rackdapter
|
|
|
142
148
|
return false unless @pid
|
|
143
149
|
found = false
|
|
144
150
|
`ps`.each_line do |line|
|
|
145
|
-
if line =~
|
|
151
|
+
if line =~ /^ *(#{@pid}) /
|
|
146
152
|
found = true
|
|
147
153
|
break
|
|
148
154
|
end
|
data/rackdapter.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{rackdapter}
|
|
5
|
-
s.version = "0.0.
|
|
5
|
+
s.version = "0.0.2"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Mutwin Kraus"]
|
|
9
|
-
s.date = %q{2008-12-
|
|
9
|
+
s.date = %q{2008-12-12}
|
|
10
10
|
s.description = %q{rackdapter}
|
|
11
11
|
s.email = %q{mutwin.kraus@gmail.com}
|
|
12
12
|
s.executables = ["rackdapter", "rackdapter_proxy"]
|
|
13
13
|
s.extra_rdoc_files = ["bin/rackdapter", "bin/rackdapter_proxy", "lib/rackdapter/config.rb", "lib/rackdapter/master.rb", "lib/rackdapter/proxy.rb", "lib/rackdapter/rackdapter.rb", "lib/rackdapter/spawner.rb", "lib/rackdapter.rb", "README.rdoc"]
|
|
14
|
-
s.files = ["bin/rackdapter", "bin/rackdapter_proxy", "lib/rackdapter/config.rb", "lib/rackdapter/master.rb", "lib/rackdapter/proxy.rb", "lib/rackdapter/rackdapter.rb", "lib/rackdapter/spawner.rb", "lib/rackdapter.rb", "Manifest", "MIT-LICENSE", "
|
|
14
|
+
s.files = ["bin/rackdapter", "bin/rackdapter_proxy", "lib/rackdapter/config.rb", "lib/rackdapter/master.rb", "lib/rackdapter/proxy.rb", "lib/rackdapter/rackdapter.rb", "lib/rackdapter/spawner.rb", "lib/rackdapter.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README.rdoc", "test/rackdapter.yml", "test/test_helper.rb", "test/unit/test_config.rb", "rackdapter.gemspec"]
|
|
15
15
|
s.has_rdoc = true
|
|
16
16
|
s.homepage = %q{http://github.com/mutle/rackdapter}
|
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rackdapter", "--main", "README.rdoc"]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mutle-rackdapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mutwin Kraus
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2008-12-
|
|
12
|
+
date: 2008-12-12 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -49,12 +49,12 @@ files:
|
|
|
49
49
|
- lib/rackdapter.rb
|
|
50
50
|
- Manifest
|
|
51
51
|
- MIT-LICENSE
|
|
52
|
-
- rackdapter.gemspec
|
|
53
52
|
- Rakefile
|
|
54
53
|
- README.rdoc
|
|
55
54
|
- test/rackdapter.yml
|
|
56
55
|
- test/test_helper.rb
|
|
57
56
|
- test/unit/test_config.rb
|
|
57
|
+
- rackdapter.gemspec
|
|
58
58
|
has_rdoc: true
|
|
59
59
|
homepage: http://github.com/mutle/rackdapter
|
|
60
60
|
post_install_message:
|