Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run clojure on OpenShift

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

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

I can run the application locally using lein run and looking at 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 using OpenShift, so I could have missed or misunderstood something obvious. But any ideas on what is going wrong?


1 Answers

I don't know anything about OpenShift though this error:

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

is a strong hint that the $HOME environment variable is not available in OpenShift. lein writes files to $HOME/.m2/repository/... so if $HOME where unset it would result in the error above. 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
like image 182
Arthur Ulfeldt Avatar answered Dec 15 '25 15:12

Arthur Ulfeldt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!