Skip to content
Craig Andera edited this page Jan 24, 2012 · 5 revisions

Deploying to Heroku

You can deploy your One-based application wherever you like. If your application truly is standalone (i.e it has no server component), this will consist merely of copying the contents of the out directory somewhere. If, however, your application has a server component, you will need to host it somewhere that can both run the server and serve the rest of the application.

The included sample application does have a simple server component, and so needs somewhere to run. One easy way to deploy is to make use of Heroku, a hosting company that offers free hosting plans and easy deployment. We have tested deploying the sample application to Heroku using the following steps. You may need to alter these if your application differs significantly from the sample application.

Steps to Deploy

First, open a terminal and change to the ClojureScript One directory.

cd /path/to/one

If you're starting from a fresh checkout, then you may need to run lein bootstrap first.

Build the application, which compiles all the ClojureScript to JavaScript, and generates the HTML from the templates you've defined.

lein run -m script.build

Commit the newly generated content to the local git repository

git add out
git commit -m "Add build content"

If you have not already, sign up for a free account at Heroku and install the Heroku gem.

gem install heroku

Create a new Heroku application.

heroku apps:create pick-a-name --stack cedar

You will be prompted to enter a username and password for your Heroku account and to enable upload of your ssh public key. Do so.

Deploy your application to Heroku. Deployment happens automatically when you push your repository to Heroku via git.

git push heroku master

You should now be able to see your application running at http://pick-a-name.herokuapp.com.