How do I get ‘puma’ to start, automatically, when I run `rails server` (like Thin does)

After some digging, I’ve found this answer: https://stackoverflow.com/a/14911994/604526 To make Puma the default, paste this code into script/rails above require ‘rails/commands’: require ‘rack/handler’ Rack::Handler::WEBrick = Rack::Handler.get(:puma) Puma is the default server now if you use rails s rails s => Booting Puma => Rails 3.2.12 application starting in development on http://0.0.0.0:3000 => Call with -d … Read more

ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)

I had the same problems which were caused by too many open connections to the database. This can happen when you have database queries outside of a controller (in a model, mailer, pdf generator, …). I could fix it by wrapping those queries in this block which closes the connection automatically. ActiveRecord::Base.connection_pool.with_connection do # your … Read more

How can I serve requests concurrently with Rails 4?

I invite you to read about the configuration options of config.threadsafe! in this article Removing config.threadsafe! It will help you to understand better the options of config.threadsafe!, in particular to allow concurrency. In Rails 4 config.threadsafe! is set by default. Now to the answer In Rails 4 requests are wrapped around a Mutex by the … Read more

Connecting to WSL2 server via local network [closed]

See this video, it helped me: netsh interface portproxy add v4tov4 listenport=<port-to-listen> listenaddress=0.0.0.0 connectport=<port-to-forward> connectaddress=<forward-to-this-IP-address> for example netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=172.30.16.3 Microsoft has published a little bit of information about this on their WSL1 to WSL2 comparison page

What is the difference between Workers and Threads in Puma

As the other answer states, this Heroku article is pretty good with explanations of certain configuration items. However if you need to tune your application on Heroku, or anywhere, then it pays to know how things work. I think you are almost correct when you say “a worker is a thread inside the puma process”, … Read more

NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

This happens because your upstream takes too long to answer the request and NGINX thinks the upstream already failed in processing the request, so it responds with an error. Just include and increase proxy_read_timeout in location config block. Same thing happened to me and I used 1 hour timeout for an internal app at work: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)