Search code examples
ruby-on-railsrubypuma

Rails server exiting immediately - Rails 5.2.0 and Ruby 2.5.1


I was using Rails 5.2.0 and Ruby 2.4.0. Everything worked fine. So I upgraded my Ruby to 2.5.1 and ran the bundle again. After that When I run "Rails S" I have the error:

rails s
=> Booting Puma
=> Rails 5.2.0 application starting in development 
=> Run `rails server -h` for more startup options
Exiting
Traceback (most recent call last):
        34: from bin/rails:3:in `<main>'
        33: from bin/rails:3:in `load'
        32: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `<top (required)>'
        31: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `require'
        30: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
        29: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
        28: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
        27: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
        26: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
        25: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
        24: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
        23: from /Users/felipemarcon/projects/marcon_portfolio/bin/rails:9:in `<top (required)>'
        22: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
        21: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
        20: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
        19: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
        18: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        17: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
        16: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
        15: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
        14: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
        13: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
        12: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
        11: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        10: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
         9: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
         8: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
         7: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
         6: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
         5: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:53:in `start'
         4: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/rack-2.0.4/lib/rack/server.rb:297:in `start'
         3: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `run'
         2: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `new'
         1: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `initialize'
/Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `chdir': No such file or directory @ dir_s_chdir - /{path_to_your_app}/current (Errno::ENOENT)  

What happened? How can I solve this?

Thanks.


Solution

  • I got solve this. Is just a problem with file config/puma.rb. Everything works fine now, with Ruby 2.5.1 and Rails 5.2.0.

    My puma.rb was like this:

    environment "production"
    
    bind  "unix:///{path_to_your_app}/shared/tmp/sockets/puma.sock"
    pidfile "/{path_to_your_app}/shared/tmp/pids/puma.pid"
    state_path "/{path_to_your_app}/shared/tmp/sockets/puma.state"
    directory "/{path_to_your_app}/current"
    
    workers 2
    threads 1,2
    
    daemonize true
    
    activate_control_app 'unix:///{path_to_your_app}/shared/tmp/sockets/pumactl.sock'
    
    prune_bundler
    

    I just change to (initial config):

    threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
    threads threads_count, threads_count
    
    port        ENV.fetch("PORT") { 3000 }
    
    environment ENV.fetch("RAILS_ENV") { "development" }
    
    plugin :tmp_restart
    
    bind "unix:/home/rails/marcon/shared/tmp/sockets/puma.sock" if ENV.fetch("RAILS_ENV") == 'production'
    

    Anyway, thanks to whoever answered.