0

I am beginner of Amazon Linux 2 and Ruby on Rails. Recently, I am working on migrating our ruby application from EB environment of Amazon Linux 1 to EB environment of Amazon Linux 2.

In our Ruby application, we set a script file in .platform .platform/hooks/postdeploy/resque_starter.sh to execute below command after deployment of application:

  su -s /bin/bash -c "PIDFILE=/var/run/reqsque/resque_1.pid BACKGROUND=yes TERM_CHILD=1 LOGGING=1 /opt/rubies/ruby-2.6.8/bin/bundle exec /opt/rubies/ruby-2.6.8/bin/rake resque:work QUEUES=email" webapp

but when the command is executed, I get below errors.

rake aborted!
LoadError: cannot load such file -- listen
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/evented_file_update_checker.rb:6:in `<main>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
/var/app/current/config/environments/development.rb:52:in `block in <main>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `instance_eval'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `configure'
/var/app/current/config/environments/development.rb:1:in `<main>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `each'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
/var/app/current/config/environment.rb:5:in `<main>'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/var/app/current/vendor/bundle/ruby/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/rubies/ruby-2.6.8/bin/bundle:23:in `load'
/opt/rubies/ruby-2.6.8/bin/bundle:23:in `<main>'
Tasks: TOP => resque:work => resque:preload => resque:setup => environment
(See full trace by running task with --trace)

From the errors, it seems the rake resque uses the "development" environment and configurations. But in fact, the environment is set as production RACK_ENV: production. I have made a lot effort to find why the rake resque is called with development configurations, but failed to find the root cause. Can you please help?

lei lei
  • 1,753
  • 4
  • 19
  • 44
  • Does `... LOGGING=1 RAILS_ENV=production ...` work? – razvans Sep 21 '21 at 06:03
  • @razvans Thanks. I tried this. It does run resque work and scheduler with some production configurations, still use some development configuration such as REDIS_URL. – lei lei Sep 21 '21 at 06:37

0 Answers0