Heroku is a popular hosting choice for many developers. This guide will show you how to:
- Install and deploy Refinery on the Heroku hosting platform
endprologue.
First you need to install Refinery. To do that you need the refinerycms gem.
gem install refinerycms
Next go to Heroku.com and click “sign up” for a free account.
Now you’ve got a Heroku account, install the Heroku gem and provide your account credentials:
gem install heroku
heroku list
Now it’s time to create your Refinery application using the built in —heroku option
refinerycms myapp —heroku
NOTE: Heroku relies on Git being installed on your system. Please check or install it beforehand.
Watch the output for these lines
Creating Heroku app..
Running: cd /path/to/app/myapp && heroku create
Creating random-site-name….. done
Created http://random-site-name.heroku.com/
This will output the URL for your Heroku hosted Refinery application. Your application should now be live at http://random-site-name.heroku.com
NOTE: if you already have a refinery app you would like to deploy then just deploy as normal according to Heroku’s instructions. You do not need to run the —heroku flag, as all it does is automate some things.
If you want to use Refinery’s image and resource support you’ll need to setup storage too. Create a bucket called “my_app_production” and uncomment this line in your Gemfile (this might already be done for you):
gem ‘fog’
Next tell Heroku about your new S3 bucket.
heroku config:add S3_KEY=123key S3_SECRET=456secret S3_BUCKET=my_app_production
If you have created your bucket in a region other than ‘us-east-1’ you need to add S3_REGION=s3region also.
That’s it! Heroku will restart your site and it should be live with S3 support.
Setting the ‘Cache Menu’ setting to true will improve performance on Heroku but before doing this you will need to use the memcache addon which is free for up to 5 MB.
To add support for memcache you will need to do the following:
heroku addons:add memcache
In your Gemfile add:
gem ‘dalli’
And in your production.rb file add:
config.cache_store = :dalli_store
For more information on the memcache addon, see http://devcenter.heroku.com/articles/memcache
Simply add that gem to the Gemfile.
Make sure that you are using at least version 0.6.6 (latest at time of writing) by putting this in your Gemfile (instead of the current entry):
gem ‘acts_as_indexed’, ‘= 0.6.6’
Double check your S3_ information and make sure that the right buckets actually exist.
Try forcing s3_backend to be true by adding the following line to the end of config/environments/production.rb:
Refinery.s3_backend = true
Otherwise, hop on to the IRC Channel and ask either stevenheidel or parndt for help. Or, run heroku logs and see if you can spot the error yourself.