Edit: 29 June 2014: This guide is slightly out of date. There is now a combined method. However this How-To is still relevant if you would like to run the scripts separately/or just one or two. (for instance, I am mostly interested in the database logging). If you want to run the combined method on Ubuntu, please follow the new instructions in the ReadMe file on GitHub
This guide below should get the multiple scripts that do not need configuration by Markus Gebhard up and running on you server. Pieces are pulled from his readme files on github and others are specific to a clean installation of ubuntu-14.04-server. You should still read all those files and forum topics because there is a lot of explanation and information in them. It may look like i know what I'm doing but don't let that fool you.
This guide is written with the intent that you can just copy and paste as you read through. From personal experience I know this is an easy way to get in over your head. I said above that this is based on a clean install, and what I mean is that once you have ubuntu installed and you are looking at a command prompt this is the first thing you do. If you have other services listening at port 1080 or 8080 these scripts will not work. (you can of course modify them to run on whatever port you desire)
With the hopes that maybe this guide will help get this project installed on more devices and more folks hacking on it.
Environment:
Set up the environment/Get all the pieces in place
Update-
sudo apt-get update
sudo apt-get upgrade
Git-
mySQL-
sudo apt-get install mysql-server
You will be prompted to set a root password
Tell MySQL to generate the directory structure it needs to store its databases and information
Run a simple security script. You can change your root password for mySQL here or say no to the first question and answer the rest of the questions yes.
sudo mysql_secure_installation
Set up the mySQL db to have all the tables and settings that the scripts will expect
mysql -u root -p
create database flm;
use flm;
create user 'pi'@'localhost' identified by 'raspberry';
grant all privileges on flm.* to 'pi'@'localhost';
flush privileges;
set password for 'pi'@'localhost' = password('raspberry');
quit
node.js-
You may need to sudo apt-get install software-properties-common
if the add-apt-repository below fails.
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs build-essential libavahi-compat-libdnssd-dev
The scripts-
Install the scripts from Markus Gebhard using git below or download them as a zip file directly from github
cd ~
git clone git://github.com/gebhardm/flmdisplay/
Panel:
cd ~/flmdisplay/panel
npm install mqtt socket.io mdns
./panel.sh
Persist:
cd ~/flmdisplay/persist
npm install mqtt mysql mdns
./persist.sh
Chart:
cd ~/flmdisplay/chart
npm install socket.io mysql
./chart.sh
If you have gotten through without errors then everything should be up and running. If you want to double check try pgrep -a node
This will list the process ID of each node instance and what the script name is at that pid. (useful if you want to kill -9 a specific process.)
You will want to know what the local IP address of your machine is. Try this if you are using wired ethernet (wlan0 if wireless)ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
or just type ifconfig
and read it yourself.
On another computer you should then go to the local address of your server to access the chart and panel.
Panel:
http://"local IP address":1080
Chart:
http://"locall IP address":8080
Remember the persist node is dumping data every second into the database. (even in the case of 0 data) Lots of info in there to manipulate. There are plenty of ways to get the data out if you want to do some presentation. Tab separated files can be dumped directly from mySQL. PHPmyAdmin can pop the data out in a spreadsheet readable file... etc some assembly required...
Size:
With 3 FLM and therefor 9 sensors recording data every second I am seeing the database become 97MB in about a day. I'd love some feed back regarding your experience with the speed of drive space consumption in your set up. (I plan on making more precise measurements) But just a heads up, you should plan accordingly, whether it be large enough drives or clean up scripts...
feedback and corrections appreciated.