From 86cba91b167e1af717d40853afe8ac38861206f6 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 11 May 2024 16:23:52 +0200 Subject: [PATCH] feat: add protos Signed-off-by: kjuulh --- Cargo.lock | 386 ++++++++++++++++++-- Cargo.toml | 2 + crates/hyperlog-protos/Cargo.toml | 12 + crates/hyperlog-protos/build.rs | 3 + crates/hyperlog-protos/proto/hyperlog.proto | 16 + crates/hyperlog-protos/src/lib.rs | 3 + crates/hyperlog-server/Cargo.toml | 2 + crates/hyperlog-server/src/lib.rs | 46 +++ crates/hyperlog/src/cli.rs | 3 +- scripts/dev.sh | 9 +- 10 files changed, 454 insertions(+), 28 deletions(-) create mode 100644 crates/hyperlog-protos/Cargo.toml create mode 100644 crates/hyperlog-protos/build.rs create mode 100644 crates/hyperlog-protos/proto/hyperlog.proto create mode 100644 crates/hyperlog-protos/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 4b2fe8d..d0b1ccd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,6 +100,28 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.62", +] + [[package]] name = "async-trait" version = "0.1.80" @@ -126,6 +148,34 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core 0.3.4", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 0.1.2", + "tower", + "tower-layer", + "tower-service", +] + [[package]] name = "axum" version = "0.7.5" @@ -133,13 +183,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.4.3", "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", - "hyper", + "hyper 1.3.1", "hyper-util", "itoa", "matchit", @@ -160,6 +210,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + [[package]] name = "axum-core" version = "0.4.3" @@ -169,8 +236,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", "mime", "pin-project-lite", @@ -588,6 +655,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flume" version = "0.11.0" @@ -713,6 +786,31 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" @@ -729,7 +827,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -786,6 +884,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.1.0" @@ -797,6 +906,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.0" @@ -804,7 +924,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http", + "http 1.1.0", ] [[package]] @@ -815,8 +935,8 @@ checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", "futures-core", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -848,6 +968,30 @@ dependencies = [ "uuid", ] +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.3.1" @@ -857,8 +1001,8 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "httparse", "httpdate", "itoa", @@ -867,6 +1011,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.28", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-util" version = "0.1.3" @@ -875,9 +1031,9 @@ checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", "pin-project-lite", "socket2", "tokio", @@ -888,7 +1044,7 @@ name = "hyperlog" version = "0.1.0" dependencies = [ "anyhow", - "axum", + "axum 0.7.5", "bus", "clap", "dirs", @@ -911,7 +1067,7 @@ name = "hyperlog-core" version = "0.1.0" dependencies = [ "anyhow", - "axum", + "axum 0.7.5", "bus", "clap", "dirs", @@ -928,19 +1084,30 @@ dependencies = [ "uuid", ] +[[package]] +name = "hyperlog-protos" +version = "0.1.0" +dependencies = [ + "prost", + "tonic", + "tonic-build", +] + [[package]] name = "hyperlog-server" version = "0.1.0" dependencies = [ "anyhow", - "axum", + "axum 0.7.5", "hyperlog-core", + "hyperlog-protos", "serde", "serde_json", "similar-asserts", "sqlx", "tempfile", "tokio", + "tonic", "tower-http", "tracing", "uuid", @@ -975,6 +1142,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + [[package]] name = "indexmap" version = "2.2.6" @@ -982,7 +1159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -1082,7 +1259,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -1149,6 +1326,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + [[package]] name = "nom" version = "7.1.3" @@ -1314,6 +1497,16 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.2.6", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -1385,6 +1578,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.62", +] + [[package]] name = "proc-macro2" version = "1.0.82" @@ -1394,6 +1597,59 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" +dependencies = [ + "bytes", + "heck 0.5.0", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 2.0.62", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.62", +] + +[[package]] +name = "prost-types" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +dependencies = [ + "prost", +] + [[package]] name = "quote" version = "1.0.36" @@ -1896,7 +2152,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap", + "indexmap 2.2.6", "log", "memchr", "once_cell", @@ -2275,6 +2531,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-macros" version = "2.2.0" @@ -2297,6 +2563,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.8.12" @@ -2324,12 +2603,52 @@ version = "0.22.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" dependencies = [ - "indexmap", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", ] +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.6.20", + "base64", + "bytes", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-build" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "quote", + "syn 2.0.62", +] + [[package]] name = "tower" version = "0.4.13" @@ -2338,9 +2657,13 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", + "indexmap 1.9.3", "pin-project", "pin-project-lite", + "rand", + "slab", "tokio", + "tokio-util", "tower-layer", "tower-service", "tracing", @@ -2354,8 +2677,8 @@ checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.5.0", "bytes", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", "pin-project-lite", "tower-layer", @@ -2437,6 +2760,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -2538,6 +2867,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 7065027..2e6493a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ resolver = "2" hyperlog-core = { path = "crates/hyperlog-core" } hyperlog-tui = { path = "crates/hyperlog-tui" } hyperlog-server = { path = "crates/hyperlog-server" } +hyperlog-protos = { path = "crates/hyperlog-protos" } anyhow = { version = "1" } tokio = { version = "1", features = ["full"] } @@ -18,6 +19,7 @@ serde = { version = "1.0.201", features = ["derive"] } serde_json = "1.0.117" itertools = "0.12.1" uuid = { version = "1.8.0", features = ["v4"] } +tonic = "0.11.0" [workspace.package] version = "0.1.0" diff --git a/crates/hyperlog-protos/Cargo.toml b/crates/hyperlog-protos/Cargo.toml new file mode 100644 index 0000000..eb44920 --- /dev/null +++ b/crates/hyperlog-protos/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "hyperlog-protos" +edition = "2021" +version.workspace = true + +[dependencies] +tonic.workspace = true + +prost = "0.12.4" + +[build-dependencies] +tonic-build = "0.11.0" diff --git a/crates/hyperlog-protos/build.rs b/crates/hyperlog-protos/build.rs new file mode 100644 index 0000000..c69b0e0 --- /dev/null +++ b/crates/hyperlog-protos/build.rs @@ -0,0 +1,3 @@ +fn main() { + tonic_build::compile_protos("proto/hyperlog.proto").unwrap(); +} diff --git a/crates/hyperlog-protos/proto/hyperlog.proto b/crates/hyperlog-protos/proto/hyperlog.proto new file mode 100644 index 0000000..e686ab2 --- /dev/null +++ b/crates/hyperlog-protos/proto/hyperlog.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package hyperlog; + +service Graph { + rpc SayHello (HelloRequest) returns (HelloReply); +} + +message HelloRequest { + string name = 1; +} + +message HelloReply { + string message = 1; +} + diff --git a/crates/hyperlog-protos/src/lib.rs b/crates/hyperlog-protos/src/lib.rs new file mode 100644 index 0000000..2b22829 --- /dev/null +++ b/crates/hyperlog-protos/src/lib.rs @@ -0,0 +1,3 @@ +pub mod hyperlog { + tonic::include_proto!("hyperlog"); // Specify the same package name as in your .proto file +} diff --git a/crates/hyperlog-server/Cargo.toml b/crates/hyperlog-server/Cargo.toml index 8991522..ba47071 100644 --- a/crates/hyperlog-server/Cargo.toml +++ b/crates/hyperlog-server/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] hyperlog-core.workspace = true +hyperlog-protos.workspace = true anyhow.workspace = true tokio.workspace = true @@ -13,6 +14,7 @@ axum.workspace = true serde.workspace = true serde_json.workspace = true uuid.workspace = true +tonic.workspace = true tower-http = { version = "0.5.2", features = ["cors", "trace"] } sqlx = { version = "0.7.4", features = [ diff --git a/crates/hyperlog-server/src/lib.rs b/crates/hyperlog-server/src/lib.rs index 003b460..a63957a 100644 --- a/crates/hyperlog-server/src/lib.rs +++ b/crates/hyperlog-server/src/lib.rs @@ -4,12 +4,55 @@ use crate::state::{SharedState, State}; mod external_http; mod internal_http; +mod external_grpc { + use std::net::SocketAddr; + + use hyperlog_protos::hyperlog::{ + graph_server::{Graph, GraphServer}, + HelloReply, HelloRequest, + }; + use tonic::{transport, Response}; + + use crate::state::SharedState; + + #[derive(Default)] + struct Server {} + + #[tonic::async_trait] + impl Graph for Server { + async fn say_hello( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status> { + tracing::info!("received hello request"); + + Ok(Response::new(HelloReply { + message: "hello".into(), + })) + } + } + + pub async fn serve(state: &SharedState, host: SocketAddr) -> anyhow::Result<()> { + tracing::info!("listening on {}", host); + + let graph_server = Server::default(); + + transport::Server::builder() + .add_service(GraphServer::new(graph_server)) + .serve(host) + .await?; + + Ok(()) + } +} mod state; #[derive(Clone)] pub struct ServeOptions { pub external_http: SocketAddr, pub internal_http: SocketAddr, + + pub external_grpc: SocketAddr, } pub async fn serve(opts: ServeOptions) -> anyhow::Result<()> { @@ -28,6 +71,9 @@ pub async fn serve(opts: ServeOptions) -> anyhow::Result<()> { res = internal_http::serve(&state, &opts.internal_http) => { res? }, + res = external_grpc::serve(&state, opts.external_grpc) => { + res? + } () = ctrl_c => {} ); tracing::debug!("serve finalized"); diff --git a/crates/hyperlog/src/cli.rs b/crates/hyperlog/src/cli.rs index 94ea478..66d8f45 100644 --- a/crates/hyperlog/src/cli.rs +++ b/crates/hyperlog/src/cli.rs @@ -78,13 +78,14 @@ pub async fn execute() -> anyhow::Result<()> { Some(Commands::Serve { external_host, internal_host, - .. + external_grpc_host, }) => { tracing::info!("Starting service"); hyperlog_server::serve(hyperlog_server::ServeOptions { external_http: external_host, internal_http: internal_host, + external_grpc: external_grpc_host, }) .await?; } diff --git a/scripts/dev.sh b/scripts/dev.sh index 81e6e60..2c81c29 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -3,10 +3,13 @@ echo "starting services" docker compose -f templates/docker-compose.yaml up -d --remove-orphans +sleep 5 + tear_down() { - docker compose -f templates/docker-compose.yaml down -v || true + echo "cleaning up services in the background" + (docker compose -f templates/docker-compose.yaml down -v &) > /dev/null 2>&1 } -trap tear_down EXIT +trap tear_down SIGINT -RUST_LOG=trace,tokio=info,tower=info,mio=info,sqlx=info cargo run -F include_server -- serve +RUST_LOG=info,hyperlog=trace cargo run -F include_server -- serve