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

Historians should create a default config file when launched without one. #15

Open
davidraker opened this issue Nov 30, 2023 · 1 comment

Comments

@davidraker
Copy link
Contributor

When historians in modular are first installed, they do not have a valid configuration file by default. This causes the agent to die with an exception on startup. Because we are distributing the agent without source code, though, there is no place for the user to easily retrieve a configuration file without searching the documentation. While current users are accustomed to finding configuration files in the repository, we should not assume that users who first encounter VOLTTRON on Pypi will know where to look.

Since with modular, different historians have more specific agents associated with them (volttron-sqlite-historian, for instance), it should be possible to create a default configuration and place it in the configuration store on startup. For some, like the sqlite historian, this will probably just work. For more complicated databases, it will likely still need to be edited. In this case, though, the sane behavior would probably be to log an error asking the user to update the configuration before shutting down gracefully.

Describe the solution you'd like

Scenario 1 (sqlite):

  1. User installs sqlite historian with "vctl install volttron-sqlite-historian".
  2. User starts agent without adding a configuration file.
  3. Agent detects that there is not a configuration file present.
  4. Agent adds a default configuration to the configuration store and starts.

Scenario 2 (PostgreSQL):

  1. User installs postgres historian with "vctl install volttron-postgresql-historian".
  2. User starts agent without adding a configuration file.
  3. Agent detects that there is not a configuration file present.
  4. Agent adds a default configuration store and stops with error: "PostgreSQL historian must be configured before starting. Please edit the "config" file in the configuration store and then restart the agent."

Describe alternatives you've considered

  • The current state of affairs is that the user must be aware of how to find the configuration file before running the agent.
  • We could have a configuration tool which generates a template for the user.
  • We could simply die gracefully (without the current stack-trace) until the user creates a configuration. In this scenario, however, we should at least log a link to the appropriate documentation.

Additional context
We should keep in mind that if we automatically create a configuration and then start, that we should probably be cautious of overwriting or adding to an existing database. It would be straightforward to either check if the database uses the same vip-identity in the name or generate a different name if the default one is taken.

@craig8
Copy link
Contributor

craig8 commented Nov 30, 2023

This is only true if you don't pass an --agent-config as argument to the install path. Which I believe is how the agent should be installed in the first place. We don't require an --agent-config but it is definitely a recommended practice and should be documented as such in the readme.

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

No branches or pull requests

2 participants