[Guide] Installing dashing Dashboard on Raspberry Pi

This guide is inspired by this guide with some modifications.

Before anything, lets have look at what is needed for this guide:

  • Raspberry Pi (We used a Raspberry Pi 2 Model B)
  • Monitor (We used an old Acer with only VGA, so maybe you need a HDMI-to-VGA adapter)
  • Raspberry Pi power supply
  • SD Card (We used an 8GB)

Firstly, you needed to download an image for your SD-card. We decided on using the Raspbian image (link).

Next, insert your SD-card and use diskutil list to see the device name. In the following our disk name is disk3.

Unmount the disk (this guide is made on OSX, but there are similar Linux commands)

$ sudo diskutil unmoundDisk /dev/disk3

Next, we write everything to the sd-card, with the following command:

$ sudo dd bs=1m if=2015-11-21-raspbian-jessie.img of=/dev/rdisk3

Configure the filesystem size

By default the Raspbian image only created a filesystem with the size of 3.8GB although we've used 8GB. To expand this go the Menu -> Preferences -> Raspberry Pi Configuration and press the button 'Expand Filesystem'. Bam! We suddenly got our 8GB back after a reboot.

Boot up the Raspberry Pi

The default user of the raspberry pi are as follows
username: pi
password: raspberry
and you can easily login via SSH.

Assign static ip

The dashboard should always stay the same. Therefore we need to configure the Raspberry Pi to have a static ip.

Edit the /etc/network/interfaces file as follows:

$ sudo nano /etc/network/interfaces

and paste the following instead

auto lo  
iface lo inet loopback

allow-hotplug eth0  
iface eth0 inet static  
address 192.168.1.100  
netmask 255.255.255.0  
network 192.168.1.0  
broadcast 192.168.1.255  
gateway 192.168.1.1

iface eth0 inet6 auto

allow-hotplug wlan0  
iface wlan0 inet dhcp  
pre-up /usr/bin/occi  
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf  
iface default inet dhcp  

Remember to change the different ip's to your network. This will always assign the Raspberry Pi the ip address 192.168.1.100

Initial updating

Now enter the following commands in the terminal

sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install libssl-dev  

Installing Node.js

First we need to install node.js (we followed this guide: link)
First add the apt.adafruit.com package repository to the /ect/apt/sources.list file:

$ curl -sLS https://apt.adafruit.com/add | sudo bash  

Next install node:

$ sudo apt-get install node

Verify that node is installed with the following command:

$ node -v
v0.12.6  

Installing Ruby

Dashing is built with ruby and we need to install this as well. Enter the following command to install Ruby.

$ sudo apt-get install ruby ruby-dev

to verify that everything is installed correctly, run the following:

$ ruby -v
ruby 2.1.5p273 (2014-11-13) [arm-linux-gnueabihf]  

Installing Dashing

Now, we are finally ready to install dashing. Enter the following commands:

$ echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
$ sudo gem install bundler dashing

Create a new folder and enter it:

$ mkdir dashboard && cd dashboard

Install the gems, by running bundle:

$ bundle

Now we can start our new cool dashboard with

$ dashing start

Configure Dashing to start at boot

We followed the this link guide.

The steps are as follows:

Create a script-file named dashboard in the directory /etc/init.d/ and paste the following into this file:

#!/bin/bash
# Dashing service
# Add this file to /etc/init.d/
# $ sudo cp dashboard /etc/init.d/
# Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation
# $ sudo nano /etc/init.d/dashboard
# Make executable
# $ sudo chmod 755 /etc/init.d/dashboard
# Update rc.d
# $ sudo update-rc.d dashboard defaults
# Dashboard will start at boot. Check out the boot log for trouble shooting "/var/log/boot.log"
# USAGE: start|stop|status|logs

### BEGIN INIT INFO
# Provides:          dashboard
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

# Gregology <greg@gho.st>
# https://gist.github.com/gregology/5313326
# Based on  Faraz Haider's LifeRay Startup Service script
# https://gist.github.com/haiderfaraz/2773431

DASHING_DIR=/path/to/dashboard/  
GEM_HOME=/usr/local/lib/ruby/gems/1.9.1  
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

case "$1" in  
start)  
echo "Starting Dashing."  
cd $DASHING_DIR; dashing start -d  
;;
stop)  
echo "Stopping Dashing."  
killall thin  
;;
logs)  
echo "See the logs of the Dashing."  
tail -f $DASHING_DIR'log/thin.log'  
;;
status)  
# Check to see if the process is running
ps aux|grep -i dashing  
;;

*)
echo "Dashing"  
echo $"Usage: $0 {start|stop|status|logs}"  
exit 1  
esac  
exit 0  

Remember to update the DASHING_DIR variable to the path of your dashboard. Next we need to change permissions of the script by chmod as follows:

$ chmod 755 dashboard

and update rd.d

$ sudo update-rc.d dashboard defaults

Displaying dashing on boot

First we need to install some packages, enter the following command

$ sudo apt-get install nodm matchbox-window-manager uzbl xinit unclutter

Next we need to enable auto-login. Edit the file /etc/default/nodm

$ sudo nano /etc/default/nodm

Change the following in this file

NODM_ENABLED=true  
NODM_USER=pi  

Next, we need to create the file in the user directory /home/pi/, enter the following:

$ nano .xsession

paste the following into this file:

xset -dpms  
xset s off  
# Wait until dashing is ready - change the dashboard name in the URL
while ! curl -s -o /dev/null http://127.0.0.1:3030/assets/application.js; do  
  sleep 10
done  
exec matchbox-window-manager -use_titlebar no &  
while true; do  
  # Sometimes uzbl gets killed due to memory issues, this loop makes sure
  # it starts back up
  uzbl -u http://127.0.0.1:3030/ -c /home/pi/uzbl.conf
done  

Remember to chmod this file:

$ chmod 755 .xsession

The last thing we need to configure is uzbl. Create a file uzbl.conf in the user directory /home/pi/:

nano uzbl.conf  

and paste the following:

set socket_dir=/tmp  
set geometry=maximized  
set show_status=0  
# Because setting show status in the config file doesn't always work
# You can try leaving this out and seeing if it works anyway for you
# but this makes sure the status bar is hidden at the beginning.
set on_event        = request ON_EVENT  
@on_event LOAD_START set show_status=0

Now everything should be good to go! Make a sudo reboot, and see watch your dashboard come to life! Enjoy!