Two versions of gems in production rails deploymen

2019-07-22 01:39发布

问题:

I think i have some issues with my gemfile in production, as it differs from my development, which i believe is causing my deployment (Capistrano) to fail, well at bundle install time at least

Development

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
bundler (1.3.4)
capistrano (2.14.2, 2.12.0)
climate_control (0.0.3)
cocaine (0.5.1, 0.2.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2, 1.3.3)
commonjs (0.2.6)
daemon_controller (1.1.2, 1.0.0)
daemons (1.1.9)
database_cleaner (0.9.1, 0.8.0)
devise (2.2.3)
diff-lcs (1.2.2, 1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
fastthread (1.0.7)
ffi (1.6.0, 1.3.1)
font-awesome-rails (3.0.2.0)
highline (1.6.16, 1.6.13)
hike (1.2.1)
i18n (0.6.4, 0.6.1)
journey (1.0.4)
jquery-rails (2.2.1, 2.0.2)
json (1.7.7, 1.7.6)
less (2.3.1, 2.2.1)
less-rails (2.3.2, 2.2.3)
libv8 (3.11.8.17 x86_64-linux, 3.3.10.4 x86_64-linux)
listen (0.7.3, 0.7.2)
mail (2.4.4)
mime-types (1.22, 1.19)
multi_json (1.7.2, 1.5.0)
mysql2 (0.3.11)
nested_form (0.3.1, 0.3.0)
net-scp (1.1.0, 1.0.4)
net-sftp (2.1.1, 2.0.5)
net-ssh (2.6.6, 2.5.2)
net-ssh-gateway (1.2.0, 1.1.0)
orm_adapter (0.4.0)
paperclip (3.4.1, 3.1.4)
passenger (3.0.19, 3.0.14)
polyglot (0.3.3)
rack (1.4.5, 1.4.4)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.4, 10.0.3)
rb-inotify (0.9.0, 0.8.8)
rb-readline (0.4.2)
rdoc (3.12.2, 3.12)
ref (1.0.4)
rmagick (2.13.2, 2.13.1)
rspec (2.11.0)
rspec-core (2.13.1, 2.11.1)
rspec-expectations (2.13.0, 2.11.1)
rspec-mocks (2.13.0, 2.11.1)
rspec-rails (2.13.0, 2.11.0)
rubygems-bundler (1.1.1)
rvm (1.11.3.6)
sass (3.2.7, 3.1.20)
sass-rails (3.2.6, 3.2.5)
sprockets (2.1.3)
therubyracer (0.11.4, 0.10.1)
thor (0.14.6)
tilt (1.3.6, 1.3.3)
treetop (1.4.12, 1.4.10)
twitter-bootstrap-rails (2.2.6, 2.1.1)
tzinfo (0.3.37, 0.3.33)
uglifier (1.3.0, 1.2.6)
warden (1.2.1)
will_paginate (3.0.4)

Production

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
bundler (1.1.4, 1.1.3)
capistrano (2.12.0)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
commonjs (0.2.6)
daemon_controller (1.0.0)
daemons (1.1.9)
database_cleaner (0.8.0)
devise (2.2.3)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
fastthread (1.0.7)
ffi (1.3.1)
font-awesome-rails (3.0.2.0)
highline (1.6.13)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.6)
less (2.2.1)
less-rails (2.2.3)
libv8 (3.3.10.4 x86_64-linux)
listen (0.7.2)
mail (2.4.4)
mime-types (1.19)
multi_json (1.5.0)
mysql2 (0.3.11)
nested_form (0.3.0)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
orm_adapter (0.4.0)
paperclip (3.1.4)
passenger (3.0.14)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.4)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.3, 0.9.2.2)
rb-inotify (0.8.8)
rb-readline (0.4.2)
rdoc (3.12)
rmagick (2.13.1)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.1)
rspec-mocks (2.11.1)
rspec-rails (2.11.0)
rubygems-bundler (1.0.3, 1.0.2)
rvm (1.11.3.5, 1.11.3.3)
sass (3.1.20)
sass-rails (3.2.5)
sprockets (2.1.3)
therubyracer (0.10.1)
thin (1.5.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
twitter-bootstrap-rails (2.1.1)
tzinfo (0.3.33)
uglifier (1.2.6)
warden (1.2.1)

Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem 'mysql2'

#Devise Gem
gem "devise", "~> 2.2.3"

#for uploading files  
gem "paperclip", "~> 3.0"
gem 'rmagick'

#Nested Form
gem "nested_form"

#need this for rails 3
gem 'rb-readline'

#Pagination
gem 'will_paginate', '~> 3.0.0'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'less-rails'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platform => :ruby

  gem 'uglifier', '>= 1.0.3'
end

#js stuff:
gem 'execjs'
gem 'jquery-rails'
gem 'twitter-bootstrap-rails'

gem "font-awesome-rails"

#gem to allow running on ubuntu server
gem 'therubyracer'


group :development do
  gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'
  gem 'rb-inotify', '~> 0.8.8'
end


group :test, :development do
  gem 'rspec-rails'
  #adding database cleaner for tests
  gem 'database_cleaner'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
group :production do
  gem 'thin'
  gem 'pg'
end

# Deploy with Capistrano
  gem 'capistrano'

#run with passenger
  gem 'passenger'

The problem i am getting is when deploying the application cannot find the will_paginate gem. Am i correct in saying that it looks like i have two gemsets trying to work here? Im not quite sure, dont want to mess up my production environment so thought best to get some advice on this one

回答1:

If it is working in development environment in your machine, then i think you should push your Gemfile.lock along with your code and deploy the application. Then "bundle install" in your production environment also installs the same gems versions as in your development environment.



回答2:

You need in your deploy.rb

require "bundler/capistrano"

set :bundle_cmd, '/path/to/bundle'

So bundler will install all necessary gems automatically.

Otherwise you need to do it manually.