Saturday, March 27, 2010

rails ferret in production

I've had a few problems as i've moved from dev to production. My task has been complicated by not always maintaining my migrations. However the problem I've had recently has been with ferret not working.

When I've started './console/script procution' and try and rebuild indexes manually I get:

=> false

It turns out that the problem was that ferret has an expectation that in production, there will be a ferret server running. This is asserted in the file:


I commented out the production server and it works.

Friday, March 26, 2010

gnuplot point types

I was using gnuplot today and wanted a list of the different point types which are available so I could choose a suitable one.

After visiting the internet, I couldn't find a list so I made my own:

echo plot `perl -e 'for ($i = 0; $i < 30; $i++) {print " \"<echo $i 1\" u 1:2 pt $i ps 2 notitle, ";}'` | sed 's/,$//' | gnuplot -persist
echo set term postscript enhanced\; set output \'./points.eps\'\; plot `perl -e 'for ($i = 0; $i < 90; $i++) {print " \"<echo $i 1\" u 1:2 pt $i ps 1 notitle, ";}'` | sed 's/,$//' | gnuplot

Thursday, March 25, 2010

rails won't run in production

I've been working on a Rails app (2.3.5).

I'm hosting on modest hardware and chose Nginx and Thin to hopefully get the most performance out of my app.

My problem was that my app wouldn't run in production. It worked fine in development, but not in production.

There were a couple of problems:
  1. I was using a legacy database, and like non-pluralised table names, development picked up 'ActiveRecord::Base.pluralize_table_names = false' in my config/environment.rb, but I didn't seem to propagate to production. I added in 'ActiveRecord::Base.pluralize_table_names = false' into ./config/environments/production.rb
  2. Thin wouldn't start. Starting thin with -D allowed me to start it not daemonized, and then I could see the problem: 'Missing the Rails  gem. Please `gem install -v= rails`, update your RAILS_GEM_VERSION'.
    This is Thin reacting against rack version 1.1.0 apparently.
    gem uninstall --version '> 1.0.1' rack fixed that.
One less thing on my todo list.