Rails 3.2.2 has been working fine in both my development environment, and on my server.
I’m trying to upgrade to 3.2.3 by changing:
gem 'rails', '3.2.2'
to
gem 'rails', '3.2.3'
then running:
bundle update
bundle
All goes well until I try to deploy to my server. During the deploy, I get this message:
An error occured while installing railties (3.2.3), and Bundler cannot continue.
Make sure that `gem install railties -v '3.2.3'` succeeds before bundling.
I have logged into the server and ran the gem install railties -v ‘3.2.3’ command and it works without problems. But the deploy always fails in the same way.
I’ve tried to delete the cache directory as shown here, but I’m not sure I’m doing that correctly. I’m using rvm on the server and my development environment.
Can anybody help point me in a direction on this?
Here’s my deploy.rb file:
require "bundler/capistrano"
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :application, "teamsite"
set :repository, "git@github.com:user/teamsite.git"
set :deploy_to, "/home/website.com/rails/application/"
set :user, "website.com"
set :scm, :git
set :use_sudo, false
default_run_options[:pty] = true
set :branch, "master"
set :scm_verbose, true
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
task :staging do
role :web, "staging.website.com"
role :app, "staging.website.com"
role :db, "staging.website.com", :primary => true
end
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
end
namespace :customs do
task :create_symlink, :roles => :app do
run <<-CMD
ln -nfs #{shared_path}/files #{release_path}/files
CMD
run <<-CMD
ln -nfs #{shared_path}/drawings #{release_path}/drawings
CMD
run <<-CMD
ln -nfs #{shared_path}/photos #{release_path}/photos
CMD
end
end
after "deploy:create_symlink","customs:create_symlink"
after "deploy", "deploy:cleanup"
Update
I was able to finally fix this by deploying to a different user. But the question still remains: How would I clear out the gem cache for the old user?
You could use
to reinstall all your gems from scratch. If you’re using passenger on your host, you will need to find out where that gem cache directory is really at. Look at the .bashrc for GEM_PATH value, mine on Dreamhost is:
Or if you’re using RVM on your server, that path is likely to the current version rvm is using.