Deploy an app from source
deploy_sourceFIRST deploy and fork redeploy: ONE build (4-8 min), not rcs_commit+test_ref+deploy_ref (two). First run code_gate on the files (1 s; it lists Cargo.toml and the API). Then build_status {build_id, wait_s: 50}; never resubmit. Same app and service names again = update, data kept. spec (string; set name, artifact_key apps/@v1). For a small store, hot_set_gib 0 uses the default cache; 1 requests 1 GiB per store copy. Call estimate_cost with this spec and the planned instance count first: {"services":[{"name":"requests","primitive":"queue","workload":{"read_qps":50,"write_qps":50,"record_size_kb":1,"keying":"PerKey","hot_set_gib":1}},{"name":"data","primitive":"store","workload":{"read_qps":50,"write_qps":50,"record_size_kb":1,"keying":"PerKey","hot_set_gib":0}}],"applications":[{"name":"vote","artifact_key":"apps/vote@v1","artifact_sha256":"0000000000000000000000000000000000000000000000000000000000000000","bindings":[{"handle":"requests","kind":"queue","service":"requests"},{"handle":"data","kind":"store","service":"data"}],"routes":[{"prefix":"/","binding":"requests","kind":"api"}],"compute":{"memory_mb":256,"cpu_percent":50}}]} src/main.rs (keep the loop, write handle()): #![forbid(unsafe_code)] use ferrite_app::client::StoreClusterClient; use ferrite_app::{app_main,rt,serde_json,AppContext,FerriteApp,IngressReply,IngressRequest}; struct App; impl FerriteApp for App{fn run(ctx:AppContext)->impl std::future::Future<Output=std::io::Result<()>>+Send{serve(ctx)}} async fn serve(ctx:AppContext)->std::io::Result<()>{ let mut q=ctx.queue("requests")?;let mut db=ctx.store("data")?; loop{ let l=match q.poll_wait(1_000).await{Ok(Some(x))=>x,Ok(None)=>continue, Err(_)=>{rt::time::sleep(std::time::Duration::from_millis(200)).await;continue}}; let Ok(req)=serde_json::from_slice::(&l.payload) else{let =q.ack(l.token).await;continue}; let rep=match handle(&mut db,&req).await{Ok(r)=>r,Err()=>IngressReply::to(&req,503,b"retry".to_vec())}; if let Ok(mut o)=ctx.reply_to_queue(&req.reply_to).await{if let Ok(p)=serde_json::to_vec(&rep){let _=o.publish(&p).await;}} let _=q.ack(l.token).await;}} async fn handle(db:&mut StoreClusterClient,req:&IngressRequest)->std::io::Result{/yours/} fn main(){app_main::()}
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"spec": "<spec>",
"files": "<files>"
},
"name": "deploy_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | the InfraSpec JSON | |
| files | Yes | ||
| token | No | fallback bearer for clients that cannot send an Authorization header; when a header is present omit this argument, because a different token is refused | |
| packages | No | Ferrite source packages to compile in, by name from list_packages ("name" or "name@version"). The server adds each package's files, and its dependencies', under src/<root>/ before anything reads `files`; declare each root in src/lib.rs (read_package gives the lines). Do not send those files yourself: a changed copy is refused. | |
| instances | No |