Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for config file #7234

Closed
eenagy opened this issue Nov 21, 2024 · 6 comments
Closed

Support for config file #7234

eenagy opened this issue Nov 21, 2024 · 6 comments
Labels
meta-feature-request Issues to track feature requests.

Comments

@eenagy
Copy link

eenagy commented Nov 21, 2024

Problem description

Lodestar lacks support for a dedicated config file, unlike other Ethereum clients. Currently, configurations must be passed through command line flags or wrapper scripts.

Currently, users need to specify multiple CLI arguments when running Lodestar, which can become unwieldy and difficult to maintain. Configuration files would:

  • Make it easier to manage multiple node configurations
  • Reduce the chance of typos in command-line arguments
  • Allow for better version control of node configurations
  • Improve the experience when running nodes in production environments
  • It helps integrate lodestar with system.d services, as lodestar would not need a wrapper script to load the config values

Solution description

Allow users to specify a config file path using the --config-file flag:

# Beacon node
lodestar beacon --config-file beacon-config.yaml

# Validator client
lodestar vc --config-file validator-config.yaml

The config files would support all existing CLI options in their YAML/TOML representation. Example:

# beacon-config.yaml
network: mainnet
dataDir: ./beacon-data
eth1:
  provider: http://localhost:8545
rest:
  enabled: true
  port: 9596
metrics:
  enabled: true

Technical Details

  • Support either YAML (.yaml, .yml) or TOML (.toml) file formats
  • Each CLI option should map directly to its configuration file equivalent
  • Maintain the same option names and structure as CLI arguments
  • Allow mixing of config file and CLI arguments (CLI takes precedence)

YAML/TOML are preferred due to their human-readable format and widespread use in configuration management.

Additional context

I maintain eth-nodes (https://github.com/eth-pkg/eth-nodes), a project that enables native installation of Ethereum clients (execution, consensus, and validator) via Debian packages, eliminating the need for Docker containers. While the project currently generates configuration files for Lodestar options through wrapper scripts, I'm seeking to implement native configuration file support.

@eenagy eenagy added the meta-feature-request Issues to track feature requests. label Nov 21, 2024
@nflaig
Copy link
Member

nflaig commented Nov 21, 2024

We already support this via --rcConfig config.yml on both beacon node and validator client, it currently work with YAML and JSON format. The key names are the same as the CLI flag names.

eg.

network: mainnet
rest: true
rest.address: 0.0.0.0
rest.port: 9596
# ...

We don't support nesting as we just handle it with the same parser we use for CLI args, although this could probably be supported somehow to achieve a format like in your example (with nested objects).

@eenagy
Copy link
Author

eenagy commented Nov 21, 2024

Fantastic! I don't need nesting, that was just an example.

Can you please update the documentation? I always check there and existing GitHub issues before opening an issue.
This option doesn't seem to be in the docs: https://chainsafe.github.io/lodestar/run/beacon-management/beacon-cli

@eenagy eenagy closed this as completed Nov 21, 2024
@nflaig
Copy link
Member

nflaig commented Nov 21, 2024

Yeah, it's a bit tricky with that one because it works differently than other CLI flags, and the documentation for those is generated from the code. I can look into how we can display that on the docs page.

@eenagy
Copy link
Author

eenagy commented Nov 21, 2024

Yeah, it's a bit tricky with that one because it works differently than other CLI flags and the documentation for those is generated from the code. I can look into how we can display that on the docs page.

Thank you! I would appreciate it. I think there are a couple of more of those that are not in the docs (devnet config values). I'm working on node setup, would be good if those are documented as well, so the users know what they stand for.

@nflaig
Copy link
Member

nflaig commented Nov 21, 2024

I think there are a couple of more of those that are not in the docs (devnet config values)

There are a lot of flags which are intentionally hidden, mostly because we might change their behavior in the future or they are too technical, can be easily misconfigured or just not meant to be used by normal users (ie. just used for testing by us).

If you have some specific flags in mind we cna unhide them on a case by case basis.

@nflaig
Copy link
Member

nflaig commented Dec 2, 2024

I think there are a couple of more of those that are not in the docs (devnet config values).

I have opened a PR for this #7271, feel free to chime in if there are additional flags that might be useful to display

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-feature-request Issues to track feature requests.
Projects
None yet
Development

No branches or pull requests

2 participants