Saturday, January 19, 2013

Deploying ruby to a server where you dont have root access

These are some notes, for posterity's sake, of things I encountered deploying ruby to a Linux server.  This is a server where I don't have sudo access and am a regular old user.  I ended up going with this route after trying to use the system-installed ruby.  The problem with that was I had trouble installing native extensions.  It was suggested to try to install a user ruby with RVM  and so I did (see this).  Here are some of the challenges I encountered.

Problem 1.  When trying to install RVM, I encountered this:
curl: (77) Problem with the SSL CA cert (path? access rights?)
Solution 1. After lots of trial and error.
echo insecure > ~/.curlrc
Reference 1.

Explanation 1. I think that when RVM moved domains, the certificates didn't get updated on this server. I don't have access to /usr/share I couldn't try most of the solutions that had to do with fixing the certificate.

After this, RVM installed.  On to getting Capistrano to run...

Problem 2. Capistrano complains about term when trying to run commands.
tput: No value for $TERM and no -T specified
Solution 2.  I solved this by setting TERM in .bashrc.  I put it as the first command.
export TERM=xterm
Reference 2. and These two didn't exactly address the command the was throughing the complaint, but they were a clue.

Problem 3. Capistrano couldn't find the bundle command to perform bundle install.  The bundle "executable" shell script was in /home/toddhitt/gems/bin (as that was where the system install put it), but it needed to be in in the rvm paty to work correctly.  E.g. /home/toddhitt/.rvm/gems/ruby-1.9.3-p362@crivens bin.  I had all sorts of problems getting this to work and also find the right gem files and the right native extensions.  In the end:

1. I removed the .gemrc file in /home/toddhitt.
2. rvm reset
3. rvm --create 1.9.3@crivens

After doing this in ssh, I was able to deploy using 1.9.3 with no errors and build the native extensions.


1 comment:

  1. This comment has been removed by a blog administrator.