Archive for March, 2009

Ski Touring Equipment List

March 28th, 2009 by pyrat

Below is a list of stuff recommended for a multiday hut to hut ski tour on randonee skis inside the arctic circle.

Ski Stuff

  • Ski boots
  • Skis
  • Skins
  • Poles
  • Transceiver
  • Probe
  • Shovel
  • Sunscreen + Lip cream.
  • Buff x2
  • Hat x2
  • Outer warm gloves
  • Liner gloves x2
  • Lightweight Goretex Jacket
  • Thermal underwear (Bottoms) x2
  • Thermal underwear tops (x3)
  • Windproof Salopettes
  • Lightweight fleece / jumper
  • Warm Socks x2

Personal Items

  • 45 L Rucksack
  • Tshirt x1 (Luxury Item)
  • Boxers x2
  • Camera
  • Googles
  • Sunglasses
  • Silk Sleeping Bag Liner
  • Slippers
  • Normal socks x1
  • Sleeping bag
  • Down Jacket / Gillet
  • Thermarest?
  • Toothbrush
  • Water bottle / Thermos
  • Headtorch
  • Book

Food

  • Turmat
  • Sweets
  • Peanut Butter
  • Polar bread

Shared Items

  • Map
  • Compass
  • Lightweight Stove x1
  • Lightweight Canister
  • Lighter
  • Toothpaste
  • Compeed for blisters
  • Simple tools and duct tape
  • Little bit of leukotape
  • Hut key
  • Tiny washing up and sponge
  • Mobile Phone

Going Live with Rails

March 27th, 2009 by pyrat

Once an application gets to the production stage, people get all excited. The project is coming to fruition. Is it all over? No, its just the beginning. Ideally, you want your application to run trouble-free while you sit back and relax.

In this short article I will describe the steps that I go through when setting up a production environment. If you are interested in this subject and want a better guide please refer to deploying rails applications

Monit

This will keep everything running, I use this rather than god as it seems more stable and less memory hungry. I have used god a bit; the name also puts me off.

We still run ubuntu not cool enough for CentOS yet so.

aptitude install monit

Example monit config for rails app server with passenger.

Logrotate

You dont want massive logs slowing your app down after its been running 6 months, remember to configure this as it is often overlooked.

Passenger

Passenger or mod_rails is in active development and is used by a lot of the big ruby on rails companies and on the big sites. Deployment of production level apps used to be about packs of mongrels and frontend lightweight webservers. No longer.

Capistrano-ext

Deployment with capistrano is standard within the community, with the capistrano-ext gem you can run multistage deployments.

So

cap production deploy

Will deploy to production.

A list of my capistrano bash aliases are as follows. I find them very useful.

alias cpd="cap deploy"
alias cpdm="cap deploy:migrations"
alias cpsd="cap staging deploy"
alias cpsdm="cap staging deploy:migrations"
alias cppd="cap production deploy"
alias cppdm="cap production deploy:migrations"
alias cptd="cap testing deploy"
alias cptdm="cap testing deploy:migrations"

Backups

You need to be covered if something goes wrong. You need to backup static assets and database. I will not go into this here. Ideally, backup to an offsite location. eg. Amazon S3.

Exception notification

Make sure you have the exception notification plugin on the go, so you get emails when things break.

New Relic

The new relic performance monitoring service is great for keeping an eye on things within your production application. And there is a free version!

Version Control

Create a production branch in your version control and deploy from that. Then as you work for bugfixes and new features on master you then merge with the production branch for deployment.

eg.

To merge master with production.

git checkout production
git merge master

You can then also do critical changes to the production branch. And to get this back into master.

git checkout master
git merge production

Thats all for now. Any comments?

Autotest Growl Notifications

March 23rd, 2009 by pyrat

growlers

I recently have had to set this up on another machine so here is a little guide which might help you if you want to setup growl notification of autotest results.

  • Make sure growl is installed
  • Make sure growlnotify is installed you will find it in the Extras directory of the Growl dmg (copy growlnotify to /usr/local/bin to test this open a terminal and type growlnotify)
  • Add the following to a file called ~/.autotest

  require 'autotest/redgreen'
  require 'autotest/timestamp'
 
  module Autotest::Growl
 
    def self.growl(title, msg, img, pri=0, sticky="")
      system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}" 
    end
 
    Autotest.add_hook :ran_command do |at|
      image_root = "~/.autotest_images" 
      results = [at.results].flatten.join("\n")
      output = results.slice(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/)
      if output
        if $~[3].to_i > 0 || $~[4].to_i > 0
          growl "FAIL", "#{output}", "#{image_root}/fail.png", 2
        else
          growl "Pass", "#{output}", "#{image_root}/pass.png" 
        end
      end
    end
 
  end

Extract this file to ~/.autotest_images directory.

You are now good to go!