From 939529f5bd54e3f6b05d26f2cafe31329a102ff0 Mon Sep 17 00:00:00 2001 From: ralvescosta Date: Thu, 2 May 2024 07:40:13 -0300 Subject: [PATCH] feat: http example --- Cargo.lock | 263 +++++++++++++++++++++++++++++++++++++++++++++++------ Cargo.toml | 8 +- 2 files changed, 240 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80ec5d5..d6be204 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -564,7 +564,7 @@ version = "0.1.0" dependencies = [ "async-trait", "base64 0.13.1", - "configs", + "configs 0.1.0", "jsonwebtoken", "moka", "openssl", @@ -577,6 +577,24 @@ dependencies = [ "tracing", ] +[[package]] +name = "auth" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "async-trait", + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "jsonwebtoken", + "moka", + "opentelemetry", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "autocfg" version = "1.2.0" @@ -1258,15 +1276,34 @@ dependencies = [ name = "configs" version = "0.1.0" +[[package]] +name = "configs" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" + [[package]] name = "configs-builder" version = "0.1.0" dependencies = [ "base64 0.22.0", - "configs", + "configs 0.1.0", "dotenvy", - "logging", - "secrets-manager", + "logging 0.1.0", + "secrets-manager 0.1.0", + "thiserror", + "tracing", +] + +[[package]] +name = "configs-builder" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "base64 0.22.0", + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "dotenvy", + "logging 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "secrets-manager 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", "thiserror", "tracing", ] @@ -2008,9 +2045,9 @@ name = "health-http-server" version = "0.1.0" dependencies = [ "actix-web", - "configs", - "health-readiness", - "http-components", + "configs 0.1.0", + "health-readiness 0.1.0", + "http-components 0.1.0", "opentelemetry", "prometheus", "thiserror", @@ -2029,6 +2066,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "health-readiness" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "async-trait", + "thiserror", + "tracing", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -2124,14 +2171,14 @@ dependencies = [ "actix-service", "actix-web", "async-trait", - "auth", + "auth 0.1.0", "futures", "futures-util", - "health-readiness", + "health-readiness 0.1.0", "opentelemetry", "opentelemetry-prometheus", "opentelemetry-semantic-conventions", - "otel", + "otel 0.1.0", "prometheus", "serde", "serde_json", @@ -2140,15 +2187,40 @@ dependencies = [ "validator", ] +[[package]] +name = "http-components" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "actix-cors", + "actix-http", + "actix-service", + "actix-web", + "async-trait", + "auth 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "futures", + "futures-util", + "health-readiness 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "opentelemetry", + "opentelemetry-prometheus", + "opentelemetry-semantic-conventions", + "otel 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "prometheus", + "serde", + "serde_json", + "tracing", + "utoipa", +] + [[package]] name = "http-server" version = "0.1.0" dependencies = [ "actix-web", - "auth", - "configs", - "health-readiness", - "http-components", + "auth 0.1.0", + "configs 0.1.0", + "health-readiness 0.1.0", + "http-components 0.1.0", "opentelemetry", "serde", "serde_json", @@ -2158,6 +2230,51 @@ dependencies = [ "utoipa-swagger-ui", ] +[[package]] +name = "http-server" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "actix-web", + "auth 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "health-readiness 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "http-components 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "opentelemetry", + "serde", + "serde_json", + "thiserror", + "tracing", + "utoipa", + "utoipa-swagger-ui", +] + +[[package]] +name = "http_api" +version = "0.1.0" +dependencies = [ + "actix-web", + "async-trait", + "auth 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "configs-builder 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "health-readiness 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "http-components 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "http-server 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "logging 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "metrics 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "migrator 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "opentelemetry", + "serde", + "serde_json", + "sql-pool 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "tokio", + "traces 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "tracing", + "utoipa", + "validator", +] + [[package]] name = "httparse" version = "1.8.0" @@ -2427,7 +2544,7 @@ name = "kafka" version = "0.1.0" dependencies = [ "async-trait", - "configs", + "configs 0.1.0", "messaging", "opentelemetry", "rdkafka", @@ -2563,7 +2680,20 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" name = "logging" version = "0.1.0" dependencies = [ - "configs", + "configs 0.1.0", + "thiserror", + "tracing", + "tracing-bunyan-formatter", + "tracing-log 0.2.0", + "tracing-subscriber", +] + +[[package]] +name = "logging" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", "thiserror", "tracing", "tracing-bunyan-formatter", @@ -2607,7 +2737,7 @@ dependencies = [ name = "metrics" version = "0.1.0" dependencies = [ - "configs", + "configs 0.1.0", "opentelemetry", "opentelemetry-otlp", "opentelemetry-prometheus", @@ -2620,15 +2750,41 @@ dependencies = [ "tracing", ] +[[package]] +name = "metrics" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "opentelemetry", + "opentelemetry_sdk", + "prometheus", + "thiserror", + "tracing", +] + [[package]] name = "migrator" version = "0.1.0" dependencies = [ "async-trait", - "configs", + "configs 0.1.0", "deadpool-postgres", "deadpool-sqlite", - "logging", + "logging 0.1.0", + "thiserror", + "tracing", +] + +[[package]] +name = "migrator" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "async-trait", + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "deadpool-postgres", + "logging 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", "thiserror", "tracing", ] @@ -2739,7 +2895,7 @@ version = "0.1.0" dependencies = [ "async-trait", "bytes", - "configs", + "configs 0.1.0", "futures-util", "messaging", "mockall", @@ -2749,7 +2905,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "traces", + "traces 0.1.0", "tracing", ] @@ -3044,6 +3200,14 @@ dependencies = [ "opentelemetry", ] +[[package]] +name = "otel" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "opentelemetry", +] + [[package]] name = "outref" version = "0.5.1" @@ -3509,7 +3673,7 @@ name = "rabbitmq" version = "0.1.0" dependencies = [ "async-trait", - "configs", + "configs 0.1.0", "futures-util", "lapin", "messaging", @@ -3519,7 +3683,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "traces", + "traces 0.1.0", "tracing", "uuid 1.8.0", ] @@ -4025,6 +4189,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "secrets-manager" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "async-trait", + "aws-config", + "aws-sdk-secretsmanager", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "security-framework" version = "2.10.0" @@ -4056,18 +4233,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", @@ -4219,7 +4396,7 @@ dependencies = [ name = "sql-pool" version = "0.1.0" dependencies = [ - "configs", + "configs 0.1.0", "deadpool-postgres", "deadpool-sqlite", "thiserror", @@ -4227,6 +4404,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "sql-pool" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "deadpool-postgres", + "thiserror", + "tokio-postgres", + "tracing", +] + [[package]] name = "stringprep" version = "0.1.4" @@ -4432,6 +4621,7 @@ dependencies = [ "bytes", "libc", "mio", + "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", @@ -4628,7 +4818,7 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" name = "traces" version = "0.1.0" dependencies = [ - "configs", + "configs 0.1.0", "opentelemetry", "opentelemetry-otlp", "opentelemetry-stdout", @@ -4640,6 +4830,21 @@ dependencies = [ "tracing", ] +[[package]] +name = "traces" +version = "0.1.0" +source = "git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0#8877971413d22174dc4052972fff580dcfcfb0e1" +dependencies = [ + "configs 0.1.0 (git+ssh://git@github.com/tointernet/ruskit.git?rev=v0.3.0)", + "opentelemetry", + "opentelemetry_sdk", + "serde", + "thiserror", + "tokio", + "tonic", + "tracing", +] + [[package]] name = "tracing" version = "0.1.40" diff --git a/Cargo.toml b/Cargo.toml index 74e370d..71af784 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,10 @@ [workspace] resolver = "2" +exclude = [ + "examples/*" +] + members = [ "configs", "configs_builder", @@ -18,7 +22,7 @@ members = [ "secrets_manager", "sql_pool", "traces", - "auth", + "auth", "examples/http_api", ] [workspace.dependencies] @@ -30,4 +34,4 @@ async-trait = { version = "0.1.80" } tracing = { version = "0.1.40" } tonic = { version = "0.11" } opentelemetry = { version = "0.22.0" } -opentelemetry_sdk = { version = "0.22.1" } \ No newline at end of file +opentelemetry_sdk = { version = "0.22.1" }