Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

6 participants

@DDAZZA

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.

@mislav
Owner

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.

@ifightcrime

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.

@mislav
Owner

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

@ifightcrime

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?

@blt

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.

@davydotcom

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

@mislav mislav referenced this pull request from a commit
@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
69fb872
@davydotcom

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.

@mateomurphy

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

@mislav
Owner

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

@mislav mislav closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 9, 2011
  1. Install Bundler on setup

    Dave authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/git_deploy.rb
View
1  lib/git_deploy.rb
@@ -38,6 +38,7 @@ def setup
cmd << "sed -i'' -e 's/master/#{branch}/' .git/HEAD" unless branch == 'master'
cmd << "git config --bool receive.denyNonFastForwards false" if options.shared?
cmd << "git config receive.denyCurrentBranch ignore"
+ cmd << "gem install bundler --no-rdoc --no-ri"
end
invoke :hooks
Something went wrong with that request. Please try again.