rails console, rbenv and rbenv-vars issues in ubuntu 20.04

317 Views Asked by At

Im experiencing a bizzare issue in ubuntu 20.04.
I've installed ruby 3.1.2, rails 6.1.5, rbenv and rbenv-vars.
Set up inside the app directory the .rbenv-vars with

RAILS_ENV=production
RAILS_MASTER_KEY=123456

Whenever i try rails console i get a bunch of lines starting with:

/home/deploy/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27:in `require': cannot load such file -- net/pop (LoadError)
from ... lots of froms ...

I have tested that the ENV's are loading but i have no access to rails console.
When i remove the .rbenv-vars completely, i can run rails console but without enviroment variables, railsloads in developer and not production mode.
Although inside the server block i have passport_app_env production;

I haven't found a solution yet... any hints?

---- Quick Update ----

Since it is my first attempt to develop & deploy a Rails app, i think i've started the project in a 'wrong' way. Many months ago started the project locally and not until recently decided to combine local (development) & remote (production) since the project progressed to an ok level. My realization now is that I should have started local & remote from the beginning. I've stumbled into many bizzare issues in production mode which didn't make sense and lost plenty of time searching and researching.

To make things pragmatic i decided to port my app to Rails 7 (from Rails 6) and combine local (dev) & remote (capistrano/production) along the way.

My current status: So far so good. App is progressing in Rails 7 solving issues in Rails 7 where worked on Rails 6 (atm: devise) and it's live on digitalocean.

1

There are 1 best solutions below

5
On

Ensure the RAILS_MASTER_KEY has the right (original) value. If it's wrong, you'll not get this working.

Or you can create new master.key with EDITOR="nano" rails credentials:edit and then save the master.key's value in RAILS_MASTER_KEY