2

Trying to bundle install a gem from github (The author has not updated the gem on rubygems.org for whatever reason...) in AWS Elastic Beanstalk but I receive the following error:

Command failed on instance. R
         (TRUNCATED)...nd `git clone "https://github.com/Diego81/omnicontacts.git"

Here's the code in my gemfile

gem 'omnicontacts', git: "https://github.com/Diego81/omnicontacts.git"

Other things i've tried...

gem 'omnicontacts', git: "git://github.com/Diego81/omnicontacts.git"

gem 'omnicontacts', github: "Diego81/omnicontacts"

Still the same error with everything I've tried. I've also tried this with other gems and I receive the same error. I should also note, this works perfectly on my local machine, it seems to be an issue with Elastic Beanstalk.

Marwan Kodeih
  • 113
  • 1
  • 6

2 Answers2

2

Ok I solved this by installing git on my EC2 instance. Just ssh into your instance and run the following:

sudo yum install git

and that should fix the problem.

Marwan Kodeih
  • 113
  • 1
  • 6
2

I prefer this answer which adds Git to .ebextensions. That way if I have e.g. a production server and a staging server, I don't have to separately SSH into both, I can just deploy to each and Git will be installed automatically.

The ebextensions approach also seems more durable. If for some reason I need to spin up a new server instance in the future, I'd rather have the configuration saved as code than have to remember what the configuration is supposed to be and then manually implement the configuration.

I was able to get what I needed by creating a file called .ebextensions/ruby.config with the following content:

packages:
  yum:
    git: []
Jason Swett
  • 43,526
  • 67
  • 220
  • 351