Using SSH Tunnels as a Proxy

In my day job, our application is hosted in Amazon’s AWS service using an autoscaled cluster and their RDS service for MySQL (among many other aspects of their environment). In this configuration the web servers boot up and shut down in order to respond to the current load of our users. This is great and all, but means that their IP addresses are always changing.

Our RDS is configured such that only the machines in our autoscaling group are allowed to access it. This is also great, but it means that if I want to look into something in the production database, I need to SSH to one of the web servers (after working out its IP address) and then connect to RDS.

This can be so much easier. Read on →

Using Git’s Post-receive Hooks to Deploy Code

I’ve recently started self-hosting some sites on some cheap, cool hosting provided by Digital Ocean. On one of their VPSs, I’ve set up some bare git repositories and made some git hooks to automate deployment of sites to that server. Read on →

Renewed Interest

Well, it looks like the pledge I made when I replaced WordPress with Octopress for my blog didn’t last too long - i.e. I didn’t even get one article out after making that pledge. That’s pretty poor. Read on →

Another New Blogging Engine

This blog tends to get updated… sporadically. I get the energy to post more often and that generally results in transferring the content from one blog engine to another - sometimes the new blog doesn’t even get a new post. This time, I’m changing from wordpress to octopress, living in GitHub pages and I guess, once again, I’ll pledge to post more often.

Read on →

MySQL Performance on OS X

Ever wondered why performance of MySQL on OS X was so much worse than a Linux or windows counterpart - especially when doing DROP/CREATE statements (ie in the setup of integration tests etc)? It turns out Mac OS has a safer file creation function than is available on other operating systems and the use of that slows down performance of file operations in MySQL.

You can fix this quickly by adding the following to your my.cnf file in the [server] block. It’s probably best not to do this in production, but who actually uses OS X as a production web server anyway?

skip-sync-frm=OFF

Source: The original MySQL bug report (although it’s not really a bug).

Problems With the Default Virtual Host on MAMP Pro 2.0.5

I’ve recently upgraded to MAMP Pro and I like how I can easily add virtual hosts in its UI - something I had previously done in code in the free version and on older machines running windows, Linux etc. I ran into a strange problem with MAMP though.

In the project I’m working on, I expect to have the default behaviour for unmatched host names go to the first virtual host (a default behaviour of the apache virtual host system) and to have some custom virtual host configurations for my Zend Framework app to work (namely “SetEnv APPLICATION_ENV development”). After pulling my hair out for a while, I found out why my environment variables weren’t being sent through to apache and PHP when I was getting the default virtual host: MAMP Pro adds an extra first virtual host above your collection of virtual hosts (trying to be helpful, I assume) which doesn’t have the custom virtual host directory settings in it and as such, requests will fail. Read on →

Stop Working on Shit Code

Do you work on old, shitty code? Does it stink? Each time you have to work on that same file that drives you nuts, does it make you question your sanity?

In my day job, if there’s something that’ll bring tears to a developer’s eyes, it’s being given a story to work on that involves touching a 6~7 year old file called sales.php. This file is a monstrous 7000+ lines long and is a gigantic state machine that is confusing and highly prone to malfunction. It also loosely forms the “C” and the “V” of a fairly broken MVC structure. To make matters worse, over the years, there have been ~10 different developers ‘work’ on it and it’s a delicate debacle of different coding styles, motivations and business desires. Read on →

OS X Lion + MAMP 2.0.1 + Memcache and PHP 5.2.17

After a fresh install of Lion, getting up to speed with my normal MAMP dev setup + memcached wasn’t as easy as on Snow Leopard. I ended up seeking inspiration from the following articles:

In hindsight, it was quite easy: Read on →

Wiki Class

Ages ago, I wrote a simple class to enable some scripts to update our wiki. A friend asked for a copy, so here it is: Read on →