Magistrate Monitor

MagistrateMonitor is a frontend to the Magistrate gem that allows the gem to check in with the status of its workers and to receive commands from the frontend user (such as enable/disable and start/stop workers)

Installation

Standalone Sinatra

MagistrateMonitor will run as a standalone Sinatra app. It will use ActiveRecord for the DB connection. Create a config/database.yml file with your connection details. Then run rake db:migrate as normal. Then you can start the app with rackup or your other preferred method.

Mounting in Rails 3.x

MagistrateMonitor will mount in a Rails 3.x app very easily.

  1. Add the gem to your Gemfile: gem 'magistrate_monitor

  2. Copy the migrations to your main migration folder and run them.

  3. Then add this to your routes.rb:

    mount MagistrateMonitor::Server => '/magistrate'

  4. Add a config/magistrate.yml file if you want to have authentication (see the magistrate gem's example_config.yml)

Mounting the application in rails 2.3.*

Create a new folder in app called metal. Add the file magistrate_monitor_web.rb with:

require 'magistrate_monitor'
class MagistrateMonitorWeb
  @app = Rack::Builder.new {
    map "/magistrate_monitor" do
      run MagistrateMonitor::Server.new
    end
  }.to_app

  def self.call(env)
    @app.call(env)
  end
end

This will route all requests to /magistrate_monitor to the magistrate_monitor rack app

Contributing to magistrate_monitor

Copyright © 2011 Drew Blas. See LICENSE.txt for further details.

Acknowledgements

Thanks to Matthew Deiter's healthy gem for the example of building this as a rack app (since I couldn't get 3.1 mountable engines to work)