Implement run-dev command support [ECR-3727] - #1217
Conversation
dmitry-timofeev
left a comment
There was a problem hiding this comment.
I have a couple of questions to the intended behaviour:
- Is this command expected to always start with a fresh blockchain? I.e., once the node is stopped, can the db be scrapped?
- If it is, then why doesn't it use a new temporary directory to store the database with auto-delete on exit feature? Deleting a directory that this process has created is fine, a directory that was previously created and (a) might not contain a database but user files; (b) might belong to another running process is not.
- If it isn't, then shan't we use a new temp by default, but allow specifying an existing db directory?
- A related question — if I started with a temporary directory, would I ever want to keep the db after I shutdown the node?
| /// Run the node in development mode (generate configuration and db files automatically). | ||
| /// | ||
| /// Runs one node with public API address 127.0.0.1:8080, private API address 127.0.0.1:8081, | ||
| /// EJB port 6400 and no logging configuration. |
There was a problem hiding this comment.
Initially no way to specify Java logging configuration. Now added a special option for it. Not sure if I need to duplicate all other ejb parameters.
There was a problem hiding this comment.
I didn't ask for an option to add configuration, I asked whether such invocation will have no configuration or the default. I do not expect and consider as sensible supporting logging configuration for this command.
|
Implementation has been rewritten almost completely, now it supports setting database directory and node configuration file. |
|
In current implementation, user is allowed to provide the following parameters to the CLI:
So the user can:
|
dmitry-timofeev
left a comment
There was a problem hiding this comment.
I doubt it works, and the first question on the intended behaviour remains: is it expected to always start anew? Do we need to support these four options?
| /// | ||
| /// If <db_path> parameter is provided, returns <db_path>/config. Else returns system temporary | ||
| /// directory. | ||
| fn config_directory(&self) -> Result<PathBuf, failure::Error> { |
There was a problem hiding this comment.
It is named as a getter but it will create a new temporary directory if none exists.
| let node_config_path = concat_path(config_directory.clone(), "node.toml"); | ||
|
|
||
| // Configuration files exist, skip generation. | ||
| if config_directory.exists() { |
There was a problem hiding this comment.
How does existence of a config_directory (a temp dir may be created in config_directory) imply config file existence? Have you tested this?
There was a problem hiding this comment.
Error messages when node configuration file is deleted from database_path/config directory:
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
loading config from testnet/config/node.toml
| /// files and <tmp>/config for node configuration files. | ||
| /// 2. Only `<db_path>` is provided. `<db_path>` is used for database files, `<db_path>/config` is | ||
| /// used for configuration files. If `<db_path>/config` exists, existing configuration files are | ||
| /// used, otherwise node configuration is auto-generated. |
There was a problem hiding this comment.
Auto-generated or extracted from the database? If the first, would it even work?
|
Reimplemented once more. Now the user must provide a required |
dmitry-timofeev
left a comment
There was a problem hiding this comment.
Good, thanks!
To give some context: we discussed that the combinations of parameters when there are separate db path and config path and they are optional are too complex to implement and document and maintain; and unclear how useful; making the blockchain path in tmp would entail some restrictions and extra burden on the user since there is no easy way to implement auto-cleaning of that directory after node finishes (as a restriction, don't use in long-running systems that generate some transactions as nothing will clear the database directory until reboot). If we consider that tmp-that-is-not-cleaned is fine for the target usages, or tmp-that-is-cleaned is required (the use cases justify the complexity) — we can add any of that later, when there is demand.
| /// Database is located in <blockchain_path>/db directory, node configuration files | ||
| /// are located in <blockchain_path>/config directory. Existing files and directories are | ||
| /// reused. To generate new node configuration and start a new blockchain, the user must | ||
| /// manually delete existing <blockchain_path> directory. |
There was a problem hiding this comment.
or specify a new one.
|
The clippy is unhappy. |
Overview
Also fixed bug in java_runtime_factory module and fixed service_runtime_bootstrap native IT (it is still disabled)
See: https://jira.bf.local/browse/ECR-3727
Definition of Done