On clean server builds, the deploy scripts fail because bundler is not installed #14

wants to merge 1 commit into


None yet

6 participants


The setup should ensure that bundler is installed otherwise the deploy scripts will fail.

Alternatively there could be documentation which should say that bundler is a prerequisite.


Your concern is in the right place but I'm not sure about this solution. Often, the gem install command will require sudo privileges. And also, multiple versions of Ruby are now popular though RVM, rbenv or other methods. Each of those versions needs bundler. So just running "gem install" might give an illusion that it is enough when if fact it's not.

Maybe there could be a "doctor" command which could perform a couple of checks on your server and report if anything is missing. I want to leave the process of actually installing stuff out of git-deploy.


are the hooks run by the same user that pushed? I'm getting a bundler error, even though I know bundler is installed for the user I'm ssh'ing/pushing with. If I run the hook on the server using ./before_restart, it runs fine.


Yes hooks are run as same user that you ssh with. However your environment (such as PATH) might be different. See my other comment


Fantastic, thanks!

Update: ok I thought I would be able to fix it myself, but env is way off between the two. PATH looks to be the same, but the hook env is missing all of the rvm_ prefixed variables and some others like GEM_PATH. One of those must be the problem. Is there a way to get those to be the same by sourcing .bash_profile or initialize rvm or something before the script runs?


My pull request will source the appropriate startup files for RVM or rbenv.

Bundler is only a pre-requisite if before_restart makes use of it, no? The only required softwares on the production machine are those referenced in the hooks, which might easily be rewritten to use shell script alone if a project needed no more.


having this issue as well...ubuntu 11.10 rvm system install

@mislav mislav added a commit that referenced this pull request Apr 3, 2012
@mislav don't run bash in interactive mode
First of all, we're lying - the shell isn't interactive. Second, it
causes the issue described in #30.

We'll have to find another way to support rbenv and RVM installations.

references #19, references #14

Found a solution for this. This occurred because i was using rvm and the shell is not properly initializing rvm. Recommend using rvm wrapper to set this up... for example

rvm wrapper 1.9.3 git
this will create a binary called git_ruby

modiify line 1 in deploy/before_restart as such

#!/usr/bin/env git_ruby

all is well.


Thanks for the tip, @davydotcom, solved my problem!


Closing since Ruby setup and Bundler installation is best done outside of git deploy, i.e. by a sysadmin.

@mislav mislav closed this Jul 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment