简体   繁体   中英

Elastic Beanstalk Ruby failing on private subnet

I have a ruby application deployed to Elastic Beanstalk that successfully deploys and runs when connected to my public su.net but fails with an error when connected to my private su.net.

2023/01/04 21:16:25.937590 [INFO] Running command /bin/su webapp -c bundle exec /opt/elasticbeanstalk/config/private/checkforraketask.rb assets:precompile
2023/01/04 21:16:26.178594 [INFO] bundler: failed to load command: /opt/elasticbeanstalk/config/private/checkforraketask.rb (/opt/elasticbeanstalk/config/private/checkforraketask.rb)
/opt/elasticbeanstalk/config/private/checkforraketask.rb:16:in `require': cannot load such file -- rake (LoadError)
    from /opt/elasticbeanstalk/config/private/checkforraketask.rb:16:in `<top (required)>'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli/exec.rb:58:in `load'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli/exec.rb:58:in `kernel_load'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli/exec.rb:23:in `run'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli.rb:491:in `exec'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli.rb:34:in `dispatch'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/cli.rb:28:in `start'
    from /opt/rubies/ruby-2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.4.1/exe/bundle:45:in `block in <top (required)>'
    from /opt/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /opt/rubies/ruby-2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.4.1/exe/bundle:33:in `<top (required)>'
    from /opt/elasticbeanstalk/.rbenv/versions/2.7.7/bin/bundle:25:in `load'
    from /opt/elasticbeanstalk/.rbenv/versions/2.7.7/bin/bundle:25:in `<main>'

Initially there was a misconfiguration with our VPC such that there was no outbound inte.net access on one of our public and one of our private su.nets. I corrected that and the error does not happen while connected to the public su.nets but it does happen on the private su.nets. I launched EC2 instances in the private su.nets and verified they do have outbound inte.net access so it seems to be something related to my beanstalk instance.

I have verified our environment lines up with the template here https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/cfn-templates/vpc-privatepublic.yaml but still no luck.

Any help would be great!

I resolved the issue. I had enable HTTPS all the way to the instance by following steps here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-tcp-passthrough.html and here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-ruby.html#Puma During that set up, it has you do this stepAWS HTTPS 设置

The key being that this only needs done on the default VPC. Not sure why this didn't break things when I had everything on my public su.nets but alas the problem is solved

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM