How to deploy a Clojure/Compojure webapp in Heroku using lein ring

And I’m guessing a great way to whore some search engine love.

Sources/Useful Reads: ; they use a different model of deployment

Target versions

For Clojure 1.5.1 and Compojure 1.1.5.


The ring-servlet dependency is required. You should also use lein2.

(defproject your-project "0.1.0-SNAPSHOT"
  :dependencies [
    [org.clojure/clojure "1.5.1"]
    [compojure "1.1.5"]
    [ring/ring-servlet "1.2.0-RC1"]
  :plugins [[lein-ring "0.8.5"]]
  :ring {:handler your-handler}
  :profiles {
    :dev {:dependencies [[ring-mock "0.1.5"]]}
  :min-lein-version "2.0.0"


Create a Procfile for Heroku:

web: lein ring server-headless $PORT

Create a on the root of the project (same place as project.clj and Procfile) and add this into it:



In your shell, run the following commands

  git init
  git add .
  git commit -m 'heroku deployment'

  ; assuming you have the Heroku toolbelt installed
  heroku login
  heroku apps:create

  git push heroku master

  heroku open

And profit!

Conception date: August 15th, 2013

comments powered by Disqus