Inventory: init draft ideas

This commit is contained in:
Johannes Kirschbauer
2024-06-15 13:41:51 +02:00
parent 7474f01193
commit 13aa60529f
9 changed files with 243 additions and 171 deletions

View File

@@ -1,8 +1,20 @@
package machines
#ServiceRole: "server" | "client" | "both"
#machine: machines: [string]: {
"name": string,
"description": string,
"icon": string,
"system": string
name: string,
description?: string,
icon?: string,
// each machines service
services?: [string]: {
// Roles if specificed must contain one or more roles
// If no roles are specified, the service module defines the default roles.
roles?: [ ...#ServiceRole ],
// The service config to use
// This config is scoped to the service.module, only serializable data (strings,numbers, etc) can be assigned here
config: {
...
}
}
}

View File

@@ -3,7 +3,6 @@ package inventory
import (
"clan.lol/inventory/services"
"clan.lol/inventory/machines"
"clan.lol/inventory/users"
)
@jsonschema(schema="http://json-schema.org/schema#")
@@ -12,9 +11,9 @@ import (
// A name of the clan (primarily shown by the UI)
name: string
// A description of the clan
description: string
description?: string
// The icon path
icon: string
icon?: string
}
// A map of services
@@ -22,7 +21,4 @@ import (
// A map of machines
machines.#machine
// A map of users
users.#user
}

View File

@@ -1,21 +1,30 @@
package services
#service: services: [string]: {
autoIncludeMachines: bool,
// Required meta fields
meta: {
name: string,
icon?: string
description?: string,
},
// TODO: this should be the list of avilable modules
// Required module specifies the behavior of the service.
module: string,
machineConfig: {
[string]: {
config: {
defaultUser?: string
}
}
},
globalConfig: {
// Should be one of the avilable users
defaultUser?: string,
// We moved the machine sepcific config to "machines".
// It may be moved back depending on what makes more sense in the future.
// machineConfig: {
// [string]: {
// roles: string[],
// config: {
// defaultUser?: string
// }
// }
// },
// Configuration for the service
config: {
// Schema depends on the module.
// It declares the interface how the service can be configured.
...
}
}
}

View File

@@ -0,0 +1,58 @@
{
"machines": {
"jon_machine": {
"name": "jon",
"description": "Jon's machine",
"icon": "assets/icon.png",
"services": {
"matrix": {
"roles": ["server"]
}
}
},
"anna_machine": {
"name": "anna",
"description": "anna's machine"
}
},
"meta": {
"name": "clan name"
},
"services": {
"sync-home": {
"meta": {
"name": "My Home Sync"
},
"module": "syncthing",
"config": {
"folders": ["/sync/my_f"]
}
},
"matrix": {
"meta": {
"name": "Our matrix chat",
"description": "Matrix chat service for our clan"
},
"module": "matrix-synapse",
"config": {
"compression": "zstd"
}
},
"backup": {
"meta": {
"name": "My daily backup"
},
"module": "borgbackup",
"config": {}
},
"borgbackup_1": {
"meta": {
"name": "My weekly backup"
},
"module": "borgbackup",
"config": {
"compression": "lz4"
}
}
}
}

View File

@@ -1,9 +0,0 @@
package users
#user: users: [string]: {
"autoInclude": bool,
"schemas": [ string ],
"config": {
...
}
}