Since about 10 years, rackis already daemonizing the process (using Process.daemon) when options[:daemonize] is set (e.g. when the -d flag is set in rails server), just before callingRack::Handler::Unicorn.run (which unicorn-rails implements). Ruby's core Process.daemonchanges the working directory to root ("/"). This is why this line will never find the configuration file:
Since about 10 years,
rack
is already daemonizing the process (usingProcess.daemon
) whenoptions[:daemonize]
is set (e.g. when the-d
flag is set inrails server
), just before callingRack::Handler::Unicorn.run
(whichunicorn-rails
implements). Ruby's coreProcess.daemon
changes the working directory to root ("/"). This is why this line will never find the configuration file:https://github.com/samuelkadolph/unicorn-rails/blob/cb99f633c41de21277627207f72cc19d4e11f0d4/lib/unicorn_rails.rb#L19