SSH, Capistrano, PATH, Mac OS X

Gentlefolk,

I need help. When I run my Capistrano script, none of svn, rake,
mongrel_rails are availble to the ssh process. When I login myself,
using the username that Capistrano is using, it’s all there. I added an
explicit PATH export to one of the tasks, which made that task work,
but I can’t easily control update_code, and I don’t want to.

I have modified my .bashrc, .bash_profile, .profile… all to no
avail. Even messed with .ssh/environment. I can ‘ssh themac.hostname
svn -help’, no problem. Aaahh!!

Thank you,

aiwilliams

aiwilliams wrote:

Gentlefolk,

I need help. When I run my Capistrano script, none of svn, rake,
mongrel_rails are availble to the ssh process. When I login myself,
using the username that Capistrano is using, it’s all there. I added an
explicit PATH export to one of the tasks, which made that task work,
but I can’t easily control update_code, and I don’t want to.

I have modified my .bashrc, .bash_profile, .profile… all to no
avail. Even messed with .ssh/environment. I can ‘ssh themac.hostname
svn -help’, no problem. Aaahh!!

Thank you,

aiwilliams

What is the actual output you are getting?

Any clues Ben? Anyone? Perhaps I need to make Capistrano allow
configuration of server path? Hate that.

I had this same problem :

http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376

I got it working after putting the PATH in the .ssh/environment file.

Hammed

Hammed M. wrote:

I had this same problem :

http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376

I got it working after putting the PATH in the .ssh/environment file.

Thank you, Hammed. I had done that long ago, but it turns out that I
lacked the knowledge of sshd that I needed. Not only do you need that
~/.ssh/environment file, you will also want to ensure that
/etc/sshd_config has ‘PermitUserEnvironment’ set yes. Otherwise
sshd will not read your ~/.ssh/environment settings.

Also of potential interest, I discovered that you can theoretically set
options, like ‘environment=“PATH=/opt/local/bin”’ in the public key on
the server, as documented when you man sshd. I tried that, but it did
not seem to work. The man page seems to indicate that sshd determines
the prescense of options by looking to see if the key line begins with
a number, which it cannot with SSH Version 2 - it has [options]
key-type base64.

Thanks again.

aiwilliams

Just so nobody else starts yelling obscenities:
Make sure you edit sshd_config, not ssh_config.

Ben Marini wrote:

What is the actual output you are getting?

adam-williams-computer:~/Documents/workspace/myapp aiwilliams$ rake
remote:cold_deploy
(in /Users/aiwilliams/Documents/workspace/myapp)
loading configuration
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb
loading configuration ./config/deploy.rb
loading configuration
#Proc:0x00771a70@/opt/local/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.0/lib/mongrel_cluster/recipes.rb:1

  • executing task cold_deploy
  • executing task deploy
    ** transaction: start
  • executing task update_code
  • querying latest revision…
  • executing “if [[ ! -d /var/www/apps/myapp/releases/20060829161326
    ]]; then\n svn co -q -r1929 http://repository/trunk
    /var/www/apps/myapp/releases/20060829161326 &&\n (test -e
    /var/www/apps/myapp/revisions.log || touch
    /var/www/apps/myapp/revisions.log && chmod 666
    /var/www/apps/myapp/revisions.log) && echo date +\"%Y-%m-%d %H:%M:%S\" $USER 1929 20060829161326 >>
    /var/www/apps/myapp/revisions.log;\n fi”
    servers: [“server.ws”]
    [server.ws] executing command
    ** [out :: server.ws] bash: line 2: svn: command not found
    command finished
    *** [update_code] transaction: rollback
  • [update_code] rolling back
  • executing “rm -rf /var/www/apps/myapp/releases/20060829161326”
    servers: [“server.ws”]
    [server.ws] executing command
    command finished
    rake aborted!
    command “if [[ ! -d /var/www/apps/myapp/releases/20060829161326 ]];
    then\\n svn co -q -r1929 http://repository/trunk
    /var/www/apps/myapp/releases/20060829161326 &&\\n (test
    -e /var/www/apps/myapp/revisions.log || touch
    /var/www/apps/myapp/revisions.log && chmod 666
    /var/www/apps/myapp/revisions.log) && echo date +\"%Y-%m-%d %H:%M:%S\" $USER 1929 20060829161326 >>
    /var/www/apps/myapp/revisions.log;\\n fi” failed on
    server.ws

(See full trace by running task with --trace)
adam-williams-computer:~/Documents/workspace/myapp aiwilliams$