app-status 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/app-status-0.0.1.gem +0 -0
- data/app_status.gemspec +23 -0
- data/lib/app_status.rb +24 -0
- data/lib/app_status/adapters/active_record.rb +21 -0
- data/lib/app_status/adapters/redis.rb +15 -0
- data/lib/app_status/adapters/sidekiq.rb +16 -0
- data/lib/app_status/app.rb +11 -0
- data/lib/app_status/version.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6601355a6943b6f0fea43d9a3e3b6e76cd0657f5
|
4
|
+
data.tar.gz: b30043487a422d4e2acefb6b4818ae96ee4a8224
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f8cac2c0c3fd4e466f157394532af2aeb7b505cf514d4bbb55695b3bb5a4f6cdb8c52bf6bf185718d2de30d837d5377340b571c4eee75b742eaeab652fb1db84
|
7
|
+
data.tar.gz: 5f6126e58db4480fc70e1b32ce1f68a7ff3713e0cf718325faadd80d08ff211b5e8cf3d4906001b4ad0421a9dbe6058c271a174f94425b4a040c157379c55198
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Serg Tkachenko
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# AppStatus
|
2
|
+
|
3
|
+
Add JSON formatter status report for Rails / Sinatra app:
|
4
|
+
```json
|
5
|
+
{
|
6
|
+
"PostgreSQL": "OK",
|
7
|
+
"Redis": "Down",
|
8
|
+
"Sidekiq": "Down",
|
9
|
+
"env": "staging"
|
10
|
+
}
|
11
|
+
```
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'app-status'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install app-status
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
### Rails
|
32
|
+
|
33
|
+
in `config/routes.rb` add following line:
|
34
|
+
```ruby
|
35
|
+
mount AppStatus::App.new => '/status'
|
36
|
+
```
|
37
|
+
|
38
|
+
### Sinatra
|
39
|
+
in `config.ru` add following:
|
40
|
+
```ruby
|
41
|
+
require 'your_sinatra_app'
|
42
|
+
require 'app_status/app'
|
43
|
+
|
44
|
+
run Rack::URLMap.new('/' => YourSinatraApp.new, '/status' => AppStatus::App.new)
|
45
|
+
```
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it ( https://github.com/[my-github-username]/app_status/fork )
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
Binary file
|
data/app_status.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'app_status/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "app-status"
|
8
|
+
spec.version = AppStatus::VERSION
|
9
|
+
spec.authors = ["Serg Tkachenko"]
|
10
|
+
spec.email = ["creeonix@gmail.com"]
|
11
|
+
spec.summary = %q{Simple app satus report}
|
12
|
+
spec.description = %q{Very simple app services status report for rails, sinatra or rack}
|
13
|
+
spec.homepage = "https://github.com/DispatchMe/app-status"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
data/lib/app_status.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'app_status/version'
|
2
|
+
require 'app_status/adapters/active_record'
|
3
|
+
require 'app_status/adapters/redis'
|
4
|
+
require 'app_status/adapters/sidekiq'
|
5
|
+
|
6
|
+
module AppStatus
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def status
|
10
|
+
result = Adapters.constants.map do |klass|
|
11
|
+
obj = ::Object.const_get("AppStatus::Adapters::#{klass}")
|
12
|
+
[obj.respond_to?(:adapter_name) ? obj.adapter_name : klass, obj.status]
|
13
|
+
end.to_h
|
14
|
+
result.merge!(env: environment)
|
15
|
+
end
|
16
|
+
|
17
|
+
def environment
|
18
|
+
if defined?(Rails)
|
19
|
+
Rails.env.to_s
|
20
|
+
elsif defined?(Sinatra)
|
21
|
+
Sinatra::Base.settings.environment.to_s
|
22
|
+
end || ENV['RACK_ENV']
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AppStatus
|
2
|
+
module Adapters
|
3
|
+
class ActiveRecord
|
4
|
+
def self.status
|
5
|
+
if defined?(::ActiveRecord)
|
6
|
+
::ActiveRecord::Base.connection.execute("SELECT 1=1").first.present? ? 'OK' : 'o_O'
|
7
|
+
else
|
8
|
+
'N/A'
|
9
|
+
end
|
10
|
+
rescue
|
11
|
+
'Down'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.adapter_name
|
15
|
+
if defined?(::ActiveRecord)
|
16
|
+
::ActiveRecord::Base.connection.adapter_name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: app-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Serg Tkachenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Very simple app services status report for rails, sinatra or rack
|
42
|
+
email:
|
43
|
+
- creeonix@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app-status-0.0.1.gem
|
54
|
+
- app_status.gemspec
|
55
|
+
- lib/app_status.rb
|
56
|
+
- lib/app_status/adapters/active_record.rb
|
57
|
+
- lib/app_status/adapters/redis.rb
|
58
|
+
- lib/app_status/adapters/sidekiq.rb
|
59
|
+
- lib/app_status/app.rb
|
60
|
+
- lib/app_status/version.rb
|
61
|
+
homepage: https://github.com/DispatchMe/app-status
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
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
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.2.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Simple app satus report
|
85
|
+
test_files: []
|