roadrunner-server / roadrunner

🤯 High-performance PHP application server, process manager written in Go and powered with plugins
https://docs.roadrunner.dev
MIT License
7.91k stars 413 forks source link

[🐛 BUG]: Config for RPC plugin does not work when included from another file #2017

Open Kaspiman opened 3 weeks ago

Kaspiman commented 3 weeks ago

No duplicates 🥲.

What happened?

When splitting configs, forwarding the rpc.listen field or something like that doesn't work. The error says that the address is not specified, although I assume that the plugin did not start or the config cannot be read.

Version (rr --version)

rr version 2024.2.1 (build time: 2024-09-12T16:25:02+0000, go1.23.1), OS: linux, arch: amd64

How to reproduce the issue?

.rr.base.yaml:

version: '3'

rpc:
    listen: tcp://127.0.0.1:6001

# also 0.0.0.0 does not working

.rr.yaml:

version: '3'

include:
    - .rr.base.yaml
...

then run rr workers

Relevant log output

/var/www/html # rr workers
rpc service not specified in the configuration. Tip: add
 rpc:
 listen: rr_rpc_address
rustatian commented 3 weeks ago

Hey @Kaspiman 👋 The case is, that RR commands (like ./rr workers) are using your initial configuration. Replace works for the plugins, but not for the RR commands. This is not a bug, but unexpected expected (huh) behavior. I'll put this to the 2024.3 milestone and add support for the replaces in the RR commands as well.

nickdnk commented 3 weeks ago

As discused in Discord, this is a problem for me as well. I'm loading different paths/routes in my application depending on domain, which requires separate RR nodes. To simplify config, I use a parent config with this:

version: "3"
rpc:
  listen: tcp://127.0.0.1:6010
kv:
  roadrunner:
    driver: memory
    config: {}
http:
  address: 0.0.0.0:8080
  pool:
    allocate_timeout: 60s
    num_workers: 2
logs:
  level: debug
  mode: development

And a child config like

version: "3"
server:
  command: "php app-with-domain-specific-routes.php"
include:
  - .rr.yaml

But loading the kv plugin like this doesn't work, and gives:

ERROR kv  can't find local or global configuration, this section will be skipped  {"local": "kv.roadrunner.config", "global": "roadrunner"}

Having rpc in the parent config does work for me though.