I was having precisely the same problem today and tracked this post
down
http://blog.zerobearing.com/2009/04/27/capistrano-rake-command-not-found/

For me, it worked perfectly. One note, you have to put the entire path
in your .ssh/environment file:
PATH=/opt/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin:/usr/games # i keep /opt/ruby symlinked to my most recent
REE install

you cannot `export PATH=/opt/ruby/bin:$PATH` or anything like that.

Also, a general word of warning - make sure you keep a ssh connection
open while you're messing with the ssh_config file. You'd hate to lock
yourself out while dabbling with it. YMMV

To check the PATH that capistrano gets, I also added this temporarily
to my deploy.rb:
namespace :deploy do
  task :check_path, :roles => :db do
    run "echo $PATH"
  end
end

and then just ran `cap deploy:check_path`

take care,
timg

On Jun 6, 10:50 pm, Bharat <[email protected]> wrote:
> I am trying to automate the deployment to my production server.  The
> application is hosted on Apache 2.2/Passenger/Enterprise Ruby
> environment.  I am also using Thinking Sphinx and am trying to
> automate Reindexing operation using Whenever gem that basically writes
> the crontab file.  The deployment fails because whenever command in my
> capistrano file cannot be found on production server.  Here is the
> deploy.rb file:
>
> set :rails_root, "#{File.dirname(__FILE__)}/.."
> require "#{rails_root}/vendor/plugins/thinking-sphinx/lib/
> thinking_sphinx/deploy/capistrano"
>
> set :application, "ssfilemgr"
> set :repository, "[email protected]:harishk/ssfilemgr.git"
> #set :repository, "#{us...@#{domain}:git/#{application}.git"
>
> set :user, "bruparel"
> set :runner, "bruparel"
> set :admin_runner, runner
> #default_run_options[:pty] = true
>
> set :domain, '72.14.181.189'
> role :app, domain
> role :web, domain
> role :db,  domain, :primary => true
>
> set :deploy_to, "/home/#{user}/r_work/#{application}"
>
> set :deploy_via, :remote_cache
> set :scm, "git"
> set :branch, "master"
> set :scm_verbose, true
> set :use_sudo, false
>
> namespace :deploy do
>
>   desc "Restart Application"
>   task :restart do
>     run "touch #{current_path}/tmp/restart.txt"
>   end
>
>   desc "Cleanup older revisions"
>   task :after_deploy do
>     cleanup
>   end
>
>   desc "Update the crontab file"
>   task :update_crontab, :roles => :db do
>     run "cd #{release_path} && whenever --update-crontab #
> {application}"
>   end
>
> end
>
> after "deploy:setup", "thinking_sphinx:shared_sphinx_folder"
> after "deploy:symlink", "deploy:update_crontab"
> after "deploy:restart", "thinking_sphinx:rebuild"
>
> Here is snippet of the terminal session when I run cap deploy with the
> fail message:
>
>   * executing "find /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242/public/images /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242/public/stylesheets /home/bruparel/r_work/ssfilemgr/
> releases/20090607024242/public/javascripts -exec touch -t
> 200906070242.42 {} ';'; true"
>     servers: ["72.14.181.189"]
>     [72.14.181.189] executing command
>     command finished
>   * executing `deploy:symlink'
>   * executing "rm -f /home/bruparel/r_work/ssfilemgr/current && ln -s /
> home/bruparel/r_work/ssfilemgr/releases/20090607024242 /home/bruparel/
> r_work/ssfilemgr/current"
>     servers: ["72.14.181.189"]
>     [72.14.181.189] executing command
>     command finished
>     triggering after callbacks for `deploy:symlink'
>   * executing `deploy:update_crontab'
>   * executing "cd /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242 && whenever --update-crontab ssfilemgr"
>     servers: ["72.14.181.189"]
>     [72.14.181.189] executing command
> *** [err :: 72.14.181.189] sh: whenever: not found
>     command finished
> *** [deploy:symlink] rolling back
>
> Funny thing is when I ssh into the server and execute "whenever"
> command from "current" directory it works as shown below:
>
> ssrxgrp ~/r_work/ssfilemgr/current: whenever --update-crontab
> ssfilemgr
> [write] crontab file updated
>
> Moreover, the whenever binary is in the path too as shown below:
>
> ssrxgrp ~/r_work/ssfilemgr/current: which whenever
> /opt/ruby-enterprise/bin/whenever
> ssrxgrp ~/r_work/ssfilemgr/current:
>
> and here is the $PATH environment variable:
>
> ssrxgrp ~/r_work/ssfilemgr/current: echo $PATH
> /opt/ruby-enterprise/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
> bin:/sbin:/bin:/usr/games
>
> Why is Capistrano having trouble finding the executable then?
>
> Thanks in advance for your help.
>
> Regards,
>
> Bharat

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.co.uk/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to