I want share with you my modified RailsRunner it works only with rack rails 2.3 i had separate RailsRunner for older version to if somone want i can post it too
There is a few modifications:
1. Process name changed now we see what is process name
it looks like:
91436 ?? S 3:33.42 ruby: RAILS: fdb.pl (production) (ruby)
91437 ?? S 3:53.94 ruby: RAILS: fdb.pl (production) (ruby)
91438 ?? S 3:29.63 ruby: RAILS: fdb.pl (production) (ruby)
91439 ?? S 3:49.33 ruby: RAILS: fdb.pl (production) (ruby)
you must set APP_NAME varible in litespeed env or it will use directory where you app is placed.
2. second change is FIX problem with ENV varible
after call server = Rack::Handler::LSWS ENV varible disaperd i rewrite it again.
hope that we be usefull for somone
There is a few modifications:
1. Process name changed now we see what is process name
it looks like:
91436 ?? S 3:33.42 ruby: RAILS: fdb.pl (production) (ruby)
91437 ?? S 3:53.94 ruby: RAILS: fdb.pl (production) (ruby)
91438 ?? S 3:29.63 ruby: RAILS: fdb.pl (production) (ruby)
91439 ?? S 3:49.33 ruby: RAILS: fdb.pl (production) (ruby)
you must set APP_NAME varible in litespeed env or it will use directory where you app is placed.
2. second change is FIX problem with ENV varible
after call server = Rack::Handler::LSWS ENV varible disaperd i rewrite it again.
Code:
#!/opt/ruby/bin/ruby
#
Dir.chdir(ENV['RAILS_ROOT'])
$0="RAILS: #{ENV['APP_NAME'] || ENV['RAILS_ROOT']} (#{ENV['RAILS_ENV']})"
if GC.respond_to?(:copy_on_write_friendly=)
GC.copy_on_write_friendly = true
end
require 'config/boot'
require 'active_support'
require 'action_controller'
require 'fileutils'
options = {
:environment => (ENV['RAILS_ENV'] || "development").dup,
:config => RAILS_ROOT + "/config.ru",
:detach => false,
:debugger => false
}
# fix bug in lsapi (ENV var disapper)
env = ENV
server = Rack::Handler::LSWS
env.each { |k,v| ENV[k] ||= v }
if File.exist?(options[:config])
config = options[:config]
if config =~ /\.ru$/
cfgfile = File.read(config)
if cfgfile[/^#\\(.*)/]
opts.parse!($1.split(/\s+/))
end
inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config)
else
require config
inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
end
else
require 'config/environment'
inner_app = ActionController::Dispatcher.new
end
app = Rack::Builder.new {
use Rails::Rack::Static
use Rails::Rack::Debugger if options[:debugger]
run inner_app
}.to_app
ActiveRecord::Base.clear_all_connections! if defined?(ActiveRecord::Base)
begin
server.run(app, options.merge(:AccessLog => []))
ensure
puts 'Exiting'
end
hope that we be usefull for somone