Skip to content

My App isn't running?

booch edited this page Sep 13, 2010 · 24 revisions

Sadly, passenger-stack isn’t going to make you a sandwich, no child; Not even if you call it with sudo.

Here are some useful tips to get the ball rolling:

  • Install your app dependencies
  • Create a config.ru file in your app root, you don’t need to do this for rails apps
  • Add a virtual host to apache (example following)

Application dependencies

Both Merb and Rails currently have their own way of managing dependencies.

For merb you can install your gems using `thor merb:gem:install`, I’ve baked this into my capistano deployment scripts (extract).

Rails manages dependencies using `config.gem` in `environment.rb`, they can be installed using `rake gems:install`

Apache virtual host

Create a new file in `/etc/apache2/sites-available/your-app-name` that looks something like this:
<pre> <VirtualHost *:80> ServerName www.your-domain.com ServerAlias your-domain.com DocumentRoot "/var/www/your-app-name/current/public" RailsEnv production <directory "/var/www/your-app-name/current/public"> Order allow,deny Allow from all

Symlink `sites-available/your-app-name` file to `sites-enabled`:

a2ensite your-app-name

Or you can do it manually:

ln -s /etc/apache2/sites-available/your-app-name /etc/apache2/sites-enabled/your-app-name

Restart Apache using `/etc/init.d/apache2 restart`
Now Apache knows that your site should be running, hopefully; it is.

Debugging your passenger setup

As root, run the following command:

tail -f /var/log/apache2/*

Reload your app, this should warn you of any broken paths, missing dependencies and alike.

It seems to be running my app slow

Apache almost never runs in an optimal state out of the box, remember, its everything to everyone.
Thankfully, its battle-hardened and can use some tweaks:

  • Add some passenger settings
  • Tweak your MPM-prefork settings in `/etc/apache2/apache2.conf`, this changes the way Apache will fork its processes off.

Additional Passenger settings

I’m not going to tell you why, so go and read the documentation, but on a 256 MB slice without MySQL or Memcached (Read: A pure app server) these worked well;

PassengerUseGlobalQueue On PassengerMaxPoolSize 4

Those options go into /etc/apache2/extras/passenger.conf

Good luck!