maerics
maerics

Reputation: 156434

How to use Phusion Passenger Standalone as the default Rails server

Due to some fancy tricks in my Rails app (and in the interest of making my dev setup look more like prod) I've started using Phusion Passenger Standalone as my development web server.

Currently I start it as $ bundle exec passenger start. If I run $ rails s it boots WEBrick, which is not what I want.

Is there a way to configure my app so I can run it the "usual way" as $ rails s?

(Sorry if this is obvious, searching for the expected keywords on Google finds a lot of unrelated stuff...)

Upvotes: 1

Views: 956

Answers (1)

LHH
LHH

Reputation: 3323

If you really want to force this, there's an easy hack that will do exactly what you want. You can modify your application's script/rails to catch all rails server calls and make a system call to start passenger, like so:

if (ARGV.first == 'server' || ARGV.first == 's')
  system("passenger start #{ARGV.shift.join(" ")}")
else
  # The old content of the script goes here
  APP_PATH = File.expand_path('../../config/application',  __FILE__)
  require File.expand_path('../../config/boot',  __FILE__)
  require 'rails/commands'
end

for more info check here https://groups.google.com/forum/#!topic/phusion-passenger/XBhlF5lRo2A

Upvotes: 4

Related Questions