Add env var that bypasses Puma cluster validation
What does this MR do?
We often need to run Puma in single-mode for performance testing, but the application isn't fully set up yet to support that. Bypassing this check as a non-published developer switch makes our life easier.
This change adds an undocumented/non-published env var PUMA_SKIP_CLUSTER_VALIDATION
that allows developers to temporarily bypass strict validation of Puma cluster config.
As a safety measure, we only allow this env var to be set outside of .com
.
Screenshots (strongly suggested)
Without the env var set and workers=0
:
web_1 | Starting Puma with 0 workers and 4 threads...
web_1 | Puma starting in single mode...
web_1 | * Puma version: 5.1.1 (ruby 2.7.2-p137) ("At Your Service")
web_1 | * Min threads: 4
web_1 | * Max threads: 4
...
web_1 | ! Unable to load application: RuntimeError: Puma is only supported in Cluster-mode: workers > 0
web_1 | Traceback (most recent call last):
web_1 | 47: from /data/cache/bundle-2.7/bin/puma:23:in `<main>'
web_1 | 46: from /data/cache/bundle-2.7/bin/puma:23:in `load'
web_1 | 45: from /data/cache/bundle-2.7/gems/puma-5.1.1/bin/puma:10:in `<top (required)>'
web_1 | 44: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/cli.rb:80:in `run'
web_1 | 43: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/launcher.rb:182:in `run'
web_1 | 42: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/single.rb:44:in `run'
web_1 | 41: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/runner.rb:138:in `load_and_bind'
web_1 | 40: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/configuration.rb:264:in `app'
web_1 | 39: from /data/cache/bundle-2.7/gems/puma-5.1.1/lib/puma/configuration.rb:342:in `load_rackup'
With the env var set:
web_1 | Starting Puma with 0 workers and 4 threads...
web_1 | Puma starting in single mode...
web_1 | * Puma version: 5.1.1 (ruby 2.7.2-p137) ("At Your Service")
web_1 | * Min threads: 4
web_1 | * Max threads: 4
...
web_1 | * Listening on http://0.0.0.0:8080
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry We should not advertise this change, it is for testing only.
- [-] Documentation (if required) We should not advertise this change, it is for testing only.
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Matthias Käppler