Forum: Ruby on Rails SSH, Capistrano, PATH, Mac OS X

3f36930861da297c00822a2f1df4b163?d=identicon&s=25 aiwilliams (Guest)
on 2006-08-29 17:43
(Received via mailing list)
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
D85d44a0eca045f40e5a31449277c26c?d=identicon&s=25 Ben Marini (bmarini)
on 2006-08-29 17:50
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?
3f36930861da297c00822a2f1df4b163?d=identicon&s=25 aiwilliams (Guest)
on 2006-08-29 18:27
(Received via mailing list)
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$
3f36930861da297c00822a2f1df4b163?d=identicon&s=25 aiwilliams (Guest)
on 2006-08-30 02:59
(Received via mailing list)
Any clues Ben? Anyone? Perhaps I need to make Capistrano allow
configuration of server path? Hate that.
0bcc972918891ef358b0b3dfb4e7f18b?d=identicon&s=25 Hammed Malik (Guest)
on 2006-08-30 04:41
(Received via mailing list)
I had this same problem :

http://thread.gmane.org/gmane.comp.lang.ruby.rails...

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

Hammed
3f36930861da297c00822a2f1df4b163?d=identicon&s=25 aiwilliams (Guest)
on 2006-08-30 17:29
(Received via mailing list)
Hammed Malik wrote:
> I had this same problem :
>
> http://thread.gmane.org/gmane.comp.lang.ruby.rails...
>
> 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
B0a4285bfc440a2efad5036bb95d68a9?d=identicon&s=25 Chad Burt (underbluewaters)
on 2007-03-26 20:13
Just so nobody else starts yelling obscenities:
Make sure you edit sshd_config, not ssh_config.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.