Reputation: 11
Hate to ask this question - it seems like it should be easier, but I'm stumped at this point... I am trying to do an initial install of a Rails app using Capistrano to a Digital Ocean droplet. This is a vanilla Rails app and runs fine on my local (Windows) machine with PG installed. However, when I run:
cap production deploy:initial
It starts to run but fails - buried in the middle is this message:
rake stdout: rake aborted! Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add
gem 'pg'
to your Gemfile (and ensure its version is at the minimum required
Now, the pg gem is in my gem file. When I run bundle install
inside the release directory, the bundler runs just fine, but then when I run bundle which
, pg is not present in the list.
bundle list Gems included by the bundle: * actionmailer (4.1.8) * actionpack (4.1.8) * actionview (4.1.8) * activemodel (4.1.8) * activerecord (4.1.8) * activesupport (4.1.8) * arel (5.0.1.20140414130214) * autoprefixer-rails (6.3.6) * babel-source (5.8.35) * babel-transpiler (0.7.0) * bootstrap-sass (3.2.0.2) * builder (3.2.2) * bundler (1.12.4) * coffee-rails (4.0.1) * coffee-script (2.4.1) * coffee-script-source (1.10.0) * connection_pool (2.2.0) * erubis (2.7.0) * execjs (2.6.0) * hike (1.2.3) * i18n (0.7.0) * jbuilder (2.4.1) * jquery-rails (3.1.2) * json (1.8.3) * mail (2.6.4) * mime-types (3.0) * mime-types-data (3.2016.0221) * minitest (5.8.4) * multi_json (1.12.0) * puma (3.4.0) * rack (1.5.5) * rack-test (0.6.3) * rails (4.1.8) * railties (4.1.8) * rake (11.1.2) * rdoc (4.2.2) * react-rails (1.7.1) * sass (3.2.19) * sass-rails (4.0.5) * sdoc (0.4.1) * sprockets (2.12.4) * sprockets-rails (2.3.3) * thor (0.19.1) * thread_safe (0.3.5) * tilt (1.4.1) * turbolinks (2.5.3) * tzinfo (1.2.2) * uglifier (3.0.0)
I feel like this is something really simple but this is my first time doing a deploy of a Rails app and I've spent more hours than I care to admit trying to nail this down. I've also run bundle config build.pg --with-pg-config=/usr/bin/pg_config
as recommended on another SO answer and I've independently run gem install pg
.
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.8'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'execjs'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'react-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
gem 'jquery-rails'
group :development do
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-puma', require: false
end
gem 'puma'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Anyone have any ideas?
Upvotes: 0
Views: 327
Reputation: 11
Found it thanks to @kasperite's help!
In my local Gemfile.lock (on Windows, which was getting pushed to GitHub and then pulled for the deployment to the Ubuntu server) I had this line:
pg (0.18.4-x86-mingw32)
Once I changed that to:
pg (0.18.4)
And pushed to GitHub, it actually did do the install on the droplet and the deployment proceeded. (Got a different error, but that's progress.)
So, if you're developing on Windows with Rails+PG and deploying to Ubuntu (or anything not Windows, I assume), your lock file will have the Windows pg gem listed but you need the "vanilla" one.
Upvotes: 1