Skip to content

Instantly share code, notes, and snippets.

@sturdy5
Last active March 30, 2017 03:58
Show Gist options
  • Save sturdy5/37efad84f8509d100179 to your computer and use it in GitHub Desktop.
Save sturdy5/37efad84f8509d100179 to your computer and use it in GitHub Desktop.
Dashboards with Dashing on Ubuntu

Setting up Dashing

Introduction

Dashing is a pretty nifty little dashboard app written in ruby. It was first introduced to me through the works of Adafruit Industries with a post about setting up some dashboards using Raspberry Pi. If you are interested here is the post. For my work, dashboards and metrics seem to be everything recently, so this was an experiment to see how easy it was to setup a dashboard using dashing.

Installation

According to the Dashing website, the first step to trying out Dashing is to install it using gems

$ gem install dashing

Unfortunately, for me, that didn't cut it. First, my ruby installation is installed as root, so I tried

$ sudo gem install dashing

When that executed, it ran into a little hiccup

Building native extensions.  This could take a while...
ERROR:  Error installing dashing:
	ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
	from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from extconf.rb:2:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/ext/gem_make.out

Thanks to a post on StackOverflow, I found that I needed to install another version of ruby. So running the command

$ sudo apt-get install ruby1.9.1-dev

and then attempt to install the dashing gem again and ... ha, ha!! We have successfully installed dashing (or so I believe).

If you run into issues where it is telling you that you don't have g++ you can run the following command to install it

$ sudo apt-get install g++

Creating a Project

So now the dashing website says that I can create a dashing project by running

$ dashing new sample-dashboard

Then to see the template that it puts together we need to go into the sample-dashboard directory and run the command

$ bundle

Well, it turns out that I wasn't done installing things - I don't have anything called bundle. I know that there is a gem called bundler - so I've installed it to get the bundle command to work.

$ sudo gem install bundler

Now when I run the bundle command it bundles everything up! Now I believe I really have installed everything I need. So on to the next step - testing!

Testing

Again, according to the dashing website we now have to run

$ dashing start

And this time, I don't have anything else I have to do. The dashboard is running!

You may get an error saying that you need to have a javascript runtime in order to run dashing. You can do this by installing npm

$ sudo apt-get install npm

I just need to go to http://localhost:3030/ to get to the dashboard.

If you need to run on a different port than the default, then you can add parameters to the dashing command to tell it which port to use like this...

$ dashing start -p 9000

You can make dashing run in the background by putting the -d flag on the command. If you do that, then to stop it run the command

$ dashing stop

There are other options that you can specify as well. If you are interested, check out the documentation for Thin (as that is what dashing uses).


See more notes at http://jsturdevant.roughdraft.io/


Written with StackEdit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment