Skip to content

add cli config options#23

Merged
Rob-Johnson merged 2 commits intomasterfrom
u/robj/add-cli-commands
Mar 9, 2026
Merged

add cli config options#23
Rob-Johnson merged 2 commits intomasterfrom
u/robj/add-cli-commands

Conversation

@Rob-Johnson
Copy link

Background: We use nerve-tools to restart nerve at Yelp. Notably, rather than doing a hard restart, we launch a second copy of nerve, replace the 'main' nerve process, and then terminate the backup. This prevents us from deregistering all the backends running on a host every time we restart nerve. We run the backup nerve instance using the same config file that we run the main instance with.

In #16 we added support for exporting prometheus metrics from nerve. this requires binding an http server to the configured port. However, this doesn't play nicely with our graceful restart procedure; we can't have 2 nerve processes bind to the same prometheus port.

To overcome this, we've chosen to disable prometheus on the backup nerve instance. Which raises the question: how should we tell the backup nerve instance to not enable prom metrics? We could tell the backup nerve instance to use a backup config file, but that introduces the suprise factor of having 2 config files on disk.

Instead, this PR introduces the ability to set the runtime nerve config (not the service/healthcheck config) via cli args. cli args take precedence over the config file. That'll allow us to just run the backup nerve instance with --prometheus-enabled=false, but still use the same config file for all other options.

I've tried to improve the docs for the config while I'm here, encoding the config in a json schema and using it to auto generate docs/configuration.md. I've included a make target for generating this automatically.

this adds support for specifying runtime config options via cli args.
cli args take precedence over the any values in config files.

note that we don't support the entire nerve config; service level/check
config can still only be done via the config file
use a json schema to encode the docs for nerve config and improve docs
@Rob-Johnson Rob-Johnson changed the title U/robj/add cli commands add cli config options Mar 4, 2026
Copy link

@giuli007 giuli007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read it all in superdetail but looks reasonable to me!

@Rob-Johnson Rob-Johnson merged commit 952ed7f into master Mar 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants