`hanami server` not taking into account `activate_control_app` option supported by Puma config
- Dominant language
- Ruby
- Stars
- 33
- Forks
- 55
- Avg merge
- 8d 7h
- Merged PRs (30d)
- 2
Description
ruby 3.1.2
puma (6.2.2)
hanami (2.0.3)
hanami-cli (2.0.3)
rack (2.2.7)
Following shown is my Puma config file containing my custom changes:
**config/puma.rb**
```
# frozen_string_literal: true
max_threads_count = ENV.fetch("HANAMI_MAX_THREADS", 5)
min_threads_count = ENV.fetch("HANAMI_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
#port ENV.fetch("HANAMI_PORT", 2300)
port ENV.fetch("HANAMI_PORT", 2400) # Note this change
activate_control_app ENV.fetch("PUMA_CONTROL_APP_URL", "tcp://127.0.01:9294") # Note this change
environment ENV.fetch("HANAMI_ENV", "development")
workers ENV.fetch("HANAMI_WEB_CONCURRENCY", 2)
on_worker_boot do
Hanami.shutdown
end
preload_app!
```
When I start the server using `hanami server` following are the logs
```
my_api$ bundle exec hanami server
13:20:22 - INFO - Using Guardfile at /.../my_api/Guardfile.
13:20:22 - INFO - Puma starting on port 2300 in development environment.
13:20:22 - INFO - Guard is now watching at ' /.../my_api/'
[9743] Puma starting in cluster mode...
[9743] * Puma version: 6.2.1 (ruby 3.1.2-p20) ("Speaking of Now")
[9743] * Min threads: 5
[9743] * Max threads: 5
[9743] * Environment: development
[9743] * Master PID: 9743
[9743] * Workers: 2
[9743] * Restarts: (✔) hot (✖) phased
[9743] * Preloading application
[9743] * Listening on http://0.0.0.0:2400
[9743] Use Ctrl-C to stop
[9743] * Starting control server on http://127.0.0.1:9293
[9743] * Starting control server on http://[::1]:9293
[9743] - Worker 0 (PID: 9749) booted in 0.0s, phase: 0
[9743] - Worker 1 (PID: 9750) booted in 0.0s, phase: 0
```
From above it is clear that `port` option change is picked up but the `activate_control_app` option specified is not taken into account which is evident from following in the logs:
```
[9743] * Starting control server on http://127.0.0.1:9293
[9743] * Starting control server on http://[::1]:9293
```
Also one more thing I noticed related to port is the following inconsistency:
```
13:20:22 - INFO - Puma starting on port 2300 in development environment.
....
....
[9743] * Listening on http://0.0.0.0:2400
```
Coming back to my point: `activate_control_app` is a supported config option as can be seen at https://github.com/puma/puma/blob/v6.2.2/lib/puma/dsl.rb#L198-L235.
But when I directly start the server using following command
```
bundle exec puma --control-url tcp://127.0.01:9294 --port=2400
```
then the options are correctly picked-up.
```
my_api$ bundle exec puma --control-url tcp://127.0.01:9294 --port=2400
[13389] Puma starting in cluster mode...
[13389] * Puma version: 6.2.1 (ruby 3.1.2-p20) ("Speaking of Now")
[13389] * Min threads: 5
[13389] * Max threads: 5
[13389] * Environment: development
[13389] * Master PID: 13389
[13389] * Workers: 2
[13389] * Restarts: (✔) hot (✖) phased
[13389] * Preloading application
[13389] * Listening on http://0.0.0.0:2400
[13389] Use Ctrl-C to stop
[13389] * Starting control server on http://127.0.0.1:9294
[13389] - Worker 0 (PID: 13393) booted in 0.0s, phase: 0
[13389] - Worker 1 (PID: 13395) booted in 0.0s, phase: 0
```
Is this a bug on hanami-cli side or it looks like Puma-side issue related to when options are defined in configuration file?
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.