Deploying a Clojure / Clojurescript Application in Production

I play with Clojure / ClojureScript and I am writing a web application. Everything is fine when I use the ring as a development server.

The question is which container should be used for production? Should I use a ring for production? Should I use Tomcat? Is there a recommended way to deploy a Clojure application? Can you tell me some documentation on this aspect?

Thanks!

+6
source share
3 answers

There is no difference in deploying the Java servlet that was written in Java compared to Clojure, and all Clojure web libraries and frameworks create compatible servlets, so you have many deployment options.

We use netty to launch our call-based web application with great production success by simply launching “start lein” from the system service. Many others prefer to use lein uberwar to create a war file and place it on tomcat. The specific hosting mechanism seems less significant than the deployment process. All JavaScript files are served from CDN. Immutant is also an interesting and very oriented choice of Clojure with a strong “entrepreneurial” feeling for it.

What seems to me most important is the creation of a repeatable assembly, including deployment. Pallet is a great way to go, although he got a bit of a learning curve.

+9
source

There are several options.

The first is easy: Heroku. They have a free level sufficient for deployment and testing. I will not dwell on this in detail, but I decided not to use Heroku anymore.

Another common option is Amazon AWS. I compile most AWS applications using lein-beanstalk [sorry no quotes here]. Lein-beanstalk has long been out of order and seems to have been neat and tidy. It is also supported by the same person who supports Compojure.

I am using VPS. I installed the linux build using Nginx and will deploy using git. So basically, my thread creates a site, compiles for lein uberjar, and then deploys. I know that some people can use and use the “ring ring” on their applications in their applications and use many other configurations like Maven, Tomcat, deployment with Vagrant, etc., but I just run java -jar myApp -xxxxx to the server, and it works fine.

In terms of documentation, there seems to be a lack of documentation for deploying Clojure. You need to bang your head against the wall and see if you want to take the VPS route the first time you do it. I found that almost none of my problems are related to Clojure.

+6
source

In development, I use:

lein ring server 

: then compile it into a war file, which I use:

 lein ring uberwar 

: and just drop the resulting jar file into the Webapps directory, and it works fine. I use jetty by the way

+4
source

Source: https://habr.com/ru/post/955460/


All Articles