Deploying a Dancer/Postgres app on dotCloud

After getting a dotCloud beta invite and not using it for a month, I finally tried the service a week ago (and I'm finally blogging about it...)

The app I deployed is StuwerCal, a communal iCal aggregator (I'm also going to talk about this project (and the dotCloud deployment) at YAPC::Europe). The frontend is powered by Dancer, but I also use a whole lot of other CPAN goodness (and of course Postgres).

There are already a few blog posts on how to setup up a Dancer app on dotCloud:

.. but they all describe the old client (prior to 0.4.0). The changes aren't that big, but it took me a while to figure them out by trial and error (especially since the docs describing how to migrate where only published after my installation attempt.

Anyway, here are a few notes ammending those posts and docs.

Create the Dancer app first

If you just init a new dotcloud namespace in an empty project dir, and add / create your app later, dotcloud does not seem to realise it's a Dancer-base app and thus does not start it.

Do not create the DB service at the same time as the Perl service

For unkown reasons the DB (or at least the Postgres) service did not work if I defined both services at the same time in my dotcloud.yml. I had to first create the namespace (dotcloud create stuwercal), then define the Perl service:

  frontend:
    type: perl

Push this to dotcloud, and only after this service is running, add the Postgres service.

Some cool features:

  • You can access all of your services via ssh.
  • This allows me to set up cron jobs etc (at least it seems so, in fact I haven't checked yet if the job is really running...)
  • There's a special file called environment.json on each of your hosts. In it you find hostnames, ports and login information, which makes connection from your app service to your DB service very easy.
  • The primary interface is a command line client. I like the command line!

BTW, here's the Stuwercal running on dotCloud: http://2281c8a9.dotcloud.com/

Now I need to figure out how to run this on a nice URL, and (even though my status as a beta user granted me a free Pro account for a year) I want to pester dotCloud for a longer running free service, as the StuwerCal is a non-profit, and according to their FAQ they offer discounts for non-profits...