Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy to Heroku without installing PostgreSQL locally?

For a Rails 3.1 app, I want to develop locally using SQLite and deploy to Heroku (which requires PostgreSQL).

I've set up my gemfile with

group :development, :test do
  gem 'sqlite3'
end

I can push to Heroku successfully but the app fails with

"Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)"

If I add the pg gem to my Gemfile and run bundle install, I get:

"ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)     /opt/local/bin/ruby extconf.rb checking for pg_config . . . not found"

because I don't have PostgreSQL installed locally.

I don't want to install PostgreSQL locally.

Is there a way to deploy to Heroku without installing PostgreSQL locally?

like image 564
Daniel Kehoe Avatar asked Jan 19 '23 00:01

Daniel Kehoe


2 Answers

bundle install --without production

should do the trick. See docs for further information.

like image 157
lucapette Avatar answered Jan 22 '23 05:01

lucapette


This walks you through deploying a 3.1 app to heroku, since you already have your app built, skip to the deployment part of the video. Your issue is encountered @9.50 in the video

http://www.youtube.com/watch?v=p_3dIPgXgkg

like image 38
Dru Avatar answered Jan 22 '23 07:01

Dru