Heroku Deployment - GoBoundless/spar GitHub Wiki
Deploying to Heroku
Spar can easily be used with Heroku. However, you'll need to add a few files to your project and run a few commands to get things working.
Adding Files
First, you need to create a Gemfile
in your apps root directory. The Gemfile
tells Heroku which ruby gems to install to run you app. Here's what it should look like:
source "http://rubygems.org"
gem 'spar'
gem 'thin'
Next, you should create a Rakefile
. This file tells Heroku about Spar's internal rake tasks which will be used to generate your assets on the Heroku platform. You Rakefile
should look like this:
require 'bundler'
Bundler.require
require 'spar/tasks'
Next up is a file called config.ru
. This is a rackup file that tells Heroku how to run the ruby process (rack application) that runs spar. It should look like this:
require 'bundler'
Bundler.require
run Spar.app
Finally, you need to create a Procfile
to tell Heroku how to run your spar app. It should look like this:
web: bundle exec thin start -p $PORT
Running Commands
First, download and install the (Heroku Toolbelt)[https://toolbelt.heroku.com/]. This will install heroku and git on your system (if you don't already have them).
Once that is done, open up a new terminal window and navigate to your app's directory.
If your app isn't already a git repository, you need to set it up as one:
git init
Next, you need to run Bundler to download and install the spar and thin gems from your Gemfile
:
bundle
Next, Create a new heroku app:
heroku create <your-app-name>
Now you have a Heroku app, but you need to enable a special Heroku Labs feature to make sure the deploys happen in the production environment:
heroku labs:enable user-env-compile -a myapp
Now you're ready to deploy!
Deploying
From this point on you should be able to deploy just like any other Heroku project. Commit your changes to git and then run:
git push heroku master
Done!