Entries tagged with “capistrano”.
Did you find what you wanted?
Mon 27 Jun 2011
Problem
After changing the IP address of your staging server the cap deploy does not work any more and gives you the following error:
** [192.168.0.50 :: err] Host key verification failed.
** [192.168.0.50 :: err] fatal: The remote end hung up unexpectedly
Solution
You would need to login to your staging server (as your deployment user) and do an initial checkout for one time for the ssh keys to work.
So you could do something like the following:
$ ssh user_name@staging_server
$sh -c 'git clone -q git_user@192.168.0.50:repo_name /some/tmp/dir/temp_repo_name
Make sure that you reply ‘y’ to the question about the authenticity of the host as in:
The authenticity of host '192.168.0.50 (192.168.0.50)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xxb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.50' (RSA) to the list of known hosts.
Net delete the newly created git project from your tmp directory, and then you should be able to use cap deploy as normal again from your development pc
Fri 4 Mar 2011
Problem
You would like to have colours in the output of your capistrano tasks similar to the ones in cucumber, indicating errors (red) or completed actions(green).
Solution
Install the capistrano_colours gem that can be found here.
sudo gem install capistrano_colors
Thu 10 Feb 2011
Problem
After the announcements in the previous posts about the security vulnerabilities in Rails 3.0.3, you would like to update your application and deploy with the latest 3.0.4 version.
Solution
- Change your Gemfile to replace
gem 'rails', '3.0.3'
with
gem 'rails', '3.0.4'
- Run:
bundle update rails
- Remove the old gems by using:
git status
and then
git rm name_of_3.0.3_gem
- Add the new gems to your git
git add vendor/cache
- Check in to your repository the new files
git commit vendor/cache -m 'upgrade to rails 3.0.4'
- Make sure that you also check in both your Gemfile and Gemfile.lock into your git repository
git commit Gemfile Gemfile.lock -m 'update Gemfiles to use 3.0.4'
otherwise when you try to deploy you will see the error:
You have modified your Gemfile in development but did not check the resulting snapshot (Gemfile.lock) into version control
- push everything to your git repository:
git push
- Deploy your application with capistrano as usual:
cap deploy
- Your new gems for 3.0.4 should be installed on the share/bundle folder
Thu 13 Jan 2011
Problem
You want to deploy your Rails 3.0.3 in Dreamhost with capistrano, but even though you follow the steps from a previous post here, when you go to the application’s main page you still get an error:
500 Internal Server Error
Solution
Thanks to a blog post from Brendon Wilson here, the last missing piece from the puzzle in order to have your application running is to add the following line to the top of your deploy.rb file:
require 'bundler/capistrano'
and redo your cap deploy.
Thanks Brendon.
Thu 13 Jan 2011
Problem
You want to deploy your Rails (3.0.3) application to Dreamhost using Capistrano, but you get errors like:
bundle command not found
or
Enter your password to install the bundled RubyGems to your system:
Solution
You may be able to see in your deploy.rb file a commented section that says the following:
As Capistrano executes in a non-interactive mode and therefore doesn’t cause
any of your shell profile scripts to be run ….
So in order for capistrano to be able to find your bundle command you should add in your deploy.rb file a line with your paths (ie):
default_environment['PATH']='/usr/lib/ruby/gems/1.8/bin:/home/your_name/.gems/bin:/usr/local/bin:/usr/bin:/bin'
If you have the previous line your bundle command can run, but if you try to do cap:deploy your bundler will probably give you an error as it would ask for your sudo password. In order to avoid this error and to make it work you have to add another line with your gem path (ie):
default_environment['GEM_PATH']='/home/your_name/.gems:/usr/lib/ruby/gems/1.8'
making sure that your home directory path for your gems is first in the list.
Fri 8 Oct 2010
Problem
You have set up your capistrano recipe for deployment to dreamhost using password less logins, but after dreamhost moves your git repository server to a different server, the deployment breaks, with ‘permission denied’ when trying to get the git repository.
Solution
As the server was moved you would need to copy your ssh public key from the deployment server to the new server again for the password-less logins to work again.
Follow the details here how to copy your public key across, login in once with your password, and after that your capistrano recipe should be working again as normal.
Mon 20 Sep 2010
Problem
You want to deploy your project in a server (dreamhost), that also hosts your git repository. When you try to do that by only setting the set_repository, you get errors like ‘permission denied, please try again’, even though if you try to checkout the git repository on your server works.
Solution
Set your :repository as a file in your host as in:
set :repository, "file:///home/username/git_on_server/projects/repo_name.git"
Then also set up your local_repository, as in:
set :local_repository, "user_name@server_domain_name:/home/username/git_on_server/projects/repo_name.git"
Mon 24 Aug 2009
Problem
Trying to deploy in dreamhost with capistrano you get the error:
RubyGem version error: rack(0.3.0 not ~> 1.0.0)
Solution
Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:
gem install rack
That assumes that you have followed the instructions for setting up your local gems in dreamhost (here) and you already have a ~/username/.gems directory.
You may probably need to also add the following to your config/environment.rb :
ENV['GEM_PATH'] = ‘/home/USERNAME/.gems’
Note 09-Sep-2009
It seems that according to the dreamhost wiki we need to add the following to the config/environment.rb, instead of the line above:
if ENV['RAILS_ENV'] == ‘production’
ENV['GEM_PATH'] = ‘/home/USERNAME/.gems’
require ‘/home/USERNAME/.gems/gems/rack-1.0.0/lib/rack.rb’
end
to use the locally installed rack-1.0.0 gem, instead of the rack installed by dreamhost.
Wed 17 Sep 2008
Problem
With the imminent upgrade in Dreamhost to Rails 2.1.1 (dreamhost blog post here), you may want to freeze your Rails version to a previous version, using capistrano.
Solution
On your local development pc freeze the rails:
rake rails:freeze:gems
Add the new code to your svn repository:
svn commit -m 'freeze rails'
And then deploy to dreamhost using capistrano:
cap deploy
Your rails project located on dreamhost should be frozen to your current Rails version.
Wed 16 Jul 2008
Posted by kosmas under ruby on rails
No Comments
Problem
You are developing on the latest version of Rails (2.1), but your production server for deployment uses version 2.0.2 (as dreamhost is using at the moment).
Solution
- First change the environment.rb file to use the rails version in your deployment server
RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
- You should probably be geting the error: undefined method = time zone by now, so make sure you comment out from further down your environment.rb file the line:
config.time_zone = 'UTC'
- Some further errors would be caused by the file config/initializers/new_rails_defaults.rb, so make sure you comment out the following lines:
ActiveRecord::Base.include_root_in_json = true
ActiveRecord::Base.store_full_sti_class = true
ActiveSupport.use_standard_json_time_format = true
ActiveSupport.use_standard_json_time_format = true
You should be able to deploy and use your application now.