This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Dec 16 02:29:44 -0800 2007 | |
| |
README | Tue Oct 21 08:00:17 -0700 2008 | |
| |
add-ferret-server | Mon Apr 21 01:31:44 -0700 2008 | |
| |
add-haproxy | Sun Oct 05 00:20:26 -0700 2008 | |
| |
add-maintenance | Mon Apr 21 01:26:55 -0700 2008 | |
| |
add-mongrel | Thu Sep 04 15:23:36 -0700 2008 | |
| |
add-nginx | Sun Oct 05 00:26:03 -0700 2008 | |
| |
add-thin | Thu Sep 11 11:40:33 -0700 2008 | |
| |
add-thinking-sphinx | Fri Oct 02 08:39:29 -0700 2009 | |
| |
add-varnish | Mon Oct 06 09:08:37 -0700 2008 | |
| |
check-port | Thu Sep 04 15:23:36 -0700 2008 | |
| |
ferret-server-run | Mon Apr 21 01:31:44 -0700 2008 | |
| |
haproxy-run | Thu Sep 04 15:28:18 -0700 2008 | |
| |
maintenance-run | Mon Apr 21 01:34:24 -0700 2008 | |
| |
mongrel-run | Sun Mar 02 04:08:01 -0800 2008 | |
| |
nginx-run | Sun Oct 26 01:41:12 -0700 2008 | |
| |
readlink_canonical | Thu Sep 11 11:41:40 -0700 2008 | |
| |
service/ | Sun Dec 16 02:29:44 -0800 2007 | |
| |
thin-run | Thu Sep 11 11:41:40 -0700 2008 | |
| |
thinking-sphinx-run | Fri Oct 02 08:39:29 -0700 2009 | |
| |
varnish-run | Sun Oct 26 01:34:48 -0700 2008 |
README
Runit services for heavy-duty Rails hosting =========================================== Here's a bunch of scripts for deploying a full production Rails app that runs under runit. This scheme is currently used to run several large production Rails apps, including http://www.looktothestars.org/, and it has workd very nicely for a couple of years now. More reliable than system-wide init.d scripts, and fewer permission headaches. How to use it ============= Create an unprivileged user for your Rails app, then set up a system-wide Runit service to manage user-specific services for that user -- see the following page for details: http://www.sanityinc.com/articles/init-scripts-considered-harmful All further steps assume that you are working as the unprivileged user. Now, clone this project into the user's home directory: cd git clone git://github.com/purcell/rails-runit.git Symlink your rails app's root directory to this directory with the name 'app': ln -s ~appuser/releases/current ~/rails-runit/app Now you can create some services: cd ~/rails-runit ./add-mongrel 4001 ./add-mongrel 4002 ./add-mongrel 4003 ./add-haproxy 4000 ./add-nginx 4020 4000 This creates (potential) runit services under ~/rails-runit/service. Symlink them to ~/service, and runit will start them for you. Once started, you can set your system-wide web server to proxy requests for your Rails app to port 4000 (haproxy => mongrel * 3), or to port 4020 (nginx => haproxy => mongrel * 3). Browse to port 3998 (= haproxy port - 2) to see the haproxy status page. You can then easily restart your app (e.g. as part of a capistrano deployment) like this: sv restart ~/service/mongrel-* Further "add-*" and "*-run" scripts are provided for varnish and ferret_server. Status ====== The haproxy service assumes that the mongrels will be found on the 10 ports higher than itself. The use of the 'production' RAILS_ENV is hard-coded, so look out for that if you try it on your own machine. The entire scheme is subject to change -- see below. Future plans ============ I'd like to rewrite all this in ruby so we can have templates for the config files in ERB, and to make the port mapping a bit more flexible. The 'run' scripts would then look up their config templates under RAILS_ROOT/config first, and fall back to ~/rails-runit/ if necessary. It'd be nice to automatically generate monitrc fragments that could be included by a system-wide monit instance for the purposes of monitoring the app.








