Skip to content

Add env var that bypasses Puma cluster validation

Matthias Käppler requested to merge mk-skip-puma-validate into master

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

Availability and Testing

Edited by Matthias Käppler

Merge request reports

Loading