https://github.com/rails-engine/status-page
Mountable status page for your Rails application, to check Cache, Redis, Sidekiq ...
https://github.com/rails-engine/status-page
Last synced: 8 months ago
JSON representation
Mountable status page for your Rails application, to check Cache, Redis, Sidekiq ...
- Host: GitHub
- URL: https://github.com/rails-engine/status-page
- Owner: rails-engine
- License: mit
- Fork: true (lbeder/health-monitor-rails)
- Created: 2016-04-06T10:02:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T12:53:11.000Z (almost 3 years ago)
- Last Synced: 2025-11-17T21:07:43.204Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 179 KB
- Stars: 109
- Watchers: 5
- Forks: 16
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-status-pages - status-page - Mountable status page for your Rails application, to check Cache, Redis, Sidekiq (Opensource)
README
# status-page
[](http://badge.fury.io/rb/status-page) [](https://travis-ci.org/rails-engine/status-page) [](https://gemnasium.com/rails-engine/status-page) [](https://coveralls.io/r/rails-engine/status-page)
Mountable status page for your Rails application, to check (DB, Cache, Sidekiq, Redis, etc.).
Mounting this gem will add a '/status' route to your application, which can be used for health monitoring the application and its various services. The method will return an appropriate HTTP status as well as a JSON array representing the state of each service.
## Example

## Install
```ruby
# Gemfile
gem 'status-page'
```
Then run:
```bash
$ bundle install
```
```ruby
# config/routes.rb
mount StatusPage::Engine, at: '/'
```
## Supported service services
The following services are currently supported:
* DB
* Cache
* Redis
* Sidekiq
* Resque
## Configuration
### Adding services
By default, only the database check is enabled. You can add more service services by explicitly enabling them via an initializer:
```ruby
StatusPage.configure do
# Cache check status result 10 seconds
self.interval = 10
# Use service
self.use :database
self.use :cache
self.use :redis
# Custom redis url
self.use :redis, url: 'redis://you-redis-host:3306/1'
self.use :sidekiq
end
```
### Adding a custom service
It's also possible to add custom health check services suited for your needs (of course, it's highly appreciated and encouraged if you'd contribute useful services to the project).
In order to add a custom service, you'd need to:
* Implement the `StatusPage::Services::Base` class and its `check!` method (a check is considered as failed if it raises an exception):
```ruby
class CustomService < StatusPage::Services::Base
def check!
raise 'Oh oh!'
end
end
```
* Add its class to the config:
```ruby
StatusPage.configure do
self.add_custom_service(CustomProvider)
end
```
### Adding a custom error callback
If you need to perform any additional error handling (for example, for additional error reporting), you can configure a custom error callback:
```ruby
StatusPage.configure do
self.error_callback = proc do |e|
logger.error "Health check failed with: #{e.message}"
Raven.capture_exception(e)
end
end
```
### Adding authentication credentials
By default, the `/status` endpoint is not authenticated and is available to any user. You can authenticate using HTTP Basic Auth by providing authentication credentials:
```ruby
StatusPage.configure do
self.basic_auth_credentials = {
username: 'SECRET_NAME',
password: 'Shhhhh!!!'
}
end
```
## License
The MIT License (MIT)