unicorn 0.95.0 → 0.95.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/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +1 -2
- data/SIGNALS +6 -1
- data/bin/unicorn +2 -2
- data/bin/unicorn_rails +1 -1
- data/lib/unicorn/configurator.rb +7 -0
- data/lib/unicorn/const.rb +1 -1
- data/test/exec/test_exec.rb +51 -0
- metadata +2 -2
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
@@ -262,9 +262,8 @@ package: $(pkgtgz) $(pkggem)
|
|
262
262
|
|
263
263
|
release: verify package $(release_notes) $(release_changes)
|
264
264
|
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
265
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
266
|
-
rubyforge add_file \
|
267
265
|
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
266
|
+
@echo do something with gemcutter for: $(pkggem)
|
268
267
|
else
|
269
268
|
gem install-gem: GIT-VERSION-FILE
|
270
269
|
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
data/SIGNALS
CHANGED
@@ -9,7 +9,12 @@ Unicorn and nginx.
|
|
9
9
|
|
10
10
|
=== Master Process
|
11
11
|
|
12
|
-
* HUP -
|
12
|
+
* HUP - reloads config file and gracefully restart all workers.
|
13
|
+
If the "preload_app" directive is false (the default), then workers
|
14
|
+
will also pick up any application code changes when restarted. If
|
15
|
+
"preload_app" is true, then application code changes will have no
|
16
|
+
effect; USR2 + QUIT (see below) must be used to load newer code in
|
17
|
+
this case.
|
13
18
|
|
14
19
|
* INT/TERM - quick shutdown, kills all workers immediately
|
15
20
|
|
data/bin/unicorn
CHANGED
@@ -68,7 +68,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
68
68
|
opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
|
69
69
|
warn %q{Use of --pid/-P is strongly discouraged}
|
70
70
|
warn %q{Use the 'pid' directive in the Unicorn config file instead}
|
71
|
-
options[:pid] =
|
71
|
+
options[:pid] = f
|
72
72
|
end
|
73
73
|
|
74
74
|
opts.on("-s", "--server SERVER",
|
@@ -85,7 +85,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
85
85
|
end
|
86
86
|
|
87
87
|
opts.on("-c", "--config-file FILE", "Unicorn-specific config file") do |f|
|
88
|
-
options[:config_file] =
|
88
|
+
options[:config_file] = f
|
89
89
|
end
|
90
90
|
|
91
91
|
# I'm avoiding Unicorn-specific config options on the command-line.
|
data/bin/unicorn_rails
CHANGED
@@ -75,7 +75,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
75
75
|
end
|
76
76
|
|
77
77
|
opts.on("-c", "--config-file FILE", "Unicorn-specific config file") do |f|
|
78
|
-
options[:config_file] =
|
78
|
+
options[:config_file] = f
|
79
79
|
end
|
80
80
|
|
81
81
|
opts.on("-P PATH", "DEPRECATED") do |v|
|
data/lib/unicorn/configurator.rb
CHANGED
@@ -372,6 +372,13 @@ module Unicorn
|
|
372
372
|
def working_directory(path)
|
373
373
|
# just let chdir raise errors
|
374
374
|
path = File.expand_path(path)
|
375
|
+
if config_file &&
|
376
|
+
config_file[0] != ?/ &&
|
377
|
+
! test(?r, "#{path}/#{config_file}")
|
378
|
+
raise ArgumentError,
|
379
|
+
"config_file=#{config_file} would not be accessible in" \
|
380
|
+
" working_directory=#{path}"
|
381
|
+
end
|
375
382
|
Dir.chdir(path)
|
376
383
|
HttpServer::START_CTX[:cwd] = ENV["PWD"] = path
|
377
384
|
end
|
data/lib/unicorn/const.rb
CHANGED
@@ -7,7 +7,7 @@ module Unicorn
|
|
7
7
|
# gave about a 3% to 10% performance improvement over using the strings directly.
|
8
8
|
# Symbols did not really improve things much compared to constants.
|
9
9
|
module Const
|
10
|
-
UNICORN_VERSION="0.95.
|
10
|
+
UNICORN_VERSION="0.95.1"
|
11
11
|
|
12
12
|
DEFAULT_HOST = "0.0.0.0" # default TCP listen host address
|
13
13
|
DEFAULT_PORT = 8080 # default TCP listen port
|
data/test/exec/test_exec.rb
CHANGED
@@ -82,6 +82,57 @@ end
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
def test_working_directory_rel_path_config_file
|
86
|
+
other = Tempfile.new('unicorn.wd')
|
87
|
+
File.unlink(other.path)
|
88
|
+
Dir.mkdir(other.path)
|
89
|
+
File.open("config.ru", "wb") do |fp|
|
90
|
+
fp.syswrite <<EOF
|
91
|
+
use Rack::ContentLength
|
92
|
+
run proc { |env| [ 200, { 'Content-Type' => 'text/plain' }, [ Dir.pwd ] ] }
|
93
|
+
EOF
|
94
|
+
end
|
95
|
+
FileUtils.cp("config.ru", other.path + "/config.ru")
|
96
|
+
Dir.chdir(@tmpdir)
|
97
|
+
|
98
|
+
tmp = File.open('unicorn.config', 'wb')
|
99
|
+
tmp.syswrite <<EOF
|
100
|
+
working_directory '#@tmpdir'
|
101
|
+
listen '#@addr:#@port'
|
102
|
+
EOF
|
103
|
+
pid = xfork { redirect_test_io { exec($unicorn_bin, "-c#{tmp.path}") } }
|
104
|
+
wait_workers_ready("test_stderr.#{pid}.log", 1)
|
105
|
+
results = hit(["http://#@addr:#@port/"])
|
106
|
+
assert_equal @tmpdir, results.first
|
107
|
+
File.truncate("test_stderr.#{pid}.log", 0)
|
108
|
+
|
109
|
+
tmp.sysseek(0)
|
110
|
+
tmp.truncate(0)
|
111
|
+
tmp.syswrite <<EOF
|
112
|
+
working_directory '#{other.path}'
|
113
|
+
listen '#@addr:#@port'
|
114
|
+
EOF
|
115
|
+
|
116
|
+
Process.kill(:HUP, pid)
|
117
|
+
lines = []
|
118
|
+
re = /config_file=(.+) would not be accessible in working_directory=(.+)/
|
119
|
+
until lines.grep(re)
|
120
|
+
sleep 0.1
|
121
|
+
lines = File.readlines("test_stderr.#{pid}.log")
|
122
|
+
end
|
123
|
+
|
124
|
+
File.truncate("test_stderr.#{pid}.log", 0)
|
125
|
+
FileUtils.cp('unicorn.config', other.path + "/unicorn.config")
|
126
|
+
Process.kill(:HUP, pid)
|
127
|
+
wait_workers_ready("test_stderr.#{pid}.log", 1)
|
128
|
+
results = hit(["http://#@addr:#@port/"])
|
129
|
+
assert_equal other.path, results.first
|
130
|
+
|
131
|
+
Process.kill(:QUIT, pid)
|
132
|
+
ensure
|
133
|
+
FileUtils.rmtree(other.path)
|
134
|
+
end
|
135
|
+
|
85
136
|
def test_working_directory
|
86
137
|
other = Tempfile.new('unicorn.wd')
|
87
138
|
File.unlink(other.path)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.95.
|
4
|
+
version: 0.95.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unicorn hackers
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-21 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|