Can't use sockets with rails #44

Closed
toovs opened this Issue Mar 2, 2012 · 10 comments

Comments

Projects
None yet
4 participants

toovs commented Mar 2, 2012

rails s puma works fine, but I get the following when appending -b unix://tmp/sockets/puma.sock:

=> Booting Puma
=> Rails 3.2.2 application starting in development on http://unix://tmp/sockets/puma.sock:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Puma 0.9.4 starting...

  • Min threads: 0, max threads: 16
  • Listening on tcp://unix://tmp/sockets/puma.sock:3000
    Exiting
    /usr/lib/ruby/gems/1.9.1/gems/puma-0.9.4/lib/puma/server.rb:103:in `initialize': getaddrinfo: Name or service not known (SocketError)

toovs commented Mar 3, 2012

huh ok so I tried puma -b unix://tmp/sockets/puma.sock config.ru, but doesn't seem to be playing well with nginx, just gives me a bad gateway error. works fine if I don't use a socket and just use a custom port.

toovs commented Mar 3, 2012

and my nginx setup works fine with unicorn's sockets.

Owner

evanphx commented Mar 21, 2012

Was the first attempt calling puma via "rails server"? It looks like it got heavily confused because it's got a port number in there too.

I did just test it using nginx and it seems to work fine. What nginx configuration do you have it? Does the request show up in puma's log at all?

sxua commented Mar 30, 2012

+1
also tried to pair it with nginx, but all I've got is "Bad Gateway"
this configuration works well with Unicorn, but not with Puma

nginx.conf:

upstream puma {
  server unix://tmp/puma.sock fail_timeout=0;
}

config/puma.rb:

bind "unix:///tmp/puma.sock"
pidfile "/tmp/puma.pid"

running as:

~$ puma -C ./config/puma.rb config.ru
Puma 1.0.0 starting...
* Min threads: 0, max threads: 16
* Listening on unix:///tmp/puma.sock
Use Ctrl-C to stop
Owner

evanphx commented Mar 30, 2012

I'm still unable to reproduce this issue. What is in config.ru?

sxua commented Mar 30, 2012

Just default Rails app

require ::File.expand_path('../config/environment',  __FILE__)
run TestApp::Application
Owner

evanphx commented Mar 30, 2012

What version of nginx are you testing against? Does anything render?

sxua commented Mar 30, 2012

nginx/1.0.13

Oops, sorry, my bad. nginx logs shows me: *1 connect() to unix://tmp/puma.sock failed (13: Permission denied) while connecting to upstream

chmod a+rw /tmp/puma.sock does the trick

Owner

evanphx commented Mar 30, 2012

Oh interesting! So it was a permission problem. I'll investigate the proper way to set the perms of a unix socket.

@evanphx evanphx closed this in 3dd7049 Mar 30, 2012

Related to this #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment