ohler55 / agoo

A High Performance HTTP Server for Ruby
MIT License
912 stars 39 forks source link

rackup -r agoo -s agoo Doesn't Work #128

Closed bendangelo closed 10 months ago

bendangelo commented 10 months ago

Running this for rails gives this error:

RACK_HANDLER is deprecated, use RACKUP_HANDLER.
/home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:269:in `block in logging_middleware': undefined method `name' for nil (NoMethodError)

          /CGI/.match?(server.server.name) || server.options[:quiet] ? nil : [Rack::CommonLogger, $stderr]
                                    ^^^^^
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:415:in `block in build_app'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:414:in `reverse_each'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:414:in `build_app'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:424:in `wrapped_app'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:326:in `block in start'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:382:in `handle_profiling'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:325:in `start'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:182:in `start'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/gems/rackup-2.1.0/bin/rackup:5:in `<top (required)>'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/bin/rackup:25:in `load'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/bin/rackup:25:in `<main>'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/bin/ruby_executable_hooks:22:in `eval'
        from /home/bendangelo/.rvm/gems/ruby-3.3.0/bin/ruby_executable_hooks:22:in `<main>'
ohler55 commented 10 months ago

I created a branch name "rackup_handler" with the addition of an env variable set for RACKUP_HANDLER. I'm not sure if that is all that is required. I suspect some methods will need to be added to the server. Are you able to either share your test or help me debug?

bendangelo commented 10 months ago

I just installed the latest version of rails and agoo. On a new blank project ran exactly that command in the title

ohler55 commented 10 months ago

ok, will debug with that. Thanks.

ohler55 commented 10 months ago

Please try the latest. It worked for me and the rack linter issue of missing SERVER_PROTOCOL was also fixed.

bendangelo commented 10 months ago

ok thanks

jackbit commented 9 months ago

how is it fixed? I tried with rails but not worked, I used agoo (2.15.8) :

╰─ bundle exec rackup -r agoo -s agoo                                                                                                                                 ─╯
RACK_HANDLER is deprecated, use RACKUP_HANDLER.
bundler: failed to load command: rackup (/home/vbuntu/.asdf/installs/ruby/3.3.0/bin/rackup)
/home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:269:in `block in logging_middleware': undefined method `name' for nil (NoMethodError)

          /CGI/.match?(server.server.name) || server.options[:quiet] ? nil : [Rack::CommonLogger, $stderr]
                                    ^^^^^
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:415:in `block in build_app'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:414:in `reverse_each'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:414:in `build_app'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:424:in `wrapped_app'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:326:in `block in start'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:382:in `handle_profiling'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:325:in `start'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:182:in `start'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/bin/rackup:5:in `<top (required)>'
    from /home/vbuntu/.asdf/installs/ruby/3.3.0/bin/rackup:25:in `load'

but if i run normal rails, it worked like this:

╰─ bundle exec rails s                                                                                                                                                ─╯
Rack::Handler is deprecated and replaced by Rackup::Handler
/home/vbuntu/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/agoo-2.15.8/lib/rack/handler/agoo.rb:180: warning: Calling Rackup::Handler.register with a string is deprecated, use the class/module itself.
RACK_HANDLER is deprecated, use RACKUP_HANDLER.
=> Booting Agoo
=> Rails 7.1.3 application starting in development http://localhost:3000
=> Run `bin/rails server --help` for more startup options
I 2024/02/19 16:18:10.226121504 INFO: Agoo 2.15.8 with pid 19007 is listening on http://:3000.
I 2024/02/19 16:23:16.592973402 INFO: Agoo with pid 19007 shutting down.

any idea? or is it the same?

jackbit commented 9 months ago

it worked after add

gem "agoo", github: 'ohler55/agoo', branch: 'rackup_handler' 

thanks.

DannyBen commented 7 months ago

I am trying to use agoo with Sinatra, and getting Rack::Handler is deprecated and replaced by Rackup::Handler.

Tried both the released and the GitHub version.

The error comes from agoo/lib/rack/handler/agoo.rb:165:inhandle'`