Rv

A little init.d system for running Camping apps, for Linux.

License

Copyright 2007 Cloudburst, LLC. See the included LICENSE file.

Features

  • cluster support

  • custom database configuration

  • interactive setup tasks

  • logging

Linux is required. Ubuntu and Gentoo are known to work.

Rv is designed for Camping, but it can actually manage any app for which you write a compatible Mongrel harness.

Usage

Installation

First, run:

sudo gem install rv
sudo rv install

This copies a very small script to /etc/init.d/rv. Edit it and change the 'user' keypair in the file if your app user is not httpd. There are a few other options you can set; see the Rv class for details.

Now, install it as a boot service. On Ubuntu, run:

sudo /usr/sbin/update-rc.d rv defaults

On Gentoo, run:

sudo rc-update add rv default

Application setup

Each Camping app should live in its own directory. Traverse to this directory and run:

sudo rv setup

The app will now start at boot. You can start it manually (along with your other Rv apps) by running:

sudo /etc/init.d/rv start

The script also responds to status, restart, and stop. You can adjust the app-specific configuration later by rerunning sudo rv setup or by editing /etc/rv/your_app.yml.

Extras

Troubleshooting

If you’re having problems, first check /var/log/rv.log. If that doesn’t help, run:

sudo env RV_DEBUG=true /etc/init.d/rv start

Copy out the inner command (between the ‘nohup sudo -u httpd’ and the ‘< /dev/null’) and try running it by hand. Make sure you’re using the correct user.

Apache configuration

If you’re using Apache 2.2, here’s how to configure it to see your Camping proxy. Add a VirtualHost entry in your httpd.conf as follows:

<VirtualHost *:80>
  ServerName myapp.example.com

  ProxyRequests Off
  ProxyPass / http://127.0.0.1:4000/
  ProxyPassReverse / http://127.0.0.1:4000/
  ProxyPreserveHost On

  #Fix for Apache bug 39499
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1
</VirtualHost>

If you configured a cluster, use a Proxy balancer instead:

<VirtualHost *:80>
  ServerName myapp.example.com

  <Proxy balancer://myapp_custer>
    BalancerMember http://127.0.0.1:4000
    BalancerMember http://127.0.0.1:4001
    BalancerMember http://127.0.0.1:4002
    # etc.
  </Proxy>

  ProxyPass / balancer://myapp_custer/
  ProxyPassReverse / balancer://myapp_custer/
  ProxyPreserveHost On

  #Fix for Apache bug 39499
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1  
</VirtualHost>

Do not use the line ProxyRequests Off.

Further resources