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

feat(node-manager): ✨ adds maintain cli command #2119

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anthonyra
Copy link

Description

Please provide a brief description of the changes made in this pull request. Highlight the purpose of the changes and the problem they address.

Related Issue

None

Type of Change

Please mark the types of changes made in this pull request.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe): Noticed that there were some #[expect] macros failing the build. Updated them to #[allow]. Currently builds. I also noticed there were some issues with the --path flag and aligning the arguments with the functions.

Checklist

Please ensure all of the following tasks have been completed:

  • I have read the contributing guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have updated the documentation accordingly.
  • I have followed the conventional commits guidelines for commit messages.
  • I have verified my commit messages with commitlint.

@anthonyra
Copy link
Author

Left this as draft since I'm not a huge rust developer and not 100% familiar with the project layout. The intention is to add the ability to the node-manager CLI to maintain a specific number of nodes running. This would be great for the DeEEP Network simplifying deployments. I didn't touch any tests and wasn't able to build the artifacts (I'm on Apple silicon). Let me know how I can help

@jacderida
Copy link
Contributor

Hi Anthony,

Thanks for the contribution! Could you elaborate more please on how you envision this command being used?

Cheers,

Chris

@anthonyra
Copy link
Author

@jacderida We want to host nodes for individuals (my parent company is NerdNode but building for DeEEP Network also). As such, with the current safenode-manager CLI we would need to manage the number of nodes an individual wants and scale up or down as necessary. With maintain we can simply call safenode-manager maintain --count 6 to scale up or safenode-manager maintain --count 1 to scale down.

@jacderida
Copy link
Contributor

I see, thanks! Let me take a look at this in a little more detail. I might need to wait until the weekend, but, it looks like a good feature.

@@ -38,7 +38,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<()>` - An Ok result or an error.
#[expect(unused_variables)]
#[allow(unused_variables)]
Copy link
Contributor

Choose a reason for hiding this comment

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

can we leave these as expect please, otherwise we can drop the lint

Copy link
Author

Choose a reason for hiding this comment

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

I'm not too familiar with rust, but I couldn't cargo build with those remaining as expect. Unless there's some cargo config settings that need to be set?

Copy link
Member

Choose a reason for hiding this comment

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

Hey, I think it might be because it was a new feature that was stablizied in the latest rust version. Could you run rustup update && rustup default stable and try compiling it?

Copy link
Author

Choose a reason for hiding this comment

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

It appears that it does allow me to build but results in a lot more orange and red in my IDE.. Also is there a way to force a rustc version so that it warns others before attempting to build? -- Looks like maybe

[package]
rust-version = "1.81.0"

@joshuef
Copy link
Contributor

joshuef commented Sep 18, 2024

thanks for this @anthonyra . QQ: In the current setup what's missing is count is that right?

Just wondering if another command is required here vs a flag to auto start the correct node counts.

@anthonyra
Copy link
Author

QQ: In the current setup what's missing is count is that right?

In the current setup, the CLI doesn't have the maintain_n_running_nodes exposed. My goal was to simply boil this up to the CLI. As such, the old function had max_nodes_to_run which I changed to count to align with the add sub-command. But while doing so noticed that there were other issues. Most notable one is that the path's flag "seemed" to be broken and some of the other arguments "shuffled". I attempted to install safenode-manager with the path flag set and got an os 13 error also after seeing the discrepancy.

1 service(s) to be added
Error: 
   0: Permission denied (os error 13)

Just wondering if another command is required here vs a flag to auto start the correct node counts.

I thought about this also but it's a hybrid of the add and start sub-commands from what I could tell requiring a mix of each to work. I could be wrong here just figured this would be the "quickest" lift from my understanding of the project.

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.

4 participants