stump icon indicating copy to clipboard operation
stump copied to clipboard

CLI utility to check server health

Open aaronleopold opened this issue 2 years ago • 0 comments

EDIT: I am making this an actual issue in case any potential hacktoberfest contributors would like to start on this. If that interests you, review the criteria at the bottom.

I think it would be cool to have a little CLI app that people can use to check on their server. See apps/tui. Some features I am thinking:

  • queue jobs
  • see running jobs and job progress
  • query libraries
  • create users

Core technologies I plan on using:

  • https://github.com/clap-rs/clap
  • https://github.com/fdehau/tui-rs

This would mostly be just for fun, and if it goes further than the silly little template in the repository it would be a small headache. The core crate will need to be converted into a library, so that the types may be shared between the applications. This means the rocket server part would become a separate application in the apps directory.

General criteria:

For hacktoberfest, not everything on the list must be completed.

  • [ ] clap should take in a config sub command to:
    • [ ] set the base_url of the Stump server
    • [ ] set the user credentials
    • [ ] both the above should be stored and encrypted somewhere secure, I am open to suggestions.
  • [ ] SSE handler to listen to the events emitted by the Stump server, something similar to Stump's event manager:
impl SSEHandler {
	pub fn new(base_url: &str, ..args..) -> Arc<Self> {
		let this = Arc::new(Self {
			..fields..
		});

		tokio::spawn(async move {
			// https://docs.rs/reqwest-eventsource/latest/reqwest_eventsource/
                        // Note: can be hard coded for now
			let mut source = EventSource::get(&format!("{}/api/jobs/listen", base_url));
			while let Some(event) = source.next().await {
				match event {
					// handle events here
				}
			}
		});

		this
	}
}
  • [ ] Super basic interface to start off with, should have some sort of manageable event loop but okay if not for now
    • [ ] should only be rendered if there were no clap args

aaronleopold avatar Sep 18 '22 23:09 aaronleopold