3.4 KiB
3.4 KiB
Database Schema
User & Session
erDiagram
user {
int id PK
str email UK
str display_name
str username UK
str password
bool is_active "default: true"
bool is_superuser "default: false"
str type "default: local"
int domain_id FK "domain.id"
int active_tenant_id FK "tenant.id, empty if user is not assigned to any tenant"
}
session {
int id PK
int user_id FK "user.id"
str session_token
}
user ||--o{ session : has
domain ||--o{ user : has
Auth Provider & Domain
erDiagram
auth_provider {
int id PK
int domain_id FK "domain.id"
str client_id "OAuth client ID"
str client_secret "OAuth client secret"
str well_known_url "URL to fetch the OpenID Connect configuration (required)"
str additional_config "Additional configuration in JSON format"
datetime created_at
datetime updated_at
}
domain {
int id PK
str name UK "e.g abyres.net"
str title "e.g Abyres Sdn Bhd"
datetime created_at
datetime updated_at
}
domain ||--o| auth_provider: has
domain ||--o{ tenant : has
Tenant
erDiagram
tenant {
int id PK
str title "Tenant's name"
str name UK "Unique name generated from 'title' field"
str logo "Path to logo file"
int domain_id FK "domain.id"
bool is_active
datetime created_at
datetime updated_at
str address "Tenant's work address"
str email "Tenant's work email"
str phone "Tenant's work phone number"
str website "Tenant's official website"
str smtp_server
}
tenant_member {
int id PK
int user_id FK, UK "user.id"
int tenant_id FK, UK "tenant.id"
datetime created_at
datetime updated_at
}
tenant ||..o{ host : has
user ||--o{ tenant_member : "associated with"
tenant ||--o{ tenant_member : "associated with"
Host & Cluster
erDiagram
host {
int id PK
str hostname "e.g. dev-01.abyres.net"
str ip_address "e.g. 192.168.1.10"
str token "Used by client agent to authenticate connection to server"
str uid UK "Unique string to identify the host"
int tenant_id FK "tenant.id"
int cluster_id FK "cluster.id, empty if host is not part of any cluster"
datetime created_at
datetime updated_at
}
cluster {
int id PK
str name "e.g. project-a-cluster"
int tenant_id FK "tenant.id"
datetime created_at
datetime updated_at
str kubeconfig "'kubeconfig' content to access the cluster"
}
tenant ||--o{ cluster : has
cluster ||--|{ host : "deployed on"
Services & Secrets
erDiagram
service_template {
int id PK
str name
str image
str resources
str volume
}
service_deployment {
int id PK
int template_id FK
int cluster_id FK
str name
}
secret {
int id PK
int deployment_id FK
str name
str token
}
service_template ||--o{ service_deployment : has
cluster ||--o{ service_deployment : has
service_deployment ||--o{ secret : has
Audit Log
erDiagram
audit_log {
int id PK
str table_name "user, domain, tenant, host, cluster, service_deployment"
int table_id FK
int timestamp
int user_id FK
str ip_addr
str message
str prev_settings
str diff
}
user ||..o{ audit_log : has
domain ||..o{ audit_log : has
tenant ||..o{ audit_log : has
host ||..o{ audit_log : has
cluster ||..o{ audit_log : has
service_deployment ||..o{ audit_log : has
audit_log ||--|| user : "acted by"