Rapid Development with PaaS Providers

As an end-to-end hacker, I frequently need to quickly stand up a server up for quick demos, POCs, micro campaigns, or to host some services for my mobile apps.  The need for a flexible, quick-to-market, pay as you go platform with tons of development choices  has prompted me to explore the PaaS market, which is rich with providers that provide free or low-cost options targeting exactly my needs.

For instance, last week I was looking to deploy a LAMP application supporting an iPhone application that shows the latest images from various street art sites.  The LAMP app scrapes more than 50 sites every 3 minutes and saves the result in an XML file that is consumed by the iPhone app.

I quickly narrowed the PaaS providers down to 2 options I was very familiar with: Dotcloud and Orchestra.

I first deployed the services in Orchestra, which couldn’t be simpler – just give it a name and provide some github settings.

Using Orchestra’s elegant addon system, I was able to set up the database and phpMyAdmin with just a few clicks.  I very quickly had everything in place except the cron job, and that turned out to be just as straightforward.  Thanks again to Orchestra’s addons and cron documentation, a few lines of code committed to my repo got the cron job running:


* The cron Custom script.
class Cron_Custom
public $path = '/iphone/whatsup/cron.php';
public $args = array();

I was pretty happy with this until I found that cron jobs do not work on free Orchestra accounts.  Luckily DotCloud does support cron for free accounts (see DotCloud’s cron docs here).

Deploying on DotCloud was just as easy but they don’t have the notion of addons, so I had to install it by hand (also very easy!).  Developers also have the option of ssh’ing into the underlying EC2 instance and running mysql commands there from the command line.

In order to deploy my app to DotCloud (using the same source!) all I had to do was install their command line utility, create a yaml build file, and then push my github code to DotCloud using “dotcloud push <appname>”. My build file looks like this:

type: php
postbuild: crontab ~/code/cron.sh
type: mysql

The “postbuild” script runs after the code is deployed, which will install the crontab and (if necessary) create the database.   The final step was to create my database tables from the command-line.

While both Orchestra and DotCloud met most of the requirements, DotCloud’s free cron support made the difference in this instance.