3

Short story: I'm trying to deploy on tomcat7 an application built with the http-kit template here, but the third step is a command (sh java -jar target/lein-template-standalone.jar --profile prod --port 8000) and I have absolutely no idea what to do with it.

Long story: For a simple compojure application I can just do:

$ lein new compojure-app projectX
$ cd projectx
$ lein ring uberwar
$ sudo mv target/projectx-0.1.0-SNAPSHOT-standalone.war /var/lib/tomcat7/webapps/ROOT.war
$ sudo service tomcat7 restart

...and it works. Now the http-kit template has instructions for deployment here (https://github.com/http-kit/lein-template) and it's pretty different. I removed everything in tomcat7/webapps and then:

$ lein new http-kit projectX
$ cd projectx
$ lein uberjar
$ sudo mv target/projectx-standalone.jar /var/lib/tomcat7/webapps/ROOT.jar
$ sudo cp -r public/ /var/lib/tomcat7/webapps/
$ sudo service tomcat7 restart

It doesn't work, but there's no error, my local host is blank. That's probably not surprising, the README for the http-kit template has three steps:

  1. lein uberjar create a standalone executable jar file in the target directory
  2. copy the jar and the public directory to your production server
  3. ```sh java -jar target/lein-template-standalone.jar --profile prod --port 8000

I have absolutely no idea what the third step is or where I should put that command.

juan.facorro
  • 9,791
  • 2
  • 33
  • 41
Suugaku
  • 2,667
  • 5
  • 31
  • 33
  • Looks like a command for your shell. http://unixhelp.ed.ac.uk/CGI/man-cgi?sh – galdre Oct 08 '14 at 19:33
  • 2
    That template is not set up to create .war files that you could deploy to tomcat. It's creating a standalone jar file with an embedded http-kit server. – Diego Basch Oct 08 '14 at 19:52
  • @DiegoBasch All right, well that answers a few questions but I still can't launch a persistent server. I'm a newbie with web technologies, I know I can launch the server with "java -jar target/lein-template-standalone.jar --profile prod --port 8000" but it won't be persistent, I'd have to keep the terminal open. Perhaps the "```sh" is there to somehow fix this, but it doesn't work on my computer. – Suugaku Oct 08 '14 at 20:01
  • 1
    You could launch in the background with `nohup`, e.g. `nohup path/to/java .... 8000 &`. Exit the terminal and the SIGHUP won't kill it so it will keep running. – Diego Basch Oct 08 '14 at 20:04
  • 1
    For running a Clojure service have a look at http://www.rkn.io/2014/02/06/clojure-cookbook-daemons/ – DanLebrero Oct 08 '14 at 20:22

0 Answers0