0

I am trying to create a tiny shell script that will deploy a Rails app by first rsync'ing, then running the bundle command remotely via ssh. My shell script looks like this:

#!/bin/bash

REMOTE_SERVER="myserver.com"
REMOTE_USER="me"
REMOTE_PATH="/home/me/"
BUNDLE_PATH="/usr/local/rvm/gems/ruby-2.0.0-p353/bin/bundle"

# Step 1: Rsync
rsync -ave ssh --exclude-from '.ignore' ./ $REMOTE_USER@$REMOTE_SERVER:$REMOTE_PATH

# Step 2: Bundle
ssh $REMOTE_USER@$REMOTE_SERVER "cd $REMOTE_PATH && $BUNDLE_PATH install"

Rsync'ing works fine but when RVM is involved, the bundle line throws the following error:

/usr/bin/env: ruby_executable_hooks: No such file or directory

So, I'm wondering ... Is it possible to run the bundle (and other commands like rake) as part of a single ssh command?

If it matters, the remote server is running Ubuntu 14.

Callmeed
  • 4,972
  • 5
  • 34
  • 49
  • Check this thread, maybe can help you: http://stackoverflow.com/questions/18936933/bundle-update-env-ruby-executable-hooks-no-such-file-or-directory – edymerchk Jul 24 '14 at 03:11
  • My test server already has executable-hooks 1.2.6. Also, when I try the commands from that thread, I get permission denied errors. Do I need to run them as root? – Callmeed Jul 24 '14 at 04:20

1 Answers1

-1

This problem has already been solved by the community. It's called Capistrano.

http://capistranorb.com/

pixelearth
  • 13,674
  • 10
  • 62
  • 110
  • No offense, but I downvoted you because your answer completely ignored my question. The project that prompted this question is, in fact, an exercise in trying to deploy an app WITHOUT a large tool like Capistrano (which, btw, I've been using since pre-version 1 so I'm quite familiar with it). With version 3, Capistrano bills itself as a "multi-server automation tool". Sometimes, I don't need that. – Callmeed Jul 24 '14 at 16:55