Code Monkey home page Code Monkey logo

dashing-rails's Introduction

Dashing

Code Climate Coverage Status Build Status Flattr Button Dependency Status codementor-button

Dashing-rails is the Rails Engine version of Dashing by Shopify. A huge thanks to Shopify for their great work with the Sinatra version.

Warning: To upgrade from 2.2.x to 2.3.x please read CHANGELOG.md.

Introduction

Dashing is a Rails engine that lets you build beautiful dashboards.

Check out a demo over here. Here's another one, optimized for 1080p screens.

Key features:

  • Use premade widgets, or fully create your own with scss, html, and coffeescript.
  • Widgets harness the power of data bindings to keep things DRY and simple. Powered by batman.js.
  • Use the API to push data to your dashboards, or make use of a simple ruby DSL for fetching data.
  • Drag & Drop interface for re-arranging your widgets.
  • Host your dashboards on Heroku in less than 30 seconds.

Requirements

  • Ruby >= 1.9.3
  • Rails >= 4
  • Redis
  • Multi Threaded server (puma, rainbows)

Getting Started

  1. Install the gem by adding the following in your Gemfile:
gem 'dashing-rails'
  1. Install puma server by adding the following in your Gemfile:
gem 'puma'
  1. Bundle install
$ bundle
  1. Install the dependencies using the following command:
$ rails g dashing:install
  1. Start redis server:
$ redis-server
  1. Open config/environments/development.rb and add:
config.allow_concurrency = true
  1. Start your server (must be a multi threaded server - See Requirements)
$ rails s
  1. Point your browser at http://localhost:3000/dashing/dashboards and have fun!

Important Note: We need to update the configuration in development to handle multiple requests at the same time. One request for the page we’re working on, and another request for the Server Sent Event controller.


Every new Dashing project comes with sample widgets & sample dashboards for you to explore. The directory is setup as follows:

  • app/views/dashing/dashboards — One .erb file for each dashboard that contains the layout for the widgets.
  • app/jobs — Your ruby jobs for fetching data (e.g for calling third party APIs like twitter).
  • app/assets/javascripts/dashing/widgets/ — A widget's name .coffee file containing your widget's js.
  • app/assets/stylesheets/dashing/widgets/ — A widget's name .scss file containing your widget's css.
  • app/views/dashing/widgets/ — A widget's name .html file containing your widget's html.
  • app/views/layouts/dashing/ — All your custom layouts where your dashboards and widgets will be included.

Getting Data Into Your Widgets

Providing data to widgets is easy. You specify which widget you want using a widget id, and then pass in the JSON data. There are two ways to do this:

Jobs

Dashing uses rufus-scheduler to schedule jobs. You can make a new job with rails g dashing:job sample_job, which will create a file in the jobs directory called sample_job.rb.

Example:

# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
Dashing.scheduler.every '1m', first_in: 1.second.since do |job|
  Dashing.send_event('karma', { current: rand(1000) })
end

This job will run every minute, and will send a random number to ALL widgets that have data-id set to "karma".

You send data using the following method:

Dashing.send_event(widget_id, json_formatted_data)

Jobs are where you put stuff such as fetching metrics from a database, or calling a third party API like Twitter. Since the data fetch is happening in only one place, it means that all instances of widgets are in sync.

Server Sent Events are used in order to stream data to the dashboards.

Redis

Dashing uses Redis to push and pull data and feed your widgets. Since Dashing Requirements can be quite frustrating, I thought it might be useful to use redis.

This way you can have a seperate Rails 4 application (with puma) running your dashboards and push your data to redis from your main Rails 3 application for example.

You can specify Dashing redis credentials in config/initializers/dashing.rb:

config.redis_host     = '127.0.0.1'
config.redis_port     = '6379'
config.redis_password = '123456'

By default Dashing subscribed to the following namespace in redis:

dashing_events.*

where * can be anything. This give you all the flexibility you need to push to redis. For example the send_event method provided by Dashing uses the following namespace:

redis.with do |redis_connection|
  redis_connection.publish("dashing_events.create", {})
end

(where redis_connection is a redis connection from a connection pooler.)

You can configure the redis namespace in config/initializers/dashing.rb:

config.redis_namespace = 'your_redis_namespace'

API

Widgets

Your widgets can be updated directly over HTTP. Post the data you want in json to /dashing/widgets/widget_id. For security, you will also have to include your auth_token (which you can generate in config/initializers/dashing.rb).

Example:

curl -X PUT http://localhost:3000/dashing/widgets/welcome -d "widget[text]=Dashing is awesome"

or

curl -X PUT http://localhost:3000/dashing/widgets/karma -d "widget[current]=100" -d "auth_token=YOUR_AUTH_TOKEN"

or

HTTParty.post('http://localhost:3000/dashing/widgets/karma',
  body: { auth_token: "YOUR_AUTH_TOKEN", current: 1000 }.to_json)

Dasboards

The reload action provided by Shopify Dashing is currently not available.

Create a new Widget

In order to create or add a custom widget to dashing-rails, simply follow the following steps:

  1. Run

     $ rails g dashing:widget my_widget
    
  2. Edit app/views/dashing/widgets/my_widget.html

  3. Edit app/assets/javascripts/dashing/widgets/my_widget.coffee

  4. Edit app/assets/stylesheets/dashing/widgets/my_widget.scss

You can also install pre-package widget compatible with dashing-rails. Here is a list of all Dashing-Rails compatible Widgets.

Note: the paths may be different depending on your dashing-rails configuration. Check your config/initializers/dashing.rb file.

Additional Resources

Check out the wiki for interesting tips such as hosting on Heroku, adding authentication or adding custom widgets.

Browser Compatibility

Tested in Chrome, Safari 6+, and Firefox 15+.

Does not work in Internet Explorer because it relies on Server Sent Events.

Contributors

Special thanks to Benjamin Roth for his ideas and support.

All contributions are more than welcome; especially new widgets!

Please add spec to your Pull Requests and run them using:

$ rake

License

Dashing is released under the MIT license

Bitdeli Badge

dashing-rails's People

Contributors

agustinf avatar allomov avatar bitdeli-chef avatar carlaares avatar ghg avatar gottfrois avatar jandintel avatar jcdavison avatar nazarhussain avatar nivensc avatar phlipper avatar ravishi avatar scambra avatar translatorzepp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dashing-rails's Issues

No data when accessing /dashing/events

Hello,

When I access /dashing/events on my dev machine I see, as expected, a stream of data.
However when I access the same page in the production environment nothing is returned. This means that data is never updated on /dashing/dashboards/sample.

I can also see the stream of data in the console using:

redis = Dashing.redis
redis.psubscribe("#{Dashing.config.redis_namespace}.*") do |on| 
  on.pmessage do |pattern, event, data|
    puts "Data: #{data}"
  end
end

I see:

Data: {"api_alerts":"Yes","id":"apimonitor","updatedAt":1387305872}
Data: {"current":56,"last":40,"id":"valuation","updatedAt":1387305872}
Data: {"value":35,"id":"synergy","updatedAt":1387305872}
Data: {"api_alerts":"Yes","id":"apimonitor","updatedAt":1387305873}
Data: {"current":56,"last":56,"id":"valuation","updatedAt":1387305874}
Data: {"value":26,"id":"synergy","updatedAt":1387305874}

... and so on.

I'm using Puma as the web server, with dashing-rails and Redis all on one machine. I also have varnish passing requests to Puma.

In initializers/dashing.rb I have:

config.redis_host     = '127.0.0.1'
config.redis_port     = '6379'
config.redis_password = nil

Wonder if anyone might be able to help at all?

Thanks,
James.

Dashing.gridsterLayout: unrecognized expression: [data-row^=]

Hi
Jquery throw an error when i try to use Dashing.gridsterLayout

Uncaught Error: Syntax error, unrecognized expression: [data-row^=]
jquery.js?body=1:1474
Sizzle.errorjquery.js?body=1:2088
Sizzle.tokenizejquery.js?body=1:2489
Sizzle.selectjquery.js?body=1:880
Sizzlejquery.js?body=1:2705
jQuery.fn.extend.findjquery.js?body=1:2822
jQuery.fn.initjquery.js?body=1:74
jQuerydashing.gridster.js?body=1:7
Dashing.gridsterLayouttest:63 (anonymous function)

I have found that if you change the line 9 of dashing.gridster.coffee from

  widgets = $("[data-row^=]")

to

  widgets = $("[data-row]")

Your code works fine :)

Error with old job code

I am getting this strange error in my production application where the widgets are switching between the data that they should display, and the data that was passed from the old job code (which has been changed and is not in the repository). Any idea why this would happen? Thanks!

Edit: Just to confirm, this is not happening in development

Running dashing under a load balancer

I'm attempting to run dashing-rails under a load balancer and ran in to a couple of issues that I'm hoping you might have some insight in to:

a) How do you keep rufus running jobs on only one box so that it doesn't trigger on each and every machine?

b) Is there an easy way to replace redis with something more stable / scalable? Apparently redis clustering support is a "work in progress" (according to their own site). Additionally it wont work with less than 3 servers. So a mirroring setup is out of the question.

Multiple Dashboards

How, should I go about adding multiple dashboards, say for each of the user in my database.
I know I can handle user authorization, by following from here https://github.com/Shopify/dashing/wiki/How-to%3A-Add-authentication, and redirect user to its specific dashboard.
But, what would be the best practice to create multiple dashboard ? Should I just create a new Job file for each dashboard/user, and give all the widgets unique Id for all the dashboard ?

Setting dashboard view path, problem with setting path using `Rails.root`

It may be unconventional, but I'm hoping to mount dashing-rails on an engine of my own. This engine is intended to be mounted on one of my employer's rails applications sometime soon. The problem I'm running into is the use of Rails.root.join(...) in the dashboards_controller.

I can set the path in the configuration object, but Rails.root will always be prepended. I'd like to override Rails.root with MyEngine::Engine.root. Seems like it could be worked in pretty easily. I'm not sure how many instances of Rails.root in the application, but they would likely all need taken care of for me to achieve my desired setup.

Rufus scheduler just stops: uninitialized constant SCHEDULER

After running seemingly fine for few hours the jobs stop running. After restarting the servers I keep getting :

app/jobs/buzzwords.rb:4:in `<top (required)>': uninitialized constant SCHEDULER (NameError)

and can't restart the server without removing the jobs files.

I looked up the rufus-scheduler docs but there is no consenus on solution . It appears Rufus can intermittently fail.

That said do you recommend a different scheduling gem that will work with Dashing-Rails?

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Is the Graph widget working?

I'm trying to make the Graph widget work, but it only shows the last value as text, not the graph in background.

I grabbed the sample code from dashing to send data to the widget:

points = .each do |i|
points << { x: i, y: rand(50) }
end
last_x = points.last[:x]

Dashing.scheduler.every '2s' do
points.shift
last_x += 1
points << { x: last_x, y: rand(50) }
Dashing.send_event('convergence', value: points)
end

What am I doing wrong?

i18n Lazy Loading not working

Hello, I am using dashing on a project that requires lazy loading on translations. For example, I am trying to load "HI" using t ('.hello') in the dashboard view file.
Doing this returns this error: "Cannot use t(".hello") shortcut because path is not available"

I have tested lazy loading in my project in other controllers and views that I generated, and it works fine.
I am not sure what I can do to make lazy loading work with the Dashing views. It would be great if anyone can post some suggestions.

Thank you

Here is my en.yml file structure
en:
application:
hello: "HI"

testing:
create:
hello: "HI"

dashing:
dashboards:
sample:
hello: "HI"

Redis error child connection

F, [2014-02-06T08:29:53.820249 #32363] FATAL -- :                                                                                                                  [111/1263]
Redis::InheritedError (Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.):
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:299:in `ensure_connected'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:191:in `block in process'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:270:in `logging'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:190:in `process'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:110:in `block in call_loop'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:244:in `with_socket_timeout'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:251:in `without_socket_timeout'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/client.rb:109:in `call_loop'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/subscribe.rb:35:in `subscription'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis/subscribe.rb:16:in `psubscribe'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis.rb:2498:in `_subscription'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis.rb:1970:in `block in psubscribe'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis.rb:37:in `block in synchronize'
  /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis.rb:37:in `synchronize'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/redis-3.0.7/lib/redis.rb:1969:in `psubscribe'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:111:in `block in method_missing'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:55:in `with'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:110:in `method_missing'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/dashing-rails-2.2.0/app/controllers/dashing/events_controller.rb:12:in `index'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:189:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/rendering.rb:10:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:383:in `_run__3850889831849708719__process_action__callbacks'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:17:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/rescue.rb:29:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `block in instrument'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `instrument'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  /home/deploy/storyful_doc/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:136:in `process'

Custom Widgets

Hello!
Just wondering if you have an example of a custom widget working in dashing-rails? I put the requisite code under /app/views/dashing/widgets

But I get a template_not_found exception.

Thoughts! And thanks again for building this thing!

Dashing.scheduler does not release ActiveRecord connections

I recently setup Dashing widgets that send data from ActiveRecord requests in the following repo: https://github.com/FifthSurprise/DeviceSniffer
I deployed it on Heroku without any issues with Postgresql as the database.

However, I'm currently seeing an issue where after starting the app, each time I access it via the browser, a connection to the database through Active Record is used and never released. Because of this, I eventually run out of ActiveRecord connections in the pool and the entire application crashes.

Is this how the widget is supposed to work where you set it up and the browser keeps one connection in constant use as the scheduler sends updates?

dashing-rails on Passenger/Apache. Where's the beef?

So I have dashing-rails up and running with Passenger and Apache and it seems to be running ok. But the docs seem to indicate Puma is the recommended setup. I'm I going to run in to problems running this under Passenger? If so, what kind of sinkholes am I going to slip in to? I really like the idea of being able to run vhosts and not having to run Puma through a convoluted proxy setup is a big plus. Thanks!

Heroku instance doesn't work with database_connection.rb

I have a basic dashing rails app and I've followed the wiki on running dashing-rails on heroku but I get the following error:

PG::ConnectionBad (could not connect to server: No such file or directory
2015-05-12T16:40:18.166407+00:00 app[web.1]: Started GET "/dashing/" for 2.120.137.89 at 2015-05-12 16:40:18 +0000
2015-05-12T16:40:18.168457+00:00 app[web.1]:    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2015-05-12T16:40:18.168456+00:00 app[web.1]:    Is the server running locally and accepting

As an experiment I commented out the database_connection.rb code and it works okay.

=begin
Rails.application.config.after_initialize do
  ActiveRecord::Base.connection_pool.disconnect!

  ActiveSupport.on_load(:active_record) do
    config = Rails.application.config.database_configuration[Rails.env]
    config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
    config['pool']              = ENV['DB_POOL']      || 5
    ActiveRecord::Base.establish_connection(config)
  end
end
=end

Has the same happened to anybody else? Also, could somebody explain a little bit about what the above code does, and if it's needed?

Dashing in different environments

I configured my dashing.rb initializer file to point my redis_host and redis_port to the production environment values. How do I have it point to different values depending on if I am in a dev environment or a production environment?

Sorry if this has been asked before (is this the issue addressed by the REDISTOGO add on?)

Dynamically generate a widget

I'm trying to dynamically add a widget to the dashboard.

So far I've got Javascript that adds html for the new widget, but it still doesn't show up. I'm guessing it needs to be added to the list of widgets observed by Dashing JS? In which case, is there a way to reload the list of widgets?

rails javascript files not included.

When I create a javascript file in app/assets/javascripts or any of the other include locations. I have /= require tree . in the application.js. Furthermore, any content I enter in to applicaiton.js does not end up served.

Is there a special specification I need to make in the dashing.rb or something to add more javascript files? I'm attempting to overrite the gridster settings to add another column to the layout and change the size of the cells to something smaller.

Issue while compressing JS files with the Asset Pipeline

Hi,

I'm trying to run rails-dashing under passenger-nginx and i Get this errors:

GET http://foo.com/dashing/widgets/r.html 500 (Internal Server Error) application-3587576a36c1ab2a24c5687247faf363.js:3
Uncaught Error: Could not load view from /r application-3587576a36c1ab2a24c5687247faf363.js:13
GET http://foo.com/dashing/widgets/u.html 500 (Internal Server Error) application-3587576a36c1ab2a24c5687247faf363.js:3
Uncaught Error: Could not load view from /u application-3587576a36c1ab2a24c5687247faf363.js:13

Of course widgets 'u' and 'r' doesn't exist and are not defined anywhere

I set the js compressosr as YUI and even leave raisl to serve the assets in real time (like in dev) but not lucky.
I also added the options suggested to run it under apache:

rails_app_spawner_idle_time 0;
passenger_min_instances 1;

Any clue will be welcome

TIA

rspec confusion

I'm attempting basic loads for rspec testing, however I am having troubles with the _path variables. Are there any querks I should be aware of?

Circular Dependency Issues. Is this a compatibility issue?

I can't seem to get a complete page loaded. Would anyone know what could be causing it to crash or what dependencies may be causing it to crash?

RuntimeError (Circular dependency detected while autoloading constant Dashing::WidgetsController):
activesupport (4.1.8) lib/active_support/dependencies.rb:478:in load_missing_constant' activesupport (4.1.8) lib/active_support/dependencies.rb:180:inconst_missing'
activesupport (4.1.8) lib/active_support/inflector/methods.rb:240:in const_get' activesupport (4.1.8) lib/active_support/inflector/methods.rb:240:inblock in constantize'
activesupport (4.1.8) lib/active_support/inflector/methods.rb:236:in each' activesupport (4.1.8) lib/active_support/inflector/methods.rb:236:ininject'
activesupport (4.1.8) lib/active_support/inflector/methods.rb:236:in constantize' activesupport (4.1.8) lib/active_support/dependencies.rb:552:inget'
activesupport (4.1.8) lib/active_support/dependencies.rb:583:in constantize' actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:78:incontroller_reference'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:68:in controller' actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:46:incall'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:in block in call' actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:ineach'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in call' actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:incall'
railties (4.1.8) lib/rails/engine.rb:514:in call' railties (4.1.8) lib/rails/railtie.rb:194:inpublic_send'
railties (4.1.8) lib/rails/railtie.rb:194:in method_missing' actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:inblock in call'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in each' actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:incall'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
rack-pjax (0.8.0) lib/rack/pjax.rb:12:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
omniauth (1.2.2) lib/omniauth/strategy.rb:186:in call!' omniauth (1.2.2) lib/omniauth/strategy.rb:164:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' omniauth (1.2.2) lib/omniauth/strategy.rb:186:incall!'
omniauth (1.2.2) lib/omniauth/strategy.rb:164:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
omniauth (1.2.2) lib/omniauth/builder.rb:59:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/rack/agent_hooks.rb:30:in traced_call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:55:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/rack/browser_monitoring.rb:23:in traced_call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:55:incall'
warden (1.2.3) lib/warden/manager.rb:35:in block in call' warden (1.2.3) lib/warden/manager.rb:34:incatch'
warden (1.2.3) lib/warden/manager.rb:34:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
rack (1.5.2) lib/rack/etag.rb:23:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
rack (1.5.2) lib/rack/conditionalget.rb:25:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
rack (1.5.2) lib/rack/head.rb:11:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
actionpack (4.1.8) lib/action_dispatch/middleware/params_parser.rb:27:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in context' rack (1.5.2) lib/rack/session/abstract/id.rb:220:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/cookies.rb:560:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' activerecord (4.1.8) lib/active_record/query_cache.rb:36:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' activerecord (4.1.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' activerecord (4.1.8) lib/active_record/migration.rb:380:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:inblock in call'
activesupport (4.1.8) lib/active_support/callbacks.rb:82:in run_callbacks' actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:27:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/reloader.rb:73:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/remote_ip.rb:76:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' airbrake (3.2.1) lib/airbrake/rails/middleware.rb:13:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' railties (4.1.8) lib/rails/rack/logger.rb:38:incall_app'
railties (4.1.8) lib/rails/rack/logger.rb:22:in call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:incall_with_quiet_assets'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.5.2) lib/rack/methodoverride.rb:21:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.5.2) lib/rack/runtime.rb:17:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware.rb:26:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.5.2) lib/rack/sendfile.rb:112:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' airbrake (3.2.1) lib/airbrake/user_informer.rb:16:in_call'
airbrake (3.2.1) lib/airbrake/user_informer.rb:12:in call' newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall'
railties (4.1.8) lib/rails/engine.rb:514:in call' railties (4.1.8) lib/rails/application.rb:144:incall'
newrelic_rpm (3.9.8.273) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.5.2) lib/rack/content_length.rb:14:incall'
puma (2.10.2) lib/puma/server.rb:492:in handle_request' puma (2.10.2) lib/puma/server.rb:363:inprocess_client'
puma (2.10.2) lib/puma/server.rb:254:in block in run' puma (2.10.2) lib/puma/thread_pool.rb:101:incall'
puma (2.10.2) lib/puma/thread_pool.rb:101:in `block in spawn_thread'

Question: How to integrate within an existing application?

Hi,
I cannot seem to get this done, Could you guide me?
I have an existing rails 4 application and I would like to put dashing inside it, but integrating the look and feel.
It would reuse the existing application layout for that:

I have a route like this (controller: graphics, action: server)
/graphics/:id/server
And would like to use dashing to show the server status

It's that possible?

Thank you very much

Closing connections

I have a lot of errors like this after a while running dahsing-rails as an engine:

ERROR -- : PG::ConnectionBad: PQsocket() can't get socket descriptor:

I fetch the data from DB before send it to dashing. By default the connection pool is 50, if I set it as 100 it get more time, but the problem appear anyway.

I'm using rails 4.0.2 with latest pg gem.

I will post any news here, but any clue will be great

Dynamically Set data-max value in html.erb file

Hello, wasn't sure if this was the right place to ask this question. I'm currently using the sample.rb job and sample.html.erb view that comes with the gem. Regarding the "Meter" widget, is there a way to dynamically set the data-max attribute value inside the div element within sample.html.erb? I want to use the meter for capacity and as we get more capacity that data-max value would change. According to the coffee file for that widget here :
https://github.com/gottfrois/dashing-rails/blob/22a81fb4df3732879ed1afb05ba404aec5860a23/vendor/assets/javascripts/dashing/default_widgets/meter.coffee

It does not look like I can send a max value in the send_event Dashing call

Issue trying to get dashing-rails working with Apache and Passenger

I have been through a lot so far. My environment is rather ancient, Centos 5.5. It took my awhile to upgrade python to 2.6 so that I could get node.js installed so that extjs would work for rails 4.

I know others have gotten apache to work , but not me.

I installed the sample dashboard and it is working fine in my development environment.

All I am getting is a dashboard with blank colored boxes.

Here are the three errors I am seeing in the logs:

I, [2014-03-16T16:44:41.125613 #7780] INFO -- : Started GET "/dashing/dashboards/sample" for 10.243.150.209 at 2014-03-16 16:44:41 -0600
I, [2014-03-16T16:44:41.136692 #7780] INFO -- : Processing by Dashing::DashboardsController#show as HTML
I, [2014-03-16T16:44:41.136993 #7780] INFO -- : Parameters: {"name"=>"sample"}
I, [2014-03-16T16:44:41.178702 #7780] INFO -- : Rendered dashing/dashboards/sample.html.erb within layouts/dashing/dashboard (1.3ms)
I, [2014-03-16T16:44:41.180592 #7780] INFO -- : Completed 200 OK in 43ms (Views: 9.1ms | ActiveRecord: 0.0ms)
I, [2014-03-16T16:44:41.651059 #7780] INFO -- : Started GET "/dashing/events" for 10.243.150.209 at 2014-03-16 16:44:41 -0600
I, [2014-03-16T16:44:41.653687 #7780] INFO -- : Processing by Dashing::EventsController#index as text/event-stream
I, [2014-03-16T16:44:41.737421 #7780] INFO -- : Completed 500 Internal Server Error in 84ms
F, [2014-03-16T16:44:41.738279 #7780] FATAL -- :
NoMethodError (undefined method call' for nil:NilClass): /usr/local/ordernow/httpd/htdocs/dashing/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/live.rb:66:incall_on_error'
/usr/local/ordernow/httpd/htdocs/dashing/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/live.rb:136:in rescue in block in process' /usr/local/ordernow/httpd/htdocs/dashing/shared/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/live.rb:145:inblock in process'

F, [2014-03-16T16:44:41.738386 #7780] FATAL -- :
Redis::InheritedError (Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.):

I, [2014-03-16T16:44:41.798125 #7780] INFO -- : Started GET "/dashing/widgets/n.html" for 10.243.150.209 at 2014-03-16 16:44:41 -0600
I, [2014-03-16T16:44:41.800297 #7780] INFO -- : Processing by Dashing::WidgetsController#show as HTML
I, [2014-03-16T16:44:41.800373 #7780] INFO -- : Parameters: {"name"=>"n"}
I, [2014-03-16T16:44:41.806322 #7780] INFO -- : Completed 500 Internal Server Error in 6ms
F, [2014-03-16T16:44:41.809743 #7780] FATAL -- :
RuntimeError (Count not find template for widget n. Define your widget in /usr/local/ordernow/httpd/htdocs/dashing/releases/20140316223521/app/views/dashing/widgets/):

There is nothing else in this app, I am just trying to validate that I can get this working in our environment.

I do have

config.allow_concurrency = true

in production.rb

I am using apache + passenger

Here is my apache config:

LoadModule passenger_module /usr/local/ordernow/lib/ruby/gems/2.0.0/gems/passenger-4.0.27/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/ordernow/lib/ruby/gems/2.0.0/gems/passenger-4.0.27
PassengerDefaultRuby /usr/local/ordernow/bin/ruby
RailsAppSpawnerIdleTime 0
PassengerMinInstances 1

EventsController *can* hold database connections it doesn't need and exhaust the connection pool

The EventsController doesn't need any database connection, but it'll hold the database connection untill the event stream is closed. If enough clients are connected, the database connection pool may get full and other clients will not be able to do any requests (because the database will timeout).

I had this problem in an application, and it was a fucking nightmare to trace it down to this.

The solution I found so far is to add a before_action filter to release the database connection before the action code starts. We can do this because we know that the events controller doesn't need to do anything with the database.

Dynamic Dashboard Layout

Firstly thanks for all this work it's great.

Would it be possible to do the following, at the moment

server:3000/dashing/ => dashing/dashboards/sample.html.erb

How can I get to,

server:3000/dashing/:dashboard => controller or view which could take that :dashboard variable and then generate the view dynamically? ie you could change the dashboard by passing a variable rather than matching the filename

I would appreciate any help/direction you can give me.

Using -d on server start not working

I can run the application without any issues without the -d, however as soon as i put -d i get the widgets with no data. I added console.log in javascript to listen to onData event but i get nothing logged when using the -d option either.

the application log shows that the request is reaching the server

Redis / PostGreSQL Timeout in Heroku

Hello,
We are trying to implement Dashing-Rails for last 2-3 days. We are storing out datapoints in DB and then pulling it in jobs and passing it through send_server. The app completely crashes when two users (more than one) tries to access the dashing dashboard at the same time due to DB connection time out or connection refuse.

Rufus not executing in production environment?

I'm running puma on my production box (ubuntu, ruby 2.0.0) with

RACK_ENV=production puma -t 5:20 -d

but rufus jobs never seem to get executed?

When I look at Dashing.config.scheduler I can see it has the jobs, but they aren't being run and I do indeed see * Min threads: 5, max threads: 20 in the start up output, so it has more than 1 thread..

I also have enable_concurrency = true in production.rb, this had no effect.

help! :)

Rails default layout being called and breaking in Dashing engine

My default application view layout is being loaded when loading the dashboard sample.

I've followed the instructions on the front page, just trying to view the sample dashboards but failing.

My default layout has calls like <% link_to 'someting', some_path %> which are not available to dashing and break. Is this normal behaviour ?

dashing on apache and passenger looking for configs

I'm looking for more info on how to properly config apache to serve dashing as referenced by this thread #5.

Any help is appreciated, was going to comment in the other thread but it is locked.

Thanks

Edit: problem solved, two versions of passenger were on the system, one installed via Fedora 20's repos which was semi-broken and my config file was referencing it.

If anyone else is looking for the apache passenger config its pretty straight forward:

LoadModule passenger_module /usr/local/share/gems/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so

PassengerRoot /usr/local/share/gems/gems/passenger-4.0.37 PassengerRuby /usr/bin/ruby

RailsAppSpawnerIdleTime 0
PassengerMaxInstancesPerApp 1

<VirtualHost *:80>
    ServerName fullyqualified.server.name
    DocumentRoot /var/www/html/public
    PassengerMinInstances 1
   <Directory /var/www/html/public>
      AllowOverride all
      Options -MultiViews
   </Directory>
    ErrorLog /var/log/httpd/passenger.error.log
    CustomLog /var/log/httpd/passenger.access.log combined
</VirtualHost>

Wrong path in widgetgenerator.rb

When using the widgetgenerator the path become /widgets/file_name/.html.

This because of the join in widgetgenerator.rb ->

Dashing.config.widgets_views_path.call.join(file_name, '.html') Dashing.config.widgets_css_path.join('widgets', file_name, '.scss') Dashing.config.widgets_js_path.join('widgets', file_name, '.coffee')

Proposed solution: "#{file_name}.html" instead

Redis Server

Anyway we can get a gem built that allows one to specify a redis server other than local host so we can deploy on something like heroku.

If not, if you could help this newbie with some instructions on the simplest way to do so 👍

Passing information to dashboard

How can I pull up a dashboard for a specific resource. Like

/dashing/dashboard/23 or /dashing/dashboard/?id=23

Since there is no controller for me to access, i'm not sure how to pull the param out and send it to the job.

CSS3 transitions?

I'm trying to use the gist here: https://gist.github.com/jwalton/6670630 to get CSS3 transitions working. I was able to get it working using the Shopify version, but I seem to get it working with this Rails version, which I'd prefer to use. For the Shopify version, you have to change a particular Coffeescript (application.coffee). Specifically, you're supposed to change ' $('.gridster ul:first').gridster' to '$('.gridster > ul').gridster', I just can't find that line anywhere. Any suggestions as to how to get this working?

Freezes rails server

Just doing the install and pulling up the dashing/dashboards page, freezes the rails app, and the page hangs forever.

I dont see anything in the redis logs.

I have to kill -9 pid the rails process to get it to quit after this.

I'm new to this so I can't say much more, its a rails 4 app, thin server.

Is the redis server used?

I'm new to rails and dashing and I hope someone can answer my questions. I have the dashing-rails-demo running with a redis server on localhost but the redis server has no key stored on it. Is the redis server being used by dashing? Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.