fixing windows build problems. i hate windows !
Agent: Added GET /healthz that returns 200 immediately. File: main.rs (router now includes /healthz). CI workflow: Start agent from target/release on both OSes. Set SOCKTOP_ENABLE_SSL=0 explicitly. Ubuntu: wait on curl http://127.0.0.1:3000/healthz (60s), log tail and ss/netstat on failure. Windows: wait on Invoke-WebRequest to /healthz (60s), capture stdout/stderr, print netstat on failure. File: .github/workflows/ci.yml.
This commit is contained in:
parent
93f4e1feea
commit
fff386f9d5
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@ -33,15 +33,12 @@ jobs:
|
|||||||
RUST_LOG=info SOCKTOP_ENABLE_SSL=0 ./target/release/socktop_agent -p 3000 > agent.log 2>&1 &
|
RUST_LOG=info SOCKTOP_ENABLE_SSL=0 ./target/release/socktop_agent -p 3000 > agent.log 2>&1 &
|
||||||
AGENT_PID=$!
|
AGENT_PID=$!
|
||||||
echo "AGENT_PID=$AGENT_PID" >> $GITHUB_ENV
|
echo "AGENT_PID=$AGENT_PID" >> $GITHUB_ENV
|
||||||
# Wait for port 3000 to accept connections (30s max)
|
# Wait for /healthz to return 200 (60s max)
|
||||||
for i in {1..60}; do
|
for i in {1..60}; do
|
||||||
if bash -lc "</dev/tcp/127.0.0.1/3000" &>/dev/null; then
|
if curl -fsS http://127.0.0.1:3000/healthz >/dev/null; then echo "agent is ready"; break; fi
|
||||||
echo "agent is ready"
|
sleep 1
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 0.5
|
|
||||||
done
|
done
|
||||||
if ! bash -lc "</dev/tcp/127.0.0.1/3000" &>/dev/null; then
|
if ! curl -fsS http://127.0.0.1:3000/healthz >/dev/null; then
|
||||||
echo "--- agent.log (tail) ---"
|
echo "--- agent.log (tail) ---"
|
||||||
tail -n 200 agent.log || true
|
tail -n 200 agent.log || true
|
||||||
echo "--- lsof/netstat ---"
|
echo "--- lsof/netstat ---"
|
||||||
@ -73,9 +70,12 @@ jobs:
|
|||||||
$p = Start-Process -FilePath "${PWD}\\target\\release\\socktop_agent.exe" -ArgumentList "-p 3000" -RedirectStandardOutput $out -RedirectStandardError $err -PassThru -NoNewWindow
|
$p = Start-Process -FilePath "${PWD}\\target\\release\\socktop_agent.exe" -ArgumentList "-p 3000" -RedirectStandardOutput $out -RedirectStandardError $err -PassThru -NoNewWindow
|
||||||
echo "AGENT_PID=$($p.Id)" | Out-File -FilePath $env:GITHUB_ENV -Append
|
echo "AGENT_PID=$($p.Id)" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
$ready = $false
|
$ready = $false
|
||||||
for ($i = 0; $i -lt 120; $i++) {
|
for ($i = 0; $i -lt 60; $i++) {
|
||||||
if (Test-NetConnection -ComputerName 127.0.0.1 -Port 3000 -InformationLevel Quiet) { $ready = $true; break }
|
try {
|
||||||
Start-Sleep -Milliseconds 500
|
$resp = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:3000/healthz" -TimeoutSec 2 -ErrorAction Stop
|
||||||
|
if ($resp.StatusCode -eq 200) { $ready = $true; break }
|
||||||
|
} catch { }
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
}
|
}
|
||||||
if (-not $ready) {
|
if (-not $ready) {
|
||||||
Write-Warning "TCP connect to (127.0.0.1 : 3000) failed"
|
Write-Warning "TCP connect to (127.0.0.1 : 3000) failed"
|
||||||
|
|||||||
@ -9,7 +9,7 @@ mod state;
|
|||||||
mod types;
|
mod types;
|
||||||
mod ws;
|
mod ws;
|
||||||
|
|
||||||
use axum::{routing::get, Router};
|
use axum::{http::StatusCode, routing::get, Router};
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
@ -48,8 +48,10 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let _h_disks = spawn_disks_sampler(state.clone(), std::time::Duration::from_secs(5));
|
let _h_disks = spawn_disks_sampler(state.clone(), std::time::Duration::from_secs(5));
|
||||||
|
|
||||||
// Web app: route /ws to the websocket handler
|
// Web app: route /ws to the websocket handler
|
||||||
|
async fn healthz() -> StatusCode { StatusCode::OK }
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/ws", get(ws::ws_handler))
|
.route("/ws", get(ws::ws_handler))
|
||||||
|
.route("/healthz", get(healthz))
|
||||||
.with_state(state.clone());
|
.with_state(state.clone());
|
||||||
|
|
||||||
let enable_ssl =
|
let enable_ssl =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user