I had a heck of a time getting a Rails + Unicorn + nginx deployment going on Fedora 17. The problem was, I could get it running using TCP sockets but not using unix sockets. I loosely followed these instructions for deploying a Rails 3.2 app but kept having problems with the unix sockets.
Don’t put the socket file in the /tmp directory.
Fedora has this in
1 2 3 4 5 6 7 8 9 10 11 12 13 14
And if you look over on the Unicorn site, you’ll see this as the documentation for the listen method / configuration setting
Adds an address to the existing listener set. May be specified more than once. address may be an Integer port number for a TCP port, an “IP_ADDRESS:PORT” for TCP listeners or a pathname for UNIX domain sockets.
1 2 3 4
Which encourages folks to put the socket in the
/tmp directory. This is going to cause trouble for every Fedora user that tries to use Unicorn.
While debugging this I got the infamous “502 Bad Gateway” page from nginx. I checked out the
error_log, and this message was there:
1 2 3 4 5 6
So, after a couple of hours of head scratching and WTF’ing, I remembered that systemd did some crazy shenanigans
to mysql, preventing me from setting the file limit higher. As soon as I saw the PrivateTmp=true line in the
nginx.service file, I knew that systemd was the culprit.
Hope this helps someone.