1

My issue is very similar to that described in issue deploying rails 5 application to AWS using Elastic Beanstalk due to rb-readline

However, setting HOME and/or HOMEPATH via the AWS console has not helped. I get the same error, every time. Here is the relevant logfile:


/var/log/eb-activity.log

  ++ export PATH=/opt/rubies/ruby-2.3.4/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  ++ PATH=/opt/rubies/ruby-2.3.4/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
  +++ /opt/rubies/ruby-2.3.4/bin/ruby -
  ++ eval 'export RUBY_ENGINE=ruby;
  export RUBY_VERSION=2.3.4;
  export GEM_ROOT="/opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0";'
  +++ export RUBY_ENGINE=ruby
  +++ RUBY_ENGINE=ruby
  +++ export RUBY_VERSION=2.3.4
  +++ RUBY_VERSION=2.3.4
  +++ export GEM_ROOT=/opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0
  +++ GEM_ROOT=/opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0
  ++ ((  0 != 0  ))
  + cd /var/app/ondeck
  + su -s /bin/bash -c 'bundle exec /opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb assets:precompile' webapp
  `/home/webapp` is not a directory.
  Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.
  + '[' false == true ']'
  + su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
  `/home/webapp` is not a directory.
  Bundler will use `/tmp/bundler/home/webapp' as your home directory temporarily.
  rake aborted!
  Bundler::GemRequireError: There was an error while trying to load the gem 'rb-readline'.
  Gem Load Error is: HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory
  Backtrace for gem load error is:
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rb-readline-0.5.5/lib/rbreadline.rb:1097:in `<module:RbReadline>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rb-readline-0.5.5/lib/rbreadline.rb:17:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rb-readline-0.5.5/lib/readline.rb:10:in `<module:Readline>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rb-readline-0.5.5/lib/readline.rb:8:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rb-readline-0.5.5/lib/rb-readline.rb:16:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:82:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:77:in `each'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:77:in `block in require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:66:in `each'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:66:in `require'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler.rb:108:in `require'
  /var/app/ondeck/config/application.rb:7:in `<top (required)>'
  /var/app/ondeck/Rakefile:5:in `require'
  /var/app/ondeck/Rakefile:5:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/bin/rake:22:in `load'
  /opt/rubies/ruby-2.3.4/bin/rake:22:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli/exec.rb:74:in `load'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli/exec.rb:74:in `kernel_load'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli/exec.rb:27:in `run'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli.rb:360:in `exec'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli.rb:20:in `dispatch'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/cli.rb:10:in `start'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/exe/bundle:35:in `block in <top (required)>'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/exe/bundle:27:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `load'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `<main>'
  Bundler Error Backtrace:
  /var/app/ondeck/config/application.rb:7:in `<top (required)>'
  /var/app/ondeck/Rakefile:5:in `require'
  /var/app/ondeck/Rakefile:5:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `load'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `<main>'
  HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory
  /var/app/ondeck/config/application.rb:7:in `<top (required)>'
  /var/app/ondeck/Rakefile:5:in `require'
  /var/app/ondeck/Rakefile:5:in `<top (required)>'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `load'
  /opt/rubies/ruby-2.3.4/bin/bundle:22:in `<main>'
  (See full trace by running task with --trace) (Executor::NonZeroExitStatus)


[2018-03-08T21:21:50.587Z] INFO  [2045]  - [Application update 2018-03-02-1047-retry-0307@28/AppDeployStage0/AppDeployPreHook/11_asset_compilation.sh] : Activity failed.
[2018-03-08T21:21:50.587Z] INFO  [2045]  - [Application update 2018-03-02-1047-retry-0307@28/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2018-03-08T21:21:50.587Z] INFO  [2045]  - [Application update 2018-03-02-1047-retry-0307@28/AppDeployStage0] : Activity failed.
[2018-03-08T21:21:50.587Z] INFO  [2045]  - [Application update 2018-03-02-1047-retry-0307@28] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed
[2018-03-08T21:30:11.781Z] INFO  [2654]  - [CMD-TailLogs] : Starting activity...
[2018-03-08T21:30:11.781Z] INFO  [2654]  - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2018-03-08T21:30:11.781Z] INFO  [2654]  - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2018-03-08T21:30:11.781Z] INFO  [2654]  - [CMD-TailLogs/TailLogs] : Starting activity...
[2018-03-08T21:30:11.781Z] INFO  [2654]  - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...

When I log on to the EC2 instance, I can verify that $HOME is set as expected, but I still get the above result. I hypothesize that maybe the problem I'm having is that the app is started in some chrooted configuration and the directories I'm choosing don't exist? Or maybe I need to use "path syntax" with ":" characters?

But trial-and-error is going to take a long, long time here, I'm redownloading via dashboard with every try. So if someone has something more definitive, I'd really appreciate it.

gischer
  • 274
  • 1
  • 3
  • 8
  • The problem doesnt seem to be that `$HOME` is or is not set; its that `/home/webapp` doesnt exist at all – Cody Caughlan Mar 08 '18 at 21:45
  • That's plausible. I don't know where that's coming from, though. It looks like it's trying to precompile assets, but I did that before deploying. I just verified that the zip file I'm downloading has assets, too. I'm uncertain about what change would make it do this. – gischer Mar 08 '18 at 22:33

1 Answers1

0

Well, I have solved this. I eliminated the rbreadline gem from my build. This was causing the problem. I had to solve another problem to do this, first I looked at rails console doesn't load due to libreadline

However the solution given,

ln -s /usr/local/opt/readline/lib/libreadline.dylib \
/usr/local/opt/readline/lib/libreadline.6.dylib 

did not work. What worked for me was

ln -s /usr/local/opt/readline/lib/libreadline.dylib \
/usr/local/opt/readline/lib/libreadline.6.2.dylib
gischer
  • 274
  • 1
  • 3
  • 8