Execute puma workers only in prod but not in dev environment

0 votes

I'm executing the following puma configuration

threads_count = Integer(ENV["DB_POOL"] || ENV["MAX_THREADS"] || 15)
threads threads_count, threads_count
workers 3
preload_app!

rackup      DefaultRackup
port        ENV["PORT"]     || 3000
environment ENV["RACK_ENV"] || "development"

on_worker_boot do
  ActiveSupport.on_load(:active_record) do
    ActiveRecord::Base.establish_connection
  end
end

before_fork do
  ActiveRecord::Base.connection_pool.disconnect!
end

It works fine for production but I do not want to create 3 workers or use webrick in dev environment. If I try and wrap the worker specific code in env check, it breaks the puma DSL. Any other way I could run puma in non clustered mode in dev.

Aug 16, 2018 in Other DevOps Questions by shubham
• 6,500 points
39 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can us RACK_ENV here instead of Rails as Rails is not defined for puma config.

workers(ENV["RACK_ENV"] == "production" ? 3 : 0)
answered Aug 16, 2018 by ajs3033
• 7,040 points

Related Questions In Other DevOps Questions

0 votes
1 answer

Using conditional to execute a command in salt

You can use unless inside your state ...READ MORE

answered Jul 23, 2018 in Other DevOps Questions by DareDev
• 6,560 points
37 views
0 votes
1 answer

How to get issues count based on rules in a sonar project?

There are API docs in the footer ...READ MORE

answered May 4, 2018 in Other DevOps Questions by DareDev
• 6,560 points
156 views
+1 vote
2 answers

Unable to build TFS project because files not found

Please make a folder in solution Nd ...READ MORE

answered May 16 in Other DevOps Questions by Shashikesh Mishra
225 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Command not working in .bat script but works in CLI

powershell /? If you run the above command ...READ MORE

answered Jul 19, 2018 in Other DevOps Questions by ajs3033
• 7,040 points
23 views
0 votes
1 answer

Puppet not recieving hiera data

Puppet does not consider the variables defined ...READ MORE

answered May 7, 2018 in Other DevOps Questions by ajs3033
• 7,040 points
146 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.