Old Rails app from Docker Container - trying to run natively again . .

People,

Docker crashed and I lost the Rails container so I have to go back to the original source.

Could someone suggest how I could fix the problem seen below? - I deleted the Gemfile.lock file first.

Thanks,

Phil.

$ bundle install --path vendor/bundle
.
Bundle complete! 15 Gemfile dependencies, 54 gems now installed.
Bundled gems are installed into `./vendor/bundle`

$ ./bin/rails s
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/object/duplicable.rb:82: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
=> Booting Puma
=> Rails 4.1.5 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
Traceback (most recent call last):
  6734: from ./bin/rails:5:in `<main>'
  6733: from ./bin/rails:5:in `require'
  6732: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
  6731: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
  6730: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
  6729: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
  6728: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:81:in `block in server'
  6727: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/railties-4.1.5/lib/rails/commands/server.rb:67:in `start'
   ... 6722 levels...
     4: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
     3: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
     2: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
     1: from /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)

Docker crashed and I lost the Rails container so I have to go back to
the original source.

I don't know what "lost the Rails container" means. Can't you just
rerun the Dockerfile?

Could someone suggest how I could fix the problem seen below? - I
deleted the Gemfile.lock file first.

Why?

$ ./bin/rails s
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/object/duplicable.rb:82:
warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
=> Booting Puma
=> Rails 4.1.5 application starting in development on

Did you originally develop this Rails 4.1.5 app using Ruby 2.6.0? Or
I guess more exactly have you been running it on that Ruby version
successfully?

Hassan,

Docker crashed and I lost the Rails container so I have to go back to
the original source.

I don't know what "lost the Rails container" means. Can't you just
rerun the Dockerfile?

No.

Could someone suggest how I could fix the problem seen below? - I
deleted the Gemfile.lock file first.

Why?

Because leaving the original lock file there caused "bundle install --path vendor/bundle" to fail with:

Installing json 1.8.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

     current directory: /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/json-1.8.3/ext/json/ext/generator
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20200315-119213-1sg3qup.rb extconf.rb
creating Makefile

current directory: /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
rm -f
rm -f generator.so *.o *.bak mkmf.log .*.time

current directory: /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -DJSON_GENERATOR -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -o generator.o -c
generator.c
generator.c: In function 'generate_json':
generator.c:861:25: error: 'rb_cFixnum' undeclared (first use in this function); did you mean 'mFixnum'?
   861 | } else if (klass == rb_cFixnum) {
       > ^~~~~~~~~~
       > mFixnum
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: 'rb_cBignum' undeclared (first use in this function); did you mean 'mBignum'?
   863 | } else if (klass == rb_cBignum) {
       > ^~~~~~~~~~
       > mBignum
make: *** [Makefile:245: generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/json-1.8.3 for inspection.
Results logged to /home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-1.8.3/gem_make.out

An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v ‘1.8.3’ --source 'https://rubygems.org/’` succeeds before bundling.

In Gemfile:
   rails was resolved to 4.1.5, which depends on
     actionmailer was resolved to 4.1.5, which depends on
       actionpack was resolved to 4.1.5, which depends on
         actionview was resolved to 4.1.5, which depends on
           activesupport was resolved to 4.1.5, which depends on
             json

$ ./bin/rails s
/home/phr/src/ruby/rails/domain-sf/vendor/bundle/ruby/2.6.0/gems/activesupport-4.1.5/lib/active_support/core_ext/object/duplicable.rb:82:
warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
=> Booting Puma
=> Rails 4.1.5 application starting in development on

Did you originally develop this Rails 4.1.5 app using Ruby 2.6.0? Or
I guess more exactly have you been running it on that Ruby version
successfully?

I can't remember what version of Ruby it was - it was from earlier than 2015 . . it was running on whatever version of Ruby that was in the container - which is gone because the whole docker setup was corrupted . . I may have backups on old hard disks but it would take too long to try and re-create old OS environment, Docker version etc so I thought the best thing to do was just the Rails app running directly on my current machine (Linux Fedora 31).

Thanks,

Phil.

You may want to check the Rails+Ruby version of your host then. It’s possible that you’re using a newer version of Ruby and your codebase requires an older version. (Due to the deprecated warning)