sparkfun / phant

the data logging engine behind data.sparkfun.com
700 stars 99 forks source link

Hosting our own Phant: Data sent but no response from the Phant and the server does not receive it #196

Closed lautiamkok closed 6 years ago

lautiamkok commented 8 years ago

We have set up Phant on our own server and got it running at port 8080. We have tried to send some data to the server and it doesn't work. The data is being sent however there is no response from the Phant and the server does not receive it.

Is it because we are using xxx.xxx.xxx.xx:8080 for our server address rather than a subdomain such as data.sparkfun.com?

I have also installed Phant on my local server and I can access Phant on http://127.0.0.1:8080 just as the version on our production server http://xxx.xxx.xxx.xx:8080/

Any ideas why? Any further information/ documentation what we can do with Phant after installation?

bsodmike commented 8 years ago

@lautiamkok did you also figure out where Phant persists data? Thanks!

m4ddav3 commented 8 years ago

@bsodmike phant stores data in the directory specified by PHANT_STORAGEDIR. This defaults to phant_streams, which is relative to your process' current working directory.

I.e. I run phant looged in as myself, from my home dir, so it is ~/phant_streams

bsodmike commented 8 years ago

Oh, I'd assumed it would persist to a database (Postgres/MySQL) or say Redis; sound like they've designed it around a simpler concept.

m4ddav3 commented 8 years ago

@lautiamkok Phant does not specify anything about the interface to listen on, except the port (http = PHANT_PORT, telnet = PHANT_TELNET_PORT). You should check your server configuration to find out what is happening.

From the NodeJS documentation:

the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise

If you have sudo access, lsof will tell you what it is listening on:

$ sudo lsof -ni -P | grep node
node      26374    -----   12u  IPv6 1060604      0t0  TCP *:8080 (LISTEN)
node      26374    -----   13u  IPv6 1060605      0t0  TCP *:8081 (LISTEN)

Shows my server listening on all interfaces (*), on ports 8080 and 8081.

You can refine this by editing /usr/local/bin/phant around line 45. I added in my IP as a second parameter and lsof reports as I expected:

$ sudo lsof -ni -P | grep node
node      26374    -----   12u  IPv6 1060604      0t0  TCP xxx.xxx.xxx.xxx:8080 (LISTEN)
node      26374    -----   13u  IPv6 1060605      0t0  TCP *:8081 (LISTEN)

Apart from these local interface tweaks, you should check any firewalls/iptables which might block access to those ports.

lautiamkok commented 8 years ago

@m4ddav3 thanks for the reply. My issue above was caused by http/ https. I changed https to http when sending data from imp and it is now working.

bboyho commented 6 years ago

Phant is No Longer in Operation

Unfortunately Phant, our data-streaming service, is no longer in service and will be discontinued. The system has reached capacity and, like a less-adventurous Cassini, has plunged conclusively into a fiery and permanent retirement. There are several other maker-friendly, data-streaming services and/or IoT platforms available as alternatives. The three we recommend are Blynk, ThingSpeak, and Cayenne. You can read our blog post [ https://www.sparkfun.com/news/2413 ] on the topic for an overview and helpful links for each platform.