✓ Solved

rails server not working

For over a year I've had a rails site working on linode using puma as the server. It has stopped working and I can't get it to restart. So I updated the rails tool chain and created a minimal rails app which also does not work:

uname -a

Linux totwcom 5.17.12-100.fc34.x86_64 #1 SMP PREEMPT Mon May 30 17:47:02 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

ruby -v

ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

bin/rails -v

Rails 7.0.4

which rails

/usr/local/bin/rails

/usr/local/bin/rails -v

Rails 7.0.4

rails new tryit

//a lot of output

cd tryit

pwd

/home/test/tryit

bin/rails about

About your application's environment
Rails version 7.0.4
Ruby version ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]
RubyGems version 3.2.33
Rack version 2.2.5
Middleware ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActionDispatch::ServerTiming, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root /home/test/tryit
Environment development
Database adapter sqlite3
Database schema version 0

bin/rails server --binding=96.126.102.82

=> Booting Puma
=> Rails 7.0.4 application starting in development
=> Run bin/rails server --help for more startup options
Puma starting in single mode…

  • Puma version: 5.6.5 (ruby 3.0.4-p208) ("Birdie's Version")
  • Min threads: 5
  • Max threads: 5
  • Environment: development
  • PID: 6587
  • Listening on http://96.126.102.82:3000
    Use Ctrl-C to stop

// but I can't reach this site

^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2022-12-28 23:45:06 +0000 ===

  • Goodbye!
    Exiting

I would appreciate any help on this problem. Thanks!

8 Replies

✓ Best Answer

Here's where I am now:

[root@totwcom tryit]# uname -a
Linux totwcom 6.0.15-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Dec 21 18:46:09 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@totwcom tryit]#

When httpd is running I can serve /var/www/html/index.html over the net with no problem:

[root@totwcom ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Fri 2022-12-23 22:41:34 UTC; 4 days ago
Docs: man:httpd.service(8)
Process: 24265 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Main PID: 724 (/usr/sbin/httpd)
Status: "Total requests: 851; Idle/Busy workers 100/0;Requests/sec: 0.00245; Bytes served/sec: 5 B/>
Tasks: 278 (limit: 1110)
Memory: 26.8M
CPU: 3min 2.694s
CGroup: /system.slice/httpd.service
├─ 724 /usr/sbin/httpd -DFOREGROUND
├─24281 /usr/sbin/httpd -DFOREGROUND
├─24282 /usr/sbin/httpd -DFOREGROUND
├─24283 /usr/sbin/httpd -DFOREGROUND
├─24284 /usr/sbin/httpd -DFOREGROUND
└─39881 /usr/sbin/httpd -DFOREGROUND

Dec 23 22:41:34 totwcom systemd[1]: Starting The Apache HTTP Server…
Dec 23 22:41:34 totwcom systemd[1]: Started The Apache HTTP Server.
Dec 23 22:41:34 totwcom httpd[724]: Server configured, listening on: port 443, …
[root@totwcom ~]#

so I issue:

[root@totwcom ~]# systemctl stop httpd

which should avoid collisions with the 2 servers, apache and puma

[root@totwcom tryit]# rails about
About your application's environment
Rails version 7.0.4
Ruby version ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
RubyGems version 3.3.26
Rack version 2.2.5
Middleware ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActionDispatch::ServerTiming, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root /home/test/tryit
Environment development
Database adapter sqlite3
Database schema version 0
[root@totwcom tryit]#

[root@totwcom tryit]# gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 3.3.26
  • RUBY VERSION: 3.1.3 (2022-11-24 patchlevel 185) [x86_64-linux]
  • INSTALLATION DIRECTORY: /usr/share/gems
  • USER INSTALLATION DIRECTORY: /root/.local/share/gem/ruby
  • RUBY EXECUTABLE: /usr/bin/ruby
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /usr/bin
  • SPEC CACHE DIRECTORY: /root/.local/share/gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /usr/share/gems
    • /root/.local/share/gem/ruby
    • /usr/local/share/gems
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => true
    • :bulk_threshold => 1000
    • "gem" => "--install-dir=/usr/local/share/gems --bindir /usr/local/bin"
  • REMOTE SOURCES:
  • SHELL PATH:
    • /root/.local/bin
    • /root/bin
    • /usr/lib64/ccache
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
      [root@totwcom tryit]#

[root@totwcom tryit]# bin/rails server --binding=96.126.102.82 -d
=> Booting Puma
=> Rails 7.0.4 application starting in development
=> Run bin/rails server --help for more startup options
DEBUGGER: Can't debug the code after Process.daemon locally. Use the remote debugging feature.
[root@totwcom tryit]#

[root@totwcom tryit]# ps -ae | grep ruby
79480 ? 00:00:00 ruby-mri

Also puma.rb is set to port 3000: port ENV.fetch("PORT") { 3000 }

and I still can't get to this on the net.

This is extremely frustrating as I've spent quite a bit of time trying to get this to work. It's especially frustrating as my full rails site ran just fine from October 2021 to December 2022. Now I can't even get a minimal example to work.

I've have been building rails sites since 2008. It does now seem that feature creep has gotten to rails with new functions such as bootsnap breaking a site. However, I can get this to run just find on my home machine which is fedora 6.0.15-602.inttf.fc36.x86_64 and is running rails 7 which fixes the bootsnap problem which was what brought my site down in the first place.

I'm not sure where to go from here. Would it make sense to completely reload the site (I have everything I need from it so I'm not worried about data loss.) and start over?

I'm in the process of completely rebuilding my original site from 2001 which is still LAMP architecure and runs on a separate linode: turtlesoftheworld.org. So I want to use rails 7 and leaflet for mapping, but so far I can't get out of the gate.

Thanks for your attention,

Ross

Listening on http://96.126.102.82:3000

Is port 3000 open in your firewall?

-- sw

Thanks!

I was pretty sure the port is open, but to check:

[ross@nyx SysAdmin]$ sudo firewall-cmd --add-port=3000/tcp
[sudo] password for ross:
Warning: ALREADY_ENABLED: '3000:tcp' already in 'FedoraWorkstation'
success
[ross@nyx SysAdmin]$

If I use httpd to host a simple site that works just fine. So I think maybe this is a rails problem or some other kind of security issue.

[ross@nyx SysAdmin]$ sudo firewall-cmd --add-port=3000/tcp
[sudo] password for ross: 
Warning: ALREADY_ENABLED: '3000:tcp' already in 'FedoraWorkstation'
success

I'm unfamiliar with Fedora's command… Hopefully, this opens the port in the firewall and doesn't close it… ;-)

I only know enough about rails to become very frustrated if I tried to use it. My only suggestion is to make sure your puma configuration is correct for your use model. In particular, make sure puma is indeed listening on port 3000. You can check this with netstat. I hope this helps…

-- sw

When I try to run the old site that worked for over a year I get:

rails server --binding=96.126.102.82
/usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:13:in to_binary': wrong argument type false (expected Symbol) (TypeError) from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:13:ininput_to_storage'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:30:in fetch' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:30:infetch'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/iseq.rb:55:in load_iseq' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inrequire'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:inregister'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:inrequire'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in require_relative' from /usr/local/share/gems/gems/thor-1.1.0/lib/thor.rb:1:in

<main>'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inrequire_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /usr/local/share/gems/gems/railties-6.1.4.1/lib/rails/command.rb:7:in<main>'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inrequire_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /usr/local/share/gems/gems/railties-6.1.4.1/lib/rails/commands.rb:3:in<main>'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inrequire_with_bootsnap_lfi'
from /usr/share/gems/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /home/Entry/bin/rails:5:in<top (required)="">'
from /usr/share/gems/gems/spring-3.0.0/lib/spring/client/rails.rb:28:in load' from /usr/share/gems/gems/spring-3.0.0/lib/spring/client/rails.rb:28:incall'
from /usr/share/gems/gems/spring-3.0.0/lib/spring/client/command.rb:7:in call' from /usr/share/gems/gems/spring-3.0.0/lib/spring/client.rb:30:inrun'
from /usr/share/gems/gems/spring-3.0.0/bin/spring:49:in <top (required)>' from /usr/share/gems/gems/spring-3.0.0/lib/spring/binstub.rb:11:inload'
from /usr/share/gems/gems/spring-3.0.0/lib/spring/binstub.rb:11:in <top (required)>' from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:inrequire'
from <internal: core_ext="" kernel_require.rb="" rubygems="" share="" usr="">:85:in require' from /home/Entry/bin/spring:10:inblock in <top (required)="">'
from <internal:kernel>:90:in tap' from /home/Entry/bin/spring:7:in<top (required)="">'
from bin/rails:2:in load' from bin/rails:2:in<main>'
[root@totwcom Entry]#

Looking around I see that bootsnap has caused problems in the past. It's why I went ahead and updated rails.

</main></top></internal:kernel></top></internal:></top></main></main></main>

Here's where I am now:

[root@totwcom tryit]# uname -a
Linux totwcom 6.0.15-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Dec 21 18:46:09 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@totwcom tryit]#

When httpd is running I can serve /var/www/html/index.html over the net with no problem:

[root@totwcom ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Fri 2022-12-23 22:41:34 UTC; 4 days ago
Docs: man:httpd.service(8)
Process: 24265 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Main PID: 724 (/usr/sbin/httpd)
Status: "Total requests: 851; Idle/Busy workers 100/0;Requests/sec: 0.00245; Bytes served/sec: 5 B/>
Tasks: 278 (limit: 1110)
Memory: 26.8M
CPU: 3min 2.694s
CGroup: /system.slice/httpd.service
├─ 724 /usr/sbin/httpd -DFOREGROUND
├─24281 /usr/sbin/httpd -DFOREGROUND
├─24282 /usr/sbin/httpd -DFOREGROUND
├─24283 /usr/sbin/httpd -DFOREGROUND
├─24284 /usr/sbin/httpd -DFOREGROUND
└─39881 /usr/sbin/httpd -DFOREGROUND

Dec 23 22:41:34 totwcom systemd[1]: Starting The Apache HTTP Server…
Dec 23 22:41:34 totwcom systemd[1]: Started The Apache HTTP Server.
Dec 23 22:41:34 totwcom httpd[724]: Server configured, listening on: port 443, …
[root@totwcom ~]#

so I issue:

[root@totwcom ~]# systemctl stop httpd

which should avoid collisions with the 2 servers, apache and puma

[root@totwcom tryit]# rails about
About your application's environment
Rails version 7.0.4
Ruby version ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
RubyGems version 3.3.26
Rack version 2.2.5
Middleware ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActionDispatch::ServerTiming, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root /home/test/tryit
Environment development
Database adapter sqlite3
Database schema version 0
[root@totwcom tryit]#

[root@totwcom tryit]# gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 3.3.26
  • RUBY VERSION: 3.1.3 (2022-11-24 patchlevel 185) [x86_64-linux]
  • INSTALLATION DIRECTORY: /usr/share/gems
  • USER INSTALLATION DIRECTORY: /root/.local/share/gem/ruby
  • RUBY EXECUTABLE: /usr/bin/ruby
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /usr/bin
  • SPEC CACHE DIRECTORY: /root/.local/share/gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /usr/share/gems
    • /root/.local/share/gem/ruby
    • /usr/local/share/gems
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => true
    • :bulk_threshold => 1000
    • "gem" => "--install-dir=/usr/local/share/gems --bindir /usr/local/bin"
  • REMOTE SOURCES:
  • SHELL PATH:
    • /root/.local/bin
    • /root/bin
    • /usr/lib64/ccache
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
      [root@totwcom tryit]#

[root@totwcom tryit]# bin/rails server --binding=96.126.102.82 -d
=> Booting Puma
=> Rails 7.0.4 application starting in development
=> Run bin/rails server --help for more startup options
DEBUGGER: Can't debug the code after Process.daemon locally. Use the remote debugging feature.
[root@totwcom tryit]#

[root@totwcom tryit]# ps -ae | grep ruby
79480 ? 00:00:00 ruby-mri

Also puma.rb is set to port 3000: port ENV.fetch("PORT") { 3000 }

and I still can't get to this on the net.

This is extremely frustrating as I've spent quite a bit of time trying to get this to work. It's especially frustrating as my full rails site ran just fine from October 2021 to December 2022. Now I can't even get a minimal example to work.

I've have been building rails sites since 2008. It does now seem that feature creep has gotten to rails with new functions such as bootsnap breaking a site. However, I can get this to run just fine on my home machine which is fedora 6.0.15-602.inttf.fc36.x86_64 and is running rails 7 which fixes the bootsnap problem which was what brought my site down in the first place.

I'm not sure where to go from here. Would it make sense to completely reload the site (I have everything I need from it so I'm not worried about data loss.) and start over?

I'm in the process of completely rebuilding my original site from 2001 which is still LAMP architecure and runs on a separate linode: turtlesoftheworld.org. So I want to use rails 7 and leaflet for mapping, but so far I can't get out of the gate.

Thanks for your attention!

Ross

I write a lot of ruby code too…all of it CLI things (mostly for email system administration). I'm scared to death of rails precisely because of crap like this. I have enough trouble with the collection of gems that I do use…

Every migration to a new ruby version is a new exercise in pain. rubygems.org is a joke…half the stuff there won't work with a current version of ruby and the other half hasn't been tested to the level of what could be accomplished by a third-grader. Nine times out of ten, documentation is non-existent. Some of the stuff there isn't even packaged correctly.

That being said, does your site work without bootsnap? If so, I'd chuck it in a heartbeat and lower my expectations about how fast my site will come up. Or, is bootsnap an inherent dependency of rails these days?

I have a staging server in my living room that I use to debug crap like this before it goes live. It was the best $250 I ever spent. If you don't want to do that, you could accomplish the same thing with a nanode.

-- sw

For now I'm throwing in the towel. Hopefully I'll be back soon.

Just to check, I tried to create a site with julia/Genie. Like rails, the server appears to be working normally, but I can't get to it on the net.

Ross

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct