22

I was following the Heroku docs on getting Puma set up and entered this command:

bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

Which made it so that now I run puma in my development environment whenever I run a rails s. But or whatever reason Puma is causing havok. How do I switch back to using WEBrick??

Tried

bundle exec webrick -p ${PORT:-3000} -e ${RACK_ENV:-development}

But of course, command is not found: webrick. Knew that' be too easy...

Thanks!

james
  • 3,989
  • 8
  • 47
  • 102

4 Answers4

36

To run the local server in development with webrick you should only have to specify it when running rails server:

rails server webrick

You may get it to default back to webrick again if you move puma to the production group of your Gemfile:

group :production do
  gem 'puma'
end

Then bundle without the production group:

bundle install --without production
infused
  • 24,000
  • 13
  • 68
  • 78
  • 11
    The first part works, but putting "gem 'puma'" within the production group does not do it. – JosephK Sep 07 '15 at 01:34
  • 2
    confirming the behavior posted by JosephK on rails 4.2.5 – Raphael Ottoni May 24 '16 at 20:38
  • That's because putting it in the `:production` group doesn't automatically stop it from being installed on `:development`. You need to tell it explicitly to not install it with `bundle install --without production` – user2490003 Mar 07 '19 at 19:48
3

Per the following:

How to set Rails dev server to webbrick instead of Puma

You want to change your Gemfile to:

group :production do
  gem 'puma'
end

And running bundle install --without production will set WEBrick as the non-production (development & test) server and Puma to production.

Community
  • 1
  • 1
Marc
  • 4,546
  • 2
  • 29
  • 45
1

Remove the puma gem from the gemfile and bundle it.

and start the application. you can see the webrick app server start info in the console.

Default app web server is Webrick

Jeyavel
  • 2,974
  • 10
  • 38
  • 48
  • Yep. Works a treat. Puma after 5.0.2 caused some major slowdowns for us - unusable. See https://github.com/puma/puma/issues/2484. It never got fixed and now there are security issues unless you upgrade. Moving back over to Webrick since it's the default for dev anyway. – Joshua Pinter Nov 16 '21 at 16:40
0

Run with:

bundle exec rails server -u webrick -p 3000 -e staging

Also you may need to have webrick installed. But as I remember it is a part of standard library

bundle add webrick
SERGHII
  • 64
  • 5