How to run clojure in OpenShift

I am trying to deploy a Clojure application on OpenShift using clojure-cartridge by running the following command:

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

I can run the application locally with lein run

and see http://localhost:8080/

It works as expected. But when I run it from OpenShift I get: Service Temporarily Unavailable.

When I do rhc tail

I get:

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.

I am new to both Clojure and OpenShift, so I might have missed or understood something confusing. But any ideas on what is going wrong?

+3


source to share


1 answer


I don't know anything about OpenShift, although this error:

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

      



is a strong hint that the environment variable is $HOME

not available in OpenShift. lein writes files to $HOME/.m2/repository/...

, so if $ HOME is where unset it will throw the above error. 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

      

+2


source







All Articles