0

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.

Filippos
  • 93
  • 1
  • 8

1 Answers1

0

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

Vi.
  • 940
  • 6
  • 24
  • i have copy/pasted the value of master.key (from local project) to apps folder / .rbenv-vars as RAILS_MASTER_KEY=xxxxxxxxxxx . With ruby -e 'p ENV["RAILS_MASTER_KEY"]' i get the value. I don't think the issue is there. – Filippos Apr 25 '22 at 11:32
  • are you able to edit credentials? – Vi. Apr 25 '22 at 12:52
  • yes, i cant edit credentials – Filippos Apr 25 '22 at 21:00
  • I'm sorry, you wrote `yes i cant`, I don't understand if yes or not I mean while using rbenv-vars? Anyway try to edit `config/puma.rb` and set `environment ENV.fetch("RAILS_ENV") { "production" }` as default environment to see if you can use console – Vi. Apr 25 '22 at 21:12
  • ahh sorry, yes i can edit the credentials. The credentials are the same with my local repository. I've just copied the master key as env variable. – Filippos Apr 26 '22 at 22:33