Archive for the ‘heroku’ category

How to deploy a git tag to Heroku

January 26th, 2012

Simple:

git push heroku tag_name:master –force

The –force is not normally needed, but i needed it because i’d already deployed git head, so needed this to avoid git complaints

Ensuring postgres gem is installed on heroku when using Rails 3.1

January 7th, 2012

It turns out that Rails 3.1 doesn’t come with a database adapter. So, when deploying to heroku, the app will blow up unless you add the require postgres gem to your gem file:

group :production do
gem “pg”
end

group :production do

gem “pg”

end

This resolves the heroku error

/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection’: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)

Ensuring that Heroku does not install gems within the Bundler :development group

January 7th, 2012

Tonight, i ran into an issue with Heroku, where is was failing when installing a gem that i have within my :development bundler group:

group :development, :test, :cucumber do

gem ‘ruby-debug19′

end

As the clear solution was to prevent heroku installing gems that it didn’t need, i found this handy heroku command:

heroku config:add BUNDLE_WITHOUT=”development:test:cucumber”

Running this has told heroku to ignore gems that it doesn’t need, meaning the deploy worked fine. Further details: http://devcenter.heroku.com/articles/bundler

This resolves the heroku error:

Installing linecache19 (0.5.12) with native extensions /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)