{"id":19,"date":"2009-10-07T12:22:59","date_gmt":"2009-10-07T18:22:59","guid":{"rendered":"http:\/\/curiosity.roguepenguin.net\/?p=19"},"modified":"2019-05-13T06:52:20","modified_gmt":"2019-05-13T12:52:20","slug":"ruby-on-rails-mongrel-configuration","status":"publish","type":"post","link":"http:\/\/curiosity.roguepenguin.net\/?p=19","title":{"rendered":"Ruby-on-Rails: Mongrel Configuration"},"content":{"rendered":"<p>I actually forgot I had this site, until <a href=\"http:\/\/www.alecjacobson.com\/weblog\/\" target=\"_blank\" rel=\"noopener noreferrer\">Alec Jacobson<\/a> made a comment and reminded me of it&#8217;s existence &nbsp;(oops). &nbsp; Will attempt to remember to post more, but I&#8217;m just not the blogging sort of person.<\/p>\n<p>So this post pertains to some work I actually did about a month ago, which would have made excellent material here, but (see paragraph above)&#8230;. &nbsp;At work we needed a way to keep track of production issues requiring engineering support. &nbsp;I had already come across the most excellent <a href=\"http:\/\/retrospectiva.org\" target=\"_blank\" rel=\"noopener noreferrer\">Retrospectiva<\/a> and had actually tried to set it up before but failed at the Apache\/fastCGI integration step. &nbsp;And so it was, a little over 1 year later, I tried again. &nbsp;The initial setup went smoothly, but once again I found myself having difficulty integrating with Apache.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-25 aligncenter\" title=\"mt-retrospectiva1\" src=\"http:\/\/curiosity.roguepenguin.net\/wp-content\/uploads\/2009\/10\/mt-retrospectiva1.jpg\" alt=\"Retrospectiva up and running\" width=\"454\" height=\"250\" srcset=\"http:\/\/curiosity.roguepenguin.net\/wp-content\/uploads\/2009\/10\/mt-retrospectiva1.jpg 454w, http:\/\/curiosity.roguepenguin.net\/wp-content\/uploads\/2009\/10\/mt-retrospectiva1-300x165.jpg 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/p>\n<p>This time I opted for Mongrel. &nbsp;Unfortunately I couldn&#8217;t find a lot of information on configuring Mongrel, so it took a lot of trial and error. &nbsp;Below, reconstructed from my notes, are the steps that I had to take to configure it and get it working. &nbsp;Note that this transpired on <strong>Fedora Core 11<\/strong>.<\/p>\n<ol>\n<li>Follow the <a href=\" http:\/\/retrospectiva.org\/wiki\/Installation\" target=\"_blank\" rel=\"noopener noreferrer\">Retrospectiva installation instructions<\/a> for setting up and installing gems.<br \/>\nNote that the command for installing the mysql gem on Fedora is:<\/p>\n<pre>   gem install mysql -- --with-mysql-config=\/usr\/bin\/mysql_config<\/pre>\n<\/li>\n<li>Install Mongrel per the Retrospectiva install <a href=\"http:\/\/retrospectiva.org\/wiki\/Apache%20Mongrel%20configuration\" target=\"_blank\" rel=\"noopener noreferrer\">guide<\/a><\/li>\n<li>Configure Mongrel to run as a cluster:\n<pre>   mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 3 -c \/var\/www\/retrospectiva<\/pre>\n<\/li>\n<li>Check that the cluster works (you should be able to browse to http:\/\/127.0.0.1:8000 and see the website):\n<pre>mongrel_rails cluster::start<\/pre>\n<\/li>\n<li>This step is partially referenced from <a href=\"http:\/\/blog.codahale.com\/2006\/06\/19\/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you\/\" target=\"_blank\" rel=\"noopener noreferrer\">another blog<\/a>. &nbsp;Set up mongrel to start on boot:\n<pre>   mkdir \/etc\/init.d\/mongrel_cluster<\/pre>\n<pre>   ln -s \/usr\/lib64\/ruby\/gems\/1.8\/gems\/mongrel_cluster-X.Y.Z\/resources\/mongrel_cluster \/etc\/init.d\/mongrel_cluster<\/pre>\n<pre>   chmod +x \/etc\/init.d\/mongrel_cluster<\/pre>\n<p>Note that depending on your setup, you might need to use <em>\/usr\/lib<\/em> rather than <em>\/usr\/lib64<\/em>.<\/li>\n<li>Edit <em>\/etc\/init.d\/mongrel_cluster<\/em>, set <em>user=root<\/em> (yes, I was bad. &nbsp;You should use limited account here, but I didn&#8217;t feel like troubleshooting permission errors)<\/li>\n<li>Add the mongrel_cluster as a service:\n<pre>   \/sbin\/chkconfig --level 345 mongrel_cluster on<\/pre>\n<\/li>\n<li>Finally, link your <em>mongrel_cluster.yml<\/em> from your app&#8217;s <em>config<\/em> directory to <em>\/etc\/mongrel_cluster<\/em>:\n<pre>   mkdir -p \/etc\/mongrel_cluster<\/pre>\n<pre>   ln -s \/var\/www\/retrospectiva\/config\/mongrel_cluster.yml \/etc\/mongrel_cluster\/retrospectiva.yml<\/pre>\n<\/li>\n<li>Mongrel should be starting on boot now. You can test by rebooting and issuing:\n<pre>   \/etc\/init.d\/mongrel_cluster start <em>(or stop)<\/em><\/pre>\n<\/li>\n<li>Configure Apache, following <a href=\"http:\/\/retrospectiva.org\/wiki\/Apache%20Mongrel%20configuration\" target=\"_blank\" rel=\"noopener noreferrer\">these directions<\/a>. &nbsp;Note that Apache might not be able to pass off to Mongrel (check the error log). &nbsp;It may be necessary to edit SELinux to allow Apache scripts to access the network (in my case I enabled all ports for tcp, using the <em>seedit-gui<\/em> program).<em><br \/>\n<\/em><\/li>\n<li>Make sure Apache is starting on boot:\n<pre>    chkconfig --list|grep http<\/pre>\n<p>You get something like this: &nbsp;<em>httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off<\/em><\/p>\n<p>Now run:<\/p>\n<pre>    chkconfig httpd on<\/pre>\n<p>This will set it up to start each time you boot. &nbsp;Verify that it set correctly:<\/p>\n<pre>    chkconfig --list|grep http<\/pre>\n<p>You should get: &nbsp;<em>httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off<\/em><\/li>\n<li><em><\/em><\/li>\n<\/ol>\n<p>That&#8217;s all I have. &nbsp;Note that this sets up your rails application as the sole Apache output. &nbsp;Hosting other static content or web applications requires more configuration than I could figure out at this time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I actually forgot I had this site, until Alec Jacobson made a comment and reminded me of it&#8217;s existence &nbsp;(oops). &nbsp; Will attempt to remember to post more, but I&#8217;m just not the blogging sort of person. So this post pertains to some work I actually did about a month ago, which would have made [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,3],"tags":[10,9,15],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-ruby","category-web","tag-mongrel","tag-rails","tag-ruby"],"_links":{"self":[{"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":5,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":61,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/61"}],"wp:attachment":[{"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/curiosity.roguepenguin.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}