Change local web server back to WEBrick in Rails from Puma
Asked Answered
P

4

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!

Pelaga answered 19/2, 2015 at 3:45 Comment(1)
What does your Procfile say?Azriel
D
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
Daltondaltonism answered 19/2, 2015 at 4:6 Comment(3)
The first part works, but putting "gem 'puma'" within the production group does not do it.Outclass
confirming the behavior posted by JosephK on rails 4.2.5Laomedon
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 productionTripe
A
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.

Askja answered 13/1, 2017 at 22:8 Comment(0)
C
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

Colmar answered 19/1, 2017 at 6:12 Comment(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.Cortex
B
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
Bagby answered 18/10, 2021 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.