Compare commits

...

31 Commits

Author SHA1 Message Date
8159603490 chore(deps): update rust crate serde to v1.0.210
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-09-07 00:07:13 +00:00
736e166b76 chore(deps): update rust crate serde to v1.0.209
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-08-24 04:06:37 +00:00
542e7aceaf chore(deps): update rust crate serde_json to v1.0.126
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-08-23 20:25:55 +00:00
3e65cda2c9 chore(deps): update all dependencies
Some checks failed
renovate/artifacts Artifact file update failure
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-08-22 13:39:37 +00:00
9f23dd935a chore(deps): update rust crate serde to v1.0.208
Some checks reported errors
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/pr Build is passing
2024-08-21 20:32:58 +00:00
085123a1b0 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-06 13:16:57 +00:00
c3dda47512 chore(deps): update all dependencies
Some checks reported errors
continuous-integration/drone/pr Build encountered an error
continuous-integration/drone/push Build encountered an error
2024-05-25 19:03:43 +00:00
0a61a1d429 chore(deps): update rust crate serde to v1.0.203
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-25 18:29:38 +00:00
385290973a chore(deps): update rust crate anyhow to 1.0.86
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-05-18 12:27:12 +00:00
d61f17e693 chore(deps): update rust crate anyhow to 1.0.85
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-17 22:42:44 +00:00
a5773107be chore(deps): update rust crate anyhow to 1.0.84
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-17 18:19:00 +00:00
97445670ab chore(deps): update rust crate itertools to 0.13.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-16 16:19:44 +00:00
19a812843f fix(deps): update rust crate capnp to 0.19.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-16 12:48:40 +00:00
e962ef58be fix(deps): update rust crate capnp to 0.19.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-13 02:08:44 +00:00
fad1329650 chore(deps): update rust crate anyhow to 1.0.83
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-06 18:20:50 +00:00
e7b513f8d5 chore(deps): update rust crate reqwest to 0.12.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-19 18:29:54 +00:00
f61c432762 chore(deps): update rust crate chrono to 0.4.38
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-15 10:05:19 +00:00
dd2bf3fe94 chore(deps): update rust crate anyhow to 1.0.82
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-10 04:29:58 +00:00
8946b688df Merge pull request 'chore(release): v0.1.0' (#4) from cuddle-please/release into main
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #4
2024-04-06 21:09:17 +00:00
cuddle-please
0bee7f11b8 chore(release): 0.1.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-04-06 21:08:11 +00:00
c322171a39
chore(test): test commit
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-06 23:05:26 +02:00
09fc25ebd5
feat: update
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-06 23:03:17 +02:00
27d2c640dd
chore(test): test commit
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2024-04-06 22:59:17 +02:00
160ecd4b2d
chore(test): test commit
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2024-04-06 22:57:16 +02:00
ee3241ba39
chore(test): test commit
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2024-04-06 22:51:11 +02:00
91e7f470ef
feat: update
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-06 22:48:23 +02:00
d5f0785c0c Merge pull request 'chore(deps): update all dependencies' (#2) from renovate/all into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2
2024-04-06 20:19:55 +00:00
f5bf3f53a4
feat: update stuff
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-06 21:58:50 +02:00
7e22a7f3ab
feat: update
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-06 21:30:49 +02:00
34fabb72be
feat: with drone
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-06 21:17:03 +02:00
b161e19021 chore(deps): update all dependencies 2024-04-05 15:10:46 +00:00
12 changed files with 1040 additions and 616 deletions

2
.drone.yml Normal file
View File

@ -0,0 +1,2 @@
kind: template
load: cuddle-rust-cli-plan.yaml

60
CHANGELOG.md Normal file
View File

@ -0,0 +1,60 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.1.0] - 2024-04-06
### Added
- update
- update
- update stuff
- update
- with drone
- with agent db
- with sled db and capnp
- with sled db
- with basic changelog
- with basic package
- with publish
- with monitoring
- with monitor
- with extra churning repl thingy
- with enroll
- add initial churn
- add simple health check
### Docs
- add notes
### Other
- *(test)* test commit
- *(test)* test commit
- *(test)* test commit
- *(test)* test commit
- Merge pull request 'chore(deps): update all dependencies' (#2) from renovate/all into main
Reviewed-on: https://git.front.kjuulh.io/kjuulh/churn/pulls/2
- *(deps)* update all dependencies
- change to byte slice
- fmt
- fmt
- Add renovate.json
- Release churn-server v0.1.0
- Release churn-agent v0.1.0
- Release churn v0.1.0
- Release churn v0.1.0
- Release churn-domain v0.1.0, churn v0.1.0
- with changelog
- Release churn-domain v0.1.0, churn v0.1.0

1469
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -19,19 +19,19 @@ churn-server = { path = "crates/churn-server" }
churn-domain = { path = "crates/churn-domain", version = "0.1.0" }
churn-capnp = { path = "crates/churn-capnp", version = "0.1.0" }
anyhow = { version = "1.0.71" }
anyhow = { version = "1.0.86" }
tokio = { version = "1", features = ["full"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3.17" }
clap = { version = "4.3.4", features = ["derive", "env"] }
tracing-subscriber = { version = "0.3.18" }
clap = { version = "4.5.4", features = ["derive", "env"] }
dotenv = { version = "0.15.0" }
axum = { version = "0.6.18", features = ["macros"] }
axum = { version = "0.7.5", features = ["macros"] }
async-trait = "*"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
reqwest = {version = "0.11.20", features = ["json"]}
uuid = {version = "1.4.1", features = ["v4", "serde"]}
itertools = {version = "0.11.0"}
reqwest = {version = "0.12.4", features = ["json"]}
uuid = {version = "1.8.0", features = ["v4", "serde"]}
itertools = {version = "0.13.0"}
sled = "0.34.7"
chrono = {version = "0.4.26", features = ["serde"]}
chrono = {version = "0.4.38", features = ["serde"]}

View File

@ -14,6 +14,7 @@ use axum::{
use churn_domain::AgentEnrollReq;
use clap::{Parser, Subcommand};
use serde_json::json;
use tokio::net::TcpListener;
#[derive(Parser)]
#[command(author, version, about, long_about = None, subcommand_required = true)]
@ -70,8 +71,8 @@ async fn handle_command(cmd: Command) -> anyhow::Result<()> {
.with_state(AppState::default());
tracing::info!("churn server listening on {}", host);
axum::Server::bind(&host)
.serve(app.into_make_service())
let listener = TcpListener::bind(&host).await?;
axum::serve(listener, app.into_make_service())
.await
.unwrap();

View File

@ -16,8 +16,8 @@ uuid.workspace = true
anyhow.workspace = true
chrono.workspace = true
capnp = "0.17.2"
capnp = "0.19.5"
[build-dependencies]
capnpc = "0.17.2"
capnpc = "0.19.0"

View File

@ -1,6 +1,6 @@
use capnp::message::{Builder, HeapAllocator};
use capnp::message::{ReaderOptions, TypedReader};
use capnp::serialize::{self, SliceSegments};
use capnp::serialize::{self, BufferSegments};
use capnp::traits::Owned;
use churn_domain::{Agent, Lease, LogEvent};
@ -17,7 +17,7 @@ pub trait CapnpPackExt {
serialize::write_message_to_words(builder)
}
fn string_to_capnp<S>(mut content: &[u8]) -> TypedReader<SliceSegments, S>
fn string_to_capnp<S>(mut content: &[u8]) -> TypedReader<BufferSegments<&[u8]>, S>
where
S: Owned,
{
@ -47,9 +47,9 @@ impl CapnpPackExt for LogEvent {
let log_event = log_event.get()?;
Ok(Self {
id: uuid::Uuid::parse_str(log_event.get_id()?)?,
author: log_event.get_author()?.into(),
content: log_event.get_content()?.into(),
id: uuid::Uuid::parse_str(log_event.get_id()?.to_str()?)?,
author: log_event.get_author()?.to_string()?,
content: log_event.get_content()?.to_string()?,
timestamp: chrono::DateTime::<chrono::Utc>::from_utc(
chrono::NaiveDateTime::from_timestamp_opt(log_event.get_datetime(), 0).unwrap(),
chrono::Utc,
@ -75,7 +75,7 @@ impl CapnpPackExt for Agent {
let item = item.get()?;
Ok(Self {
name: item.get_name()?.into(),
name: item.get_name()?.to_string()?,
})
}
}
@ -98,8 +98,8 @@ impl CapnpPackExt for Lease {
let item = item.get()?;
Ok(Self {
id: uuid::Uuid::parse_str(item.get_id()?)?,
lease: uuid::Uuid::parse_str(item.get_lease()?)?,
id: uuid::Uuid::parse_str(item.get_id()?.to_str()?)?,
lease: uuid::Uuid::parse_str(item.get_lease()?.to_str()?)?,
})
}
}

View File

@ -128,7 +128,7 @@ pub mod log_event {
}
}
impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> {
impl <'a,> ::capnp::traits::SetterInput<Owned<>> for Reader<'a,> {
fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) }
}
@ -151,8 +151,8 @@ pub mod log_event {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None)
}
#[inline]
pub fn set_id(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(0).set_text(value);
pub fn set_id(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false).unwrap()
}
#[inline]
pub fn init_id(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -167,8 +167,8 @@ pub mod log_event {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None)
}
#[inline]
pub fn set_author(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(1).set_text(value);
pub fn set_author(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false).unwrap()
}
#[inline]
pub fn init_author(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -183,8 +183,8 @@ pub mod log_event {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None)
}
#[inline]
pub fn set_content(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(2).set_text(value);
pub fn set_content(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(2), value, false).unwrap()
}
#[inline]
pub fn init_content(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -309,9 +309,11 @@ pub mod log_event {
encoded_node: &ENCODED_NODE,
nonunion_members: NONUNION_MEMBERS,
members_by_discriminant: MEMBERS_BY_DISCRIMINANT,
members_by_name: MEMBERS_BY_NAME,
};
pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3];
pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[];
pub static MEMBERS_BY_NAME : &[u16] = &[1,2,3,0];
pub const TYPE_ID: u64 = 0xe78f_0c5b_590e_1932;
}
}
@ -421,7 +423,7 @@ pub mod agent {
}
}
impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> {
impl <'a,> ::capnp::traits::SetterInput<Owned<>> for Reader<'a,> {
fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) }
}
@ -444,8 +446,8 @@ pub mod agent {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None)
}
#[inline]
pub fn set_name(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(0).set_text(value);
pub fn set_name(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false).unwrap()
}
#[inline]
pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -513,9 +515,11 @@ pub mod agent {
encoded_node: &ENCODED_NODE,
nonunion_members: NONUNION_MEMBERS,
members_by_discriminant: MEMBERS_BY_DISCRIMINANT,
members_by_name: MEMBERS_BY_NAME,
};
pub static NONUNION_MEMBERS : &[u16] = &[0];
pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[];
pub static MEMBERS_BY_NAME : &[u16] = &[0];
pub const TYPE_ID: u64 = 0xf4a4_cb97_342c_81a0;
}
}
@ -633,7 +637,7 @@ pub mod lease {
}
}
impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> {
impl <'a,> ::capnp::traits::SetterInput<Owned<>> for Reader<'a,> {
fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) }
}
@ -656,8 +660,8 @@ pub mod lease {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None)
}
#[inline]
pub fn set_id(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(0).set_text(value);
pub fn set_id(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false).unwrap()
}
#[inline]
pub fn init_id(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -672,8 +676,8 @@ pub mod lease {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None)
}
#[inline]
pub fn set_lease(&mut self, value: ::capnp::text::Reader<'_>) {
self.builder.reborrow().get_pointer_field(1).set_text(value);
pub fn set_lease(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) {
::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false).unwrap()
}
#[inline]
pub fn init_lease(self, size: u32) -> ::capnp::text::Builder<'a> {
@ -757,9 +761,11 @@ pub mod lease {
encoded_node: &ENCODED_NODE,
nonunion_members: NONUNION_MEMBERS,
members_by_discriminant: MEMBERS_BY_DISCRIMINANT,
members_by_name: MEMBERS_BY_NAME,
};
pub static NONUNION_MEMBERS : &[u16] = &[0,1];
pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[];
pub static MEMBERS_BY_NAME : &[u16] = &[0,1];
pub const TYPE_ID: u64 = 0xb0d6_0854_c50e_5662;
}
}

View File

@ -21,6 +21,7 @@ use event::EventService;
use lease::LeaseService;
use serde::Deserialize;
use serde_json::json;
use tokio::net::TcpListener;
use crate::db::Db;
@ -94,8 +95,8 @@ async fn main() -> anyhow::Result<()> {
});
tracing::info!("churn server listening on {}", host);
axum::Server::bind(&host)
.serve(app.into_make_service())
let listener = TcpListener::bind(&host).await?;
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}

View File

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dagger-sdk = "0.2.2"
dagger-rust = "0.2.0"
dagger-sdk = "0.11.0"
dagger-rust = {git = "https://git.front.kjuulh.io/kjuulh/dagger-components.git", ref = "main"}
tokio.workspace = true
eyre = "*"

View File

@ -19,21 +19,22 @@ async fn main() -> eyre::Result<()> {
let server = server
.with_env_variable("CHURN_DATABASE", "sled")
.with_env_variable("CHURN_SLED_PATH", "/mnt/sled")
.with_mounted_cache("/mnt/sled", client.cache_volume("sled").id().await?)
.with_mounted_cache("/mnt/sled", client.cache_volume("sled"))
.with_exec(vec!["churn-server", "serve", "--host", "0.0.0.0:3000"])
.with_exposed_port(3000);
let server_id = server.id().await?;
let server_service = server.as_service();
let agent = build_container(client.clone(), "churn-agent").await?;
let agent = agent
.with_service_binding("churn-server", server_id.clone())
.with_service_binding("churn-server", server_service.clone())
.with_exec(vec!["churn-agent", "daemon", "--host", "0.0.0.0:3000"])
.with_exposed_port(3000);
let agent_service = agent.as_service();
let churning = cli
.with_service_binding("churn-agent", agent.id().await?)
.with_service_binding("churn-server", server_id)
.with_service_binding("churn-agent", agent_service)
.with_service_binding("churn-server", server_service)
.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")
@ -52,7 +53,7 @@ async fn main() -> eyre::Result<()> {
let stderr = churning.stderr().await?;
println!("{stderr}");
churning.exit_code().await?;
churning.sync().await?;
println!("Finished building churning...");
repl(churning).await?; //.with_entrypoint(vec!["churn"])).await?;
@ -90,7 +91,7 @@ async fn repl(container: dagger_sdk::Container) -> eyre::Result<()> {
}
}
match container.exit_code().await {
match container.sync().await {
Ok(_) => {}
Err(_e) => {
//eprintln!("encountred error: {}", e);
@ -101,10 +102,7 @@ async fn repl(container: dagger_sdk::Container) -> eyre::Result<()> {
Ok(())
}
async fn build_container(
client: Arc<Query>,
bin_name: &str,
) -> eyre::Result<dagger_sdk::Container> {
async fn build_container(client: Query, bin_name: &str) -> eyre::Result<dagger_sdk::Container> {
let crates = &["crates/*", "ci"];
let debian_deps = &[
"libssl-dev",

View File

@ -1,7 +1,24 @@
# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json
base: "git@git.front.kjuulh.io:kjuulh/cuddle-base.git"
base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-cli-plan.git"
vars:
service: "churn"
registry: kasperhermansen
please:
project:
owner: kjuulh
repository: churn
branch: main
settings:
api_url: https://git.front.kjuulh.io
components:
packages:
debian:
dev:
- capnproto
release:
- capnproto