By using AWS re:Post, you agree to the Terms of Use

Ruby beanstalk platform can't run /opt/elasticbeanstalk/bin/get-config


We recently upgrade two apps to ruby 2.4 (Puma with Ruby 2.4 running on 64bit Amazon Linux/2.11.1) and 2.6 (Puma with Ruby 2.6 running on 64bit Amazon Linux/2.11.0), but it looks like we can't run /opt/elasticbeanstalk/bin/get-config anymore.

[ec2-user@ip-172-31-23-133 2.2.0]$ ruby --version
ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-linux]
[ec2-user@ip-172-31-23-133 2.2.0]$ cd gems/
[ec2-user@ip-172-31-23-133 gems]$ ls
addressable-2.4.0        aws-sdk-v1-1.66.0           cookiejar-0.3.0        executor-1.1           healthd-basestat-1.0.1                 json_pure-1.8.3      ox-2.1.8            rack-parser-0.6.1      sinatra-1.4.5
aws-sdk-1.66.0           beanstalk-core-2.12         docopt-0.5.0           executor-1.2           healthd-metadata-1.0.1                 mini_portile2-2.0.0  parse-cron-0.1.4    rack-protection-1.5.3  test-unit-3.0.8
aws-sdk-2.3.0            beanstalk-core-healthd-1.1  em-http-request-1.1.3  foreman-0.78.0         healthd-sysstat-1.0.3-universal-linux  minitest-5.4.3       power_assert-0.2.2  rake-10.4.2            thor-0.19.1
aws-sdk-core-2.3.0       bundler-1.12.1              em-socksify-0.3.1      healthd-1.0.3          http_parser.rb-0.6.0                   nokogiri-     puma-2.11.1         rdoc-4.2.0             tilt-1.4.1
aws-sdk-resources-2.3.0  chainsaw-1.0.1              eventmachine-   healthd-appstat-1.0.1  jmespath-1.2.4                         oj-2.15.0            rack-1.6.0          ruby-filemagic-0.7.1   x-digest-1.0.1
[ec2-user@ip-172-31-23-133 gems]$  /opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig
/opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'beanstalk-core' (>= 0) among 133 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/ec2-user/.gem/ruby/2.4.9:/opt/rubies/ruby-2.4.9/lib/ruby/gems/2.4.0', execute `gem env` for more information
	from /opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
	from /opt/elasticbeanstalk/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
	from /opt/elasticbeanstalk/lib/ruby/bin/get-config:22:in `<main>'

Seems like probably a bug in the platform. Is there any workaround available?


asked 3 years ago102 views
3 Answers

Looks like this sort of works around running the tool, but the metadata key we used to use seems to have changed

 sudo bash -c 'GEM_PATH=/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0 /opt/rubies/ruby-2.2.10/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/get-config meta -k sqsdconfig'
Path AWS::ElasticBeanstalk::Ext||_SqsDaemonConfigFileContent doesn't exist in metadata.
answered 3 years ago

Slightly off of the topic, but is there a recommended way to find out the SQS visibility timeout in a worker env?

The whole usage of get-config was to find that out so we can adjust the nginx timeout to match:

    command: |
      # If worker tier set nginx timeout to SQS visibility timeout
      if /opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig 2>/dev/null; then
        VISIBILITY_TIMEOUT=$(/opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig | jq -r .visibility_timeout)
        echo "proxy_read_timeout ${VISIBILITY_TIMEOUT}s;" > /etc/nginx/conf.d/worker.conf
        service nginx restart

Otherwise nginx can timeout too early and cause worker job retries (and pileup of jobs)

Edited by: matschaffer-safecast on Dec 4, 2019 12:25 AM

answered 3 years ago

Looks like I figured it out. /opt/elasticbeanstalk/bin/get-config meta -k sqsdconfig still works just only as root (not ec2-user like I was trying)

And the missing Path AWS::ElasticBeanstalk::Ext||_SqsDaemonConfigFileContent doesn't exist in metadata. was due to what should have been a worker tier env having been started as a web tier.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions