Elastic Beanstalk: can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)Installing a gem from Github with BundlerSSH to Elastic Beanstalk instanceRails. Gem bundle failedbundle (Gem::LoadError)Getting error on bundle install as (Bundler could not find compatible versions for gem “bundler”)Rails bundler gem update error?bundler does not vendor/bundle :git source gemerror deploying rails app aws elastic beanstalkfind_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)Error while creating AWS Elastic Beanstalk Environment for Rails Application
Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?
How to Sow[] until I've Reap[]'d enough?
What would be the side effects on the life of a person becoming indestructible?
'wollen' said of inanimate objects ordinarily without volition
Character Frequency in a String
how to add 1 milliseconds on a datetime string?
What is wrong with this query (unexpected token: AND)
What is the spanish equivalent of "the boys are sitting"?
Why did computer video outputs go from digital to analog, then back to digital?
Why do people say "I am broke" instead of "I am broken"?
Considerations when providing money to one child now, and the other later?
Can GPL and BSD licensed applications be used for government work?
What's the 1 inch size square knob sticking out of wall?
JavaScript Sort Stack Coding Challenge
Is an easily guessed plot twist a good plot twist?
What exactly makes a General Products hull nearly indestructible?
Travelling from Venice to Budapest, making a stop in Croatia
Can 々 stand for a duplicated kanji with a different reading?
Where is this photo of a group of hikers taken? Is it really in the Ural?
What is a "staved" town, like in "Staverton"?
Why can't a country print its own money to spend it only abroad?
Found more old paper shares from broken up companies
Monty Hall Problem with a Fallible Monty
From the start of the game what is the longest possible series of consecutive white moves where white can do those moves no matter what black does?
Elastic Beanstalk: can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
Installing a gem from Github with BundlerSSH to Elastic Beanstalk instanceRails. Gem bundle failedbundle (Gem::LoadError)Getting error on bundle install as (Bundler could not find compatible versions for gem “bundler”)Rails bundler gem update error?bundler does not vendor/bundle :git source gemerror deploying rails app aws elastic beanstalkfind_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)Error while creating AWS Elastic Beanstalk Environment for Rails Application
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
This error message is a well known error message. (see https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html for example.) Although I'm getting it with a new Elastic Beanstalk application with Ruby 2.6.1, and bundler 2.0.1. The error is:
/opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:308:in `activate_bin_path'
from /opt/rubies/ruby-2.6.1/bin/bundle:23:in `<main>' (ElasticBeanstalk::ExternalInvocationError)
I've tried putting the following file: 01_install_bundler.config in the .ebextensions folder:
container_commands:
01_install_bundler:
command: "gem install bundler —-version 2.0.1"
Although this never gets run because if I look at the above error, I can see that it is happening during this point in the deploy process:
.../AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed.
(i.e. during the bundle install command of an AppDeployPreHook script). See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html for reference of PlatformHooks.
I'm pretty sure that if I can ensure that the version of bundler being used is at least version 2.0.0, then there won't be a problem. Although I don't know how I can specify that easily. At the moment I'm ssh'ing to the server to /opt/elasticbeanstalk/hooks/appdeploy/pre/ to edit and fiddle with the scripts. Although I obviously need an automated, repeatable way of doing it.
It's frustrating that ruby 2.6.1 isn't choosing bundler version 2.0.0 by default. Any ideas?
==============================
Update:
If I edit the file /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh
if [ -f Gemfile ]; then
echo "running 'bundle install' with Gemfile:"
cat Gemfile
+++ gem install bundler +++
if [ -d $EB_APP_STAGING_DIR/vendor/cache ]; then
bundle install --local
else
bundle install
fi
else
echo "no Gemfile found! Skipping bundle install stage!"
fi
and add the gem install bundler (without the pluses), then this fixes the problem because it installs the latest bundler, which is 2.0.1. For those who want to know the hack, the commands were:
eb ssh
sudo -i
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
vim 10_bundle_install.sh
The problem with this solution is that it feels like a bit of a hack because it doesn't use .ebextensions. Is there a more proper way of fixing this?
ruby-on-rails ruby amazon-web-services rubygems amazon-elastic-beanstalk
add a comment |
This error message is a well known error message. (see https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html for example.) Although I'm getting it with a new Elastic Beanstalk application with Ruby 2.6.1, and bundler 2.0.1. The error is:
/opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:308:in `activate_bin_path'
from /opt/rubies/ruby-2.6.1/bin/bundle:23:in `<main>' (ElasticBeanstalk::ExternalInvocationError)
I've tried putting the following file: 01_install_bundler.config in the .ebextensions folder:
container_commands:
01_install_bundler:
command: "gem install bundler —-version 2.0.1"
Although this never gets run because if I look at the above error, I can see that it is happening during this point in the deploy process:
.../AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed.
(i.e. during the bundle install command of an AppDeployPreHook script). See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html for reference of PlatformHooks.
I'm pretty sure that if I can ensure that the version of bundler being used is at least version 2.0.0, then there won't be a problem. Although I don't know how I can specify that easily. At the moment I'm ssh'ing to the server to /opt/elasticbeanstalk/hooks/appdeploy/pre/ to edit and fiddle with the scripts. Although I obviously need an automated, repeatable way of doing it.
It's frustrating that ruby 2.6.1 isn't choosing bundler version 2.0.0 by default. Any ideas?
==============================
Update:
If I edit the file /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh
if [ -f Gemfile ]; then
echo "running 'bundle install' with Gemfile:"
cat Gemfile
+++ gem install bundler +++
if [ -d $EB_APP_STAGING_DIR/vendor/cache ]; then
bundle install --local
else
bundle install
fi
else
echo "no Gemfile found! Skipping bundle install stage!"
fi
and add the gem install bundler (without the pluses), then this fixes the problem because it installs the latest bundler, which is 2.0.1. For those who want to know the hack, the commands were:
eb ssh
sudo -i
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
vim 10_bundle_install.sh
The problem with this solution is that it feels like a bit of a hack because it doesn't use .ebextensions. Is there a more proper way of fixing this?
ruby-on-rails ruby amazon-web-services rubygems amazon-elastic-beanstalk
Tried the10_bundle_install.sh1hack and had EB complain that I shouldn't try to install Bundler as root.
– NBarnes
Mar 27 at 0:28
@NBarnes, that might be because when you're runningeb deployyou're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions:AWSElasticBeanstalkFullAccessandElasticLoadBalancingFullAccess. Then create access keys for that user and runeb deploywith that profile instead.
– stwr667
Mar 27 at 5:24
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;cat ~/.aws/configshows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you haveownerset toroot?
– NBarnes
Mar 27 at 23:49
I not sure @NBarnes. Theownerofrootbelow is the file owner. Whereas it sounds like your error is talking about the user beingrootwhile executing that file, not that the file itself is owned byroot. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm runningPassenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1
– stwr667
Mar 28 at 4:24
add a comment |
This error message is a well known error message. (see https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html for example.) Although I'm getting it with a new Elastic Beanstalk application with Ruby 2.6.1, and bundler 2.0.1. The error is:
/opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:308:in `activate_bin_path'
from /opt/rubies/ruby-2.6.1/bin/bundle:23:in `<main>' (ElasticBeanstalk::ExternalInvocationError)
I've tried putting the following file: 01_install_bundler.config in the .ebextensions folder:
container_commands:
01_install_bundler:
command: "gem install bundler —-version 2.0.1"
Although this never gets run because if I look at the above error, I can see that it is happening during this point in the deploy process:
.../AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed.
(i.e. during the bundle install command of an AppDeployPreHook script). See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html for reference of PlatformHooks.
I'm pretty sure that if I can ensure that the version of bundler being used is at least version 2.0.0, then there won't be a problem. Although I don't know how I can specify that easily. At the moment I'm ssh'ing to the server to /opt/elasticbeanstalk/hooks/appdeploy/pre/ to edit and fiddle with the scripts. Although I obviously need an automated, repeatable way of doing it.
It's frustrating that ruby 2.6.1 isn't choosing bundler version 2.0.0 by default. Any ideas?
==============================
Update:
If I edit the file /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh
if [ -f Gemfile ]; then
echo "running 'bundle install' with Gemfile:"
cat Gemfile
+++ gem install bundler +++
if [ -d $EB_APP_STAGING_DIR/vendor/cache ]; then
bundle install --local
else
bundle install
fi
else
echo "no Gemfile found! Skipping bundle install stage!"
fi
and add the gem install bundler (without the pluses), then this fixes the problem because it installs the latest bundler, which is 2.0.1. For those who want to know the hack, the commands were:
eb ssh
sudo -i
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
vim 10_bundle_install.sh
The problem with this solution is that it feels like a bit of a hack because it doesn't use .ebextensions. Is there a more proper way of fixing this?
ruby-on-rails ruby amazon-web-services rubygems amazon-elastic-beanstalk
This error message is a well known error message. (see https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html for example.) Although I'm getting it with a new Elastic Beanstalk application with Ruby 2.6.1, and bundler 2.0.1. The error is:
/opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:308:in `activate_bin_path'
from /opt/rubies/ruby-2.6.1/bin/bundle:23:in `<main>' (ElasticBeanstalk::ExternalInvocationError)
I've tried putting the following file: 01_install_bundler.config in the .ebextensions folder:
container_commands:
01_install_bundler:
command: "gem install bundler —-version 2.0.1"
Although this never gets run because if I look at the above error, I can see that it is happening during this point in the deploy process:
.../AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed.
(i.e. during the bundle install command of an AppDeployPreHook script). See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html for reference of PlatformHooks.
I'm pretty sure that if I can ensure that the version of bundler being used is at least version 2.0.0, then there won't be a problem. Although I don't know how I can specify that easily. At the moment I'm ssh'ing to the server to /opt/elasticbeanstalk/hooks/appdeploy/pre/ to edit and fiddle with the scripts. Although I obviously need an automated, repeatable way of doing it.
It's frustrating that ruby 2.6.1 isn't choosing bundler version 2.0.0 by default. Any ideas?
==============================
Update:
If I edit the file /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh
if [ -f Gemfile ]; then
echo "running 'bundle install' with Gemfile:"
cat Gemfile
+++ gem install bundler +++
if [ -d $EB_APP_STAGING_DIR/vendor/cache ]; then
bundle install --local
else
bundle install
fi
else
echo "no Gemfile found! Skipping bundle install stage!"
fi
and add the gem install bundler (without the pluses), then this fixes the problem because it installs the latest bundler, which is 2.0.1. For those who want to know the hack, the commands were:
eb ssh
sudo -i
cd /opt/elasticbeanstalk/hooks/appdeploy/pre
vim 10_bundle_install.sh
The problem with this solution is that it feels like a bit of a hack because it doesn't use .ebextensions. Is there a more proper way of fixing this?
ruby-on-rails ruby amazon-web-services rubygems amazon-elastic-beanstalk
ruby-on-rails ruby amazon-web-services rubygems amazon-elastic-beanstalk
edited Mar 26 at 15:32
stwr667
asked Mar 26 at 15:08
stwr667stwr667
3862 silver badges10 bronze badges
3862 silver badges10 bronze badges
Tried the10_bundle_install.sh1hack and had EB complain that I shouldn't try to install Bundler as root.
– NBarnes
Mar 27 at 0:28
@NBarnes, that might be because when you're runningeb deployyou're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions:AWSElasticBeanstalkFullAccessandElasticLoadBalancingFullAccess. Then create access keys for that user and runeb deploywith that profile instead.
– stwr667
Mar 27 at 5:24
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;cat ~/.aws/configshows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you haveownerset toroot?
– NBarnes
Mar 27 at 23:49
I not sure @NBarnes. Theownerofrootbelow is the file owner. Whereas it sounds like your error is talking about the user beingrootwhile executing that file, not that the file itself is owned byroot. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm runningPassenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1
– stwr667
Mar 28 at 4:24
add a comment |
Tried the10_bundle_install.sh1hack and had EB complain that I shouldn't try to install Bundler as root.
– NBarnes
Mar 27 at 0:28
@NBarnes, that might be because when you're runningeb deployyou're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions:AWSElasticBeanstalkFullAccessandElasticLoadBalancingFullAccess. Then create access keys for that user and runeb deploywith that profile instead.
– stwr667
Mar 27 at 5:24
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;cat ~/.aws/configshows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you haveownerset toroot?
– NBarnes
Mar 27 at 23:49
I not sure @NBarnes. Theownerofrootbelow is the file owner. Whereas it sounds like your error is talking about the user beingrootwhile executing that file, not that the file itself is owned byroot. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm runningPassenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1
– stwr667
Mar 28 at 4:24
Tried the
10_bundle_install.sh1 hack and had EB complain that I shouldn't try to install Bundler as root.– NBarnes
Mar 27 at 0:28
Tried the
10_bundle_install.sh1 hack and had EB complain that I shouldn't try to install Bundler as root.– NBarnes
Mar 27 at 0:28
@NBarnes, that might be because when you're running
eb deploy you're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions: AWSElasticBeanstalkFullAccess and ElasticLoadBalancingFullAccess. Then create access keys for that user and run eb deploy with that profile instead.– stwr667
Mar 27 at 5:24
@NBarnes, that might be because when you're running
eb deploy you're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions: AWSElasticBeanstalkFullAccess and ElasticLoadBalancingFullAccess. Then create access keys for that user and run eb deploy with that profile instead.– stwr667
Mar 27 at 5:24
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;
cat ~/.aws/config shows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you have owner set to root?– NBarnes
Mar 27 at 23:49
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;
cat ~/.aws/config shows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you have owner set to root?– NBarnes
Mar 27 at 23:49
I not sure @NBarnes. The
owner of root below is the file owner. Whereas it sounds like your error is talking about the user being root while executing that file, not that the file itself is owned by root. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm running Passenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1– stwr667
Mar 28 at 4:24
I not sure @NBarnes. The
owner of root below is the file owner. Whereas it sounds like your error is talking about the user being root while executing that file, not that the file itself is owned by root. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm running Passenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1– stwr667
Mar 28 at 4:24
add a comment |
2 Answers
2
active
oldest
votes
So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:
files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1
Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.
More information in the docs here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html
and here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files
Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the.ebextensions/gem_install_bundler.configfile in the root level -- is there something else that I have to do? I am using Ruby 2.6.3
– Betty St
Jun 25 at 14:39
1
If you don't get theechothen it's not executing at all. Try moving theechoas the first statement to be executed, in case your above commands are failing.
– stwr667
Jun 29 at 5:25
I had to addgem update --systemat the end of the file and it fixed the problem :)
– Betty St
Jul 2 at 11:52
add a comment |
I only just saw this post after I had found an alternative (perhaps easier) solution: backgrading bundler to 1.17.3 (gem unistall bundler followed up with gem install bundler -v 1.17.3)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360450%2felastic-beanstalk-cant-find-gem-bundler-0-a-with-executable-bundle-gem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:
files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1
Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.
More information in the docs here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html
and here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files
Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the.ebextensions/gem_install_bundler.configfile in the root level -- is there something else that I have to do? I am using Ruby 2.6.3
– Betty St
Jun 25 at 14:39
1
If you don't get theechothen it's not executing at all. Try moving theechoas the first statement to be executed, in case your above commands are failing.
– stwr667
Jun 29 at 5:25
I had to addgem update --systemat the end of the file and it fixed the problem :)
– Betty St
Jul 2 at 11:52
add a comment |
So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:
files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1
Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.
More information in the docs here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html
and here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files
Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the.ebextensions/gem_install_bundler.configfile in the root level -- is there something else that I have to do? I am using Ruby 2.6.3
– Betty St
Jun 25 at 14:39
1
If you don't get theechothen it's not executing at all. Try moving theechoas the first statement to be executed, in case your above commands are failing.
– stwr667
Jun 29 at 5:25
I had to addgem update --systemat the end of the file and it fixed the problem :)
– Betty St
Jul 2 at 11:52
add a comment |
So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:
files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1
Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.
More information in the docs here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html
and here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files
Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!
So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:
files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1
Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.
More information in the docs here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html
and here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files
Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!
answered Mar 27 at 13:25
stwr667stwr667
3862 silver badges10 bronze badges
3862 silver badges10 bronze badges
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the.ebextensions/gem_install_bundler.configfile in the root level -- is there something else that I have to do? I am using Ruby 2.6.3
– Betty St
Jun 25 at 14:39
1
If you don't get theechothen it's not executing at all. Try moving theechoas the first statement to be executed, in case your above commands are failing.
– stwr667
Jun 29 at 5:25
I had to addgem update --systemat the end of the file and it fixed the problem :)
– Betty St
Jul 2 at 11:52
add a comment |
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the.ebextensions/gem_install_bundler.configfile in the root level -- is there something else that I have to do? I am using Ruby 2.6.3
– Betty St
Jun 25 at 14:39
1
If you don't get theechothen it's not executing at all. Try moving theechoas the first statement to be executed, in case your above commands are failing.
– stwr667
Jun 29 at 5:25
I had to addgem update --systemat the end of the file and it fixed the problem :)
– Betty St
Jul 2 at 11:52
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the
.ebextensions/gem_install_bundler.config file in the root level -- is there something else that I have to do? I am using Ruby 2.6.3– Betty St
Jun 25 at 14:39
i added this file, but still got the same error, the strange thing is that i do not get the echo, but inside the archive there is the
.ebextensions/gem_install_bundler.config file in the root level -- is there something else that I have to do? I am using Ruby 2.6.3– Betty St
Jun 25 at 14:39
1
1
If you don't get the
echo then it's not executing at all. Try moving the echo as the first statement to be executed, in case your above commands are failing.– stwr667
Jun 29 at 5:25
If you don't get the
echo then it's not executing at all. Try moving the echo as the first statement to be executed, in case your above commands are failing.– stwr667
Jun 29 at 5:25
I had to add
gem update --system at the end of the file and it fixed the problem :)– Betty St
Jul 2 at 11:52
I had to add
gem update --system at the end of the file and it fixed the problem :)– Betty St
Jul 2 at 11:52
add a comment |
I only just saw this post after I had found an alternative (perhaps easier) solution: backgrading bundler to 1.17.3 (gem unistall bundler followed up with gem install bundler -v 1.17.3)
add a comment |
I only just saw this post after I had found an alternative (perhaps easier) solution: backgrading bundler to 1.17.3 (gem unistall bundler followed up with gem install bundler -v 1.17.3)
add a comment |
I only just saw this post after I had found an alternative (perhaps easier) solution: backgrading bundler to 1.17.3 (gem unistall bundler followed up with gem install bundler -v 1.17.3)
I only just saw this post after I had found an alternative (perhaps easier) solution: backgrading bundler to 1.17.3 (gem unistall bundler followed up with gem install bundler -v 1.17.3)
answered Jun 9 at 5:11
Drew JohnstonDrew Johnston
311 silver badge6 bronze badges
311 silver badge6 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360450%2felastic-beanstalk-cant-find-gem-bundler-0-a-with-executable-bundle-gem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Tried the
10_bundle_install.sh1hack and had EB complain that I shouldn't try to install Bundler as root.– NBarnes
Mar 27 at 0:28
@NBarnes, that might be because when you're running
eb deployyou're probably connecting with the aws_access_key and aws_secret_access_key of your root AWS account. AWS recommends that you use Identity Access Management (IAM) for this purpose. It's not too hard to set up. Under IAM -> Users, you'll just need to create a user with these permissions:AWSElasticBeanstalkFullAccessandElasticLoadBalancingFullAccess. Then create access keys for that user and runeb deploywith that profile instead.– stwr667
Mar 27 at 5:24
Based on your suggestion, I created a new User using IAM and gave them those two permissions. I am still getting the error about running Bundler as root, however. I did reset the credentials in the AWS CLI;
cat ~/.aws/configshows the access keys for the non-root user. EDIT: Is the problem perhaps that in the extension file snippet below you haveownerset toroot?– NBarnes
Mar 27 at 23:49
I not sure @NBarnes. The
ownerofrootbelow is the file owner. Whereas it sounds like your error is talking about the user beingrootwhile executing that file, not that the file itself is owned byroot. If you google search "install Bundler as root" there are a few possible explanations. And perhaps your AWS environment is different to mine? I'm runningPassenger with Ruby 2.6 running on 64bit Amazon Linux/2.9.1– stwr667
Mar 28 at 4:24