The Brightbox Gem supports using Phusion Passenger by default, mongrel based configurations are still supported but no longer the default. Passenger based configurations are only supported on Hardy and Lucid boxes, and are not available if you are still on an Ubuntu Dapper install. You can upgrade to Hardy or Lucid by ordering a new box, moving your data and then cancelling the old box.
We have apt packages available for Ruby Enterprise Edition and there is more information on setting your Brightbox up to use Ruby Enterprise Edition with Passenger over on the Ruby Enterprise Packages page.
The Brightbox gem has an option to specify either “passenger” or “mongrel” based on your preference. If no option is specified then Passenger is used by default.
brightbox -i example-001.vm.brightbox.net -a mongrel .
This will create the file config/deploy.rb containing the details needed to deploy your application. Edit this file and change the settings as required.
set :passenger_restart_strategy, :hard
By default, restarting passenger requires creating a file called “restart.txt” which signals the application to gracefully restart. The old passenger processes then time out after 10 minutes of inactivity. Unfortunately this results in stale database connections using up your Brightbox MySQL connection allowance so by default we perform a more immediate “kill” of the passenger processes before starting new ones. Should you have enough database connections or experience problems with the default you can change the above option to :soft to restart in the normal manner.
Passenger, by default, is configured to spawn up to six ruby processes to handle incoming requests. If you are using Ruby on Rails, each ruby process can be between 50 and 100Mb in size - and this can cause Out of Memory errors on smaller boxes. These manifest as 500 errors, “broken pipe” messages or, in the worst cases, Apache or the ssh daemon shutting down (requiring a reboot).
In order to limit the number of processes that Passenger creates, there are two directives that can be applied. We normally create an extra configuration file in /etc/apache2/conf.d/passenger.conf (this needs to be created as root) with the following contents:
PassengerMaxPoolSize 4 PassengerMaxInstancesPerApp 2 PassengerPoolIdleTime 300
(Phusion recommend that PassengerMaxPoolSize should be no more than 2 for a 256Mb box, although the actual memory usage of your application will govern the optimum value)
You will then need to reload Apache to tell it to pick up the new settings.
The configuration above means that Passenger will create up to two ruby processes for each application on that box, with no more than four ruby processes in action at any one time. If a ruby process is left idle for more than 300 seconds it will be killed, releasing its memory.
There is no automated way to move from mongrel to passenger at this time, instead you will have to follow the steps below to setup your existing application to use passenger. This process will cause some downtime for you application while things are swapped over.
cat /etc/lsb-release)sudo monit -g <yourapp> stop all/etc/monit/conf.d/rails-<yourapp>.monitrc filesudo monit reloadcp config/deploy.rb config/deploy.rb.oldbrightbox command as detailed for a new customer using passengercap deploy:initial to run the installation procedure from scratch