chendo / lifx-http

A HTTP API for controlling LIFX devices.
MIT License
91 stars 13 forks source link

Ubuntu install #9

Open garethds opened 10 years ago

garethds commented 10 years ago

I am having issues running lifx-http on Ubuntu 13.10 Server. Here is the error I am getting

lifx-http

lifx-http can be reached at http://lifx-http.local:56780/ [2014-05-03 15:14:24] INFO WEBrick 1.3.1 [2014-05-03 15:14:24] INFO ruby 2.0.0 (2013-08-29) [x86_64-linux-gnu] [2014-05-03 15:14:24] WARN TCPServer Error: Address already in use - bind(2) [2014-05-03 15:14:24] INFO WEBrick::HTTPServer#start: pid=20303 port=56780

uname -a

Linux NAS 3.11.0-20-generic #34-Ubuntu SMP Tue Apr 1 20:40:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

ruby --version

ruby 2.0.0p299 (2013-08-29) [x86_64-linux-gnu]

lsof shows nothing when the service is not running.

lsof -wni tcp:56780

dhallgb commented 10 years ago

Try netstat -tulnp?

garethds commented 10 years ago

When running and there is nothing listening when I kill the process

netstat -tulnp | grep 5678

tcp 0 0 0.0.0.0:56780 0.0.0.0:* LISTEN 17260/ruby2.0

chendo commented 10 years ago

What happens if you run netstat -tulnp | grep 56700?

garethds commented 10 years ago

netstat -tulnp | grep 56700

udp 0 0 0.0.0.0:56700 0.0.0.0:* 28434/ruby2.0

On Mon, May 19, 2014 at 12:20 PM, Jack Chen notifications@github.comwrote:

What happens if you run netstat -tulnp | grep 56700?

— Reply to this email directly or view it on GitHubhttps://github.com/chendo/lifx-http/issues/9#issuecomment-43461520 .

chendo commented 10 years ago

What is that process doing? It's holding on to a port that's used for communicating with the bulbs. If you kill that process, you should be able to run lifx-http

cboettig commented 10 years ago

I see this same error message (also on Ubuntu 14.04). netstat -tulnp | grep 56700 shows nothing though, and it appears the server is running.

When I issue the curl commands from another terminal, the terminal with lifx-http running in the foreground does seem to acknowledge them, e.g.

running

curl http://localhost:56780/lights.json
curl -XPUT http://localhost:56780/lights/all/toggle -d ''

shows in the foreground lifx-http terminal:

 - - [06/Sep/2014:05:11:06 UTC] "GET /lights.json HTTP/1.1" 200 2
- -> /lights.json

 - - [06/Sep/2014:05:15:47 UTC] "PUT /lights/all/toggle HTTP/1.1" 200 2
- -> /lights/all/toggle

but in the terminal where I execute these curl commands the only thing I get back is an empty json string [], and the light does not toggle.

CWempe commented 9 years ago

Same here.

user@htpc:~$ sudo netstat -tulnp | grep ruby tcp 0 0 127.0.0.1:56780 0.0.0.0:* LISTEN 17608/ruby2.2 udp 0 0 0.0.0.0:40257 0.0.0.0:* 17608/ruby2.2 udp 0 0 0.0.0.0:56700 0.0.0.0:* 17608/ruby2.2 udp 0 0 0.0.0.0:56750 0.0.0.0:* 17608/ruby2.2 udp 0 0 0.0.0.0:49357 0.0.0.0:* 17608/ruby2.2 udp 0 0 0.0.0.0:54183 0.0.0.0:* 17608/ruby2.2 udp 0 0 0.0.0.0:5353 0.0.0.0:* 17608/ruby2.2

I think the answer is here: http://stackoverflow.com/questions/16118971/cannot-access-sinatra-app-through-the-local-network

Bit I don't know how to apply this to lifx-http.

CWempe commented 9 years ago

I found a good work around. https://github.com/chendo/lifx-http/issues/14#issuecomment-69872986 I won't call it a solution though.

Looks like this issue and issue #14 (https://github.com/chendo/lifx-http/issues/14) are the same.