Introduction

This tutorial will show you how to deploy your Clojure app in several minutes. These instructions will also give you enough information to make the most out of Dokkur.

Be sure that you already have:

  1. Dokkur account.
  2. SSH keys added to your account.
  3. Clojure and Leiningen installed locally.

Set up

In this step you will install the Dokkur Toolbelt that gives you you access to the Dokkur Command Line Interface (CLI).

After installation you can use dokkur login command to log in with your email and password you set when creating Dokkur account.

Prepare the app

To deploy an app you need to have the app prepared for deployment.

If you don’t have your own Clojure project, you can use a template that we have already prepared for you:

$ git clone https://github.com/dokkur/clojure-getting-started.git
$ cd clojure-getting-started

If you have a Clojure app that you want to deploy, you need to do some preparations.

Declare app dependencies

How does Dokkur recognize an app as a Clojure app? The answer is by the existence of a project.clj file in the root directory.

It may look something like this:

(defproject clojure-getting-started "1.0.0-SNAPSHOT"
:description "Demo Clojure web app"
:url "http://clojure-getting-started.herokuapp.com"
:license {
:name "Eclipse Public License v1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"
}
:dependencies [
[org.clojure/clojure "1.6.0"]
[compojure "1.4.0"]
[ring/ring-jetty-adapter "1.4.0"]
[environ "1.0.0"]
]
:min-lein-version "2.0.0"
:plugins [
[environ/environ.lein "0.3.1"]
]
:hooks [environ.leiningen.hooks]
:uberjar-name "clojure-getting-started-standalone.jar"
:profiles {
:production {
:env {
:production true
}
}
}
)

The project.clj file is a specification of which dependencies should be installed with your application including version of Clojure.

Create a new app

Follow these steps:

  1. Open website, go to Personal apps (left menu bar)
  2. Click ⨁ button to open New App interface
  3. Enter the app’s name (Caution! Use latin lowercase and numbers, e.g. myapp007), choose available and convenient instances for hosting, pick Custom App template and press Create App button.

Congrats! Your app has easily been created. Now you need to deploy it. Just do it!

Add BUILDPACK_URL config var

  1. Go to Settings page, in Environmental variables section click on Edit button.
  2. Choose ADD NEW VARIABLE
  3. In the Name field write BUILDPACK_URL
  4. In the VALUE field put
    https://github.com/dokkur/buildpack-clojure
  5. Save settings

Deploy your app

  1. Go to Settings page, copy the app git url from the Git URL section.
  2. Switch to Dokkur Toolbelt and execute this command:

    git remote add dokkur git_url
    Instead of git_url paste your app's git url.

  3. Push your app:
    git push dokkur master
    If you want to deploy another branch, run:
    git push dokkur yourbranch:master

Hell yeah! Your app is deployed! Open yourappname.dokkurapp.com in your browser.