Configure CI (#2)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2 Co-authored-by: Pierre HUBERT <pierre.git@communiquons.org> Co-committed-by: Pierre HUBERT <pierre.git@communiquons.org>
This commit is contained in:
parent
9b55f1f29c
commit
1ed23317cb
52
.drone.yml
Normal file
52
.drone.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: web_build
|
||||
image: node:20
|
||||
volumes:
|
||||
- name: web_app
|
||||
path: /tmp/web_build
|
||||
commands:
|
||||
- cd virtweb_frontend
|
||||
- npm install
|
||||
- npm run build
|
||||
- mv dist /tmp/web_build
|
||||
|
||||
- name: backend_check
|
||||
image: rust
|
||||
volumes:
|
||||
- name: rust_registry
|
||||
path: /usr/local/cargo/registry
|
||||
commands:
|
||||
- apt update && apt install -y libvirt-dev
|
||||
- rustup component add clippy
|
||||
- cd virtweb_backend
|
||||
- cargo clippy -- -D warnings
|
||||
- cargo test
|
||||
|
||||
- name: backend_compile
|
||||
image: rust
|
||||
volumes:
|
||||
- name: rust_registry
|
||||
path: /usr/local/cargo/registry
|
||||
- name: web_app
|
||||
path: /tmp/web_build
|
||||
depends_on:
|
||||
- backend_check
|
||||
- web_build
|
||||
commands:
|
||||
- apt update && apt install -y libvirt-dev
|
||||
- cd virtweb_backend
|
||||
- mv /tmp/web_build/dist static
|
||||
- cargo build --release
|
||||
- ls -lah target/release/virtweb_backend
|
||||
|
||||
|
||||
volumes:
|
||||
- name: rust_registry
|
||||
temp: {}
|
||||
- name: web_app
|
||||
temp: {}
|
1333
virtweb_backend/Cargo.lock
generated
1333
virtweb_backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -6,42 +6,42 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.19"
|
||||
env_logger = "0.10.1"
|
||||
clap = { version = "4.4.11", features = ["derive", "env"] }
|
||||
light-openid = { version = "1.0.1", features = ["crypto-wrapper"] }
|
||||
log = "0.4.21"
|
||||
env_logger = "0.11.3"
|
||||
clap = { version = "4.5.4", features = ["derive", "env"] }
|
||||
light-openid = { version = "1.0.2", features = ["crypto-wrapper"] }
|
||||
lazy_static = "1.4.0"
|
||||
actix = "0.13.1"
|
||||
actix-web = "4"
|
||||
actix = "0.13.3"
|
||||
actix-web = "4.5.1"
|
||||
actix-remote-ip = "0.1.0"
|
||||
actix-session = { version = "0.8.0", features = ["cookie-session"] }
|
||||
actix-identity = "0.6.0"
|
||||
actix-cors = "0.6.5"
|
||||
actix-files = "0.6.2"
|
||||
actix-web-actors = "4.2.0"
|
||||
actix-http = "3.4.0"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
actix-session = { version = "0.9.0", features = ["cookie-session"] }
|
||||
actix-identity = "0.7.1"
|
||||
actix-cors = "0.7.0"
|
||||
actix-files = "0.6.5"
|
||||
actix-web-actors = "4.3.0"
|
||||
actix-http = "3.6.0"
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
quick-xml = { version = "0.31.0", features = ["serialize", "overlapped-lists"] }
|
||||
futures-util = "0.3.28"
|
||||
anyhow = "1.0.75"
|
||||
anyhow = "1.0.81"
|
||||
actix-multipart = "0.6.1"
|
||||
tempfile = "3.8.1"
|
||||
reqwest = { version = "0.11.23", features = ["stream"] }
|
||||
tempfile = "3.10.1"
|
||||
reqwest = { version = "0.12.3", features = ["stream"] }
|
||||
url = "2.5.0"
|
||||
virt = "0.3.1"
|
||||
sysinfo = { version = "0.29.11", features = ["serde"] }
|
||||
uuid = { version = "1.6.1", features = ["v4", "serde"] }
|
||||
sysinfo = { version = "0.30.8", features = ["serde"] }
|
||||
uuid = { version = "1.8.0", features = ["v4", "serde"] }
|
||||
lazy-regex = "3.1.0"
|
||||
thiserror = "1.0.51"
|
||||
image = "0.24.7"
|
||||
thiserror = "1.0.58"
|
||||
image = "0.25.1"
|
||||
rand = "0.8.5"
|
||||
bytes = "1.5.0"
|
||||
tokio = "1.35.0"
|
||||
futures = "0.3.29"
|
||||
bytes = "1.6.0"
|
||||
tokio = "1.37.0"
|
||||
futures = "0.3.30"
|
||||
ipnetwork = "0.20.0"
|
||||
num = "0.4.1"
|
||||
rust-embed = { version = "8.1.0" }
|
||||
rust-embed = { version = "8.3.0" }
|
||||
mime_guess = "2.0.4"
|
||||
dotenvy = "0.15.7"
|
||||
nix = { version = "0.27.1", features = ["net"] }
|
||||
nix = { version = "0.28.0", features = ["net"] }
|
||||
|
@ -9,7 +9,7 @@ use crate::libvirt_rest_structures::nw_filter::{NetworkFilter, NetworkFilterName
|
||||
use crate::libvirt_rest_structures::vm::*;
|
||||
use crate::nat::nat_lib;
|
||||
use actix::{Actor, Context, Handler, Message};
|
||||
use image::ImageOutputFormat;
|
||||
use image::ImageFormat;
|
||||
use std::io::Cursor;
|
||||
use virt::connect::Connect;
|
||||
use virt::domain::Domain;
|
||||
@ -337,7 +337,7 @@ impl Handler<ScreenshotDomainReq> for LibVirtActor {
|
||||
|
||||
let image = image::load_from_memory(&screen_out)?;
|
||||
let mut png_out = Cursor::new(Vec::new());
|
||||
image.write_to(&mut png_out, ImageOutputFormat::Png)?;
|
||||
image.write_to(&mut png_out, ImageFormat::Png)?;
|
||||
|
||||
Ok(png_out.into_inner())
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use crate::libvirt_rest_structures::hypervisor::HypervisorInfo;
|
||||
use crate::nat::nat_hook;
|
||||
use crate::utils::net_utils;
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sysinfo::{System, SystemExt};
|
||||
use sysinfo::{Components, Disks, Networks, System};
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct StaticConfig {
|
||||
@ -106,18 +106,33 @@ pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
|
||||
struct ServerInfo {
|
||||
hypervisor: HypervisorInfo,
|
||||
system: System,
|
||||
components: Components,
|
||||
disks: Disks,
|
||||
networks: Networks,
|
||||
}
|
||||
|
||||
pub async fn server_info(client: LibVirtReq) -> HttpResult {
|
||||
let mut system = System::new();
|
||||
system.refresh_disks_list();
|
||||
system.refresh_components_list();
|
||||
system.refresh_networks_list();
|
||||
system.refresh_all();
|
||||
|
||||
let mut components = Components::new();
|
||||
components.refresh_list();
|
||||
components.refresh();
|
||||
|
||||
let mut disks = Disks::new();
|
||||
disks.refresh_list();
|
||||
disks.refresh();
|
||||
|
||||
let mut networks = Networks::new();
|
||||
networks.refresh_list();
|
||||
networks.refresh();
|
||||
|
||||
Ok(HttpResponse::Ok().json(ServerInfo {
|
||||
hypervisor: client.get_info().await?,
|
||||
system,
|
||||
components,
|
||||
disks,
|
||||
networks,
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ use nix::sys::socket::{AddressFamily, SockaddrLike};
|
||||
use std::collections::HashMap;
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
|
||||
use std::str::FromStr;
|
||||
use sysinfo::{NetworksExt, System, SystemExt};
|
||||
use sysinfo::Networks;
|
||||
|
||||
pub fn extract_ipv4(ip: IpAddr) -> Ipv4Addr {
|
||||
match ip {
|
||||
@ -56,11 +56,11 @@ pub fn is_net_interface_name_valid<D: AsRef<str>>(int: D) -> bool {
|
||||
|
||||
/// Get the list of available network interfaces
|
||||
pub fn net_list() -> Vec<String> {
|
||||
let mut system = System::new();
|
||||
system.refresh_networks_list();
|
||||
let mut networks = Networks::new();
|
||||
networks.refresh_list();
|
||||
|
||||
system
|
||||
.networks()
|
||||
networks
|
||||
.list()
|
||||
.iter()
|
||||
.map(|n| n.0.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
|
5146
virtweb_frontend/package-lock.json
generated
5146
virtweb_frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,9 @@ let config: ServerConfig | null = null;
|
||||
export interface ServerSystemInfo {
|
||||
hypervisor: HypervisorInfo;
|
||||
system: SystemInfo;
|
||||
components: SysComponent;
|
||||
disks: DiskInfo[];
|
||||
networks: NetworkInfo[];
|
||||
}
|
||||
|
||||
interface HypervisorInfo {
|
||||
@ -77,10 +80,6 @@ interface SystemInfo {
|
||||
total_swap: number;
|
||||
free_swap: number;
|
||||
used_swap: number;
|
||||
components: SysComponent;
|
||||
users: [];
|
||||
disks: DiskInfo[];
|
||||
networks: NetworkInfo[];
|
||||
uptime: number;
|
||||
boot_time: number;
|
||||
load_average: SysLoadAverage;
|
||||
|
@ -51,7 +51,7 @@ export function SysInfoRoute(): React.ReactElement {
|
||||
export function SysInfoRouteInner(p: {
|
||||
info: ServerSystemInfo;
|
||||
}): React.ReactElement {
|
||||
const sumDiskUsage = p.info.system.disks.reduce(
|
||||
const sumDiskUsage = p.info.disks.reduce(
|
||||
(prev, disk) => {
|
||||
return {
|
||||
used: prev.used + disk.total_space - disk.available_space,
|
||||
@ -227,8 +227,8 @@ export function SysInfoRouteInner(p: {
|
||||
]}
|
||||
/>
|
||||
|
||||
<DiskDetailsTable disks={p.info.system.disks} />
|
||||
<NetworksDetailsTable networks={p.info.system.networks} />
|
||||
<DiskDetailsTable disks={p.info.disks} />
|
||||
<NetworksDetailsTable networks={p.info.networks} />
|
||||
</VirtWebRouteContainer>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user