Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compojure: lein-ring in production?

It seems that people sugget the use of lein-ring for a no-brainer deploy of a Compojure application. Isn't it just meant for development? I've benchmarked the same app running with lein-ring vs packed by leiningen with uberjar (executed with java -jar, it contains ring-jetty).

To my surprise, the performance is even slightly better with lein-ring! Am I missing something?

How can i keep on using lein-ring but avoid printing out stacktraces in case of exceptions and avoid checking for modified files?

Thanks

like image 548
pistacchio Avatar asked Oct 16 '11 22:10

pistacchio


1 Answers

lein-ring will allow you to readily produce a war file for deployment to a container (and serves as the basis for lein-beanstalk for easy deployment to Amazon's Elastic Beanstalk), but I'm not aware of a common practice of using it in production. Certainly an option, but probably rarely the best one. I'd recommend deploying using the methods recommended by your host / container; this will most often mean deploying a war (which lein-ring can be used to build) or using some variety of containerless deployment with an embedded Jetty instance (as on Heroku with Leiningen).

If you do want to use lein-ring in production but want to turn off its development-time capabilities (code reloading, stack trace rendering, etc), you must set the RING_ENV environment variable to production, e.g.:

export RING_ENV=production
lein ring ...
like image 101
cemerick Avatar answered Oct 20 '22 23:10

cemerick