Compare commits
6 Commits
f3e9cb92df
...
fb0568bee6
| Author | SHA1 | Date |
|---|---|---|
|
|
fb0568bee6 | |
|
|
93917800f0 | |
|
|
9d14658fd0 | |
|
|
1b12ecc67f | |
|
|
5a9bf795e9 | |
|
|
d67e77c5cc |
|
|
@ -1,6 +1,4 @@
|
||||||
/target
|
/target
|
||||||
.idea
|
.idea
|
||||||
Dockerfile
|
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
settings.json
|
|
||||||
hagent_test.sock
|
hagent_test.sock
|
||||||
24
Cargo.toml
24
Cargo.toml
|
|
@ -1,24 +1,12 @@
|
||||||
[package]
|
[workspace]
|
||||||
name = "runner-rs"
|
resolver = "2"
|
||||||
version = "0.10.11"
|
members = [
|
||||||
edition = "2021"
|
"noxis-rs",
|
||||||
|
"noxis-cli",
|
||||||
|
]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[profile.test]
|
[profile.test]
|
||||||
debug = false
|
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"] }
|
|
||||||
|
|
|
||||||
13
README.md
13
README.md
|
|
@ -1,13 +1,16 @@
|
||||||
|
|
||||||
# runner-rs ( with amd64 and riscv64 support )
|
# noxis-rs
|
||||||

|

|
||||||
in-container integrating util to handle processes runtime
|
### In-container integrating util to handle processes runtime
|
||||||
|
( with amd64 and riscv64 support )
|
||||||
|
|
||||||
## Depends on
|
## Depends on
|
||||||
- `rustup (>=1.27.1)`
|
- `rustup (>=1.27.1)`
|
||||||
- `gcc-riscv64-unknown-elf`
|
- `gcc-riscv64-unknown-elf`
|
||||||
- `build-essential`
|
- `build-essential`
|
||||||
|
- `gcc-riscv64-linux-gnu`
|
||||||
|
- `binutils-riscv64-linux-gnu`
|
||||||
|
|
||||||
|
|
||||||
## Setting up
|
## Setting up
|
||||||
Download and execute rustup.sh
|
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
|
cd runner-rs/ && rustup target add riscv64gc-unknown-linux-gnu && rustup target add x86_64-unknown-linux-gnu
|
||||||
~~~
|
~~~
|
||||||
> [!NOTE]
|
> [!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
|
3.1. Release build of app for amd64/linux
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "noxis-cli"
|
||||||
|
version = "0.1.5"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = { version = "4.5.22", features = ["derive"] }
|
||||||
|
|
@ -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,
|
||||||
|
}
|
||||||
|
|
@ -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(())
|
||||||
|
}
|
||||||
|
|
@ -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"] }
|
||||||
|
|
@ -98,7 +98,10 @@ pub async fn file_handler(
|
||||||
// * watcher recreation after dealing with file recreation mechanism in text editors
|
// * watcher recreation after dealing with file recreation mechanism in text editors
|
||||||
let mutex = notify.borrow_mut();
|
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() {
|
match file.triggers.on_change.as_str() {
|
||||||
"stop" => {
|
"stop" => {
|
||||||
Loading…
Reference in New Issue