I want to use the Daemons pearl with my Rails project, so I can easily control it with Monit, this stone will allow me to create PIDs and use commands like start and stop.
In any case, it seems that I cannot use it with rails, I create a file and call it admin:
require 'rubygems'
require 'daemons'
ROOT_PATH = File.expand_path("#{File.dirname __FILE__}/../")
require "#{ROOT_PATH}/config/environment"
Daemons.run("#{ROOT_PATH}/script/rails" ,
:dir_mode => :system,
:log_output => true
)
When I try to run it with:
bundle exec ./bin/admin run -- s
I get this error:
/Users/info/.rvm/gems/ruby-1.9.3-p286/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
configuration /config.ru not found
Exiting
The config.ru file exists for sure. and I can start the application when I try to do it manually using the command line, but for some reason I can unmount the rails application.
I would appreciate any help as I tried to smooth it all my day.
Greetings
source
share