feat: beginning of v2
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-04-28 11:13:13 +02:00
commit 779c48145c
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
14 changed files with 1203 additions and 0 deletions

2
.drone.yml Normal file
View File

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

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target/
.cuddle/

1028
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

13
Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[workspace]
members = ["crates/*"]
resolver = "2"
[workspace.dependencies]
cuddle = { path = "crates/cuddle" }
anyhow = { version = "1" }
tokio = { version = "1", features = ["full"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3.18" }
clap = { version = "4", features = ["derive", "env"] }
dotenv = { version = "0.15" }

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# cuddle

1
crates/cuddle/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

15
crates/cuddle/Cargo.toml Normal file
View File

@ -0,0 +1,15 @@
[package]
name = "cuddle"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
serde = { version = "1.0.197", features = ["derive"] }
nickel = "0.11.0"

View File

@ -0,0 +1,7 @@
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
tracing_subscriber::fmt::init();
Ok(())
}

21
cuddle.yaml Normal file
View File

@ -0,0 +1,21 @@
# 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-rust-cli-plan.git"
vars:
service: "cuddle"
registry: kasperhermansen
clusters:
clank-prod:
replicas: "3"
namespace: prod
deployment:
registry: git@git.front.kjuulh.io:kjuulh/clank-clusters
env:
prod:
clusters:
- clank-prod

39
examples/cuddle.ncl Normal file
View File

@ -0,0 +1,39 @@
let { Vars, GoPlan, .. } = import "cuddle/vars.ncl" in
let something = "something" in
{
vars = {
name = "some-service",
owner = "git.front.kjuulh.io/kjuulh",
values = {
something = {
something = "something"
},
something_else = {
something = {
some = "something",
something = "something"
}
}
}
},
go_plan = {
database = {
enabled = true
},
rabbitmq = {
enabled = true
},
clusters = {
dev = {
name = "something",
env = {
"some.thing" = something
}
}
}
},
} & Vars & GoPlan

1
examples/cuddle.yaml Normal file
View File

@ -0,0 +1 @@

3
renovate.json Normal file
View File

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}

View File

@ -0,0 +1,54 @@
{
Var = fun label value =>
if std.is_record value then
value | {_: Var}
else if std.is_string value then
value | String
else
std.contract.blame_with_message "value was not a record or string" label,
Vars =
{
vars = {
name
| String,
owner
| String,
values
| {_ | Var}
}
},
Cluster = {
name | String,
env | {_: String} | optional
},
Clusters = {_: Cluster},
DatabaseOffering = {
database = {
enabled
| Bool
| optional
}
},
QueueOffering = {
rabbitmq = {
enabled
| Bool
| optional
}
},
GoPlan = {
go_plan = {
clusters
| Clusters
}
& DatabaseOffering
& QueueOffering
}
}

View File

@ -0,0 +1,15 @@
version: "3"
services:
crdb:
restart: 'always'
image: 'cockroachdb/cockroach:v23.1.14'
command: 'start-single-node --advertise-addr 0.0.0.0 --insecure'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
interval: '10s'
timeout: '30s'
retries: 5
start_period: '20s'
ports:
- 8080:8080
- '26257:26257'