John Topley’s Weblog

Installing Mint On A Rails Machine

I recently added Shaun Inman’s superb Mint statistics package to my AssetGraphed Rails Machine installation. As the installation wasn’t particularly straightforward, I thought I’d write this little guide for others who may be struggling. I should point out that the real credit for the information here goes to Bradley Taylor from Rails Machine who was extremely helpful and persistent.

First of all, I should point out that these instructions cover installing Mint under your /public directory i.e. yoursite.tld/mint/ rather than the subdomain installation method (mint.yoursite.tld). With that out of the way, here’s what you need to do:

  1. Install PHP on your Rails Machine using these instructions. You should have no problems with them if you follow them exactly.
  2. Log in to your Rails Machine as your deploy user then become root by using su - root and entering your root password.
  3. Edit: /etc/httpd/conf/httpd.conf and search for DirectoryIndex index.html. Add index.php to the end if it’s not present as shown below and save the file:
    DirectoryIndex index.html index.php
  4. Edit: /etc/httpd/conf/apps/yourapp.conf and add the following immediately after the RewriteEngine On line:
    RewriteRule ^/mint/?$ /mint/index.php [QSA]
  5. Now find the three lines shown below:
    # Redirect all non-static requests to cluster
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://yourapp_cluster%{REQUEST_URI} [P,QSA,L]
    —And add the following lines immediately before them:
    # Don't redirect requests to /mint
    RewriteCond %{REQUEST_URI} !^/mint/(.*)$
  6. The full rewrite rules should look like this:
    RewriteEngine On
    RewriteRule ^/mint/?$ /mint/index.php [QSA]
    
    # Prevent access to .svn directories
    RewriteRule ^(.*/)?\.svn/ - [F,L]
    ErrorDocument 403 "Access Forbidden"
    
    # Check for maintenance file and redirect all requests
    RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /system/maintenance.html [L]
    
    # Rewrite index to check for static
    RewriteRule ^/$ /index.html [QSA]
    
    # Rewrite to check for Rails cached page
    RewriteRule ^([^.]+)$ $1.html [QSA]
    
    # Don't redirect requests to /mint
    RewriteCond %{REQUEST_URI} !^/mint/(.*)$
    
    # Redirect all non-static requests to cluster
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://yourapp_cluster%{REQUEST_URI} [P,QSA,L]
  7. Save the file. It’s probably read-only. If you edited it using vi then you can save it even though it’s read-only by using :wq!
  8. Finally, restart Apache by using /sbin/service httpd reload and log out completely from your Rails Machine.

You can now install Mint itself by adding it to your working copy directory under /public and adding it to your Subversion repository using svn add ./public/mint. Once you’ve deployed to your Rails Machine you’ll be able to complete the Mint installation by visiting http://yoursite.tld/mint/ and following the instructions.

Comments

There are 6 comments on this post. Comments are closed.

  • avatar Theo
    30 January 2007 at 16:36

    Hi John,

    I was curious how you like RailsMachine. I am really impressed with what I have read, but the price point is kind of high.

    -Theo

  • avatar John Topley
    30 January 2007 at 20:20

    Hi Theo,

    I think they're great, as I wrote about here: http://www.johntopley.com/2007/01/03/assetsgraphed-on-rails-machine/

    Sure, they're are cheaper Rails hosts out there but it all depends on what you want. I wanted a package that lets me concentrate on development and not have to worry about infrastructure and deployment. I don't have any complaints about their reliability. Oh and their support has been excellent too.

  • avatar observer
    04 March 2007 at 03:18

    excellent instructions. many thanks.

  • avatar Andy Stewart
    29 May 2007 at 07:39

    I've been wondering how to do this for quite a while so many thanks for the detailed instructions.

    There's one inconsistency though. Step 4 says this:

    RewriteRule ^/mint/$ /mint/index.php [QSA]

    But the summary in step 6 says this:

    RewriteRule ^/mint/?$ /mint/index.php [QSA]

    Thanks again for writing all this up.
    - Andy

  • avatar John Topley
    29 May 2007 at 09:13

    Hi Andy,

    Good spot - thanks! It should be:

    RewriteRule ^/mint/?$ /mint/index.php [QSA]

    I'll update the instructions.

  • avatar John Topley
    30 May 2007 at 19:14

    Hmm, I just went to edit the original article and it turns out that it does have the question mark before the dollar in step four, but for some reason it's being swallowed by WordPress! :-(

I should point out that the real credit for the information here goes to Bradley Taylor from Rails Machine who was extremely helpful and persistent.


Archives

  • Jan
  • Feb
  • Mar
  • Apr
  • May
  • Jun
  • Jul
  • Aug
  • Sep
  • Oct
  • Nov
  • Dec
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014

More Archives


Sign In