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!

1
  • What does your Procfile say?
    – Joel
    Feb 19, 2015 at 3:51

4 Answers 4

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
3
  • 11
    The first part works, but putting "gem 'puma'" within the production group does not do it.
    – JosephK
    Sep 7, 2015 at 1:34
  • 2
    confirming the behavior posted by JosephK on rails 4.2.5 May 24, 2016 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 Mar 7, 2019 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.

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

1
  • Yep. Works a treat. Puma after 5.0.2 caused some major slowdowns for us - unusable. See 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. Nov 16, 2021 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.