Saturday, January 15, 2011

Clojure on Google App Engine

Deploying Clojure on GAE has typically been a pain in the ass, by which I mean more of a pain in the ass than deploying the Python stuff. That is, until I found this:

AppEngine Magic

This is hands down the best Google App Engine library for Clojure.

Here's a sampling of the features:
1. It is leiningen integrated.
2. It includes a dev environment AND packages up your code automatically for deployment to GAE.
3. It is very well documented. Compojure devs, you might learn something here.
4. It doesn't force you to use any particular web framework. I was able to successfully hook in a vanilla Java HTTPServlet.
5. It has libraries for pretty much anything worth using in GAE.

I'm usually not impressed with Clojure libraries since (let's be honest here) they're almost always just wrappers around Java libraries with some semantic sugar. Appengine-magic is just so complete and useful that it has overwhelmed my prejudices.

Just look at how easy it is to deploy FROM SCRATCH:
0. I assume you have a [project] account created in Google App Engine
1. lein new [project]
2. cd [project]
3. Edit project.clj to include [appengine-magic "0.3.2"] in :dev-dependencies
4. lein deps
5. lein appengine-new
[optional step: writing code]
6. lein appengine-prepare
7. Assuming your appengine SDK is in the directory above your project, ../appengine-java-sdk-1.4.0/bin/appcfg.sh update resources
8. Go to [project].appspot.com

This is definitely easier than vanilla Java and arguably easier than the Python SDK. I won't go into running development servers and deploying code changes, because the most excellent documentation covers all that.

Don't be a jabroni. If you're using the Java GAE API, you should be using Clojure and this library.


In other news...


To the one or two people who read my blog, sorry for the complete lack of updates over the past few months. I just moved to the Bay Area and things have been extremely hectic at work (iTeleport,) with my side project (BeBannered,) and with life in general.

Yes, I absolutely love it here. I always thought that there was a comparable CAP theorem for people: the TAN (talented, ambitious, nice) theorem. This theorem does not apply here. In addition to the awesome people, the weather is amazing (and I'm saying this in January, the worst month in the area weather-wise,) the food selection kicks ass, the nightlife rocks, and did I mention soup dumplings?

1 comment:

Erick said...

thanks for the post