amazon-web-servicesaws-opsworks

How to start rails console in AWS OpsWorks


Recently an app was upgraded to rails 6 and it uses Apache and Passenger at AWS Opsworks

I would like to know how to start the rails console in production?

deploy@apricots:/srv/www/app_name/current$ bundle exec rails c production                                                                                                                            
Traceback (most recent call last):
        9: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        8: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        7: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/setup.rb:10:in `<top (required)>'
        6: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:107:in `setup'
        5: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `setup'
        4: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `map'
        3: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
        2: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
        1: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:31:in `block in setup'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:319:in `check_for_activated_spec!': You have already activated bundler 1.17.2, but your Gemfile requires bundler 2.0.2. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError)

Note: It was working before with Rails 5 and Nginx Unicorn Server.


Solution

  • Fix

    Note: * Commit the new / modified files.