Archive for September, 2007

Logrotate in Rails

September 29th, 2007 by pyrat

Just a wee snippet for logrotate.
Open /etc/logrotate.conf or find it.

Then drop this at the bottom:


/var/www/apps/oentries/current/log/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
copytruncate
}

Apache Configuration Tool

September 28th, 2007 by pyrat

apache-gunship-flickr

I have been doing a bit of sysadmin stuff with iformis recently which has involved a bit of virtual host configuration for a number of sites. Although Nginx is top for rails, apache is still the king of PHP.

We use apache in a debian / ubuntu environment so I have gone and written a wee gem to make vhost configuration a bit easier.

1. Install apacheconf


sudo gem install apacheconf

2. Setup YAML Config


site_name: fun
server_name: fun.com
server_alias: www.fun.com
document_root: /var/www/apps/fun

3. Run apacheconf


apacheconf –enable fun.yml

4. There is no step 4!

Apacheconf

Please contact me with any issues and ideas for improvements.

PHP Mysqli Ubuntu Install

September 26th, 2007 by pyrat

For installing mysqli extension after PHP is installed on a Linux ubuntu or debian.

  1. apt-get install php5-mysqli

NOTE: after install, you need to reboot apache

  1. apache2ctl graceful

Simple Effective Firewall Configuration

September 21st, 2007 by pyrat

Simple Configuration

This allows HTTPS, HTTP and SSH traffic on a non standard port.

Running as a City Tour

September 17th, 2007 by pyrat

running-city

Im in Berlin at the moment for Railsconf Europe. After a long day today I went for a nice run round the city to make more sense of the city and how it all fits together. I love running in random place where you dont really know the layout.

You can cover so much ground in a short time and this allows you to take in much much more. Its the same with Hill running. You can be up the mountain, down the mountain and in the pub before the hill walkers have got half way up.

I did a good thing and a bad thing. I hope its ok. I was running and I found the holocaust memorial (pictured above) but didnt know this at the time. I decided to run along the tops of all the concrete. This made for a good time as they end up being about 3-4m high and I was jumping between them in the dark. This brought on the fear and was a great adrenaline hit. The thing is I feel direspectul after I knew what it was.

I suppose as I was ignorant it was OK. :0)

Example Monit Configuration with Mongrel

September 15th, 2007 by pyrat

Monit is great for keeping your services online. I use them for keeping my collection of slices online when I am asleep.
The example monitrc is a great starting point of listing the services which you should be monitoring.

One thing: monit can have its own little http server which runs internally. This is off in the example config as you have to explicitly enable it.

I hope to release a monit config generator gem in the near future which makes this a lot quicker.

Apache2 Low Memory Footprint

September 14th, 2007 by pyrat

I found this very useful for fine tuning my vps memory usage.

Buy Little, Buy Quality

September 14th, 2007 by pyrat

Quality Shot

In the same vein as my last minimalist post I have been thinking about buying stuff. The wonderful website that is ebuyer allows me to purchase computer stuff super cheap.

The thing is these products don’t last that long and often has shortcomings. The result is that you end up with something which is OK for the short time but doesn’t last. Its the same with shoes.

I think it is a far better investment and so do lots of other people that its better to buy less. Instead of impulse buying wait for 14 days and see if you still really want it. If the answer is yes, then go for it. Dont buy stuff which is stupidly expensive but try to get a quality product which is going to last.

For example, a few months ago I bought a flat panel monitor to replace my ageing CRT. It turned out that there was a monitor available for like £50 which was a 14.1” in size. I though wow! Thats properly cheap and bought it. Now that im using only laptops and these have better screens that this, it is useless. I should have spent 3x more for a 24” and instead have a tasty docking station.

Even underwear should be good. One area which you can scrimp on though is t-shirts. Just by cheap ones and replace them every few months.

Minimalism is the Way Forward

September 13th, 2007 by pyrat

Minimalism

Im moving out of my flat in a couple of weeks and what with RailsConfEurope coming up next week im having to packup sooner rather than later.

The goal is to get a flat full of stuff into one Subaru Impreza. This is going to be a tough but achievable goal and something which we need to do when Helen and I move to Trondheim, Norway in January. We are following rules like:

  • If it hasnt been used in 6 months and is of questionable use get rid of it.
  • If stuff is too good to throw away it goes to charity shops or glasgow freecycle. Got rid of my monster desk the other day through this. It was named ‘the cockpit’ in Staples.

  • Personally, the most stuff I have is technology related. I am using online web services wherever possible to try and move as much as possible to ‘the cloud’. (Google apps for your domain, Amazon S3, Flickr, VPS Servers)
  • Get rid of desktop machines and use only laptops for space saving reasons.
  • Take photos of stuff that is sentimental to you. Normally this is enough, why keep the hard copy!

Next step is to get one of those Fujitsu ScanSnap scanners and convert all documents to electronic format and backup to S3 in an attempt to go properly paperless.

Anyone got any other suggestions for living a truly minimalist lifestyle?

Ipod shuffle weird with podcasts

September 10th, 2007 by pyrat

I copied some podcasts onto my ipod shuffle the other day and they didnt play at all. I was perplexed by this and as it turns out all you need to do it put the shuffle into non shuffle mode. This is weird. Why cant I listen to my podcasts at random?

Also, you can autofill podcasts into the shuffle. Why is this? Do they really just want you to purchase music from the ITUNES instead?

In other news there is a new ipod out which seems to be just like an iphone without phone capabilities. Maybe someone can put a microphone on it and install skype?