/Catalyst-DotCloud

Example of Catalyst 5.9 running on dotCloud

Primary LanguagePerl

Catalyst 5.9 on dotCloud

This is an example of what's needed to run Catalyst 5.9 on dotCloud. It's just the skeleton app created by catalyst.pl

The interesting parts are in these files:

  • .dotcloudignore

  • app.psgi

  • dotcloud.yml

  • nginx.conf

.dotcloudignore

The file looks like this:

- /t
- /script

No need to sync test to production environment. And no need to sync scripts, we'll be using PSGI

app.psgi

The file looks like this:

#!/usr/bin/env perl

use strict;
use warnings;
use lib 'lib';
use Catalyst::DotCloud;
use Plack::Builder;

builder {
    enable 'Plack::Middleware::BufferedStreaming';
    Catalyst::DotCloud->psgi_app(@_);
};

The only thing to notice here, is that we're enabling Plack::Middleware::BufferedStreaming, to to get around incompatabilities between Catalyst 5.9 and uWSGI.

dotcloud.yml

The file looks like this:

---
www:
    type: perl
    requirements:
        - 'Module::Install::Catalyst'
        - 'Plack::Builder'
        - 'Plack::Middleware::BufferedStreaming'

Notice the requirements. Module::Install::Catalyst is needed by Makefile.PL, if it's not there the makefile won't run, and the requirements listed there won't be installed. The last two is needed for our app.psgi file.

nginx.conf

The file looks like this:

location /static/ {
    root /home/dotcloud/current/root;
}

DotCloud defaults to serving static content from a directory called static in the base directory. This makes dotCloud serve static files also from root/static.