The Night Watch

The Night Watch (tnw) is a mountable Rails engine for inspecting and operating a Kamal-backed Rails application from a protected web UI.

The project is under active development. The engine and dummy host application are scaffolded; operational features are not available yet.

Installation

Add the gem to the host application's Gemfile:

gem "tnw"

Mount the engine in config/routes.rb:

mount Tnw::Engine => "/tnw"

The install generator creates the initializer, mounts the engine, and copies its migrations:

bin/rails generate tnw:install
bin/rails db:migrate

Configure either the host authentication callback shown in the generated initializer or basic auth credentials. Outside development, the dashboard fails closed when neither mode is complete.

Configure server metrics from a host-app initializer:

Tnw.configure do |config|
  config.metrics_sample_interval = 5.seconds
  config.metrics_retention = 7.days
  config.metrics_ingestion_token = ENV["TNW_METRICS_INGESTION_TOKEN"]
  config.metrics_accepted_clock_skew = 30.seconds
end

Metric ingestion fails closed when the ingestion token is missing.

Host collector installation is documented in the server stats installation guide.

Development

The generated dummy Rails application lives in test/dummy.

bundle install
bin/rails test

License

The gem is available as open source under the terms of the MIT License.