@@ -11,21 +11,30 @@ async fn main() -> eyre::Result<()> {
|
||||
|
||||
println!("Building churning...");
|
||||
|
||||
let client = dagger_sdk::connect_opts(config).await?;
|
||||
//let client = dagger_sdk::connect_opts(config).await?;
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
let agent = build_container(client.clone(), "churn-agent").await?;
|
||||
let agent = agent
|
||||
.with_exec(vec!["churn-agent", "daemon", "--host", "0.0.0.0:3000"])
|
||||
.with_exposed_port(3000);
|
||||
let cli = build_container(client.clone(), "churn").await?;
|
||||
let server = build_container(client.clone(), "churn-server").await?;
|
||||
let server = server
|
||||
.with_exec(vec!["churn-server", "serve", "--host", "0.0.0.0:3000"])
|
||||
.with_exposed_port(3000);
|
||||
|
||||
let server_id = server.id().await?;
|
||||
|
||||
let agent = build_container(client.clone(), "churn-agent").await?;
|
||||
let agent = agent
|
||||
.with_service_binding("churn-server", server_id.clone())
|
||||
.with_exec(vec!["churn-agent", "daemon", "--host", "0.0.0.0:3000"])
|
||||
.with_exposed_port(3000);
|
||||
|
||||
let churning = cli
|
||||
.with_service_binding("churn-agent", agent.id().await?)
|
||||
.with_service_binding("churn-server", server.id().await?)
|
||||
.with_service_binding("churn-server", server_id)
|
||||
.with_env_variable("CHURN_SERVER", "http://churn-server:3000")
|
||||
.with_env_variable("CHURN_SERVER_TOKEN", "something")
|
||||
.with_env_variable("CHURN_AGENT", "http://churn-agent:3000")
|
||||
.with_env_variable("CHURN_AGENT_NAME", "churn-agent")
|
||||
.with_exec(vec![
|
||||
"churn",
|
||||
"health",
|
||||
@@ -52,7 +61,7 @@ async fn repl(container: dagger_sdk::Container) -> eyre::Result<()> {
|
||||
let mut container = container;
|
||||
|
||||
loop {
|
||||
let mut stdin = tokio::io::stdin();
|
||||
let stdin = tokio::io::stdin();
|
||||
let mut stdout = tokio::io::stdout();
|
||||
|
||||
stdout.write_all(b"> ").await?;
|
||||
@@ -79,14 +88,14 @@ async fn repl(container: dagger_sdk::Container) -> eyre::Result<()> {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
}
|
||||
match container.stderr().await {
|
||||
Ok(stderr) => {
|
||||
println!("{stderr}");
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
}
|
||||
// match container.stderr().await {
|
||||
// Ok(stderr) => {
|
||||
// println!("{stderr}");
|
||||
// }
|
||||
// Err(e) => {
|
||||
// eprintln!("{}", e);
|
||||
// }
|
||||
// }
|
||||
|
||||
match container.exit_code().await {
|
||||
Ok(_) => {}
|
||||
@@ -121,7 +130,7 @@ async fn build_container(
|
||||
.collect::<Vec<_>>(),
|
||||
architecture: dagger_rust::build::BuildArchitecture::Amd64,
|
||||
}],
|
||||
&bin_name,
|
||||
bin_name,
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
Reference in New Issue
Block a user