10 July 2008

capitate rocks!

I have inherited a server with super sized log files for Rails and nginx: hundred of GB ... All the files occupy 65G (including home partition), it seems a lot to me!

The fact the person who configured is supposed to be an expert on Rails hosting and has a good "WWR reputation" .... If s(he) "forgot" about such things, it gives me a lot of hope regarding my sysadmin skills: I don't know anything but it's easy to learn...

After a few googling, I found out about logrotate and then t capitate, which contain very usefull recipees for capistrano. Rails conventions and philosophy is about DRY and automatize all these repetitive tasks and capitate author Gabriel Handford has understood it very well and share its work to the community. THANKS :-)

You could spend 5-10 minutes on each project configuring logrotate for all your dependencies (monit, sphinx, Rails, nginx ...). copy-paste et voila! how boring ...

In 1 minute, using capitate, you can configure logrotate with a capistrano task!
Install capitate (read the capitate well written doc) and


$ cap nginx:logrotate:install
...
$ cap rails:logrotate:install
...

VERY IMPORTANT: you need to specify:

set :use_sudo, true

to run that command otherwise it will fail with:
** [out :: beta.lecool.com] install:
** [out :: beta.lecool.com] cannot create regular file `/etc/logrotate.d/rails_beta.lecool.com'
** [out :: beta.lecool.com] : Permission denied


Let's contribute to this gem! Get the sources with
git clone git://github.com/gabriel/capitate.git

No comments: