0

I've got a simple Clojure web application based on ring, compojure and enlive.

I run it on a linux VPS with the following command:

nohup lein trampoline run -m <application-name>.routes &

From time to time it crashes and I haven't quite diagnosed why yet.

Until I've figured out the cause, I have to periodically check whether the website is online, and if it's not, manually restart it. I'd prefer it if the website could automatically restart if it goes down. What is the best way of doing this? Is this even a sensible thing to do?

I was looking into using Immutant (http://immutant.org/) because at first glance it looked like it might be helpful, but on closer inspection I couldn't understand what it did or whether it was relevant.

Daniel Neal
  • 4,165
  • 2
  • 20
  • 34
  • how familiar with server admin are you? Have you used cron and bash scripts? – georgek Aug 17 '13 at 21:32
  • It's all quite new to me at the moment - I've not used cron before, or written my own bash scripts. In fact, the most I've done admin-wise so far is a run a few command line tools (like `nohup`, which fixed the first problem I had of the app quitting every time I disconnected from the server) – Daniel Neal Aug 18 '13 at 06:59
  • you could also look into upstart, here is an example https://gist.github.com/c4milo/940909 – Shlomi Aug 19 '13 at 22:35
  • Looks interesting - but not sure how to use it to automatically restart after a crash. What does the `start on runlevel [2345]`, does it detect if a process has stopped? – Daniel Neal Aug 20 '13 at 08:43

0 Answers0