rack-server_status 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +3 -0
- data/README.md +44 -1
- data/examples/Gemfile +1 -2
- data/examples/Gemfile.lock +4 -3
- data/lib/rack/server_status.rb +5 -20
- data/lib/rack/server_status/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 37148a09571f8aaeaa6375977c39ce033bac533b6f35179e7073f78fd60ab934
|
4
|
+
data.tar.gz: bb2bd52467f2bf3cc3d7bc3c21c3ef31b3387ee944ebc93c86d6b470964a89c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d6cd6ec1c13bbd8338a1174ff5b338d7cb32a53c9112623963497bb4fc3110f6ce6475bae5e80de9ea1e832fcb0fd6c3f60ca0ba20d8972f497f555c71a348
|
7
|
+
data.tar.gz: 2b58d0c8dc3f6e24d38d7563921f6b1029fb7986dbff0303be1da0a5375afd9df9edafb3110627aa272491cb7401634ab4fa33cb40514aadac40fa15d549277b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -19,8 +19,51 @@ Or install it yourself as:
|
|
19
19
|
$ gem install rack-server_status
|
20
20
|
|
21
21
|
## Usage
|
22
|
+
### Getting started
|
23
|
+
Tell your app to use the Rack::ServerStatus middleware.
|
24
|
+
|
25
|
+
#### For Rails 3+ apps
|
26
|
+
|
27
|
+
```
|
28
|
+
# In config/application.rb
|
29
|
+
config.middleware.use Rack::ServerStatus, scoreboard_path: './tmp'
|
30
|
+
```
|
31
|
+
|
32
|
+
#### Rackup files
|
33
|
+
|
34
|
+
```
|
35
|
+
# In config.ru
|
36
|
+
use Rack::ServerStatus, scoreboard_path: './tmp'
|
37
|
+
```
|
38
|
+
|
39
|
+
### Get Status
|
40
|
+
|
41
|
+
```
|
42
|
+
% curl http://server:port/server-status
|
43
|
+
Uptime: 1432227723 (12 seconds)
|
44
|
+
BusyWorkers: 1
|
45
|
+
IdleWorkers: 3
|
46
|
+
--
|
47
|
+
pid status remote_addr host method uri protocol ss
|
48
|
+
55091 _ - 0
|
49
|
+
55092 _ - 1
|
50
|
+
55093 A 127.0.0.1 localhost:3000 GET /server-status HTTP/1.1 0
|
51
|
+
55094 _ - 0
|
52
|
+
|
53
|
+
# JSON format
|
54
|
+
% curl http://server:port/server-status?json
|
55
|
+
{"Uptime":1432388968,"BusyWorkers":1,"IdleWorkers":3,"stats":[{"remote_addr":null,"host":"-","method":null,"uri":null,"protocol":null,"pid":87240,"status":"_","ss":2},{"remote_addr":"127.0.0.1","host":"localhost:3000","method":"GET","uri":"/server-status?json","protocol":"HTTP/1.1","pid":87241,"status":"A","ss":0},{"remote_addr":null,"host":"-","method":null,"uri":null,"protocol":null,"pid":87242,"status":"_","ss":3},{"remote_addr":null,"host":"-","method":null,"uri":null,"protocol":null,"pid":87243,"status":"_","ss":3}]}
|
56
|
+
```
|
57
|
+
|
58
|
+
## Configuration
|
59
|
+
|
60
|
+
| name | detail | example | default |
|
61
|
+
|------|--------|---------|---------|
|
62
|
+
| path | location that displays server status | `path: '/server-status'` | `/server-status` |
|
63
|
+
| allow | host based access control of a page of server status. | `allow: ['127.0.0.1']` | `[]` |
|
64
|
+
| scoreboard | scoreboard directory | `scoreboard_path: './tmp'` | nil |
|
65
|
+
| skip_ps_command | | `skip_ps_command: true` | false |
|
22
66
|
|
23
|
-
TODO: Write usage instructions here
|
24
67
|
|
25
68
|
## Contributing
|
26
69
|
|
data/examples/Gemfile
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gem 'unicorn'
|
3
|
-
|
4
|
-
gem 'worker_scoreboard', path: '/Users/haruyama.makoto/worker_scoreboard'
|
3
|
+
gem 'worker_scoreboard', git: 'https://github.com/SpringMT/worker_scoreboard.git'
|
5
4
|
gem 'parallel'
|
data/examples/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
remote: /
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/SpringMT/worker_scoreboard.git
|
3
|
+
revision: 949d7a98b4044f26b9de864a64eb6cc790cab1ba
|
3
4
|
specs:
|
4
|
-
worker_scoreboard (0.0.
|
5
|
+
worker_scoreboard (0.0.3)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
data/lib/rack/server_status.rb
CHANGED
@@ -19,18 +19,13 @@ module Rack
|
|
19
19
|
def call(env)
|
20
20
|
set_state!('A', env)
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
res = handle_server_status(env)
|
27
|
-
set_state!('_')
|
28
|
-
return res
|
22
|
+
if env['PATH_INFO'] == @path
|
23
|
+
handle_server_status(env)
|
24
|
+
else
|
25
|
+
@app.call(env)
|
29
26
|
end
|
30
|
-
|
31
|
-
res = @app.call(env)
|
27
|
+
ensure
|
32
28
|
set_state!('_')
|
33
|
-
return res
|
34
29
|
end
|
35
30
|
|
36
31
|
private
|
@@ -132,15 +127,5 @@ EOF
|
|
132
127
|
end
|
133
128
|
return [200, {'Content-Type' => 'text/plain'}, [body]]
|
134
129
|
end
|
135
|
-
|
136
|
-
class Remover
|
137
|
-
def initialize
|
138
|
-
end
|
139
|
-
def call(*args)
|
140
|
-
set_state!('_')
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
130
|
end
|
145
|
-
|
146
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-server_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SpringMT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: worker_scoreboard
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '2.0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.7.6
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Show server status
|
@@ -123,4 +123,3 @@ test_files:
|
|
123
123
|
- examples/unicorn.rb
|
124
124
|
- spec/server_status_spec.rb
|
125
125
|
- spec/spec_helper.rb
|
126
|
-
has_rdoc:
|