Radiant is an excellent Rails-based Content Management System (CMS). It was created by John W. Long and Sean Cribbs, and has been around for a couple of years, growing steadily in popularity. With the recent addition of taps and gem manifests, it’s super-easy to get this lightweight CMS up and running on Heroku.
Start by installing the latest radiant gem on your local box:
$ sudo gem install radiant
Now use the radiant command-line tool to set up your Radiant CMS locally. We’ll use SQLite as the local database:
$ radiant --database sqlite mycms $ cd mycms $ rake db:bootstrap
Before we can push to Heroku, we’ll need to initialize a git repo in our project directory:
$ git init
By default, Radiant caches CMS pages in RAILS_ROOT/cache. This won’t work with Heroku’s read-only file system, so before deploying we’ll change it to make sure cached files are written in the tmp directory. Open up your config/environment.rb, and change the cache config line so it reads:
config.action_controller.page_cache_directory = "#{RAILS_ROOT}/tmp/cache"
We’ll also add a gem manifest to make sure the radiant gem is installed on Heroku when we push. Radiant depends on rSpec 1.2.2, so our .gems file should look like this:
rspec --version 1.2.2 radiant --version 0.7.1
Then commit your changes:
$ git add . $ git commit -m "changed cache dir and added gem manifest"
Now it’s time to create an app on Heroku and deploy this baby to it.
$ heroku create Created http://vivid-fog-54.heroku.com/ | git@heroku.com:vivid-fog-54.git Git remote heroku added $ git push heroku master .... -----> Heroku receiving push -----> Rails app detected Compiled slug size is 5.4MB -----> Launching.......... done App deployed to Heroku
Finally, we’ll transfer over our local database using taps:
$ heroku db:push Auto-detected local database: sqlite://db/development.sqlite3 Sending schema Sending data 9 tables, 57 records schema_migrat: 100% |==================| Time: 00:00:00 config: 100% |==================| Time: 00:00:00 page_parts: 100% |==================| Time: 00:00:00 extension_met: 100% |==================| Time: 00:00:00 sessions: 100% |==================| Time: 00:00:00 pages: 100% |==================| Time: 00:00:00 snippets: 100% |==================| Time: 00:00:00 layouts: 100% |==================| Time: 00:00:00 users: 100% |==================| Time: 00:00:00 Sending indexes
And now our Radiant instance is live and ready to go!