Skip to content

Commit

Permalink
Merge branch 'main' into feat/worker/monitor/pusher
Browse files Browse the repository at this point in the history
  • Loading branch information
lemosep authored Apr 12, 2024
2 parents 5e4eb6e + 63216e1 commit 042af35
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ctl/src/http/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use axum::{routing::post, Router};
use tracing::info;

pub mod worker;

pub async fn run_server() {
let app = Router::new().route("/worker/metrics", post(worker::push_metrics));

let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
println!("HTTP listening at port 3000");
info!("HTTP listening at port 3000");
axum::serve(listener, app).await.unwrap();
}
54 changes: 54 additions & 0 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,60 @@ graph TB
may also optionally call a health check endpoint for the corresponding
service.

# Deployment seq. diagram

```mermaid
sequenceDiagram
%% Alice->>+John: Hello John, how are you?
%% Alice->>+John: John, can you hear me?
%% John-->>-Alice: Hi Alice, I can hear you!
%% John-->>-Alice: I feel great!
actor SysAdmin
participant deployer as ctl::deployer
participant discovery as ctl::discovery
participant wrk_mgr as ctl::worker_mgr
participant runner as wrk::runner
participant builder as wrk::builder
participant supervisor as wrk::supervisor
SysAdmin ->>+ deployer: New deploy request (via CLI)
deployer ->>+ discovery: Create new deployment
discovery ->>- deployer: Deployment ID
deployer ->>- SysAdmin: Deployment ID
deployer ->>+ discovery: Fetch available workers
discovery ->>- deployer:
deployer ->> deployer: Select worker
deployer -->>+ runner: Start deployment
runner ->>+ builder: Execute build script
builder ->>- runner: Report status
alt build failed
runner -->> wrk_mgr: Report build failure
wrk_mgr -->> discovery: Record build failed status
else build ok
runner ->>+ supervisor: Start service
supervisor ->>- runner: Report status
alt service started
runner -->> wrk_mgr: Report service running
wrk_mgr -->> discovery: Record running status
opt service crashed
runner -->> wrk_mgr: Report failed
wrk_mgr -->> discovery: Record failed status
end
else service failed to start
runner -->> wrk_mgr: Report failure
wrk_mgr -->> discovery: Record failed status
end
end
```

# TODO

- Add sequence diagrams for communication patterns.
Expand Down

0 comments on commit 042af35

Please sign in to comment.