组合:生产中的环圈? [英] Compojure: lein-ring in production?

查看:127
本文介绍了组合:生产中的环圈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎人们希望使用lein-ring来免去部署Compojure应用程序。这不是只是为了发展?我已经基准测试了同样的应用程序运行lein-ring和打包leiningen与uberjar(执行与java -jar,它包含ring-jetty)。

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?

我如何继续使用lein-ring,但在异常情况下避免打印stacktraces,避免检查修改的文件?

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

感谢

推荐答案

lein-ring将允许您轻松地生成一个war文件到容器(并作为 lein-beanstalk
的基础,以便轻松部署亚马逊的Elastic Beanstalk),但我不知道在生产中使用它的常见做法。当然是一个选择,但可能很少是最好的一个。我建议使用主机/容器推荐的方法进行部署;这通常意味着部署一个战争(可以使用lein-ring来构建)或使用嵌入式Jetty实例的一些种类的无容器部署(如 Heroku with Leiningen)。

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).

如果您想使用lein-ring生产,但要关闭其开发时间能力(代码重新加载,堆栈跟踪渲染等),必须将 RING_ENV 环境变量设置为生产,例如:

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 ...

这篇关于组合:生产中的环圈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆