mikehale / daemons

A toolkit to convert your script to a controllable daemon, with Chris Kline's fix
http://gemcutter.org/gems/daemons-mikehale
Other
13 stars 7 forks source link

I can't run Rails app with daemons #1

Open cubiic opened 12 years ago

cubiic commented 12 years ago

How am I supposed to daemonize a rails server project ? I need for some reason to daemize the whole rails project with this gem, and i don't want to use rails feature of -d, I tried to do the following :

require 'rubygems'
require 'daemons'

ROOT_PATH = File.expand_path("#{File.dirname __FILE__}/../")

Daemons.run("#{ROOT_PATH}/script/rails" , 
    :dir_mode => :system, 
    :log_output => true 
    )

Then :

bundle exec ./bin/admin run -- s But I'm getting 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 Any help would be appreciated

Thanks

sodabrew commented 10 years ago

http://guides.rubyonrails.org/command_line.html#rails-server

rails server -d

You don't need daemons gem for this, a minimal server component is already built into rails.

mikehale commented 10 years ago

Also if possible I wouldn't use this gem or the daemonization in rails. Instead when running on linux use the init system (like upstart) to keep your process running.

For example: http://www.stackednotion.com/blog/2012/02/09/easy-rails-daemons-with-upstart/