unicorn-ctl 0.1.5 → 0.1.6

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +1 -1
  4. data/bin/unicornctl +19 -13
  5. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6493e6ab1f002e3e8e334c403e29a5ec3e3552a1
4
- data.tar.gz: 48acfe52ffe52808933727b864c5b86e8f59f058
3
+ metadata.gz: 9942b7c093975e739c080458689d9878472570f4
4
+ data.tar.gz: 15291d5de03286c8d20fffb1806adef9a2f06a9f
5
5
  SHA512:
6
- metadata.gz: 178cafb7c8f6914d1f6e877269df0a15775919b08181b44f7dc5cbeb2475216137321884e80242b269abf5fa8883f75da8709a6b5e25108a7bc2e87b3f3fd49f
7
- data.tar.gz: d070792765a6f0fc0ac1faf0638e24b46f68c84ab98a48c85e24d534f7d4fd91c02e66494814abe24fb858ba2899f6e1c88db03a3624b3cf4f7a8aca656ad8ee
6
+ metadata.gz: ad78f2f23d649ebde54da12e234bd96057b18e33f367de5a8a909a2c4b4114dc3669ede418f93a4ac92e5dbe0923c3cc59424bae575371d3fee9d5eb72c159f8
7
+ data.tar.gz: 73285fb1268571d33589301e695134013ab0e135307e03ae1b3cd0e58f1e78baed5d778cf6723f95ccf0db6b9a15dd4a26118892d64d5062d39823d5c7153429
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## UnicornCtl Changelog
2
2
 
3
+ ### 0.1.6 / 2014-06-18
4
+
5
+ * Do not follow recirects when performing a health check and handle all 1xx/2xx/3xx as success.
6
+ * When pid file is empty, treat it as a stale one.
7
+
3
8
  ### 0.1.5 / 2014-02-21
4
9
 
5
10
  * Fix --unicorn-config/--rackup-config/--pid-file options handling.
data/README.md CHANGED
@@ -63,7 +63,7 @@ The following command are supported at the moment:
63
63
  * `status` - Display current application server status. If the server is up, the command exits with exit
64
64
  code 0, otherwise the exit code will be 1.
65
65
 
66
- For more information on unicorn procss management you could check their
66
+ For more information on unicorn process management you could check their
67
67
  [official documentation page](http://unicorn.bogomips.org/SIGNALS.html).
68
68
 
69
69
  ### License
data/bin/unicornctl CHANGED
@@ -69,17 +69,22 @@ def wait_with_timeout(timeout, sleep_time = 1, &block)
69
69
  end
70
70
  end
71
71
 
72
- #-------------------------------------------------------------------------------------------
72
+ #---------------------------------------------------------------------------------------------------
73
73
  # Check if process is still running
74
74
  def pid_running?(pid)
75
- begin
76
- Process.kill(0, pid)
77
- return true
78
- rescue Errno::ESRCH
79
- return false
80
- rescue ::Exception # for example on EPERM (process exists but does not belong to us)
81
- return true
82
- end
75
+ # Make sure PID is correct
76
+ pid = pid.to_i
77
+ return false if pid <= 0
78
+
79
+ # Check if the process exists
80
+ Process.kill(0, pid)
81
+ return true
82
+
83
+ rescue Errno::ESRCH # Process does not exist
84
+ return false
85
+
86
+ rescue ::Exception # for example on EPERM (process exists but does not belong to us)
87
+ return true
83
88
  end
84
89
 
85
90
  def send_signal(signal, pid)
@@ -139,14 +144,15 @@ def check_app_health(options)
139
144
  sleep(1)
140
145
 
141
146
  response = begin
142
- HTTParty.get(options[:check_url], :timeout => options[:check_timeout])
147
+ HTTParty.get(options[:check_url], :timeout => options[:check_timeout], :no_follow => true)
143
148
  rescue Timeout::Error => e
144
149
  puts "Health check timed out after #{options[:check_timeout]} seconds. Retrying..."
145
150
  next
146
151
  end
147
152
 
148
- if response.code.to_i / 100 == 2
149
- puts "Health check succeeded with code: #{response.code}"
153
+ code = response.code.to_i
154
+ if 100 <= code && code < 400
155
+ puts "Health check succeeded with code: #{code}"
150
156
  if options[:check_content]
151
157
  if response.body.match(options[:check_content])
152
158
  puts "Content check succeeded, found content in response body: #{options[:check_content]}"
@@ -458,7 +464,7 @@ def show_help(error = nil)
458
464
  puts ' --app-dir=dir | -d dir Base directory for the application (required)'
459
465
  puts ' --environment=name | -e name RACK_ENV to use for the app (default: development)'
460
466
  puts ' --health-check-url=url | -H url Health check URL used to make sure the app has started'
461
- puts ' --health-check-content=string | -C string Health check expected content (default: just check for HTTP 200 OK)'
467
+ puts ' --health-check-content=string | -C string Health check expected content (default: just check for HTTP 1xx/2xx/3xx)'
462
468
  puts ' --health-check-timeout=sec | -T sec Individual health check timeout (default: 5 sec)'
463
469
  puts ' --start-wait=sec | -w sec New master startup wait (default: 5 sec, use 0 to disable)'
464
470
  puts ' --timeout=sec | -t sec Operation (start/stop/etc) timeout (default: 30 sec)'
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn-ctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksiy Kovyrin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2014-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: A script to control unicorn instances.
@@ -60,18 +60,19 @@ require_paths:
60
60
  - lib
61
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ">="
63
+ - - '>='
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.2.0
73
+ rubygems_version: 2.2.2
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Start/stop/restart/upgrade unicorn instances reliably.
77
77
  test_files: []
78
+ has_rdoc: