by Ryan Walker

Upgrading to latest Nesta and deploying to Heroku

I want to shut down my slicehost server and move apps to Heroku. One of the apps I have on the server is this blog. So I figure I’d update to latest version, as the Nesta page mentions deploying to Heroku.

My process:

  • extract the UI customizations into a Nesta theme.
  • extract the functionality customizations into a Nesta plugin where I generate some links content link from my Delicious account.
  • delete my old Nesta fork, and refork the latest as a private repository

Once my theme and plugin were completed, and I forked the latest nesta, here’s what I typed:

git clone git://github.com/ryw/nesta.git
cd nesta
bundle install
cp config/config.yml.sample config/config.yml
bundle exec rake setup:sample_content
bundle exec shotgun config.ru
open http://localhost:9393

So Nesta is working, but I need to get three things in there:

  • My content – easy, just copied the content directory in from my old version
  • My theme – git clone https://github.com/ryw/nesta-theme-rywalker themes\rywalker then add theme: rywalker to the config\config.yml file
  • My plugin – git clone https://github.com/ryw/nesta-external-links plugins\nesta-external-links

In case you hadn’t heard, Heroku doesn’t support Git submodules, so after cloning I ran:

rm -rf `find . -mindepth 2 -name .git`

which removed the .git directories created by the cloning, and I was then able to toss it all into my new private Nesta repository (not ideal, as the process for updating to latest versions of plugins or themes becomes a bit of a pain.)

Then to push it out to Heroku:

heroku create --stack bamboo-mri-1.8.7
rake heroku:config
git push heroku master

I actually had this issue with Ruby 1.9.2 barfing on my content, so I stuck with 1.8.7.

Getting custom DNS working was a snap after updating my DNS entries to point to Heroku:

heroku addons:add custom_domains
heroku domains:add rywalker.com
heroku domains:add www.rywalker.com

However I didn’t like that it was serving the site at both http://www.rywalker.com and http://rywalker.com, so I tossed in rack-rewrite by adding gem "rack-rewrite" to Gemfile, bundle install, then adding this to my config.ru

require 'rack/rewrite'
use Rack::Rewrite do
  r301 %r{.*}, 'http://rywalker.com$&', :if => Proc.new {|rack_env|
    rack_env['SERVER_NAME'] != 'rywalker.com'
  }
end

Not too bad at all, a few hours of work and I’m one step closer to shutting down the Slicehost VPS :)


Filed under Heroku Nesta CMS Sinatra