Installing Sparkfun’s Phant (with WebUI) on a Raspberry PI

datasparkAs mentioned in the earlier Phant post the version of Phant available via npm & the phant github repo doesn’t have the WebUI part of data.sparkfun.com and thus a couple of things you can do with the Sparkfun hosted version of Phant can’t be done (AFAIK) with the self-hosted version. However, after digging around on the sparkfun github page & phant.io/docs I noticed that a /config page was mentioned
phantconfig

 

 

 

and also  that there was a link on data.sparkfun.com phantdeploy1

for configuring and deploying your own copy of the phant server

 

 

So after clicking I end up on a nice, pretty page that seems (remember i know sweet f.a. about javascript and/or node.js so all my assumptions are guesses and all my clicks are me running in betatest/idiotproofing mode.

phantconfigurator

and as instructed by the readme in the phant-manager-http repo I clicked Add Manager phantmana
& added HTTP
phantmana1

I left everything as default & clicked download, selected tar.gz as archive format and after it had downloaded copied to my raspberry pi. Once it was over on the Raspberry Pi I again followed the instructions to the letter (as i have no idea what i’m doing :) ) and created a directory phantconfig-custom & untared the downloaded tarball into it.

phantcust

then installed it (as i’m not sure exactly how this works i’m installing it in a directory for my pi user rather than globally. It shouldn’t make that much different other than this way any problems are probably something I did rather than caused by not following instructions)

npm install

After a few minutes phant with a WebUI will be installed.

phantinst

You can now test/use it by running it using the command

npm start

and if everything installed ok you’ll see a small phant banner

phantrunning

and I can now store sensor data in my self-host phant by either using the telnet interface.

phantruntn

or via the WebUI with all it’s extra bells and whistles such as hidden streams & stream aliases.

phantwebui

phantwebuicr

Everything looks fine & now matches up with http://phant.io/docs pretty well although of course you’ll need to change the domain:port part of the url in the docs to the one your self-hosted phant uses.

So you have a choice, you can run the github version of phant that only has the telnet ui for stream creation & a few less functions or you can use the full blown phant with all the shinies. Both versions seem to run reasonably well on the Raspberry Pi even with the warnings that the WebUI is a resource hog and not suitable for less powerful devices but i will admit i haven’t tested much and have just had a mess around with it trying to make it do things it wasn’t designed to do such as distributing binaries/data to many devices automagically.

one final thing is that I removed a couple of parts of the WebUI as if i’m using this privately i really don’t need them. I edited

/phantconfig-custom/node_modules/phant-manager-http/views/home.handlebars

phantviews

and deleted the the block2 & block5

phantmod

Now that it’s been tested in a user directory and seems to be working ok i’ll probably try it installed globally and/or use the forever https://www.npmjs.com/package/forever to keep it running 24/7 even if i close the ssh session or close the terminal window

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

 

russelldavis.org © 2014 Frontier Theme