如何在OpenShift上运行clojure

时间:2014-12-29 19:29:11

标签: clojure openshift leiningen

我正在尝试使用运行以下命令的clojure-cartridge在OpenShift上部署Clojure应用程序:

rhc app create myapp http://cartreflect-claytondev.rhcloud.com/github/openshift-cartridges/clojure-cartridge

我可以使用lein run在本地运行应用程序并查看http://localhost:8080/它按预期工作。但是当我从OpenShift运行它时,我得到:服务暂时不可用。

当我rhc tail时,我得到:

Downloading Leiningen to /var/lib/openshift/54a1a338fcf933fb93000106/clojure//home/self-installs/leiningen-2.5.0-standalone.jar now... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14.2M 100 14.2M 0 0 18.6M 0 --:--:-- --:--:-- --:--:-- 25.5M Could not transfer artifact lein-ring:lein-ring:pom:0.7.5 from/to clojars (https://clojars.org/repo/): Specified destination directory cannot be created: /.m2/repository/lein-ring/lein-ring/0.7.5 This could be due to a typo in :dependencies or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable.

我是Clojure和使用OpenShift的新手,所以我可能错过或误解了一些明显的东西。但是关于什么是错误的任何想法?

1 个答案:

答案 0 :(得分:2)

虽然这个错误,但我对OpenShift一无所知:

Specified destination directory cannot be created: /.m2/repository/lein-ring/lein-ring/0.7.5

强烈暗示,$HOME环境变量在OpenShift中不可用。 lein将文件写入$HOME/.m2/repository/...,因此如果$ HOME未设置,则会导致上述错误。 It looks like OpenShift allows this:

Setting Custom Environment Variables
Set one of more environment variables for an application with the following command:

$  hc env set <Variable>=<Value> <Variable2>=<Value2> -a App_Name