Project

rails_live

0.01
No release in over 3 years
Low commit activity in last 3 years
See in live what is happening on server in real-time. Track all activities.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 4.1.3
>= 0
>= 0
>= 0

Runtime

 Project Readme

Rails Live

Watch application activities in real-time using them gem. Live stream for all events which you want to monitor.

Use tags, categories, custom message and even user. Get better picture of what happening on server.

Every event will be prepender in the list with all the details.

Demo

Link to video: https://www.youtube.com/watch?v=1PhyEgU7Pao

Usage

Just open in browser /rails/live and watch for updates. BUT to capture them you need to add code something like:

  after_create :notify
  def notify
    RailsLive.notify({
      message: "article id: #{self.id} created",
      tags: {
        category.name => 'info',
      },
      category: 'article'
    })
  end

or

  before_action :log_action

def log_action
    RailsLive.notify({
      message: "action on server #{request.url}",
      tags: {
        action_name => 'light',
      },
      user: {
        id: current_user&.id,
        full_name: current_user&.full_name
      },
      category: controller_name
    })
  end

or anywhere from code

    RailsLive.notify({
      message: "action on server #{request.url}",
      tags: {
        'admin' => 'danger',
        'approved' => 'success',
      },
      user: {
        id: user.id,
        full_name: user&.full_name
      },
      category: 'category'
    })

Note: it doesn't store all events in DB. It just broadcasting them to dashboard.

Installation

gem 'rails_live'

And then execute:

$ bundle

Customization

If you want to customize gem (create initializer) run in console:

rails g rails_live initializer

If will create file config/initializers/rails_live.rb.

Options

  • enabled - enable or disable gem (default: true).
  • automatic_routes_mount - automatically mount engine routes in your app (default: true).
  • http_basic_authentication_enabled - Enable HTTP_BASIC authentication (default: false).
  • http_basic_authentication_user_name - HTTP_BASIC authentication user name.
  • http_basic_authentication_password - HTTP_BASIC authentication password.

If you want to add routes manually (or customize the mounted location) you need to first turn off automatic_routes_mount and then add to your routes.rb

  mount RailsLive::Engine => '/rails/live', :as => 'rails_live'

Tags

Contributing

You are welcome to contribute to this gem.

TODO

  • add support for older versions (for example 5.1, 5.0)
  • add filtering
  • add start/stop capturing events
  • localications for datetime
  • maybe column customization?

License

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