Wednesday, July 13, 2011

Making sure dotcloud serves static files not Dancer

Dancer is a great framework. It does a great job making a default development work out of the box. Its a nice alternative to some of the heavier ones that require quite a bit of setup (actually most Perl web frameworks do a great job of this).

Also it makes sure to serve static content (to avoid deployment issues, I assume). But compared to nginx or apache it is much slower at serving this (not a big surprise). In my dotcloud deployments I've found this to be a bit confusing to make sure nginx handles it instead of Dancer.

My first pass at this was setting up these symlinks in my source tree:
static/css         --> ../public/css
static/javascripts --> ../public/javascripts 
and such.

It felt wrong to have this inside source control so I dug around a bit and ran into the postinstall script that is supported by the deploy dotcloud command option.

I added the following link commands to mine to create those nice symlinks:

# used for dotcloud deployment

# setup static symlinks
ln -s ../public/images static/
ln -s ../public/css static/ 
ln -s ../public/javascripts static/
ln -s ../public/favicon.ico static/favicon.ico

Nice, pretty and only used for dotcloud deployments.


No comments:

Post a Comment