Posted on 16-01-2014
Filed Under (Technology) by bigbang

There are many basic startup code examples for Compojure on the web, but I don’t see any kind of deployment tutorial. Here are some basic collections if you want to use Clojure to start a web development.

  1. First, clone the code of compojure-example, and run it with the instructions on the page. If you can run it successfully by command
    lein ring server
    

    , then you can proceed to next step.

  2. Try to develop your web site with the lein ring server. This is the best way to develop Clojure web application for it can refresh your code automatically.
  3. Here comes the final step to deploy Clojure code to web server to provide official service for other people. First, package all resources such as code, css, html template files to war file:
    lein ring uberwar
    

    Then config your Tomcat according to manual and deploy the war file with http://localhost:8080/manager. There is a “WAR file to deploy” option on the manager page. It is the key point of deploying Clojure service to Tomcat. You can just think it is a Java application and use the normal way to deploy it.

BTW: the Tomcat root folder is something like D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT. If you web application can’t load some resource file, please check the relative path for it.

© 2014, The Big Bang on Reading Busy. All rights reserved.
On republishing this post you must provide link to the original post.

Post a Comment
Name:
Email:
Website:
Comments: