chendo / lifx-http

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

Raspberry Pi - "Connection Refused" #14

Open adamjpfister opened 10 years ago

adamjpfister commented 10 years ago

I'm trying to get this setup on a Pi and I keep getting this error when i try to run a test curl from a different machine (same network).

curl: (7) Failed connect to 192.168.1.144:56780; Connection refused

I've verified the IP is correct and there is no error/warning when I run "lifx-http" from the Pi.

Any ideas? is this more related to the pi and/or ruby? I have ruby 2.1.2 on the Pi.

thanks!

lanej0 commented 10 years ago

No firewall? Can you SSH in and try doing a curl to localhost:56780?

adamjpfister commented 10 years ago

i don't believe there is a firewall in place.

i did a curl to localhost:56780 and got "Not Found" as a response.

i can ping the pi via it's IP. any other thoughts?

adamjpfister commented 10 years ago

After a reboot of the Pi and then restarting lifx-http, i saw this message:

TCPServer Error: Address family not supported by protocol - socket(2)

some google-fu landed me here: http://stackoverflow.com/questions/4356646/address-family-not-supported-by-protocol-family. I am executing curl requests from a MacBook pro to the Pi.

this is going a bit above my knowledge of ruby so any pointers would be appreciated.

lanej0 commented 10 years ago

Actually, this might be more helpful for you. Looks like it might have something to do with IPv6 on a Raspberry Pi?

http://raspberrypi.stackexchange.com/questions/1868/ruby-and-selenium-webdriver-address-family-not-supported-by-protocol-socket

Try following those instructions, for /etc/modprobe.d/ipv6.conf and /etc/hosts and give it a reboot. Does that do the trick?

adamjpfister commented 10 years ago

went through disabling ipv6 with no luck.

when i ssh the pi and do a test curl using localhost, all comes back fine. then i switch from using localhost to the IP of the PI and i get a connection refused. all while on ssh. do i need to edit a file to make sure the IP address can be used?

thanks for your help and suggestions (and patience :))

lanej0 commented 10 years ago

I'd put money on it being the mdns gem doing something funky and not returning the proper IP address for the server to bind to. Unfortunately I'm out of my depth on how to fix that -- unless you can do update the gem (I noticed in the gemspec that it's calling for 0.2, and there is a 0.2.1 -- I don't know if that will fix anything).

Looks like @chendo looks after that gem as well, maybe he can help out here?

egiljae commented 10 years ago

Ok, seems like webrick defaults to localhost if RACK_ENV is not set. Solution is to export RACK_ENV=production (or something else).

zzarbi commented 10 years ago

@eg1l is right might be due to a different version of RACK

amil109 commented 10 years ago

@eg1l has nailed it - works just fine on my Pi when I run

RACK_ENV=production lifx-http

justinatomatic commented 9 years ago

I've run into this problem and tried some of the above suggestions with no luck. The problems seems to be Rack 1.6.0, downgrading the gem to 1.5.2 worked for me.

gem uninstall rack gem install rack:1.5.2