Scalatra on Dotcloud
I couldn’t easily find information on this, so here’s a summary for those that go after me.
The sbt-scalatra-example project combines two great technologies. The first is Scalatra, a super light-weight web framework for Scala that’s modeled after Ruby’s Sinatra. The second is the simple-build-tool (sbt), a tool for building Scala applications that’s more like rake (config file written in real programming language) than make or ant/maven (config file written in an abstract form). I was able to run the example, but I wanted to try out deploying to dotcloud, and doing that requires a war file (according to the java service documentation).
The biggest thing I had to figure out is that as of version 0.10 of sbt, web application support is now in the xsbt-web-plugin plugin. Just knowing that would have saved me an hour this morning. Setting that up and tweaking a few other files means I can now do this:
$ sbt clean package-war ... snip ... [info] Packaging /home/user/sbt-scalatra-example/target/scala-2.9.1.final/sbt-scalatra-example.war ... [info] Done packaging. [success] Total time: 13 s, completed Sep 23, 2011 3:57:00 PM $ cp target/scala-2.9.1.final/sbt-scalatra-example.war dotcloud/ROOT.war $ dotcloud create sbtscalatra Created application "sbtscalatra" $ cd dotcloud && dotcloud push sbtscalatra ... snip ... Deployment finished. Your application is available at the following URLs www: http://sbtscalatra-xxx.dotcloud.com/
Of course, this assumes you’ve installed sbt (brew install sbt on the mac) and signed up and configured Dotcloud.