provisioning/schemas/platform/deployment-mode.ncl

111 lines
3.5 KiB
Text

# Platform Deployment Mode Configuration Schema
# Defines how the platform is deployed: local binaries, Docker Compose, or Kubernetes
# This is separate from application modes (solo, cicd, enterprise)
# This determines INFRASTRUCTURE deployment, not application features
let lib = import "../lib/main.ncl" in
{
# Deployment mode enum: local | docker-compose | kubernetes
DeploymentMode = fun label value =>
if std.array.elem value ["local", "docker-compose", "kubernetes"] then
value
else
std.contract.blame_with_message "deployment_mode must be one of: local, docker-compose, kubernetes" label,
# Local deployment manager (localhost, host IP, or custom)
LocalManager = {
hostname | String,
port | lib.PositiveNumber | optional = 9090,
},
# Docker Compose manager (daemon socket or host)
DockerManager = {
host | String, # e.g., "unix:///var/run/docker.sock" or "tcp://docker-host:2375"
api_version | String | optional = "v1.45",
},
# Kubernetes cluster manager
KubernetesManager = {
cluster_name | String,
api_server | String, # e.g., "https://k8s-master:6443"
namespace | String | default = "provisioning",
kubeconfig_path | String | optional, # e.g., ~/.kube/config
ca_cert_path | String | optional,
},
# External service configuration (e.g., svault_server-vault, surrealdb-dbs, forgejo-git)
# Pattern: service_name-service_type (e.g., svault_server-vault where "-vault" is the service type)
ExternalService = {
# Full name with service type separator: "svault_server-vault"
name | String,
# Service type (the part after the dash): "vault", "dbs", "git", "cdci", etc.
srvc | String,
# Human-readable description
desc | String,
# Service URL/endpoint
url | String,
# Service port
port | lib.PositiveNumber,
# Is this service required for deployment
required | Bool | default = false,
# List of service names this service depends on
dependencies | Array String | default = [],
# Optional: binary path for local services
binary_path | String | optional,
# Optional: startup command
startup_command | String | optional,
# Optional: health check timeout in seconds
health_check_timeout | lib.PositiveNumber | optional,
# Optional: environment variables (key-value pairs)
env | {} | optional,
},
# External services collection
ExternalServices = Array ExternalService,
# Main platform deployment mode configuration
PlatformDeploymentMode = {
# Deployment mode: how services are deployed
mode | DeploymentMode,
# Manager configuration (type depends on mode)
manager | (
if std.array.elem mode ["local"] then
LocalManager
else if std.array.elem mode ["docker-compose"] then
DockerManager
else if std.array.elem mode ["kubernetes"] then
KubernetesManager
else
null
),
# Configuration directory for user service configs (*.ncl files)
config_dir | String | optional, # e.g., ~/.config/provisioning/platform/config
# Enable health checks and monitoring
health_checks_enabled | Bool | default = true,
# Timeout for service startup (seconds)
startup_timeout | lib.PositiveNumber | default = 60,
# External infrastructure services (databases, git servers, registries, CI/CD, etc.)
external_services | ExternalServices | default = [],
# Metadata
description | String | optional = null,
created_at | String | optional = null,
updated_at | String | optional = null,
},
}