This is assuming you know the rest of the rails application stuff: putting the files somewhere
and configuring database.yml (and the requisite setting up mysql and mysql users).
1) Put in a mongrel_cluster.yml file that will pull your private IP automatically, and write
hostname-specific PIDs.
# cd /home/YOUR/PATH/TO/RAILS/APP
# svn export http://svn.joyent.com/public/accelerators/configs/mongrel/mongrel_cluster.yml config/mongrel_cluster.yml
2) Fire up the application
# cd /home/YOUR/PATH/TO/RAILS/APP
# mongrel_rails cluster::start
3) Check that you're getting something
# curl `myprivateip`:8000
# curl -I `myprivateip`:8000
The second one should return a "200", like
HTTP/1.1 200 OK
Connection: close
Date: Tue, 06 Mar 2007 07:09:13 GMT
Status: 200 OK
Server: Mongrel 1.0.1
Content-Type: text/html
Content-Length: 0
If there's nothing happening check your production.log
4) Configure an apache virtual host to proxy balance to these mongrels
# cd /opt/csw/apache2/etc/virtualhost
# nano myrailsapp-domain.conf
With the contents of
ServerName YOURDOMAIN.com ServerAlias *.YOURDOMAIN.com
DocumentRoot /home/YOUR/PATH/TO/RAILS/APP/public
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
BalancerMember http://YOUR-PRIVATE-IP:8000
BalancerMember http://YOUR-PRIVATE-IP:8001
BalancerMember http://YOUR-PRIVATE-IP:8002
BalancerMember http://YOUR-PRIVATE-IP:8003
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass / balancer://app1-mongrels/
ProxyPassReverse / balancer://app1-mongrels/
ProxyPreserveHost On
# apachectl restart
You need to have a unique name for "balancer://app1-mongrels" and the ports you use are the same that are in your mongrel_cluster.yml
5) Now make sure that you're app is under SMF and will restart on reboot
Replace YOURAPP, the /HOME/YOUR/PATH/TO/RAILS/APP, and the USER and GROUP
Put this xml file at
# nano /HOME/YOUR/PATH/TO/RAILS/APP/mongrel-app-smf.xml
# cd /HOME/YOUR/PATH/TO/RAILS/APP/
# mongrel_rails cluster::stop
# rm log/*.pid
# svccfg import /HOME/YOUR/PATH/TO/RAILS/APP/mongrel-app-smf.xml
# svcadm enable mongrel/YOURAPP-production
# svcs -v | grep mongrel