System Administration

Articles on System Administration

  1. Finding performance problems

    20 November 2009

    A user recently reported poor performance on one of our Rails apps. I pulled up New Relic’s performance graphs and checked what was happening around the time that we received the email. Sure enough there was a massive spike over a 10 minute period in the time taken to serve a request.

    Analyse Rails log files with cut, sort and uniq

  2. Installing Nokogiri on Leopard

    07 October 2009

    Nokogiri complains that the version of libxml2 installed on Mac OS X Leopard is over 4 years out of date. Well we can’t have that now can we!

    Update your libxml2 library

  3. Installing the pg PostgreSQL gem on Mac

    10 June 2009

    You can connect to a PostgreSQL database from Ruby using the pg gem, but if the pg_config program isn’t in your path you’ll run into problems during installation.

    This article is mainly here to provide some Google juice for those who hit the same problem…

    Compiling the pg gem

  4. Installing Merb, DataMapper and Postgres on Ubuntu

    02 March 2009

    This isn’t particularly difficult, but if you’re not familiar with Postgres on Ubuntu it could take you ten minutes to work it out:

    $ sudo apt-get install postgresql-8.2 postgresql-server-dev-8.2 -y
    $ sudo apt-get install libsqlite3-dev -y
    $ sudo gem install merb do_postgres

    The merb gem depends on the do_sqlite3 DataMapper database driver, so we need the libsqlite3-dev package in order to compile it. You can remove it afterwards if you like.

  5. Deploying Sinatra with Vlad

    01 March 2009

    So you’ve just written a nice new Sinatra application, and you want to get it running on your web server. How hard can it be? Well with Vlad the Deployer, it’s actually rather easy.

    Read about how to roll out Sinatra

  6. Configure the Expires header for Rails under nginx

    13 September 2008

    The images, CSS and JavaScript files served up by your Rails application can usually be cached by the web browser, rather than being downloaded (or checked) every time the browser loads a page on your site. For a properly configured site the net effect is faster page load times and a vastly improved user experience. Rails gives you some help here, but it doesn’t happen automatically – you need to configure your web server to set the HTTP Expires header. This article explains how to configure the expires header for a Rails application running behind the nginx HTTP proxy server.

    Continue reading

  7. Removing an entry from /etc/hosts on a Mac

    09 June 2008

    I was testing a freshly deployed web site for a client the other day before they’d setup their DNS entry, and added the server to my Mac’s /etc/hosts file. It looked something like this:

    208.75.85.73    www.clientsite.com

    When I’d finished my testing I removed the entry from /etc/hosts. On most Unix systems that’s enough to eradicate all traces of your meddling, but not on the Mac. Any IP address that you add to /etc/hosts gets cached by the operating system.

    After a bit of poking around I discovered lookupd. On Tiger you can flush the cache by entering this in the terminal:

    lookupd -flushcache

    On Leopard the lookupd command has been replaced with dscacheutil:

    dscacheutil -flushcache

    Update: The HostsWidget Dashboard widget appears to solve the same problem rather well.

  8. Monitoring BackgrounDRb with God

    08 April 2008

    God is a very neat piece of software, frequently used by Rails developers to monitor mongrel servers, and restart them if/when they crash or use up too many system resources.

    Its use isn’t limited purely to monitoring web servers though; you can monitor pretty much anything you like. Read on to see how to configure it to monitor the Ruby job processing daemon, BackgrounDRb.

    Continue reading

  9. Automate your sysadmin with adl

    06 April 2008

    I used to work for a company that was in the business of deploying laptops running Linux into hospitals. We automated the installation of these laptops to such a degree that all we had to do build a new laptop was unwrap it, plug it into an ethernet network and turn it on. We used PXE boot and our own bespoke deployment system to achieve it. It even supported deploying automatic configuration updates over a mobile phone connection, while the laptops were in a different country.

    It never seems to be worth going to the effort to setup a tool like puppet when configuring a new desktop computer, a virtual server to run your blog, or a VPS for a small client who is keen to keep the budget down. But why should automation be expensive?

    If you like the idea of an automated server build on the cheap, read on…

    Continue reading