Mark's Blog

Feb 16

Deploying Typo to Heroku

  1. Install the heroku gem.

    $ [sudo] gem install heroku
    
  2. Download and extract typo.

  3. Create a git repository and commit the typo source code to the repository.

    $ cd <wherever you extracted typo>
    $ git init
    $ git add *
    $ git commit -m 'The typo package.'
    
  4. Typo tries to create a couple of empty folders on startup. We need to pre-empt this as heroku doesn’t allow writing.

    $ touch public/files/.gitkeep
    $ touch tmp/cache/.gitkeep
    
  5. You need to tell heroku that you need all of the correct gems installed. To do this I copy and pasted from typo’s environment.rb file.

    $ cat .gems
    rails                     --source gemcutter.org   --version '2.3.5'
    htmlentities              --source gemcutter.org
    calendar_date_select      --source gemcutter.org
    bluecloth                 --source gemcutter.org   --version '~> 2.0.5'
    coderay                   --source gemcutter.org   --version '~> 0.8'
    RedCloth                  --source gemcutter.org   --version '~> 4.2.2'
    addressable               --source gemcutter.org   --version '~> 2.1.0'
    mini_magick               --source gemcutter.org   --version '~> 1.2.5'
    mislav-will_paginate      --source gems.github.com --version '~> 2.3.11'
    panztel-actionwebservice  --source gems.github.com --version '= 2.3.5'
    
  6. Typo appears to do filesystem access in two main areas. For things to work properly on heroku we need to stop that.

  7. Commit everything to the git repository.

    $ git add *
    $ git commit -m 'Getting things setup for heroku'
    
  8. Get heroku setup. I am not going to get into this here. There is great documentation for this on heroku.com.

  9. Push the code to heroku.

    $ git push heroku master
    
  10. Get the database ready to go.

    $ heroku rake db:migrate
    
  11. Hit your heroku url and get typo setup as you normally would.