Archive for July, 2007

The Dip Seth Godin Review

July 27th, 2007 by pyrat

Just finished The Dip by Seth Godin. I have long been a reader of his blog and I was intrigued enough by his latest book to give it a bash and bought it painlessly on amazon.

Its a lightweight book (~80 pages) which I would say falls into the personal development genre. The biggest thing I have taken from it is to concentrate my efforts on key areas that I have goals in

and stop stuff which is just wasting my time. I also feel as if I am currently in a dip with oentries and racentries and am inspired to get

where I want with these web applications.

It provided some good debate with Helen who didnt like it in some ways and found it repetitive trying hard to deliver the same message over and over. But once you have got it you have got it and but there are also a

few gems. My favourite being the one about how certain organisations make is especially hard to get to the top and you have to jump through many hoops. Also, the main point about how the people at the top have

exponentially more success than second and third.

Overall I still enjoyed this book and would give it a 6.5/10 and recommend it to friends.

Email Administration on a VPS (Postfix etc)

July 25th, 2007 by pyrat

I have recently been moving some sites from shared hosting to my vps. And one of the benefits of shared hosting is a shiny cpanel installation which provides controls for working with email. Something which a barebones vps installation lacks. (Which is not a bad thing :-)

Whilst it is good to have postfix configured so your site can send email I am now of the mind that it is easier and a better use of resources to outsource the incoming email to google apps.

It is still free for the time being and all you need to do is add a few MX records to allow google to handle your mail and you are cooking on gas.

Also there is the ability to create domain aliases, so you can have multiple domains running through one google apps account. (Assuming you want to do this).

I was too short on time to learn the ins and outs of postfix so im using yet another google web service solved my problems.

File upload plugin for rails

July 13th, 2007 by pyrat

I just found a great tutorial on using the attachment_fu rails plugin for uploading images to your rails app.

If you have every done this before in rails you will agree it takes a while and this makes it easy and powerful. You can even store all your images in amazon s3 with a couple of lines.

I’m going to write a wee rails project using these technologies and will let you know how it goes.

Web-based Subversion Repository

July 10th, 2007 by pyrat

For the last couple of years I have used svnrepository to manage my subversion repositories through a web interface. This is a pretty good way of doing things and the web interface is good enough, if a bit slow.

But, there is the new kid on the block warehouse which provides everything that svnrepository provides and more. It also looks pretty. The difference here is that you install it on your own server.

So get yourself a VPS and install warehouse on it and back it all up to amazon S3. Sorted.

Subversion Command Line

July 7th, 2007 by pyrat

After using subversion for the past couple of years I have tried various GUI clients and unfortunately none are as fast and as powerful as the command line.

With the help of shell aliases and simply helper scripts (@matt ex-mt knows all about these) you can get the job done quicker and with a lot less hassle than bothering with a GUI client.

My shortcuts are as follows:

That being said, if what you are doing is simple and you are not that technical in mind like Helen keeping her phd thesis in a repository then I would recommend TortoiseSVN. But it falls over when you start dealing with repositories which have gigabytes of files in them.

Deploying with Capistrano VPS

July 4th, 2007 by pyrat

It has taken me a while to move from the custom checkout scripts that I use for rails deployment to move to the capistrano way of doing things. I am so excited about it that I have decided to write this blog post.

This is not a definitive guide to rails deployment with capistrano but is the way I do things when deploying to slicehost for an application which we will be releasing in the not too distant future. This should work out for other vps servers and can be modified for shared hosting where you dont have as many permissions such as sudo access. Also I am basically a capistrano beginner so take what I say with a pinch of salt.

Firstly, if you are not familiar with capistrano I recommend purchasing the peepcode episode titled Capistrano Concepts

Your using source control right?


The first step is to make sure that you are using source control. The source control system of choice in the rails world is subversion. Capistrano works with quite a few other scm applications but subversion is by far the most common.

So you need to have your application in a repository somewhere which your deployment box can access. You should also setup the repository to work with the rails app (ignore log files, ignore database.yml, ignore *.pid files etc.) There is a great rake task for setting up subversion on rails

You have installed and setup your vps?


Lets say you have setup your vps and plan to deploy with an nginx / mongrel_cluster rails stack. There is a good guide at usefuljaja for doing this.

You have also setup ssh key authentication to avoid typing in passwords all the time. You are also just deploying to a single server and only have one mongrel process to start with.

For installing and setting up nginx for your deployment its best just to install nginx from source and use the nginx config generator to configure nginx for your deployment. I am also loving the no_www option which redirects requests to www.example.org→example.org. Is it just me or do other people hate www.*

Setting up a deploy user on the VPS is also recommended for cleanliness.

You have setup a database and there is a domain you can run this off?


You need to setup the database in your production environment. A url to deploy to would also be nice, maybe you are still in development and you can use a static dyndns.org free domain to get started.

Install capistrano and railsmachine


sudo gem install railsmachine —include-dependencies

This is a great little collection of capistrano tasks to organise the deployment by convention over configuration.

Setup your rails app and deploy


cd {RAILS_ROOT}
cap—apply-to .

This creates a deploy.rb in your /config directory where you can setup the deployment. My deployment script can be found over at pastie

The tasks defined in the two bottom tasks are defined in a mycaptasks.rb file which I can move around projects. You could also set it up as an svn:external in your project if you want to be more DRY. It is also up on pastie

Now run:
cap setup

This sets up the folder structure that capistrano uses.

Now:
cap cold_deploy

To check everything is working ok.

Now:
cap deploy_with_migrations

This will build up your new database assuming you work withe database migrations.

From now on
cap deploy

To deploy your app.

Its in source control


Because the deploy scripts are contained within the source control it works great in a distributed work environment so other developers can work with your project and deploy in a common way. It brings deployment into a convention rather than custom built and often nasty deployment methods which exist out there.

Cheers for now


This has been a skim at deploying with capistrano and I urge you to check out the other and probably a lot better learning resources out there.