launching Phant on your own server

Everything pertaining to the data.sparkfun.com service, the phant project which powers it, and user projects which talk to the service.

Moderators: phalanx, toddtreece, Brennen@SparkFun

launching Phant on your own server

Postby newneophyte » Tue Jan 13, 2015 4:47 pm

has anyone successfully launched Phant on their own (hosted) server ? Any input?

thanks
dan
newneophyte
 
Posts: 1
Joined: Tue Jan 13, 2015 4:46 pm

Re: launching Phant on your own server

Postby Stuart » Tue Feb 10, 2015 12:34 pm

Hi Dan,

I think I've successfully launched Phant on my own AWS instance but as yet I haven't been able to call it properly. I think I need the full URL of the Phant service, where it's running, but don't know what that is.

How far have you got?

Stuart
Stuart
 
Posts: 2
Joined: Tue Feb 10, 2015 12:30 pm

Re: launching Phant on your own server

Postby agilb » Thu Jun 18, 2015 11:28 am

So far I think I am the same. I have launched Phant, but am unable to send data to it. I have the same thing going to the Sparkfun Phant and it works just fine. The only difference I can see is the URL and the keys. I will keep trying, but somebody let me know if they find a solution.
agilb
 
Posts: 12
Joined: Wed Apr 11, 2012 8:23 am
Location: Utah, USA

Re: launching Phant on your own server

Postby agilb » Mon Jun 22, 2015 8:43 am

New bit of data. I have been running an Electric Imp but have been puzzled as to why other devices, like my laptop can log to the local instance of Phant, but the Imp can not. I thought since the Imp is speaking over the same network as the phant, it can all stay local and is fine. I assume the problem is I don't have a URL that can be accessed outside of this network, so after the data is transferred and processed on the Imp cloud, data can't make it back in. I will try to process data before it gets there, but my hopes aren't high. If anybody as help on this, much thanks in advance.
agilb
 
Posts: 12
Joined: Wed Apr 11, 2012 8:23 am
Location: Utah, USA

Re: launching Phant on your own server

Postby bdevlin » Wed Sep 23, 2015 1:09 pm

No luck here either. Installed nodejs and "npm install -g phant"... I can telnet to 8081 and run commands but http to 8080 does nothing, just blank screen. I can 'create' a stream and get keys for it over the telnet client, but I don;t seem to be able to post data via http as in the docs using the keys provided by the 'create' function. So cool. yet so frustrating. Maybe I'll just use postgres for my project... oh well.
bdevlin
 
Posts: 3
Joined: Mon Aug 31, 2015 9:13 am

Re: launching Phant on your own server

Postby distro inferno » Fri Sep 09, 2016 2:05 pm

I also want to ask anyone who successfully got Phant running on a local server how much speedup they notice in data throughput. Right now I'm trying to get an ESP8266 Thing Dev to post lots of data to Phant, but I need much higher throughput than I'm getting using data.sparkfun.com. I'll be taking 150Hz measurements on 4 channels so I need to upload (150*4)*(4 bytes per integer) = 2400 B/s. The values come in out-of-order and some get dropped.

If I can run Phant on a server on my own home network hopefully this would let me get the data throughput I need while still using the nice Phant demo code. I want to do this because trying to craft TCP or UDP packets with the data and send it from the ESP8266 to a device running $netcat -l has not worked. (I think it needs some kind of application layer rather than trying to clumsily push raw packets).
distro inferno
 
Posts: 17
Joined: Sat Apr 04, 2015 11:55 am

Re: launching Phant on your own server

Postby distro inferno » Fri Sep 09, 2016 4:17 pm

bdevlin wrote:No luck here either. Installed nodejs and "npm install -g phant"... I can telnet to 8081 and run commands but http to 8080 does nothing, just blank screen. I can 'create' a stream and get keys for it over the telnet client, but I don;t seem to be able to post data via http as in the docs using the keys provided by the 'create' function. So cool. yet so frustrating. Maybe I'll just use postgres for my project... oh well.


I'm having this experience too.

I am pretty impressed that I was able to install it on an Intel Edison with no issues at all. Telnet works, cute elephant ASCII, phant server does open port 8080 and 8081 as advertised, but that's it- nothing seems to work on the 8080 side of things.

Also should I be worried that the git repo, which was last updated Nov 2015, has an icon that says "build|failing"? Doesn't sound good.
distro inferno
 
Posts: 17
Joined: Sat Apr 04, 2015 11:55 am

Re: launching Phant on your own server

Postby gsolar » Thu Jul 13, 2017 5:58 pm

I’ve got phant running on an Arduino Yun.

I have a scale under a bee hive out in the yard driven by an ESP8266 Thing Dev and a couple of C batteries. It posts to data.sparkfun.com just fine except that this site often goes down for hours at a time so I wanted a more reliable place to upload the data. I have several Yuns on my local net that are on all the time anyway and may as well log the data there.

1) Get the latest OS. First I tried this procedure
https://gist.github.com/cvarta/894c5d40bf7391c97853
but this version of opkg accesses an out-of-date version of nodejs. This procedure
https://www.arduino.cc/en/Tutorial/YunSysupgrade
seems to give you the same OS but now opkg accesses a newer version of nodejs. Go figure.

2) The Yun doesn’t have enough native memory to install nodejs so you have to create root space on the SD card. This is done using the ExpandingYunDiskSpace sketch. I found two versions of this sketch, one older by a few months and which doesn’t work. Use the newer one. Reboot and type “df” and you should see that rootfs has a ton of room on it. Here is a “regular” Yun, which few MB on rootfs and a bunch of room on sda1. (Sorry about the typesetting- copy/paste isn't handling tabs very well.)

root@Well:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    5952      1160   4792  19% /
/dev/root                 8704      8704  0 100% /rom
tmpfs                    30728       104     30624   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3        5952      1160  4792  19% /overlay
overlayfs:/overlay   5952      1160  4792  19% /
/dev/sda1              3862528     37312 3825216   1% /mnt/sda1

Here is a Yun reconfigured as above. It has way more room in rootfs, which is the only reason there’s enough room to install nodejs.

root@SPO2:~# df
Filesystem 1K-blocks  Used Available Use% Mounted on
rootfs   1321980   150484  1105244 12% /
/dev/root 7680 7680 0 100% /rom
tmpfs         30560 136  30424   0% /tmp
tmpfs     512 0 512   0% /dev
/dev/sda3 1321980    150484   1105244  12% /overlay
overlayfs:/overlay 1321980  150484  1105244  12% /
/dev/sda1    12275984 24 12275960   0% /mnt/sda1

3) Now install node and phant.

opkg update
opkg install node
opkg install node-ws
opkg install node-serialport

npm -g install phant

4) If you telnet into the Yun you can set up a phant stream just like you do on data.sparkfun.com

[Johns-MacPro:~] john% telnet spo2.local 8081
Trying 10.0.1.7...
Connected to spo2.local.
Escape character is '^]'.
            .-.._
      __  /`     '.
   .-'  `/   (   a \
  /      (    \,_   \
 /|       '---` |\ =|
` \    /__.-/  /  | |
   |  / / \ \  \   \_\  jgs
   |__|_|  |_|__\
  welcome to phant.

Type 'help' for a list of available commands

phant> help

list       list public streams
create     create a new stream
delete     remove a stream
help       display this dialog
quit       close the connection

If you need help getting started, visit http://phant.io/docs.

phant> create
Enter a title> Hive
Enter a description> hive weight
Enter fields (comma separated)> upTime,temp,Vbat,weight
Enter tags (comma separated)> 

Stream created!
PUBLIC KEY: aK…..Pd6a
PRIVATE KEY:  Pn5…..QqzE
DELETE KEY:  lBb……ZNk

If you need help getting started, visit http://phant.io/docs.

phant> 

The ESP8266 board driving the beehive logs to spo2.local just fine. Make sure your ESP8266 has
const int httpPort = 8080;
gsolar
 
Posts: 2
Joined: Thu Jul 13, 2017 5:01 pm

Re: launching Phant on your own server

Postby gsolar » Fri Jul 14, 2017 11:49 am

agilb wrote:So far I think I am the same. I have launched Phant, but am unable to send data to it. I have the same thing going to the Sparkfun Phant and it works just fine. The only difference I can see is the URL and the keys. I will keep trying, but somebody let me know if they find a solution.


What is httpPort set at in your sketch? I've got phant running on a Yun. The ESP8266 that is collecting data used to send to data.sparkfun.com with httpPort = 80 but I had to change this to httpPort = 8080 to send to the Yun.
gsolar
 
Posts: 2
Joined: Thu Jul 13, 2017 5:01 pm

Re: launching Phant on your own server

Postby CaptAndy » Sat Jul 29, 2017 9:29 am

I have the phant server running on a Raspberry Pi Zero W with the DietPi operating system.

It took a while to get it working as the latest version of Node Js was crashing when trying to start up the phant server.
To get it working I had to modify a node js file, validator.js .

I believe the problem is to do with a missing object property.

Have a look at this link as it explains what is causing the crash to occur:

https://github.com/sparkfun/phant/issues/200

The modification to validator.js worked for me and I can continue to use the latest Node Js. I believe that reverting to an earlier version of Nods Js may also fix the issue but have not tried this.

I should think that this issue will affect most people trying to get the phant server up and running on their own platform.
CaptAndy
 
Posts: 2
Joined: Sat Jul 29, 2017 9:04 am


Return to data.sparkfun.com

Who is online

Users browsing this forum: No registered users and 1 guest