{"id":8,"date":"2007-12-27T09:58:58","date_gmt":"2007-12-27T14:58:58","guid":{"rendered":"http:\/\/unixmonkey.net\/blog\/?p=8"},"modified":"2007-12-27T09:58:58","modified_gmt":"2007-12-27T14:58:58","slug":"setting-up-a-production-rails-server-step-by-step","status":"publish","type":"post","link":"https:\/\/unixmonkey.net\/?p=8","title":{"rendered":"Setting up a production rails server step-by-step"},"content":{"rendered":"<p>Pushing your app to the real world with Rails can be a very daunting task to someone who is used to just uploading flat html or php files.<\/p>\n<p>If you&#8217;ve never dealt with <a href=\"http:\/\/www.apache.org\/\" title=\"apache.org\">Apache<\/a>, <a href=\"http:\/\/www.ilovejackdaniels.com\/cheat-sheets\/mod_rewrite-cheat-sheet\/\" title=\"ilovejackdaniels.com\">mod_rewrite<\/a>, or <a href=\"http:\/\/en.wikipedia.org\/wiki\/Proxy_server\" title=\"wikipedia.org\">proxy servers<\/a>, prepare to spend a lot of time hammering out a solution. Worried about performance, or your need to scale out at a later date? Pick a solution that won&#8217;t leave you wondering if your site will be able to take a spike in traffic.<\/p>\n<p>For Rails, there are lots of deployment strategies, some are tuned for compatibility with shared hosting (<a href=\"http:\/\/www.fastcgi.com\/\" title=\"fastcgi.com\">fastcgi<\/a>), and some are built for speed and minimum configuration (<a href=\"http:\/\/litespeedtech.com\/\" title=\"litespeedtech.com\">Litespeed<\/a> <a href=\"http:\/\/railsjitsu.com\/installing-and-configuring-nginx-and-mongrel-for-rails\" title=\"railsjitsu.com\">Nginx<\/a> and <a href=\"http:\/\/www.lighttpd.net\/\" title=\"lighttpd.net\">Lighttpd<\/a>), and some are built to leverage the strength and flexibility of stable and established server software (<a href=\"http:\/\/blog.codahale.com\/2006\/06\/19\/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you\/\" title=\"blog.codahale.com\">Apache+Mongrel<\/a>).<\/p>\n<p>If you want to scale, you&#8217;re going to need a load balancing proxy. The choices here are <a href=\"http:\/\/www.apsis.ch\/pound\/\" title=\"apsis.ch\">pound<\/a>, <a href=\"http:\/\/siag.nu\/pen\/\" title=\"siag.nu\">pen<\/a>, and apache&#8217;s <a href=\"http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_proxy_balancer.html\" title=\"apache.org\">mod_proxy_balancer<\/a>.<\/p>\n<p>An abundance of choice is a double-edged sword. Competition is good in any arena, but it makes it very hard for someone who hasn&#8217;t tried them all to choose one.<\/p>\n<p>I&#8217;ve chosen to setup my Rails server using the Apache+Mongrel+mod_proxy_balancer combination.<\/p>\n<p>For the operating system, I&#8217;ve chosen the newest Ubuntu 7.10 (Gusty) server. <a href=\"http:\/\/ubuntu.com\" title=\"ubuntu.com\">Ubuntu<\/a> uses the Debian-style apt package management, but with more current packages than Debian stable, and is the current cool kid on the block for Linux systems. I have been using Ubuntu for years and can attest to its stability and cutting edge (but not bleeding edge) packages.<\/p>\n<p>I&#8217;ve gone through and built a Rails server by hand before, but poorly documenting what I had done, and not securing it properly. When I stumbled upon <a href=\"http:\/\/articles.slicehost.com\" title=\"articles.slicehost.com\">Slicehost&#8217;s server setup articles<\/a>, I knew I had found exactly what I needed to build a server configured like a pro, and all the documentation I should have written in the first place.<\/p>\n<p>Here is the step-by-step setup for a production Rails server. I&#8217;ve tested this setup and can vouch for its awesomeness. I encourage you to make some changes specific to your setup where appropriate.  You should be able to skip unneccesary stuff like php and virtual hosts if  you don&#8217;t need them.<\/p>\n<p><a href=\"http:\/\/articles.slicehost.com\/2007\/11\/6\/ubuntu-gutsy-setup-page-1\" title=\"articles.slicehost.com\">Ubunty Setup &#8211; part 1<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/6\/ubuntu-gutsy-setup-page-2\" title=\"articles.slicehost.com\">Ubunty Setup &#8211; part 2<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/23\/ubuntu-gutsy-mysql-and-ror\" title=\"articles.slicehost.com\"> Myql and Rails<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/23\/ubuntu-gutsy-installing-apache-and-php5\" title=\"articles.slicehost.com\">Apache and PHP<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/23\/ubuntu-gutsy-apache-virtual-hosts\" title=\"articles.slicehost.com\"> Apache Virtual Hosts<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/9\/18\/apache-virtual-hosts-permissions\" title=\"articles.slicehost.com\">Vhosts and permissions<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/29\/ubuntu-gutsy-apache-vhosts-rails-and-mongrels\" title=\"articles.slicehost.com\"> Apache Vhosts, Rails and Mongrels<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/11\/29\/ubuntu-gutsy-mongrel-clusters-and-surviving-a-reboot\" title=\"articles.slicehost.com\">Mongrel Clustering<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/9\/5\/introduction-to-subversion\" title=\"articles.slicehost.com\">Subversion intro<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/9\/5\/introduction-to-svnserve\" title=\"articles.slicehost.com\">Setting up svnserve<\/a><br \/>\n<a href=\"http:\/\/articles.slicehost.com\/2007\/9\/5\/using-ssh-with-svnserve\" title=\"articles.slicehost.com\">Securing svnserve with ssh<\/a><br \/>\n<a href=\"http:\/\/capify.org\/getting-started\/rails\" title=\"capify.org\">Setting up Capistrano<\/a><br \/>\n<a href=\"http:\/\/piston.rubyforge.org\/usage.html\" title=\"articles.slicehost.com\">Setting up Piston to manage plugins<\/a><\/p>\n<p>As you can see, most of these are from <a href=\"http:\/\/articles.slicehost.com\" title=\"articles.slicehost.com\">Slicehost&#8217;s documentation articles<\/a>. They also detail setup for several other major linux distributions and other deployment strategies like nginx. Major props to slicehost for putting such excellent documentation together.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pushing your app to the real world with Rails can be a very daunting task to someone who is used to just uploading flat html or php files. If you&#8217;ve never dealt with Apache, mod_rewrite, or proxy servers, prepare to spend a lot of time hammering out a solution. Worried about performance, or your need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,15],"tags":[37,42,46],"_links":{"self":[{"href":"https:\/\/unixmonkey.net\/index.php?rest_route=\/wp\/v2\/posts\/8"}],"collection":[{"href":"https:\/\/unixmonkey.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unixmonkey.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unixmonkey.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unixmonkey.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/unixmonkey.net\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/unixmonkey.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unixmonkey.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unixmonkey.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}