It seems that starting rails server and asking it to bind to a unix socket doesn't work. The -b
option with rails server doesn't behave the same was as with the puma
command. Basically it wants to bind to an IP address:
rails server --help
Usage: rails server [mongrel, thin, etc] [options]
-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 0.0.0.0
You can run puma directly:
puma -e production -b unix:///srv/vhosts/rumysitename/www/mysitename/tmp/mysitename.sock
The socket will be created by running puma like this. It doesn't need to exist already. You'll need to have permission to create it in the location specified but you'll get a different error if that is not the case.
Another alternative is to create a config/puma.rb
file which can include the binding:
config/puma.rb
:
bind 'unix:///srv/vhosts/rumysitename/www/mysitename/tmp/mysitename.sock'
and then run puma referencing that:
puma -C config/puma.rb -e production
You can put a lot more in the config file than just the sock. The puma example config file is a good starting point.