feat: added please and release
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-11-17 20:57:48 +01:00
parent 7510c9a333
commit 8b24dc23e0
No known key found for this signature in database
7 changed files with 93 additions and 664 deletions

698
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,11 @@
members = ["crates/*"] members = ["crates/*"]
resolver = "2" resolver = "2"
[workspace.package]
version = "0.1.0"
[workspace.dependencies] [workspace.dependencies]
nodata-storage = { path = "crates/nodata-storage" } nodata-storage = { path = "crates/nodata-storage", version = "0.1.0" }
anyhow = { version = "1" } anyhow = { version = "1" }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
@ -12,9 +15,9 @@ tracing-subscriber = { version = "0.3.18" }
clap = { version = "4", features = ["derive", "env"] } clap = { version = "4", features = ["derive", "env"] }
dotenv = { version = "0.15" } dotenv = { version = "0.15" }
axum = { version = "0.7" } axum = { version = "0.7" }
drift = { git = "https://github.com/kjuulh/drift", branch = "main" } nodrift = { version = "0.2" }
async-trait = "0.1" async-trait = "0.1"
tonic = "0.12.1" tonic = { version = "0.12.3", features = ["tls", "tls-roots"] }
bytes = "1.7.1" bytes = "1.7.1"
prost = "0.13.1" prost = "0.13.1"
prost-types = "0.13.1" prost-types = "0.13.1"

View File

@ -1,6 +1,8 @@
[package] [package]
name = "nodata-storage" name = "nodata-storage"
version = "0.1.0" version.workspace = true
description = "nodata storage is the backend that serves the nodata message broker, it allows storing data in many different types of backends"
license = "MIT"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -2,6 +2,8 @@
name = "nodata" name = "nodata"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
description = "nodata is a kafka like message broker that is simple and easy to use, while relying on either local or s3 like data storage for consistency"
license = "MIT"
[dependencies] [dependencies]
nodata-storage.workspace = true nodata-storage.workspace = true
@ -13,17 +15,10 @@ tracing-subscriber.workspace = true
clap.workspace = true clap.workspace = true
dotenv.workspace = true dotenv.workspace = true
axum.workspace = true axum.workspace = true
drift.workspace = true nodrift.workspace = true
uuid.workspace = true uuid.workspace = true
serde = { version = "1.0.197", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
sqlx = { version = "0.8.0", features = [
"runtime-tokio",
"tls-rustls",
"postgres",
"uuid",
"time",
] }
tower-http = { version = "0.6.0", features = ["cors", "trace"] } tower-http = { version = "0.6.0", features = ["cors", "trace"] }
tokio-util = "0.7.11" tokio-util = "0.7.11"
tonic.workspace = true tonic.workspace = true

View File

@ -1,7 +1,7 @@
use std::{collections::BTreeMap, sync::Arc, time::Duration}; use std::{collections::BTreeMap, sync::Arc, time::Duration};
use axum::async_trait; use axum::async_trait;
use drift::Drifter; use nodrift::Drifter;
use notmad::Component; use notmad::Component;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
@ -33,7 +33,7 @@ impl Component for Broker {
&self, &self,
cancellation_token: tokio_util::sync::CancellationToken, cancellation_token: tokio_util::sync::CancellationToken,
) -> Result<(), notmad::MadError> { ) -> Result<(), notmad::MadError> {
let token = drift::schedule_drifter(Duration::from_secs(1), self.clone()); let token = nodrift::schedule_drifter(Duration::from_secs(1), self.clone());
tokio::select! { tokio::select! {
_ = token.cancelled() => {}, _ = token.cancelled() => {},
@ -95,7 +95,7 @@ impl BrokerHandler {
_parent_token: CancellationToken, _parent_token: CancellationToken,
) -> Self { ) -> Self {
let inner_state = state.clone(); let inner_state = state.clone();
let token = drift::schedule(Duration::from_secs(1), move || { let token = nodrift::schedule(Duration::from_secs(1), move || {
let consumer_group = consumer_group.clone(); let consumer_group = consumer_group.clone();
let state = inner_state.clone(); let state = inner_state.clone();

View File

@ -10,6 +10,7 @@ mod services;
use std::net::SocketAddr; use std::net::SocketAddr;
use anyhow::Context;
use broker::Broker; use broker::Broker;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use grpc::{GetTopicsRequest, GrpcServer, PublishEventRequest, SubscribeRequest}; use grpc::{GetTopicsRequest, GrpcServer, PublishEventRequest, SubscribeRequest};
@ -17,6 +18,7 @@ use grpc_component::GrpcComponentClient;
use http::HttpServer; use http::HttpServer;
use notmad::Mad; use notmad::Mad;
use state::SharedState; use state::SharedState;
use tonic::transport::{Channel, ClientTlsConfig};
#[derive(Parser)] #[derive(Parser)]
#[command(author, version, about, long_about = None, subcommand_required = true)] #[command(author, version, about, long_about = None, subcommand_required = true)]
@ -192,8 +194,22 @@ async fn create_client(
) -> anyhow::Result< ) -> anyhow::Result<
crate::grpc::no_data_service_client::NoDataServiceClient<tonic::transport::Channel>, crate::grpc::no_data_service_client::NoDataServiceClient<tonic::transport::Channel>,
> { > {
let client = let channel = if grpc_host.starts_with("https") {
crate::grpc::no_data_service_client::NoDataServiceClient::connect(grpc_host).await?; Channel::from_shared(grpc_host.to_owned())
.context(format!("failed to connect to: {}", &grpc_host))?
.tls_config(ClientTlsConfig::new().with_native_roots())?
.connect()
.await
.context(format!("failed to connect to: {}", &grpc_host))?
} else {
Channel::from_shared(grpc_host.to_owned())
.context(format!("failed to connect to: {}", &grpc_host))?
.connect()
.await
.context(format!("failed to connect to: {}", &grpc_host))?
};
let client = crate::grpc::no_data_service_client::NoDataServiceClient::new(channel);
Ok(client) Ok(client)
} }

View File

@ -13,6 +13,15 @@ vars:
- internal: "true" - internal: "true"
- internal_grpc: "true" - internal_grpc: "true"
please:
project:
owner: kjuulh
repository: nodata
branch: main
settings:
api_url: https://git.front.kjuulh.io
actions:
rust:
cuddle/clusters: cuddle/clusters:
dev: dev: