18

This is the first time I am deploying and getting errors.

here is my deploy.rb file require 'bundler/capistrano' set :application, "app"

set :scm, :git
set :repository,  "[email protected]:myname/#{application}.git"
set :branch, "master"

server "198.12.78.92", :web, :app, :db, primary: true
set :user, "myname"
set :deploy_to, "/home/#{user}/public_html/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

 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
 end

Here is the error I am getting.

*** [deploy:update_code] rolling back
  * executing "rm -rf /home/myname/public_html/app/releases/20130313073408; true"
    servers: ["198.12.78.92"]
    [198.12.78.92] executing command
    command finished in 891ms
failed: "sh -c 'cp -RPp /home/myname/public_html/app/shared/cached-copy /home/myname/public_html/app/releases/20130313073408 && (echo dd92017bc8bb7f951df52d6a14c933e3033fd24b > /home/myname/public_html/app/releases/20130313073408/REVISION)'" on 198.12.78.92

EDIT - I have commented "set :deploy_via, :remote_cache" and now getting bundle: not found error though

1
  • I have a similar problem, where I get "bundle not found". I am pretty sure it has to do with the fact that I use RVM, and it is setup in .bashrc, which is not used when using the "sh" shell. Therefore ruby and bundle is not found even thought you would find it in an interactive shell (like bash). Working on a fix but I'm no unix guru so I have no answer just yet. However use "cap deploy:check" and "cap shell" followed by "on <target> bundle" to get some informative error messages. Mar 22, 2013 at 13:06

3 Answers 3

19

OK It seems the answer is (see my comment to your question):

Have a recent rvm installed on both your workstation and the server (I have 1.17.1).

add:

gem 'rvm-capistrano'

to your Gemfile (inside group :development as the capistrano gem)

add:

require "rvm/capistrano"
require "bundler/capistrano"

to your config/deploy.rb

That should do it

12

If using rbenv put this in .bashrc

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

before the following line to capistrano load the environment even if connect with non-interactive shell

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

probably will also work also with rvm initialization

0
10

I've had the same problems. Below is solution for RBenv and RVM.

RBENV

Install correctly RBenv. Install bundler gem. Pefrorm 'rbenv rehash'.

Add to deploy.rb or deploy/.rb

set :default_environment, { 'PATH' => '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' }

RVM

Install correctly RVM. Install bundler gem.

gem 'rvm-capistrano'

deloy.rb or deploy/.rb

require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-2.0.0-p247' # Change to your ruby version
set :rvm_type, :system # :user if RVM installed in $HOME

For further configuration info read: https://github.com/wayneeseguin/rvm-capistrano

Good luck.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.