Compare commits

...

6 Commits

Author SHA1 Message Date
Vladislav Drozdov fb0568bee6 Merge pull request 'preboot to master' (#11) from preboot into master
Reviewed-on: http://git.enode/VladislavD/runner-rs/pulls/11
2024-12-06 11:26:05 +03:00
prplV 93917800f0 README update 2024-12-06 11:20:18 +03:00
prplV 9d14658fd0 cli added 2024-12-04 16:13:22 +03:00
prplV 1b12ecc67f critical bug in files fixed + cli created 2024-12-04 12:55:26 +03:00
prplV 5a9bf795e9 gr v2 2024-12-04 11:23:42 +03:00
prplV d67e77c5cc global refactor to work as workspace 2024-12-04 11:23:18 +03:00
36 changed files with 188 additions and 26 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
/target
.idea
Dockerfile
Cargo.lock
settings.json
hagent_test.sock

View File

@ -1,24 +1,12 @@
[package]
name = "runner-rs"
version = "0.10.11"
edition = "2021"
[workspace]
resolver = "2"
members = [
"noxis-rs",
"noxis-cli",
]
[profile.dev]
debug = true
[profile.test]
debug = false
[dependencies]
anyhow = "1.0.93"
chrono = "0.4.38"
clap = { version = "4.5.21", features = ["derive"] }
env_logger = "0.11.3"
inotify = "0.10.2"
log = "0.4.22"
pcap = "2.2.0"
redis = "0.25.4"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.118"
sysinfo = "0.32.0"
tokio = { version = "1.38.0", features = ["full", "time"] }

View File

@ -1,13 +1,16 @@
# runner-rs ( with amd64 and riscv64 support )
![Logo](https://blog.desdelinux.net/wp-content/uploads/2023/07/rust-logo.png)
in-container integrating util to handle processes runtime
# noxis-rs
![Logo](logo.png)
### In-container integrating util to handle processes runtime
( with amd64 and riscv64 support )
## Depends on
- `rustup (>=1.27.1)`
- `gcc-riscv64-unknown-elf`
- `build-essential`
- `gcc-riscv64-linux-gnu`
- `binutils-riscv64-linux-gnu`
## Setting up
Download and execute rustup.sh
@ -29,7 +32,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cd runner-rs/ && rustup target add riscv64gc-unknown-linux-gnu && rustup target add x86_64-unknown-linux-gnu
~~~
> [!NOTE]
> Cargo is configured to build an app for amd64/linux defaultly. RISC-based compilation is optional.
> Cargo is configured to build an app for amd64/linux defaultly. RISCV-based compilation is optional.
3.1. Release build of app for amd64/linux

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

7
noxis-cli/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "noxis-cli"
version = "0.1.5"
edition = "2021"
[dependencies]
clap = { version = "4.5.22", features = ["derive"] }

134
noxis-cli/src/cli.rs Normal file
View File

@ -0,0 +1,134 @@
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
pub struct Cli {
#[command(
subcommand,
help = "status|start|stop|restart|",
)]
command : Commands,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
#[command(
about = "To get info about current Noxis status",
)]
Status,
#[command(
about = "To start Noxis process",
)]
Start,
#[command(
about = "To stop Noxis process",
)]
Stop,
#[command(
about = "To restart Noxis process",
)]
Restart,
#[command(
about = "To get list of processes that are being monitoring",
)]
Processes,
// process command
#[command(
about = "To manage current process that is being monitoring",
)]
Process(ProcessCommand),
// config command =
#[command(
about = "To manage config settings",
)]
Config(ConfigCommand),
}
#[derive(Debug, Parser)]
pub struct ConfigCommand {
#[command(subcommand)]
action : ConfigAction,
}
#[derive(Debug, Subcommand)]
pub enum ConfigAction {
#[command(
about = "To change current Noxis configuration",
)]
Local(LocalConfig),
#[command(
about = "To change credentials of the remote config server",
)]
Remote,
#[command(
about = "To reset all config settings",
)]
Reset,
}
#[derive(Debug, Parser)]
pub struct LocalConfig {
// flag
#[arg(
long = "json",
action,
help = "to read following input as JSON",
)]
type_of_entry : bool,
// value
#[arg(
help = "path to config file or config String (with --json flag)",
)]
config : String,
}
#[derive(Debug, Parser)]
pub struct ProcessCommand {
#[arg(
help = "name of needed process",
)]
process : String,
#[command(
subcommand,
help = "To get current process's status",
)]
action : ProcessAction,
}
#[derive(Debug, Subcommand)]
enum ProcessAction {
#[command(
about = "To get info about current process status",
)]
Status,
#[command(
about = "To start current process",
)]
Start,
#[command(
about = "To stop current process",
)]
Stop,
#[command(
about = "To freeze (hybernaze) current process",
)]
Freeze,
#[command(
about = "To unfreeze (unhybernaze) current process",
)]
Unfreeze,
#[command(
about = "To restart current process",
)]
Restart,
#[command(
about = "To get info about current process's dependencies",
)]
Deps,
#[command(
about = "To get info about current process's files-dependencies",
)]
Files,
#[command(
about = "To get info about current process's services-dependencies",
)]
Services,
}

11
noxis-cli/src/main.rs Normal file
View File

@ -0,0 +1,11 @@
mod cli;
use clap::Parser;
use cli::Cli;
fn main() -> Result<(), std::io::Error>{
let cli = Cli::parse();
dbg!(&cli);
println!("{:?}", cli);
Ok(())
}

18
noxis-rs/Cargo.toml Normal file
View File

@ -0,0 +1,18 @@
[package]
name = "noxis-rs"
version = "0.10.11"
edition = "2021"
[dependencies]
anyhow = "1.0.93"
chrono = "0.4.38"
clap = { version = "4.5.21", features = ["derive"] }
env_logger = "0.11.3"
inotify = "0.10.2"
log = "0.4.22"
pcap = "2.2.0"
redis = "0.25.4"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.118"
sysinfo = "0.32.0"
tokio = { version = "1.38.0", features = ["full", "time"] }

View File

@ -98,7 +98,10 @@ pub async fn file_handler(
// * watcher recreation after dealing with file recreation mechanism in text editors
let mutex = notify.borrow_mut();
*mutex = create_watcher(&file.filename, &file.src).await.unwrap();
// *mutex = create_watcher(&file.filename, &file.src).await.unwrap();
if let Ok(watcher) = create_watcher(&file.filename, &file.src).await {
*mutex = watcher;
}
}
match file.triggers.on_change.as_str() {
"stop" => {