A place where the Joyent community can gather, help each other out, and stay informed.
You are not logged in.
Pages: 1
Capistrano fills a much needed whole in the Ruby on Rails universe: making deployments sensable and easy. But, there are some things you need to put in place to make Capistrano work properly. If you've trying to deploy your app and get "Command not found" errors, keep reading.
Capistrano relies heavily on SSH, Subversion, and sudo. As a developer I'm sure you've already got a good SVN repo someplace, so we'll look just at SSH and sudo.
Setting up sudo
In the Solaris world we don't use sudo, instead we use a much more robust method known as RBAC (Role-Based Access Control). I've blogged about this in the past, its really powerful: http://www.cuddletech.com/blog/pivot/entry.php?id=362
Reguardless, most people are used to sudo on Mac OS X or Linux and want to just stick with it, besides the fact that Capistrano's default recipes call for it, so you'll want to make sure that you update the "sudoers" file in: /opt/csw/etc. By default we include the "admin" account. If your deploying as some other user you'll want to add them to that file before you attempt a deployment.
SSH Environments
You think everything is setup, everything should work, you 'rake deploy' and are greated with a slew of "Command not found" errors after which Rake aborts. The problem is somewhat obvious, it can't find the "svn" command, "sudo" or something else. But if you try to update your .bash_profile or .bashrc you may still not fix the problem. What then?
The answer is to use a little known capability of SSH, to insert enviromental variables in $HOME/.ssh/environment. You do not need to export the var, just insert a single line like this:
PATH=/opt/csw/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/ccs/bin:/blah/blah/blah
Add whatever you want to that path. You can add other variables to the file in the same way.
BUT! Thats not enough. You need to edit your sshd_config or SSH won't even read that file. So, as root edit /etc/ssh/sshd_config and add the following line to the end of the file:
PermitUserEnvironment yes
Now restart SSH for it to take effect:
$ svcadm restart network/ssh
$ svcs network/ssh
STATE STIME FMRI
online 16:34:47 svc:/network/ssh:default
Presto chango. Now try your deployment again.
Offline
Is there a way to set an alias in this $HOME/.ssh/environment file? I am not sure what shell syntax to use here. The reason for this is to have my Capistrano user use the GNU ln (gln) instead of the solaris ln to make the soft links. For now I have overwritten the 3 functions that use ln but I would prefer an alias solution if there is one.
Offline
I'm having the same problem with Capistrano and the 'ln' command. What seems to be happening in ssh non-interactive mode is that even though my .bashrc file is being sourced (I tested this by addding an echo command to that file and am seeing the output) my aliases are not getting recognized.
Example:
alias ln='gln'
that works fine in interactive mode but not in non-interactive mode. I cannot seem to find a config setting ssh or sshd that might be affecting this. Does anyone have any idea how I can get my aliases working in non-interactive mode. I'm running on an Accelerator btw.
Offline
I think you just need to add the /opt/csw/gnu directory to your path first so you get all of the gnu tools. That directory has all of the symlinks to map to the gnu tools. for example
[geobliki:/opt/csw/gnu] linda$ ls -lrt l* lrwxrwxrwx 1 root root 10 Oct 27 2006 ls -> ../bin/gls* lrwxrwxrwx 1 root root 15 Oct 27 2006 logname -> ../bin/glogname lrwxrwxrwx 1 root root 14 Oct 27 2006 locate -> ../bin/glocate* lrwxrwxrwx 1 root root 10 Oct 27 2006 ln -> ../bin/gln* lrwxrwxrwx 1 root root 10 Oct 27 2006 ld -> ../bin/gld*
Last edited by lderezinski (2007-07-30 22:10:36)
Online
that path doesn't exist on my Accelerator. I solved it by doing the following:
in my .bashrc file I added:
#gln needs to be in your path. .ssh/environment
alias ln='gln'
#I added the expand_aliases option. Without this your ssh client will not expand aliases and will try and use ln instead of gln.
shopt -s expand_aliases cdspell extglob progcomp
from your local machine you can give it a spin:
ssh you@yourdomain.com lnso now capistrano will use gln.
Offline
Pages: 1