Hosting a Spree webshop on Heroku

Spree is the webshop solution for Ruby on Rails, and Heroku is the place to host your Rails-applications – especially if you like free hosting :)

Finding myself in the need of a webshop, I decided to try to deploy Spree to Heroku. It wasn’t too hard, but it did take a few tricks to get Spree running on a server that doesn’t allow you to write to the file system.

I can’t say I have too much hands-on experience with Spree yet, but it seems to be have borrowed its extension concept from Radiant CMS, which happens to be one of my areas of expertise. So I put together an extension for Spree that will easily allow you to deploy the e-commerce system to Heroku.

Just follow the instructions in the README on Github.

7 thoughts on “Hosting a Spree webshop on Heroku

  1. Hey Casper!

    Thanks for a great blog post. I followed the steps in the instructions, and it works perfectly.

    However, I would like to clone the spree source code, install the heroku extension, and deploy to Heroku.

    When I try this, I get an error saying

    “/usr/local/lib/ruby/1.8/fileutils.rb:1262:in `initialize’: Read-only file system”

    I followed the exact same steps as for the spree gem. Do you have any ideas why this does not work?

    Thanks a lot!

  2. Hi Magne,

    Glad you could use it. As for the error you get when cloning the Spree master repository, it could be for a number of reasons. Obviously the error is related to some code trying to write to disk, but as you haven’t included the stacktrace, I can’t see where it happens. Most likely it is Rails trying to cache some stylesheets or javascripts.

    I have patched one specific error related to that I got with the 0.9.1 gem, but this can easily have changed in the “edge” version of Spree you get by cloning the repository. I will upgrade my extension to work with 0.9.2 when I have the time (perhaps it already does, you tell me?), but I can’t really play catch up with the edge version of Spree ;)


  3. Hi Magne,

    Sorry to keep you waiting a bit longer this time. Nothing is clear from the stacktrace, since for the interesting part is just says ” … 34 levels…” ;)

    However, I’d guess that it is trying the write the blank_iframe.html file – or perhaps delete it? Do you have some sort of extension that tries to generate this file perhaps?


  4. Well, I’m pretty sure it works just like plugins: By default, all extensions are loaded alphabetically, and if you want it any other way you must specify the extensions you want to load in the config.

    So, and I have not tested this, you could probably put something like this in your config/development.rb:

    config.extensions = [:site, ... (other extensions, but not :heroku)]

    Hope this helps :)

  5. hi there, thanks for this post. I am not a programer but would like to have my own site with spree on heroku.
    I am having trouble getting started on Heroku. the main reason i am using Heroku, is because i like spree. can you help me with a step by step on how to load spree on heroku. I have a mac.
    I have done a lot of php stuff, i have a few website but never on heroku.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>