
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
= Operations Routes
This library provides a Rails plugin and a piece of Rack middleware for monitoring application status. When using with a Rails application, the plugin is preferred, but the middleware is available for use in non-Rails Rack applications.
Note: Previous versions of this library were available as the gem operations_middleware and included only the middleware portion.
== Installation
To include it in a Rails application, install the plugin:
script/plugin install git://github.com/primedia/ops_routes.git
Then add the following minimum configuration to config/initializers/ops_routes.rb:
OpsRoutes.config do |ops| ops.file_root = RAILS_ROOT end
To include it in a Sinatra application, install the gem ops_routes then add the following to your app:
require 'ops_routes/middleware' use OpsRoutes::Middleware do |ops| ops.file_root = File.dirname(FILE) end
== Version Page
This will provide a page at /ops/version which shows, in development mode, the current git branch and last commit SHA. In all other modes, it shows the same information, but taken from the contents of VERSION and REVISION files in the file_root directory. If you are deploying with Capistrano, the REVISION file will be created for you. If you want the VERSION file, you'll need to add that to your project or your Capistrano scripts.
== Heartbeat Page
It also provides a simple page at /ops/heartbeat which returns a 200 'OK' as long as the application is running.
The application name is taken from the file_root option. If that folder is a Capistrano timestamped release, it goes up 2 additional levels for the name, stripping .com from the end of the directory if necessary. If this logic does not get the correct application name, it can be set manually in the configuration block:
ops.app_name = 'Custom Application Name'
=== Adding Custom Heartbeats
Additionally, you can specify custom heartbeat monitoring pages as follows:
ops.add_heartbeat :mysql do conn = ActiveRecord::Base.connection migrations = conn.select_all("SELECT COUNT(1) FROM schema_migrations;") conn.disconnect! end
The mysql example shown above would be accessed at ops/heartbeat/mysql. The heartbeat page will return a 200 'OK' as long as the provided block does not raise an error. If an error is raised or the heartbeat does not exist, a 500 will be returned instead.
== Configuration Page
The third provided page is /ops/configuration which is designed to let you check that the environment-specific configuration variables used by your app are set to the correct values. This is especially useful if production options are set using file replacement or modification during the deploy process.
If you add any sensitive information to this page, make sure to hide it from outside access!
To add a configuration section, specify it as follows:
ops.add_configuration section :action_controller do { :consider_all_requests_local => Rails.configuration.consider_all_requests_local, :perform_caching => Rails.configuration.perform_caching } end
This example will add a section to the /ops/configuration page called `action_controiller'. Each time the configuration page is requested, the block provided for the section will be called. This means the current values for your configuration options will be shown, even if they change while the app is running. The block is expected to return a hash of key/value pairs to be displayed.
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2010 PRIMEDIA Inc. See LICENSE for details.
FAQs
Unknown package
We found that ops_routes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.