samuelkadolph / unicorn-rails

unicorn-rails is a simple gem that sets the default server for rack (and rails) to unicorn.
MIT License
127 stars 22 forks source link

Ignores present unicorn configuration files when daemonizing #25

Open michaelfranzl opened 4 years ago

michaelfranzl commented 4 years ago

Since about 10 years, rack is 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 calling Rack::Handler::Unicorn.run (which unicorn-rails implements). Ruby's core Process.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

bmalets commented 4 years ago

Have absolutely the same problem.