I use a combination of the following to make it pretty painless:
Cake (including deployment team)
Cake template for web projects designed by Lau Jensen.
Vagrant (a Ruby VM management tool (Virtualbox) that uses Chef or Puppet)
VPS (from Slicehost)
The key part is the webdev template that Lau made. The webdev folder should be placed in ~/.cake/templates . To create a new project based on it, use:
cake new webdev *projectname*
Note that the template includes log4j and Java mail, which may / should be excluded if they are not needed. The following assumes that you are using Enlive and Mustache, but changing this to Compojure / Hiccup is trivial if it is your poison.
The template takes care of serving the application from the berth in development (you just eval server.clj) and works like a war when working under Tomcat. Routes remain identical when deployed to a server like ROOT.war under Tomcat. All static files should be located in the resource directory. Jetty will service them from there (thanks to Ring Ring middleware). In production, they are moved to the root of webapp and sent from there to Tomcat (web.xml takes care of this).
The Devbox folder contains the Vagrant file and cookbooks needed to create a virtual machine with Tomcat installed. I use the cake to expand the .war file in the /home/vagrant (this is determined from the dev context definition in project.clj). The .war file is symbolically linked to Tomcat webapps dir ( /var/lib/tomcat6/webapps ) as ROOT.war. For more information on how to use Vagrant, see the Vagrant Website.
This gist shows an example of how to adapt project.clj to use the cake deployment command. In the example, two contexts @dev and @prod are created that can be expanded for use:
cake deploy @dev / cake delpoy @prod
I put together a webdev Cake template and Vagrant files in this zip .
mac Apr 01 '11 at 17:40 2011-04-01 17:40
source share