chore: fix docs after fences fix
This commit is contained in:
parent
a4b3c02371
commit
17ef93ed23
141
docs/README.md
141
docs/README.md
File diff suppressed because one or more lines are too long
@ -86,7 +86,7 @@ Declarative Infrastructure as Code (IaC) platform providing:
|
|||||||
|
|
||||||
**Solution**: Unified abstraction layer with provider-agnostic interfaces. Write configuration once, deploy anywhere.
|
**Solution**: Unified abstraction layer with provider-agnostic interfaces. Write configuration once, deploy anywhere.
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Same configuration works on UpCloud, AWS, or local infrastructure
|
# Same configuration works on UpCloud, AWS, or local infrastructure
|
||||||
server: Server {
|
server: Server {
|
||||||
name = "web-01"
|
name = "web-01"
|
||||||
@ -101,7 +101,7 @@ server: Server {
|
|||||||
|
|
||||||
**Solution**: Automatic dependency resolution with topological sorting and health checks.
|
**Solution**: Automatic dependency resolution with topological sorting and health checks.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Provisioning resolves: containerd → etcd → kubernetes → cilium
|
# Provisioning resolves: containerd → etcd → kubernetes → cilium
|
||||||
taskservs = ["cilium"] # Automatically installs all dependencies
|
taskservs = ["cilium"] # Automatically installs all dependencies
|
||||||
```
|
```
|
||||||
@ -112,7 +112,7 @@ taskservs = ["cilium"] # Automatically installs all dependencies
|
|||||||
|
|
||||||
**Solution**: Hierarchical configuration system with 476+ config accessors replacing 200+ ENV variables.
|
**Solution**: Hierarchical configuration system with 476+ config accessors replacing 200+ ENV variables.
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
Defaults → User → Project → Infrastructure → Environment → Runtime
|
Defaults → User → Project → Infrastructure → Environment → Runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ Clusters handle:
|
|||||||
|
|
||||||
Isolated environments for different projects or deployment stages.
|
Isolated environments for different projects or deployment stages.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace_librecloud/ # Production workspace
|
workspace_librecloud/ # Production workspace
|
||||||
├── infra/ # Infrastructure definitions
|
├── infra/ # Infrastructure definitions
|
||||||
├── config/ # Workspace configuration
|
├── config/ # Workspace configuration
|
||||||
@ -211,7 +211,7 @@ workspace_dev/ # Development workspace
|
|||||||
|
|
||||||
Switch between workspaces with single command:
|
Switch between workspaces with single command:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning workspace switch librecloud
|
provisioning workspace switch librecloud
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ Coordinated sequences of operations with dependency management.
|
|||||||
|
|
||||||
### System Components
|
### System Components
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ User Interface Layer │
|
│ User Interface Layer │
|
||||||
│ • CLI (provisioning command) │
|
│ • CLI (provisioning command) │
|
||||||
@ -282,7 +282,7 @@ Coordinated sequences of operations with dependency management.
|
|||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
project-provisioning/
|
project-provisioning/
|
||||||
├── provisioning/ # Core provisioning system
|
├── provisioning/ # Core provisioning system
|
||||||
│ ├── core/ # Core engine and libraries
|
│ ├── core/ # Core engine and libraries
|
||||||
@ -514,7 +514,7 @@ Comprehensive version tracking and updates.
|
|||||||
|
|
||||||
### Data Flow
|
### Data Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. User defines infrastructure in Nickel
|
1. User defines infrastructure in Nickel
|
||||||
↓
|
↓
|
||||||
2. CLI loads configuration (hierarchical)
|
2. CLI loads configuration (hierarchical)
|
||||||
@ -540,7 +540,7 @@ Comprehensive version tracking and updates.
|
|||||||
|
|
||||||
**Step 1**: Define infrastructure in Nickel
|
**Step 1**: Define infrastructure in Nickel
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# infra/my-cluster.ncl
|
# infra/my-cluster.ncl
|
||||||
let config = {
|
let config = {
|
||||||
infra = {
|
infra = {
|
||||||
@ -561,13 +561,13 @@ config
|
|||||||
|
|
||||||
**Step 2**: Submit to Provisioning
|
**Step 2**: Submit to Provisioning
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create --infra my-cluster
|
provisioning server create --infra my-cluster
|
||||||
```
|
```
|
||||||
|
|
||||||
**Step 3**: Provisioning executes workflow
|
**Step 3**: Provisioning executes workflow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Create workflow: "deploy-my-cluster"
|
1. Create workflow: "deploy-my-cluster"
|
||||||
2. Resolve dependencies:
|
2. Resolve dependencies:
|
||||||
- containerd (required by kubernetes)
|
- containerd (required by kubernetes)
|
||||||
@ -592,7 +592,7 @@ provisioning server create --infra my-cluster
|
|||||||
|
|
||||||
**Step 4**: Verify deployment
|
**Step 4**: Verify deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning cluster status my-cluster
|
provisioning cluster status my-cluster
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -600,7 +600,7 @@ provisioning cluster status my-cluster
|
|||||||
|
|
||||||
Configuration values are resolved through a hierarchy:
|
Configuration values are resolved through a hierarchy:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. System Defaults (provisioning/config/config.defaults.toml)
|
1. System Defaults (provisioning/config/config.defaults.toml)
|
||||||
↓ (overridden by)
|
↓ (overridden by)
|
||||||
2. User Preferences (~/.config/provisioning/user_config.yaml)
|
2. User Preferences (~/.config/provisioning/user_config.yaml)
|
||||||
@ -616,7 +616,7 @@ Configuration values are resolved through a hierarchy:
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# System default
|
# System default
|
||||||
[servers]
|
[servers]
|
||||||
default_plan = "small"
|
default_plan = "small"
|
||||||
@ -641,7 +641,7 @@ provisioning server create --plan xlarge # Overrides everything
|
|||||||
|
|
||||||
Deploy Kubernetes clusters across different cloud providers with identical configuration.
|
Deploy Kubernetes clusters across different cloud providers with identical configuration.
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# UpCloud cluster
|
# UpCloud cluster
|
||||||
provisioning cluster create k8s-prod --provider upcloud
|
provisioning cluster create k8s-prod --provider upcloud
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ provisioning cluster create k8s-prod --provider aws
|
|||||||
|
|
||||||
Manage multiple environments with workspace switching.
|
Manage multiple environments with workspace switching.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Development
|
# Development
|
||||||
provisioning workspace switch dev
|
provisioning workspace switch dev
|
||||||
provisioning cluster create app-stack
|
provisioning cluster create app-stack
|
||||||
@ -671,7 +671,7 @@ provisioning cluster create app-stack
|
|||||||
|
|
||||||
Test infrastructure changes before deploying to production.
|
Test infrastructure changes before deploying to production.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test Kubernetes upgrade locally
|
# Test Kubernetes upgrade locally
|
||||||
provisioning test topology load kubernetes_3node |
|
provisioning test topology load kubernetes_3node |
|
||||||
test env cluster kubernetes --version 1.29.0
|
test env cluster kubernetes --version 1.29.0
|
||||||
@ -687,7 +687,7 @@ provisioning test env cleanup <env-id>
|
|||||||
|
|
||||||
Deploy to multiple regions in parallel.
|
Deploy to multiple regions in parallel.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# workflows/multi-region.ncl
|
# workflows/multi-region.ncl
|
||||||
let batch_workflow = {
|
let batch_workflow = {
|
||||||
operations = [
|
operations = [
|
||||||
@ -715,7 +715,7 @@ let batch_workflow = {
|
|||||||
batch_workflow
|
batch_workflow
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning batch submit workflows/multi-region.ncl
|
provisioning batch submit workflows/multi-region.ncl
|
||||||
provisioning batch monitor <workflow-id>
|
provisioning batch monitor <workflow-id>
|
||||||
```
|
```
|
||||||
@ -724,7 +724,7 @@ provisioning batch monitor <workflow-id>
|
|||||||
|
|
||||||
Recreate infrastructure from configuration.
|
Recreate infrastructure from configuration.
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Infrastructure destroyed
|
# Infrastructure destroyed
|
||||||
provisioning workspace switch prod
|
provisioning workspace switch prod
|
||||||
|
|
||||||
@ -738,7 +738,7 @@ provisioning cluster create --infra backup-restore --wait
|
|||||||
|
|
||||||
Automated testing and deployment pipelines.
|
Automated testing and deployment pipelines.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# .gitlab-ci.yml
|
# .gitlab-ci.yml
|
||||||
test-infrastructure:
|
test-infrastructure:
|
||||||
script:
|
script:
|
||||||
|
|||||||
@ -117,7 +117,7 @@ Nickel, and Rust.
|
|||||||
|
|
||||||
## Documentation Structure
|
## Documentation Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/docs/src/
|
provisioning/docs/src/
|
||||||
├── README.md (this file) # Documentation hub
|
├── README.md (this file) # Documentation hub
|
||||||
├── getting-started/ # Getting started guides
|
├── getting-started/ # Getting started guides
|
||||||
|
|||||||
@ -20,7 +20,7 @@ The AI integration consists of multiple components working together to provide i
|
|||||||
### Natural Language Configuration
|
### Natural Language Configuration
|
||||||
|
|
||||||
Generate infrastructure configurations from plain English descriptions:
|
Generate infrastructure configurations from plain English descriptions:
|
||||||
```text
|
```toml
|
||||||
provisioning ai generate "Create a production PostgreSQL cluster with encryption and daily backups"
|
provisioning ai generate "Create a production PostgreSQL cluster with encryption and daily backups"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Real-time suggestions and explanations as you fill out configuration forms via t
|
|||||||
### Intelligent Troubleshooting
|
### Intelligent Troubleshooting
|
||||||
|
|
||||||
AI analyzes deployment failures and suggests fixes:
|
AI analyzes deployment failures and suggests fixes:
|
||||||
```text
|
```bash
|
||||||
provisioning ai troubleshoot deployment-12345
|
provisioning ai troubleshoot deployment-12345
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -39,13 +39,13 @@ provisioning ai troubleshoot deployment-12345
|
|||||||
|
|
||||||
Configuration Optimization
|
Configuration Optimization
|
||||||
AI reviews configurations and suggests performance and security improvements:
|
AI reviews configurations and suggests performance and security improvements:
|
||||||
```text
|
```toml
|
||||||
provisioning ai optimize workspaces/prod/config.ncl
|
provisioning ai optimize workspaces/prod/config.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
### Autonomous Agents
|
### Autonomous Agents
|
||||||
AI agents execute multi-step workflows with minimal human intervention:
|
AI agents execute multi-step workflows with minimal human intervention:
|
||||||
```text
|
```bash
|
||||||
provisioning ai agent --goal "Set up complete dev environment for Python app"
|
provisioning ai agent --goal "Set up complete dev environment for Python app"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ provisioning ai agent --goal "Set up complete dev environment for Python app"
|
|||||||
|
|
||||||
### Enable AI Features
|
### Enable AI Features
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Edit provisioning config
|
# Edit provisioning config
|
||||||
vim provisioning/config/ai.toml
|
vim provisioning/config/ai.toml
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ troubleshooting = true
|
|||||||
|
|
||||||
### Generate Configuration from Natural Language
|
### Generate Configuration from Natural Language
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Simple generation
|
# Simple generation
|
||||||
provisioning ai generate "PostgreSQL database with encryption"
|
provisioning ai generate "PostgreSQL database with encryption"
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ provisioning ai generate
|
|||||||
|
|
||||||
### Use AI-Assisted Forms
|
### Use AI-Assisted Forms
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Open typdialog web UI with AI assistance
|
# Open typdialog web UI with AI assistance
|
||||||
provisioning workspace init --interactive --ai-assist
|
provisioning workspace init --interactive --ai-assist
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ provisioning workspace init --interactive --ai-assist
|
|||||||
|
|
||||||
### Troubleshoot with AI
|
### Troubleshoot with AI
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Analyze failed deployment
|
# Analyze failed deployment
|
||||||
provisioning ai troubleshoot deployment-12345
|
provisioning ai troubleshoot deployment-12345
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ security and requiring human approval for critical operations.
|
|||||||
|
|
||||||
Enable AI agents to manage complex provisioning workflows:
|
Enable AI agents to manage complex provisioning workflows:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User Goal:
|
User Goal:
|
||||||
"Set up a complete development environment with:
|
"Set up a complete development environment with:
|
||||||
- PostgreSQL database
|
- PostgreSQL database
|
||||||
@ -39,7 +39,7 @@ AI Agent executes:
|
|||||||
|
|
||||||
Agents coordinate complex, multi-component deployments:
|
Agents coordinate complex, multi-component deployments:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Goal: "Deploy production Kubernetes cluster with managed databases"
|
Goal: "Deploy production Kubernetes cluster with managed databases"
|
||||||
|
|
||||||
Agent Plan:
|
Agent Plan:
|
||||||
@ -75,7 +75,7 @@ Agent Plan:
|
|||||||
|
|
||||||
Agents adapt to conditions and make intelligent decisions:
|
Agents adapt to conditions and make intelligent decisions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario: Database provisioning fails due to resource quota
|
Scenario: Database provisioning fails due to resource quota
|
||||||
|
|
||||||
Standard approach (human):
|
Standard approach (human):
|
||||||
@ -102,7 +102,7 @@ Agent approach:
|
|||||||
|
|
||||||
Agents understand resource dependencies:
|
Agents understand resource dependencies:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Knowledge graph of dependencies:
|
Knowledge graph of dependencies:
|
||||||
|
|
||||||
VPC ──→ Subnets ──→ EC2 Instances
|
VPC ──→ Subnets ──→ EC2 Instances
|
||||||
@ -125,7 +125,7 @@ Agent ensures:
|
|||||||
|
|
||||||
### Agent Design Pattern
|
### Agent Design Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌────────────────────────────────────────────────────────┐
|
┌────────────────────────────────────────────────────────┐
|
||||||
│ Agent Supervisor (Orchestrator) │
|
│ Agent Supervisor (Orchestrator) │
|
||||||
│ - Accepts user goal │
|
│ - Accepts user goal │
|
||||||
@ -151,7 +151,7 @@ Agent ensures:
|
|||||||
|
|
||||||
### Agent Workflow
|
### Agent Workflow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Start: User Goal
|
Start: User Goal
|
||||||
↓
|
↓
|
||||||
┌─────────────────────────────────────────┐
|
┌─────────────────────────────────────────┐
|
||||||
@ -214,7 +214,7 @@ Success: Deployment Complete
|
|||||||
|
|
||||||
### 1. Database Specialist Agent
|
### 1. Database Specialist Agent
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Responsibilities:
|
Responsibilities:
|
||||||
- Create and configure databases
|
- Create and configure databases
|
||||||
- Set up replication and backups
|
- Set up replication and backups
|
||||||
@ -231,7 +231,7 @@ Examples:
|
|||||||
|
|
||||||
### 2. Kubernetes Specialist Agent
|
### 2. Kubernetes Specialist Agent
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
Responsibilities:
|
Responsibilities:
|
||||||
- Create and configure Kubernetes clusters
|
- Create and configure Kubernetes clusters
|
||||||
- Configure networking and ingress
|
- Configure networking and ingress
|
||||||
@ -248,7 +248,7 @@ Examples:
|
|||||||
|
|
||||||
### 3. Infrastructure Agent
|
### 3. Infrastructure Agent
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Responsibilities:
|
Responsibilities:
|
||||||
- Create networking infrastructure
|
- Create networking infrastructure
|
||||||
- Configure security and firewalls
|
- Configure security and firewalls
|
||||||
@ -265,7 +265,7 @@ Examples:
|
|||||||
|
|
||||||
### 4. Monitoring Agent
|
### 4. Monitoring Agent
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Responsibilities:
|
Responsibilities:
|
||||||
- Deploy monitoring stack
|
- Deploy monitoring stack
|
||||||
- Configure alerting
|
- Configure alerting
|
||||||
@ -282,7 +282,7 @@ Examples:
|
|||||||
|
|
||||||
### 5. Compliance Agent
|
### 5. Compliance Agent
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Responsibilities:
|
Responsibilities:
|
||||||
- Check security policies
|
- Check security policies
|
||||||
- Verify compliance requirements
|
- Verify compliance requirements
|
||||||
@ -301,7 +301,7 @@ Examples:
|
|||||||
|
|
||||||
### Example 1: Development Environment Setup
|
### Example 1: Development Environment Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
$ provisioning ai agent --goal "Set up dev environment for Python web app"
|
$ provisioning ai agent --goal "Set up dev environment for Python web app"
|
||||||
|
|
||||||
Agent Plan Generated:
|
Agent Plan Generated:
|
||||||
@ -357,7 +357,7 @@ Grafana dashboards: [http://grafana.internal:3000](http://grafana.internal:3000)
|
|||||||
|
|
||||||
### Example 2: Production Kubernetes Deployment
|
### Example 2: Production Kubernetes Deployment
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
$ provisioning ai agent --interactive
|
$ provisioning ai agent --interactive
|
||||||
--goal "Deploy production Kubernetes cluster with managed databases"
|
--goal "Deploy production Kubernetes cluster with managed databases"
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ User: Review configs
|
|||||||
|
|
||||||
Agents stop and ask humans for approval at critical points:
|
Agents stop and ask humans for approval at critical points:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Automatic Approval (Agent decides):
|
Automatic Approval (Agent decides):
|
||||||
- Create configuration
|
- Create configuration
|
||||||
- Validate configuration
|
- Validate configuration
|
||||||
@ -434,7 +434,7 @@ Human Approval Required:
|
|||||||
|
|
||||||
All decisions logged for audit trail:
|
All decisions logged for audit trail:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Agent Decision Log:
|
Agent Decision Log:
|
||||||
| 2025-01-13 10:00:00 | Generate database config |
|
| 2025-01-13 10:00:00 | Generate database config |
|
||||||
| 2025-01-13 10:00:05 | Config validation: PASS |
|
| 2025-01-13 10:00:05 | Config validation: PASS |
|
||||||
@ -451,7 +451,7 @@ Agent Decision Log:
|
|||||||
|
|
||||||
Agents can rollback on failure:
|
Agents can rollback on failure:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario: Database creation succeeds, but Kubernetes creation fails
|
Scenario: Database creation succeeds, but Kubernetes creation fails
|
||||||
|
|
||||||
Agent behavior:
|
Agent behavior:
|
||||||
@ -469,7 +469,7 @@ Full rollback capability if entire workflow fails before human approval.
|
|||||||
|
|
||||||
### Agent Settings
|
### Agent Settings
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# In provisioning/config/ai.toml
|
# In provisioning/config/ai.toml
|
||||||
[ai.agents]
|
[ai.agents]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|||||||
@ -11,7 +11,7 @@ typdialog web UI. This enables users to configure infrastructure through interac
|
|||||||
|
|
||||||
Enhance configuration forms with AI-powered assistance:
|
Enhance configuration forms with AI-powered assistance:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
User typing in form field: "storage"
|
User typing in form field: "storage"
|
||||||
↓
|
↓
|
||||||
AI analyzes context:
|
AI analyzes context:
|
||||||
@ -38,7 +38,7 @@ Suggestions appear:
|
|||||||
|
|
||||||
### User Interface Integration
|
### User Interface Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌────────────────────────────────────────┐
|
┌────────────────────────────────────────┐
|
||||||
│ Typdialog Web UI (React/TypeScript) │
|
│ Typdialog Web UI (React/TypeScript) │
|
||||||
│ │
|
│ │
|
||||||
@ -65,7 +65,7 @@ Suggestions appear:
|
|||||||
|
|
||||||
### Suggestion Pipeline
|
### Suggestion Pipeline
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User Event (typing, focusing field, validation error)
|
User Event (typing, focusing field, validation error)
|
||||||
↓
|
↓
|
||||||
┌─────────────────────────────────────┐
|
┌─────────────────────────────────────┐
|
||||||
@ -107,7 +107,7 @@ User Event (typing, focusing field, validation error)
|
|||||||
|
|
||||||
Intelligent suggestions based on context:
|
Intelligent suggestions based on context:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario: User filling database configuration form
|
Scenario: User filling database configuration form
|
||||||
|
|
||||||
1. Engine selection
|
1. Engine selection
|
||||||
@ -135,7 +135,7 @@ Scenario: User filling database configuration form
|
|||||||
|
|
||||||
Human-readable error messages with fixes:
|
Human-readable error messages with fixes:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User enters: "storage = -100"
|
User enters: "storage = -100"
|
||||||
|
|
||||||
Current behavior:
|
Current behavior:
|
||||||
@ -157,7 +157,7 @@ Planned AI behavior:
|
|||||||
|
|
||||||
Suggestions change based on other fields:
|
Suggestions change based on other fields:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario: Multi-step configuration form
|
Scenario: Multi-step configuration form
|
||||||
|
|
||||||
Step 1: Select environment
|
Step 1: Select environment
|
||||||
@ -186,7 +186,7 @@ Step 4: Encryption
|
|||||||
|
|
||||||
Quick access to relevant docs:
|
Quick access to relevant docs:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Field: "Backup Retention Days"
|
Field: "Backup Retention Days"
|
||||||
|
|
||||||
Suggestion popup:
|
Suggestion popup:
|
||||||
@ -207,7 +207,7 @@ Suggestion popup:
|
|||||||
|
|
||||||
Suggest multiple related fields together:
|
Suggest multiple related fields together:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User selects: environment = "production"
|
User selects: environment = "production"
|
||||||
|
|
||||||
AI suggests completing:
|
AI suggests completing:
|
||||||
@ -231,7 +231,7 @@ AI suggests completing:
|
|||||||
|
|
||||||
### Frontend (typdialog-ai JavaScript/TypeScript)
|
### Frontend (typdialog-ai JavaScript/TypeScript)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// React component for field with AI assistance
|
// React component for field with AI assistance
|
||||||
interface AIFieldProps {
|
interface AIFieldProps {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
@ -286,7 +286,7 @@ function AIAssistedField({fieldName, formContext, schema}: AIFieldProps) {
|
|||||||
|
|
||||||
### Backend Service Integration
|
### Backend Service Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// In AI Service: field suggestion endpoint
|
// In AI Service: field suggestion endpoint
|
||||||
async fn suggest_field_value(
|
async fn suggest_field_value(
|
||||||
req: SuggestFieldRequest,
|
req: SuggestFieldRequest,
|
||||||
@ -316,7 +316,7 @@ async fn suggest_field_value(
|
|||||||
|
|
||||||
### Form Assistant Settings
|
### Form Assistant Settings
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# In provisioning/config/ai.toml
|
# In provisioning/config/ai.toml
|
||||||
[ai.forms]
|
[ai.forms]
|
||||||
enabled = true
|
enabled = true
|
||||||
@ -352,7 +352,7 @@ track_rejected_suggestions = true
|
|||||||
|
|
||||||
### Scenario: New User Configuring PostgreSQL
|
### Scenario: New User Configuring PostgreSQL
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. User opens typdialog form
|
1. User opens typdialog form
|
||||||
- Form title: "Create Database"
|
- Form title: "Create Database"
|
||||||
- First field: "Database Engine"
|
- First field: "Database Engine"
|
||||||
@ -395,7 +395,7 @@ track_rejected_suggestions = true
|
|||||||
|
|
||||||
NLC and form assistance share the same backend:
|
NLC and form assistance share the same backend:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Natural Language Generation AI-Assisted Forms
|
Natural Language Generation AI-Assisted Forms
|
||||||
↓ ↓
|
↓ ↓
|
||||||
"Create a PostgreSQL db" Select field values
|
"Create a PostgreSQL db" Select field values
|
||||||
|
|||||||
@ -36,7 +36,7 @@ The RAG system enables AI to access and reason over platform documentation:
|
|||||||
- Semantic caching for repeated queries
|
- Semantic caching for repeated queries
|
||||||
|
|
||||||
**Capabilities**:
|
**Capabilities**:
|
||||||
```text
|
```bash
|
||||||
provisioning ai query "How do I set up Kubernetes?"
|
provisioning ai query "How do I set up Kubernetes?"
|
||||||
provisioning ai template "Describe my infrastructure"
|
provisioning ai template "Describe my infrastructure"
|
||||||
```
|
```
|
||||||
@ -56,14 +56,14 @@ Provides Model Context Protocol integration:
|
|||||||
**Status**: ✅ Production-Ready
|
**Status**: ✅ Production-Ready
|
||||||
|
|
||||||
Interactive commands:
|
Interactive commands:
|
||||||
```text
|
```bash
|
||||||
provisioning ai template --prompt "Describe infrastructure"
|
provisioning ai template --prompt "Describe infrastructure"
|
||||||
provisioning ai query --prompt "Configuration question"
|
provisioning ai query --prompt "Configuration question"
|
||||||
provisioning ai chat # Interactive mode
|
provisioning ai chat # Interactive mode
|
||||||
```
|
```
|
||||||
|
|
||||||
**Configuration**:
|
**Configuration**:
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "anthropic" # or "openai" or "local"
|
provider = "anthropic" # or "openai" or "local"
|
||||||
@ -108,7 +108,7 @@ Real-time AI suggestions in configuration forms:
|
|||||||
|
|
||||||
## Architecture Diagram
|
## Architecture Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────┐
|
||||||
│ User Interface │
|
│ User Interface │
|
||||||
│ ├── CLI (provisioning ai ...) │
|
│ ├── CLI (provisioning ai ...) │
|
||||||
|
|||||||
@ -14,7 +14,7 @@ The Configuration Generator (typdialog-prov-gen) will provide template-based Nic
|
|||||||
- Preview before generation
|
- Preview before generation
|
||||||
|
|
||||||
### Customization via Natural Language
|
### Customization via Natural Language
|
||||||
```text
|
```bash
|
||||||
provisioning ai config-gen
|
provisioning ai config-gen
|
||||||
--template "kubernetes-cluster"
|
--template "kubernetes-cluster"
|
||||||
--customize "Add Prometheus monitoring, increase replicas to 5, use us-east-1"
|
--customize "Add Prometheus monitoring, increase replicas to 5, use us-east-1"
|
||||||
@ -32,7 +32,7 @@ provisioning ai config-gen
|
|||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Template Library
|
Template Library
|
||||||
↓
|
↓
|
||||||
Template Selection (AI + User)
|
Template Selection (AI + User)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ controls, and security settings.
|
|||||||
|
|
||||||
### Minimal Configuration
|
### Minimal Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# provisioning/config/ai.toml
|
# provisioning/config/ai.toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
@ -27,7 +27,7 @@ temperature = 0.7
|
|||||||
|
|
||||||
### Initialize Configuration
|
### Initialize Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Generate default configuration
|
# Generate default configuration
|
||||||
provisioning config init ai
|
provisioning config init ai
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ provisioning config show ai
|
|||||||
|
|
||||||
### Anthropic Claude
|
### Anthropic Claude
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "anthropic"
|
provider = "anthropic"
|
||||||
@ -68,7 +68,7 @@ top_k = 40
|
|||||||
|
|
||||||
### OpenAI GPT-4
|
### OpenAI GPT-4
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "openai"
|
provider = "openai"
|
||||||
@ -89,7 +89,7 @@ top_p = 0.95
|
|||||||
|
|
||||||
### Local Models
|
### Local Models
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "local"
|
provider = "local"
|
||||||
@ -112,7 +112,7 @@ max_batch_size = 4
|
|||||||
|
|
||||||
### Enable Specific Features
|
### Enable Specific Features
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.features]
|
[ai.features]
|
||||||
# Core features (production-ready)
|
# Core features (production-ready)
|
||||||
rag_search = true # Retrieve-Augmented Generation
|
rag_search = true # Retrieve-Augmented Generation
|
||||||
@ -137,7 +137,7 @@ knowledge_base = false # Custom knowledge base per workspace
|
|||||||
|
|
||||||
### Cache Strategy
|
### Cache Strategy
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.cache]
|
[ai.cache]
|
||||||
enabled = true
|
enabled = true
|
||||||
cache_type = "memory" # or "redis", "disk"
|
cache_type = "memory" # or "redis", "disk"
|
||||||
@ -169,7 +169,7 @@ cache_embeddings = true # Cache embedding vectors
|
|||||||
|
|
||||||
### Cache Metrics
|
### Cache Metrics
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monitor cache performance
|
# Monitor cache performance
|
||||||
provisioning admin cache stats ai
|
provisioning admin cache stats ai
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ provisioning admin cache analyze ai --hours 24
|
|||||||
|
|
||||||
### Rate Limits
|
### Rate Limits
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.limits]
|
[ai.limits]
|
||||||
# Tokens per request
|
# Tokens per request
|
||||||
max_tokens = 4096
|
max_tokens = 4096
|
||||||
@ -207,7 +207,7 @@ track_cost_per_request = true
|
|||||||
|
|
||||||
### Cost Budgeting
|
### Cost Budgeting
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.budget]
|
[ai.budget]
|
||||||
enabled = true
|
enabled = true
|
||||||
monthly_limit_usd = 1000
|
monthly_limit_usd = 1000
|
||||||
@ -226,7 +226,7 @@ local_limit = 0 # Free (run locally)
|
|||||||
|
|
||||||
### Track Costs
|
### Track Costs
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View cost metrics
|
# View cost metrics
|
||||||
provisioning admin costs show ai --period month
|
provisioning admin costs show ai --period month
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ provisioning admin costs export ai --format csv --output costs.csv
|
|||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.auth]
|
[ai.auth]
|
||||||
# API key from environment variable
|
# API key from environment variable
|
||||||
api_key = "${PROVISIONING_AI_API_KEY}"
|
api_key = "${PROVISIONING_AI_API_KEY}"
|
||||||
@ -263,7 +263,7 @@ signing_method = "hmac-sha256"
|
|||||||
|
|
||||||
### Authorization (Cedar)
|
### Authorization (Cedar)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.authorization]
|
[ai.authorization]
|
||||||
enabled = true
|
enabled = true
|
||||||
policy_file = "provisioning/policies/ai-policies.cedar"
|
policy_file = "provisioning/policies/ai-policies.cedar"
|
||||||
@ -276,7 +276,7 @@ policy_file = "provisioning/policies/ai-policies.cedar"
|
|||||||
|
|
||||||
### Data Protection
|
### Data Protection
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.security]
|
[ai.security]
|
||||||
# Sanitize data before sending to external LLM
|
# Sanitize data before sending to external LLM
|
||||||
sanitize_pii = true
|
sanitize_pii = true
|
||||||
@ -300,7 +300,7 @@ local_only = false # Set true for air-gapped deployments
|
|||||||
|
|
||||||
### Vector Store Setup
|
### Vector Store Setup
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.rag]
|
[ai.rag]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ code_overlap = 128
|
|||||||
|
|
||||||
### Index Management
|
### Index Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create indexes
|
# Create indexes
|
||||||
provisioning ai index create rag
|
provisioning ai index create rag
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ provisioning ai index cleanup rag --older-than 30days
|
|||||||
|
|
||||||
### MCP Server Setup
|
### MCP Server Setup
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.mcp]
|
[ai.mcp]
|
||||||
enabled = true
|
enabled = true
|
||||||
port = 3000
|
port = 3000
|
||||||
@ -380,7 +380,7 @@ timeout_seconds = 30
|
|||||||
|
|
||||||
### MCP Client Configuration
|
### MCP Client Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
~/.claude/claude_desktop_config.json:
|
~/.claude/claude_desktop_config.json:
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
@ -400,7 +400,7 @@ timeout_seconds = 30
|
|||||||
|
|
||||||
### Logging Configuration
|
### Logging Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.logging]
|
[ai.logging]
|
||||||
level = "info" # or "debug", "warn", "error"
|
level = "info" # or "debug", "warn", "error"
|
||||||
format = "json" # or "text"
|
format = "json" # or "text"
|
||||||
@ -423,7 +423,7 @@ log_costs = true
|
|||||||
|
|
||||||
### Metrics and Monitoring
|
### Metrics and Monitoring
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View AI service metrics
|
# View AI service metrics
|
||||||
provisioning admin metrics show ai
|
provisioning admin metrics show ai
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ curl [http://localhost:8083/metrics](http://localhost:8083/metrics)
|
|||||||
|
|
||||||
### Configuration Validation
|
### Configuration Validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate configuration syntax
|
# Validate configuration syntax
|
||||||
provisioning config validate ai
|
provisioning config validate ai
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ provisioning ai health-check
|
|||||||
|
|
||||||
### Common Settings
|
### Common Settings
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Provider configuration
|
# Provider configuration
|
||||||
export PROVISIONING_AI_PROVIDER="anthropic"
|
export PROVISIONING_AI_PROVIDER="anthropic"
|
||||||
export PROVISIONING_AI_MODEL="claude-sonnet-4"
|
export PROVISIONING_AI_MODEL="claude-sonnet-4"
|
||||||
@ -492,7 +492,7 @@ export RUST_LOG="provisioning::ai=info"
|
|||||||
### Common Issues
|
### Common Issues
|
||||||
|
|
||||||
**Issue**: API key not recognized
|
**Issue**: API key not recognized
|
||||||
```text
|
```bash
|
||||||
# Check environment variable is set
|
# Check environment variable is set
|
||||||
echo $PROVISIONING_AI_API_KEY
|
echo $PROVISIONING_AI_API_KEY
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ provisioning ai test provider anthropic
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Issue**: Cache not working
|
**Issue**: Cache not working
|
||||||
```text
|
```bash
|
||||||
# Check cache status
|
# Check cache status
|
||||||
provisioning admin cache stats ai
|
provisioning admin cache stats ai
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ RUST_LOG=provisioning::cache=debug provisioning-ai-service
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Issue**: RAG search not finding results
|
**Issue**: RAG search not finding results
|
||||||
```text
|
```bash
|
||||||
# Rebuild RAG indexes
|
# Rebuild RAG indexes
|
||||||
provisioning ai index rebuild rag
|
provisioning ai index rebuild rag
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ provisioning ai index status rag
|
|||||||
|
|
||||||
New AI versions automatically migrate old configurations:
|
New AI versions automatically migrate old configurations:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Check configuration version
|
# Check configuration version
|
||||||
provisioning config version ai
|
provisioning config version ai
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ provisioning config backup ai
|
|||||||
|
|
||||||
### Recommended Production Settings
|
### Recommended Production Settings
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "anthropic"
|
provider = "anthropic"
|
||||||
|
|||||||
@ -21,7 +21,7 @@ includes built-in cost controls to prevent runaway spending while maximizing val
|
|||||||
|
|
||||||
### Cost Examples
|
### Cost Examples
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario 1: Generate simple database configuration
|
Scenario 1: Generate simple database configuration
|
||||||
- Input: 500 tokens (description + schema)
|
- Input: 500 tokens (description + schema)
|
||||||
- Output: 200 tokens (generated config)
|
- Output: 200 tokens (generated config)
|
||||||
@ -49,7 +49,7 @@ Scenario 3: Monthly usage (typical organization)
|
|||||||
|
|
||||||
Caching is the primary cost reduction strategy, cutting costs by 50-80%:
|
Caching is the primary cost reduction strategy, cutting costs by 50-80%:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Without Caching:
|
Without Caching:
|
||||||
User 1: "Generate PostgreSQL config" → API call → $0.005
|
User 1: "Generate PostgreSQL config" → API call → $0.005
|
||||||
User 2: "Generate PostgreSQL config" → API call → $0.005
|
User 2: "Generate PostgreSQL config" → API call → $0.005
|
||||||
@ -69,7 +69,7 @@ With Semantic Cache:
|
|||||||
|
|
||||||
### Cache Configuration
|
### Cache Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.cache]
|
[ai.cache]
|
||||||
enabled = true
|
enabled = true
|
||||||
cache_type = "redis" # Distributed cache across instances
|
cache_type = "redis" # Distributed cache across instances
|
||||||
@ -96,7 +96,7 @@ alert_on_low_hit_rate = true
|
|||||||
|
|
||||||
Prevent usage spikes from unexpected costs:
|
Prevent usage spikes from unexpected costs:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.limits]
|
[ai.limits]
|
||||||
# Per-request limits
|
# Per-request limits
|
||||||
max_tokens = 4096
|
max_tokens = 4096
|
||||||
@ -119,7 +119,7 @@ stop_at_percent = 95 # Stop when at 95% of budget
|
|||||||
|
|
||||||
### Workspace-Level Budgets
|
### Workspace-Level Budgets
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.workspace_budgets]
|
[ai.workspace_budgets]
|
||||||
# Per-workspace cost limits
|
# Per-workspace cost limits
|
||||||
dev.daily_limit_usd = 10
|
dev.daily_limit_usd = 10
|
||||||
@ -135,7 +135,7 @@ teams.team-b.monthly_limit = 300
|
|||||||
|
|
||||||
### Track Spending
|
### Track Spending
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View current month spending
|
# View current month spending
|
||||||
provisioning admin costs show ai
|
provisioning admin costs show ai
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ provisioning admin costs export ai --format csv --output costs.csv
|
|||||||
|
|
||||||
### Cost Breakdown
|
### Cost Breakdown
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Month: January 2025
|
Month: January 2025
|
||||||
|
|
||||||
Total Spending: $285.42
|
Total Spending: $285.42
|
||||||
@ -192,7 +192,7 @@ Cache Performance:
|
|||||||
|
|
||||||
### Strategy 1: Increase Cache Hit Rate
|
### Strategy 1: Increase Cache Hit Rate
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Longer TTL = more cache hits
|
# Longer TTL = more cache hits
|
||||||
[ai.cache]
|
[ai.cache]
|
||||||
ttl_seconds = 7200 # 2 hours instead of 1 hour
|
ttl_seconds = 7200 # 2 hours instead of 1 hour
|
||||||
@ -208,7 +208,7 @@ similarity_threshold = 0.90 # Lower threshold = more hits
|
|||||||
|
|
||||||
### Strategy 2: Use Local Models
|
### Strategy 2: Use Local Models
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
provider = "local"
|
provider = "local"
|
||||||
model = "mistral-7b" # Free, runs on GPU
|
model = "mistral-7b" # Free, runs on GPU
|
||||||
@ -222,7 +222,7 @@ model = "mistral-7b" # Free, runs on GPU
|
|||||||
|
|
||||||
### Strategy 3: Use Haiku for Simple Tasks
|
### Strategy 3: Use Haiku for Simple Tasks
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Task Complexity vs Model:
|
Task Complexity vs Model:
|
||||||
|
|
||||||
Simple (form assist): Claude Haiku 4 ($0.80/$4)
|
Simple (form assist): Claude Haiku 4 ($0.80/$4)
|
||||||
@ -241,7 +241,7 @@ Example optimization:
|
|||||||
|
|
||||||
### Strategy 4: Batch Operations
|
### Strategy 4: Batch Operations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Instead of individual requests, batch similar operations:
|
# Instead of individual requests, batch similar operations:
|
||||||
|
|
||||||
# Before: 100 configs, 100 separate API calls
|
# Before: 100 configs, 100 separate API calls
|
||||||
@ -257,7 +257,7 @@ provisioning ai batch --input configs-list.yaml
|
|||||||
|
|
||||||
### Strategy 5: Smart Feature Enablement
|
### Strategy 5: Smart Feature Enablement
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.features]
|
[ai.features]
|
||||||
# Enable high-ROI features
|
# Enable high-ROI features
|
||||||
config_generation = true # High value, moderate cost
|
config_generation = true # High value, moderate cost
|
||||||
@ -273,7 +273,7 @@ agents = false # Complex, requires multiple calls
|
|||||||
|
|
||||||
### 1. Set Budget
|
### 1. Set Budget
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set monthly budget
|
# Set monthly budget
|
||||||
provisioning config set ai.budget.monthly_limit_usd 500
|
provisioning config set ai.budget.monthly_limit_usd 500
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ provisioning config set ai.workspace_budgets.dev.monthly_limit 100
|
|||||||
|
|
||||||
### 2. Monitor Spending
|
### 2. Monitor Spending
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Daily check
|
# Daily check
|
||||||
provisioning admin costs show ai
|
provisioning admin costs show ai
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ provisioning admin costs analyze ai --period month
|
|||||||
|
|
||||||
### 3. Adjust If Needed
|
### 3. Adjust If Needed
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# If overspending:
|
# If overspending:
|
||||||
# - Increase cache TTL
|
# - Increase cache TTL
|
||||||
# - Enable local models for simple tasks
|
# - Enable local models for simple tasks
|
||||||
@ -315,7 +315,7 @@ provisioning admin costs analyze ai --period month
|
|||||||
|
|
||||||
### 4. Forecast and Plan
|
### 4. Forecast and Plan
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Current monthly run rate
|
# Current monthly run rate
|
||||||
provisioning admin costs forecast ai
|
provisioning admin costs forecast ai
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ provisioning admin costs forecast ai
|
|||||||
### Chargeback Models
|
### Chargeback Models
|
||||||
|
|
||||||
**Per-Workspace Model**:
|
**Per-Workspace Model**:
|
||||||
```text
|
```bash
|
||||||
Development workspace: $50/month
|
Development workspace: $50/month
|
||||||
Staging workspace: $100/month
|
Staging workspace: $100/month
|
||||||
Production workspace: $300/month
|
Production workspace: $300/month
|
||||||
@ -343,14 +343,14 @@ Total: $450/month
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Per-User Model**:
|
**Per-User Model**:
|
||||||
```text
|
```bash
|
||||||
Each user charged based on their usage
|
Each user charged based on their usage
|
||||||
Encourages efficiency
|
Encourages efficiency
|
||||||
Difficult to track/allocate
|
Difficult to track/allocate
|
||||||
```
|
```
|
||||||
|
|
||||||
**Shared Pool Model**:
|
**Shared Pool Model**:
|
||||||
```text
|
```bash
|
||||||
All teams share $1000/month budget
|
All teams share $1000/month budget
|
||||||
Budget splits by consumption rate
|
Budget splits by consumption rate
|
||||||
Encourages optimization
|
Encourages optimization
|
||||||
@ -361,7 +361,7 @@ Most flexible
|
|||||||
|
|
||||||
### Generate Reports
|
### Generate Reports
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monthly cost report
|
# Monthly cost report
|
||||||
provisioning admin costs report ai
|
provisioning admin costs report ai
|
||||||
--format pdf
|
--format pdf
|
||||||
@ -384,7 +384,7 @@ provisioning admin costs report ai
|
|||||||
|
|
||||||
### ROI Examples
|
### ROI Examples
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario 1: Developer Time Savings
|
Scenario 1: Developer Time Savings
|
||||||
Problem: Manual config creation takes 2 hours
|
Problem: Manual config creation takes 2 hours
|
||||||
Solution: AI config generation, 10 minutes (12x faster)
|
Solution: AI config generation, 10 minutes (12x faster)
|
||||||
@ -422,7 +422,7 @@ Scenario 3: Reduction in Failed Deployments
|
|||||||
|
|
||||||
### Hybrid Strategy (Recommended)
|
### Hybrid Strategy (Recommended)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
✓ Local models for:
|
✓ Local models for:
|
||||||
- Form assistance (high volume, low complexity)
|
- Form assistance (high volume, low complexity)
|
||||||
- Simple validation checks
|
- Simple validation checks
|
||||||
@ -445,7 +445,7 @@ Result:
|
|||||||
|
|
||||||
### Cost Anomaly Detection
|
### Cost Anomaly Detection
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable anomaly detection
|
# Enable anomaly detection
|
||||||
provisioning config set ai.monitoring.anomaly_detection true
|
provisioning config set ai.monitoring.anomaly_detection true
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ provisioning config set ai.monitoring.cost_spike_percent 150
|
|||||||
|
|
||||||
### Alert Configuration
|
### Alert Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.monitoring.alerts]
|
[ai.monitoring.alerts]
|
||||||
enabled = true
|
enabled = true
|
||||||
spike_threshold_percent = 150
|
spike_threshold_percent = 150
|
||||||
|
|||||||
@ -9,7 +9,7 @@ platform capabilities as tools. This enables complex multi-step workflows, tool
|
|||||||
|
|
||||||
The MCP integration follows the Model Context Protocol specification:
|
The MCP integration follows the Model Context Protocol specification:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌──────────────────────────────────────────────────────────────┐
|
┌──────────────────────────────────────────────────────────────┐
|
||||||
│ External LLM (Claude, GPT-4, etc.) │
|
│ External LLM (Claude, GPT-4, etc.) │
|
||||||
└────────────────────┬─────────────────────────────────────────┘
|
└────────────────────┬─────────────────────────────────────────┘
|
||||||
@ -44,7 +44,7 @@ The MCP integration follows the Model Context Protocol specification:
|
|||||||
|
|
||||||
The MCP server is started as a stdio-based service:
|
The MCP server is started as a stdio-based service:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start MCP server (stdio transport)
|
# Start MCP server (stdio transport)
|
||||||
provisioning-mcp-server --config /etc/provisioning/ai.toml
|
provisioning-mcp-server --config /etc/provisioning/ai.toml
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ RUST_LOG=debug provisioning-mcp-server --config /etc/provisioning/ai.toml
|
|||||||
|
|
||||||
Generate infrastructure configuration from natural language description.
|
Generate infrastructure configuration from natural language description.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "generate_config",
|
"name": "generate_config",
|
||||||
"description": "Generate a Nickel infrastructure configuration from a natural language description",
|
"description": "Generate a Nickel infrastructure configuration from a natural language description",
|
||||||
@ -102,7 +102,7 @@ Generate infrastructure configuration from natural language description.
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Via MCP client
|
# Via MCP client
|
||||||
mcp-client provisioning generate_config
|
mcp-client provisioning generate_config
|
||||||
--description "Production PostgreSQL cluster with encryption and daily backups"
|
--description "Production PostgreSQL cluster with encryption and daily backups"
|
||||||
@ -114,7 +114,7 @@ mcp-client provisioning generate_config
|
|||||||
|
|
||||||
**Response**:
|
**Response**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
database = {
|
database = {
|
||||||
engine = "postgresql",
|
engine = "postgresql",
|
||||||
@ -155,7 +155,7 @@ mcp-client provisioning generate_config
|
|||||||
|
|
||||||
Validate a Nickel configuration against schemas and policies.
|
Validate a Nickel configuration against schemas and policies.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "validate_config",
|
"name": "validate_config",
|
||||||
"description": "Validate a Nickel configuration file",
|
"description": "Validate a Nickel configuration file",
|
||||||
@ -182,7 +182,7 @@ Validate a Nickel configuration against schemas and policies.
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
mcp-client provisioning validate_config
|
mcp-client provisioning validate_config
|
||||||
--config "$(cat workspaces/prod/database.ncl)"
|
--config "$(cat workspaces/prod/database.ncl)"
|
||||||
@ -195,7 +195,7 @@ mcp-client provisioning validate_config
|
|||||||
|
|
||||||
**Response**:
|
**Response**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"valid": true,
|
"valid": true,
|
||||||
"errors": [],
|
"errors": [],
|
||||||
@ -216,7 +216,7 @@ mcp-client provisioning validate_config
|
|||||||
|
|
||||||
Search infrastructure documentation using RAG system.
|
Search infrastructure documentation using RAG system.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "search_docs",
|
"name": "search_docs",
|
||||||
"description": "Search provisioning documentation for information",
|
"description": "Search provisioning documentation for information",
|
||||||
@ -244,7 +244,7 @@ Search infrastructure documentation using RAG system.
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Search documentation
|
# Search documentation
|
||||||
mcp-client provisioning search_docs
|
mcp-client provisioning search_docs
|
||||||
--query "How do I configure PostgreSQL with replication?"
|
--query "How do I configure PostgreSQL with replication?"
|
||||||
@ -258,7 +258,7 @@ mcp-client provisioning search_docs
|
|||||||
|
|
||||||
**Response**:
|
**Response**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
@ -283,7 +283,7 @@ mcp-client provisioning search_docs
|
|||||||
|
|
||||||
Analyze deployment failures and suggest fixes.
|
Analyze deployment failures and suggest fixes.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "troubleshoot_deployment",
|
"name": "troubleshoot_deployment",
|
||||||
"description": "Analyze deployment logs and suggest fixes",
|
"description": "Analyze deployment logs and suggest fixes",
|
||||||
@ -310,7 +310,7 @@ Analyze deployment failures and suggest fixes.
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Troubleshoot recent deployment
|
# Troubleshoot recent deployment
|
||||||
mcp-client provisioning troubleshoot_deployment
|
mcp-client provisioning troubleshoot_deployment
|
||||||
--deployment_id "deploy-2025-01-13-001"
|
--deployment_id "deploy-2025-01-13-001"
|
||||||
@ -322,7 +322,7 @@ mcp-client provisioning troubleshoot_deployment
|
|||||||
|
|
||||||
**Response**:
|
**Response**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"status": "failure",
|
"status": "failure",
|
||||||
"root_cause": "Database connection timeout during migration phase",
|
"root_cause": "Database connection timeout during migration phase",
|
||||||
@ -349,7 +349,7 @@ mcp-client provisioning troubleshoot_deployment
|
|||||||
|
|
||||||
Retrieve schema definition with examples.
|
Retrieve schema definition with examples.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "get_schema",
|
"name": "get_schema",
|
||||||
"description": "Get a provisioning schema definition",
|
"description": "Get a provisioning schema definition",
|
||||||
@ -373,7 +373,7 @@ Retrieve schema definition with examples.
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Get schema definition
|
# Get schema definition
|
||||||
mcp-client provisioning get_schema --schema_name database
|
mcp-client provisioning get_schema --schema_name database
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ mcp-client provisioning get_schema
|
|||||||
|
|
||||||
Verify configuration against compliance policies (Cedar).
|
Verify configuration against compliance policies (Cedar).
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "check_compliance",
|
"name": "check_compliance",
|
||||||
"description": "Check configuration against compliance policies",
|
"description": "Check configuration against compliance policies",
|
||||||
@ -412,7 +412,7 @@ Verify configuration against compliance policies (Cedar).
|
|||||||
|
|
||||||
**Example Usage**:
|
**Example Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check against PCI-DSS
|
# Check against PCI-DSS
|
||||||
mcp-client provisioning check_compliance
|
mcp-client provisioning check_compliance
|
||||||
--config "$(cat workspaces/prod/database.ncl)"
|
--config "$(cat workspaces/prod/database.ncl)"
|
||||||
@ -423,7 +423,7 @@ mcp-client provisioning check_compliance
|
|||||||
|
|
||||||
### Claude Desktop (Most Common)
|
### Claude Desktop (Most Common)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
~/.claude/claude_desktop_config.json:
|
~/.claude/claude_desktop_config.json:
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
@ -441,7 +441,7 @@ mcp-client provisioning check_compliance
|
|||||||
|
|
||||||
**Usage in Claude**:
|
**Usage in Claude**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User: I need a production Kubernetes cluster in AWS with automatic scaling
|
User: I need a production Kubernetes cluster in AWS with automatic scaling
|
||||||
|
|
||||||
Claude can now use provisioning tools:
|
Claude can now use provisioning tools:
|
||||||
@ -454,7 +454,7 @@ I'll help you create a production Kubernetes cluster. Let me:
|
|||||||
|
|
||||||
### OpenAI Function Calling
|
### OpenAI Function Calling
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import openai
|
import openai
|
||||||
|
|
||||||
tools = [
|
tools = [
|
||||||
@ -486,7 +486,7 @@ response = openai.ChatCompletion.create(
|
|||||||
|
|
||||||
### Local LLM Integration (Ollama)
|
### Local LLM Integration (Ollama)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start Ollama with provisioning MCP
|
# Start Ollama with provisioning MCP
|
||||||
OLLAMA_MCP_SERVERS=provisioning://localhost:3000
|
OLLAMA_MCP_SERVERS=provisioning://localhost:3000
|
||||||
ollama serve
|
ollama serve
|
||||||
@ -504,7 +504,7 @@ curl [http://localhost:11434/api/generate](http://localhost:11434/api/generate)
|
|||||||
|
|
||||||
Tools return consistent error responses:
|
Tools return consistent error responses:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"error": {
|
"error": {
|
||||||
"code": "VALIDATION_ERROR",
|
"code": "VALIDATION_ERROR",
|
||||||
@ -567,7 +567,7 @@ See [Configuration Guide](configuration.md) for MCP-specific settings:
|
|||||||
|
|
||||||
## Monitoring and Debugging
|
## Monitoring and Debugging
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monitor MCP server
|
# Monitor MCP server
|
||||||
provisioning admin mcp status
|
provisioning admin mcp status
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ validation.
|
|||||||
|
|
||||||
Transform infrastructure descriptions into production-ready Nickel configurations:
|
Transform infrastructure descriptions into production-ready Nickel configurations:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
User Input:
|
User Input:
|
||||||
"Create a production PostgreSQL cluster with 100GB storage,
|
"Create a production PostgreSQL cluster with 100GB storage,
|
||||||
daily backups, encryption enabled, and cross-region replication
|
daily backups, encryption enabled, and cross-region replication
|
||||||
@ -34,7 +34,7 @@ System Output:
|
|||||||
|
|
||||||
### Generation Pipeline
|
### Generation Pipeline
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Input Description (Natural Language)
|
Input Description (Natural Language)
|
||||||
↓
|
↓
|
||||||
┌─────────────────────────────────────┐
|
┌─────────────────────────────────────┐
|
||||||
@ -84,7 +84,7 @@ Input Description (Natural Language)
|
|||||||
|
|
||||||
Extract structured intent from natural language:
|
Extract structured intent from natural language:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Input: "Create a production PostgreSQL cluster with encryption and backups"
|
Input: "Create a production PostgreSQL cluster with encryption and backups"
|
||||||
|
|
||||||
Extracted Intent:
|
Extracted Intent:
|
||||||
@ -104,7 +104,7 @@ Extracted Intent:
|
|||||||
|
|
||||||
Map natural language entities to schema fields:
|
Map natural language entities to schema fields:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Description Terms → Schema Fields:
|
Description Terms → Schema Fields:
|
||||||
"100GB storage" → database.instance.allocated_storage_gb = 100
|
"100GB storage" → database.instance.allocated_storage_gb = 100
|
||||||
"daily backups" → backup.enabled = true, backup.frequency = "daily"
|
"daily backups" → backup.enabled = true, backup.frequency = "daily"
|
||||||
@ -117,7 +117,7 @@ Description Terms → Schema Fields:
|
|||||||
|
|
||||||
Sophisticated prompting for schema-aware generation:
|
Sophisticated prompting for schema-aware generation:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
System Prompt:
|
System Prompt:
|
||||||
You are generating Nickel infrastructure configurations.
|
You are generating Nickel infrastructure configurations.
|
||||||
Generate ONLY valid Nickel syntax.
|
Generate ONLY valid Nickel syntax.
|
||||||
@ -144,7 +144,7 @@ Start with: let { database = {
|
|||||||
|
|
||||||
Handle generation errors through iteration:
|
Handle generation errors through iteration:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Attempt 1: Generate initial config
|
Attempt 1: Generate initial config
|
||||||
↓ Validate
|
↓ Validate
|
||||||
✗ Error: field `version` type mismatch (string vs number)
|
✗ Error: field `version` type mismatch (string vs number)
|
||||||
@ -158,7 +158,7 @@ Attempt 2: Fix with context from error
|
|||||||
|
|
||||||
### CLI Usage
|
### CLI Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Simple generation
|
# Simple generation
|
||||||
provisioning ai generate "PostgreSQL database for production"
|
provisioning ai generate "PostgreSQL database for production"
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ provisioning ai generate --batch descriptions.yaml
|
|||||||
|
|
||||||
### Interactive Refinement
|
### Interactive Refinement
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
$ provisioning ai generate --interactive
|
$ provisioning ai generate --interactive
|
||||||
> Describe infrastructure: Create production PostgreSQL cluster
|
> Describe infrastructure: Create production PostgreSQL cluster
|
||||||
|
|
||||||
@ -209,12 +209,12 @@ Configuration saved to: workspaces/prod/database.ncl
|
|||||||
### Example 1: Simple Database
|
### Example 1: Simple Database
|
||||||
|
|
||||||
**Input**:
|
**Input**:
|
||||||
```text
|
```bash
|
||||||
"PostgreSQL database with 50GB storage and encryption"
|
"PostgreSQL database with 50GB storage and encryption"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**:
|
**Output**:
|
||||||
```text
|
```javascript
|
||||||
let {
|
let {
|
||||||
database = {
|
database = {
|
||||||
engine = "postgresql",
|
engine = "postgresql",
|
||||||
@ -249,13 +249,13 @@ let {
|
|||||||
### Example 2: Complex Kubernetes Setup
|
### Example 2: Complex Kubernetes Setup
|
||||||
|
|
||||||
**Input**:
|
**Input**:
|
||||||
```text
|
```yaml
|
||||||
"Production Kubernetes cluster in AWS with 3 availability zones,
|
"Production Kubernetes cluster in AWS with 3 availability zones,
|
||||||
auto-scaling from 3 to 10 nodes, managed PostgreSQL, and monitoring"
|
auto-scaling from 3 to 10 nodes, managed PostgreSQL, and monitoring"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**:
|
**Output**:
|
||||||
```text
|
```javascript
|
||||||
let {
|
let {
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
version = "1.28.0",
|
version = "1.28.0",
|
||||||
@ -314,7 +314,7 @@ let {
|
|||||||
|
|
||||||
### Configurable Generation Parameters
|
### Configurable Generation Parameters
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# In provisioning/config/ai.toml
|
# In provisioning/config/ai.toml
|
||||||
[ai.generation]
|
[ai.generation]
|
||||||
# Which schema to use by default
|
# Which schema to use by default
|
||||||
@ -360,7 +360,7 @@ require_compliance_check = true
|
|||||||
|
|
||||||
### Typical Usage Session
|
### Typical Usage Session
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Describe infrastructure need
|
# 1. Describe infrastructure need
|
||||||
$ provisioning ai generate "I need a database for my web app"
|
$ provisioning ai generate "I need a database for my web app"
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ $ provisioning workspace logs database
|
|||||||
|
|
||||||
NLC uses RAG to find similar configurations:
|
NLC uses RAG to find similar configurations:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
User: "Create Kubernetes cluster"
|
User: "Create Kubernetes cluster"
|
||||||
↓
|
↓
|
||||||
RAG searches for:
|
RAG searches for:
|
||||||
@ -407,7 +407,7 @@ NLC and form assistance share components:
|
|||||||
|
|
||||||
### CLI Integration
|
### CLI Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate then preview
|
# Generate then preview
|
||||||
| provisioning ai generate "PostgreSQL prod" | \ |
|
| provisioning ai generate "PostgreSQL prod" | \ |
|
||||||
provisioning config preview
|
provisioning config preview
|
||||||
|
|||||||
@ -22,7 +22,7 @@ The RAG system consists of:
|
|||||||
|
|
||||||
The system uses embedding models to convert documents into vector representations:
|
The system uses embedding models to convert documents into vector representations:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────┐
|
┌─────────────────────┐
|
||||||
│ Document Source │
|
│ Document Source │
|
||||||
│ (Markdown, Code) │
|
│ (Markdown, Code) │
|
||||||
@ -55,7 +55,7 @@ The system uses embedding models to convert documents into vector representation
|
|||||||
|
|
||||||
SurrealDB serves as the vector database and knowledge store:
|
SurrealDB serves as the vector database and knowledge store:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Configuration in provisioning/schemas/ai.ncl
|
# Configuration in provisioning/schemas/ai.ncl
|
||||||
let {
|
let {
|
||||||
rag = {
|
rag = {
|
||||||
@ -108,7 +108,7 @@ Intelligent chunking preserves context while managing token limits:
|
|||||||
|
|
||||||
#### Markdown Chunking Strategy
|
#### Markdown Chunking Strategy
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Input Document: provisioning/docs/src/guides/from-scratch.md
|
Input Document: provisioning/docs/src/guides/from-scratch.md
|
||||||
|
|
||||||
Chunks:
|
Chunks:
|
||||||
@ -126,7 +126,7 @@ Each chunk includes:
|
|||||||
|
|
||||||
#### Code Chunking Strategy
|
#### Code Chunking Strategy
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Input Document: provisioning/schemas/main.ncl
|
Input Document: provisioning/schemas/main.ncl
|
||||||
|
|
||||||
Chunks:
|
Chunks:
|
||||||
@ -148,7 +148,7 @@ The system implements dual search strategy for optimal results:
|
|||||||
|
|
||||||
### Vector Similarity Search
|
### Vector Similarity Search
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Find semantically similar documents
|
// Find semantically similar documents
|
||||||
async fn vector_search(query: &str, top_k: usize) -> Vec<Document> {
|
async fn vector_search(query: &str, top_k: usize) -> Vec<Document> {
|
||||||
let embedding = embed(query).await?;
|
let embedding = embed(query).await?;
|
||||||
@ -173,7 +173,7 @@ async fn vector_search(query: &str, top_k: usize) -> Vec<Document> {
|
|||||||
|
|
||||||
### BM25 Keyword Search
|
### BM25 Keyword Search
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Find documents with matching keywords
|
// Find documents with matching keywords
|
||||||
async fn keyword_search(query: &str, top_k: usize) -> Vec<Document> {
|
async fn keyword_search(query: &str, top_k: usize) -> Vec<Document> {
|
||||||
// BM25 full-text search in SurrealDB
|
// BM25 full-text search in SurrealDB
|
||||||
@ -196,7 +196,7 @@ async fn keyword_search(query: &str, top_k: usize) -> Vec<Document> {
|
|||||||
|
|
||||||
### Hybrid Results
|
### Hybrid Results
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
async fn hybrid_search(
|
async fn hybrid_search(
|
||||||
query: &str,
|
query: &str,
|
||||||
vector_weight: f32,
|
vector_weight: f32,
|
||||||
@ -231,7 +231,7 @@ async fn hybrid_search(
|
|||||||
|
|
||||||
Reduces API calls by caching embeddings of repeated queries:
|
Reduces API calls by caching embeddings of repeated queries:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
struct SemanticCache {
|
struct SemanticCache {
|
||||||
queries: Arc<DashMap<Vec<f32>, CachedResult>>,
|
queries: Arc<DashMap<Vec<f32>, CachedResult>>,
|
||||||
similarity_threshold: f32,
|
similarity_threshold: f32,
|
||||||
@ -268,7 +268,7 @@ impl SemanticCache {
|
|||||||
|
|
||||||
### Document Indexing
|
### Document Indexing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Index all documentation
|
# Index all documentation
|
||||||
provisioning ai index-docs provisioning/docs/src
|
provisioning ai index-docs provisioning/docs/src
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ provisioning ai watch docs provisioning/docs/src
|
|||||||
|
|
||||||
### Programmatic Indexing
|
### Programmatic Indexing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// In ai-service on startup
|
// In ai-service on startup
|
||||||
async fn initialize_rag() -> Result<()> {
|
async fn initialize_rag() -> Result<()> {
|
||||||
let rag = RAGSystem::new(&config.rag).await?;
|
let rag = RAGSystem::new(&config.rag).await?;
|
||||||
@ -309,7 +309,7 @@ async fn initialize_rag() -> Result<()> {
|
|||||||
|
|
||||||
### Query the RAG System
|
### Query the RAG System
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Search for context-aware information
|
# Search for context-aware information
|
||||||
provisioning ai query "How do I configure PostgreSQL with encryption?"
|
provisioning ai query "How do I configure PostgreSQL with encryption?"
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ provisioning ai chat
|
|||||||
|
|
||||||
### AI Service Integration
|
### AI Service Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// AI service uses RAG to enhance generation
|
// AI service uses RAG to enhance generation
|
||||||
async fn generate_config(user_request: &str) -> Result<String> {
|
async fn generate_config(user_request: &str) -> Result<String> {
|
||||||
// Retrieve relevant context
|
// Retrieve relevant context
|
||||||
@ -344,7 +344,7 @@ async fn generate_config(user_request: &str) -> Result<String> {
|
|||||||
|
|
||||||
### Form Assistance Integration
|
### Form Assistance Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// In typdialog-ai (JavaScript/TypeScript)
|
// In typdialog-ai (JavaScript/TypeScript)
|
||||||
async function suggestFieldValue(fieldName, currentInput) {
|
async function suggestFieldValue(fieldName, currentInput) {
|
||||||
// Query RAG for similar configurations
|
// Query RAG for similar configurations
|
||||||
@ -415,7 +415,7 @@ See [Configuration Guide](configuration.md) for detailed RAG setup:
|
|||||||
|
|
||||||
### Query Metrics
|
### Query Metrics
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View RAG search metrics
|
# View RAG search metrics
|
||||||
provisioning ai metrics show rag
|
provisioning ai metrics show rag
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ provisioning ai eval-rag --sample-queries 100
|
|||||||
|
|
||||||
### Debug Mode
|
### Debug Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# In provisioning/config/ai.toml
|
# In provisioning/config/ai.toml
|
||||||
[ai.rag.debug]
|
[ai.rag.debug]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|||||||
@ -9,7 +9,7 @@ controlled through Cedar policies and include strict secret isolation.
|
|||||||
|
|
||||||
### Defense in Depth
|
### Defense in Depth
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────┐
|
┌─────────────────────────────────────────┐
|
||||||
│ User Request to AI │
|
│ User Request to AI │
|
||||||
└──────────────┬──────────────────────────┘
|
└──────────────┬──────────────────────────┘
|
||||||
@ -60,7 +60,7 @@ controlled through Cedar policies and include strict secret isolation.
|
|||||||
|
|
||||||
### Policy Engine Setup
|
### Policy Engine Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// File: provisioning/policies/ai-policies.cedar
|
// File: provisioning/policies/ai-policies.cedar
|
||||||
|
|
||||||
// Core principle: Least privilege
|
// Core principle: Least privilege
|
||||||
@ -164,7 +164,7 @@ when {
|
|||||||
|
|
||||||
Before sending data to external LLMs, the system removes:
|
Before sending data to external LLMs, the system removes:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Patterns Removed:
|
Patterns Removed:
|
||||||
├─ Passwords: password="...", pwd=..., etc.
|
├─ Passwords: password="...", pwd=..., etc.
|
||||||
├─ API Keys: api_key=..., api-key=..., etc.
|
├─ API Keys: api_key=..., api-key=..., etc.
|
||||||
@ -178,7 +178,7 @@ Patterns Removed:
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.security]
|
[ai.security]
|
||||||
sanitize_pii = true
|
sanitize_pii = true
|
||||||
sanitize_secrets = true
|
sanitize_secrets = true
|
||||||
@ -207,7 +207,7 @@ preserve_patterns = [
|
|||||||
### Example Sanitization
|
### Example Sanitization
|
||||||
|
|
||||||
**Before**:
|
**Before**:
|
||||||
```text
|
```bash
|
||||||
Error configuring database:
|
Error configuring database:
|
||||||
connection_string: postgresql://dbadmin:MySecurePassword123@prod-db.us-east-1.rds.amazonaws.com:5432/app
|
connection_string: postgresql://dbadmin:MySecurePassword123@prod-db.us-east-1.rds.amazonaws.com:5432/app
|
||||||
api_key: sk-ant-abc123def456
|
api_key: sk-ant-abc123def456
|
||||||
@ -215,7 +215,7 @@ vault_token: hvs.CAESIyg7...
|
|||||||
```
|
```
|
||||||
|
|
||||||
**After Sanitization**:
|
**After Sanitization**:
|
||||||
```text
|
```bash
|
||||||
Error configuring database:
|
Error configuring database:
|
||||||
connection_string: postgresql://dbadmin:[REDACTED]@prod-db.us-east-1.rds.amazonaws.com:5432/app
|
connection_string: postgresql://dbadmin:[REDACTED]@prod-db.us-east-1.rds.amazonaws.com:5432/app
|
||||||
api_key: [REDACTED]
|
api_key: [REDACTED]
|
||||||
@ -228,7 +228,7 @@ vault_token: [REDACTED]
|
|||||||
|
|
||||||
AI cannot directly access secrets. Instead:
|
AI cannot directly access secrets. Instead:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User wants: "Configure PostgreSQL with encrypted backups"
|
User wants: "Configure PostgreSQL with encrypted backups"
|
||||||
↓
|
↓
|
||||||
AI generates: Configuration schema with placeholders
|
AI generates: Configuration schema with placeholders
|
||||||
@ -255,7 +255,7 @@ Deployment: Uses secrets from secure store (Vault, AWS Secrets Manager)
|
|||||||
|
|
||||||
For environments requiring zero external API calls:
|
For environments requiring zero external API calls:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Deploy local Ollama with provisioning support
|
# Deploy local Ollama with provisioning support
|
||||||
docker run -d
|
docker run -d
|
||||||
--name provisioning-ai
|
--name provisioning-ai
|
||||||
@ -301,7 +301,7 @@ api_base = "[http://localhost:11434"](http://localhost:11434")
|
|||||||
|
|
||||||
For highly sensitive environments:
|
For highly sensitive environments:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.security.hsm]
|
[ai.security.hsm]
|
||||||
enabled = true
|
enabled = true
|
||||||
provider = "aws-cloudhsm" # or "thales", "yubihsm"
|
provider = "aws-cloudhsm" # or "thales", "yubihsm"
|
||||||
@ -317,7 +317,7 @@ server_key = "/etc/provisioning/certs/server.key"
|
|||||||
|
|
||||||
### Data at Rest
|
### Data at Rest
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.security.encryption]
|
[ai.security.encryption]
|
||||||
enabled = true
|
enabled = true
|
||||||
algorithm = "aes-256-gcm"
|
algorithm = "aes-256-gcm"
|
||||||
@ -335,7 +335,7 @@ log_encryption = true
|
|||||||
|
|
||||||
### Data in Transit
|
### Data in Transit
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
All external LLM API calls:
|
All external LLM API calls:
|
||||||
├─ TLS 1.3 (minimum)
|
├─ TLS 1.3 (minimum)
|
||||||
├─ Certificate pinning (optional)
|
├─ Certificate pinning (optional)
|
||||||
@ -347,7 +347,7 @@ All external LLM API calls:
|
|||||||
|
|
||||||
### What Gets Logged
|
### What Gets Logged
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"timestamp": "2025-01-13T10:30:45Z",
|
"timestamp": "2025-01-13T10:30:45Z",
|
||||||
"event_type": "ai_action",
|
"event_type": "ai_action",
|
||||||
@ -380,7 +380,7 @@ All external LLM API calls:
|
|||||||
|
|
||||||
### Audit Trail Access
|
### Audit Trail Access
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View recent AI actions
|
# View recent AI actions
|
||||||
provisioning audit log ai --tail 100
|
provisioning audit log ai --tail 100
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ provisioning audit search ai "error in database configuration"
|
|||||||
|
|
||||||
### Built-in Compliance Checks
|
### Built-in Compliance Checks
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.compliance]
|
[ai.compliance]
|
||||||
frameworks = ["pci-dss", "hipaa", "sox", "gdpr"]
|
frameworks = ["pci-dss", "hipaa", "sox", "gdpr"]
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ enabled = true
|
|||||||
|
|
||||||
### Compliance Reports
|
### Compliance Reports
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate compliance report
|
# Generate compliance report
|
||||||
provisioning audit compliance-report
|
provisioning audit compliance-report
|
||||||
--framework pci-dss
|
--framework pci-dss
|
||||||
@ -467,7 +467,7 @@ provisioning audit verify-compliance
|
|||||||
|
|
||||||
### Compromised API Key
|
### Compromised API Key
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Immediately revoke key
|
# 1. Immediately revoke key
|
||||||
provisioning admin revoke-key ai-api-key-123
|
provisioning admin revoke-key ai-api-key-123
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ provisioning audit log ai
|
|||||||
|
|
||||||
### Unauthorized Access
|
### Unauthorized Access
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Review Cedar policy logs
|
# Review Cedar policy logs
|
||||||
provisioning audit log ai
|
provisioning audit log ai
|
||||||
--decision deny
|
--decision deny
|
||||||
|
|||||||
@ -11,7 +11,7 @@ root causes, suggests fixes, and generates corrected configurations based on fai
|
|||||||
|
|
||||||
Transform deployment failures into actionable insights:
|
Transform deployment failures into actionable insights:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Deployment Fails with Error
|
Deployment Fails with Error
|
||||||
↓
|
↓
|
||||||
AI analyzes logs:
|
AI analyzes logs:
|
||||||
@ -37,7 +37,7 @@ Developer reviews and accepts:
|
|||||||
|
|
||||||
### Automatic Detection and Analysis
|
### Automatic Detection and Analysis
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌──────────────────────────────────────────┐
|
┌──────────────────────────────────────────┐
|
||||||
│ Deployment Monitoring │
|
│ Deployment Monitoring │
|
||||||
│ - Watches deployment for failures │
|
│ - Watches deployment for failures │
|
||||||
@ -91,14 +91,14 @@ Developer reviews and accepts:
|
|||||||
### Example 1: Database Connection Timeout
|
### Example 1: Database Connection Timeout
|
||||||
|
|
||||||
**Failure**:
|
**Failure**:
|
||||||
```text
|
```bash
|
||||||
Deployment: deploy-2025-01-13-001
|
Deployment: deploy-2025-01-13-001
|
||||||
Status: FAILED at phase database_migration
|
Status: FAILED at phase database_migration
|
||||||
Error: connection timeout after 30s connecting to postgres://...
|
Error: connection timeout after 30s connecting to postgres://...
|
||||||
```
|
```
|
||||||
|
|
||||||
**Run Troubleshooting**:
|
**Run Troubleshooting**:
|
||||||
```text
|
```bash
|
||||||
$ provisioning ai troubleshoot deploy-2025-01-13-001
|
$ provisioning ai troubleshoot deploy-2025-01-13-001
|
||||||
|
|
||||||
Analyzing deployment failure...
|
Analyzing deployment failure...
|
||||||
@ -175,14 +175,14 @@ Ready to redeploy with corrected configuration? [yes/no]: yes
|
|||||||
### Example 2: Kubernetes Deployment Error
|
### Example 2: Kubernetes Deployment Error
|
||||||
|
|
||||||
**Failure**:
|
**Failure**:
|
||||||
```text
|
```yaml
|
||||||
Deployment: deploy-2025-01-13-002
|
Deployment: deploy-2025-01-13-002
|
||||||
Status: FAILED at phase kubernetes_workload
|
Status: FAILED at phase kubernetes_workload
|
||||||
Error: failed to create deployment app: Pod exceeded capacity
|
Error: failed to create deployment app: Pod exceeded capacity
|
||||||
```
|
```
|
||||||
|
|
||||||
**Troubleshooting**:
|
**Troubleshooting**:
|
||||||
```text
|
```bash
|
||||||
$ provisioning ai troubleshoot deploy-2025-01-13-002 --detailed
|
$ provisioning ai troubleshoot deploy-2025-01-13-002 --detailed
|
||||||
|
|
||||||
╔════════════════════════════════════════════════════════════════╗
|
╔════════════════════════════════════════════════════════════════╗
|
||||||
@ -239,7 +239,7 @@ $ provisioning ai troubleshoot deploy-2025-01-13-002 --detailed
|
|||||||
|
|
||||||
### Basic Troubleshooting
|
### Basic Troubleshooting
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Troubleshoot recent deployment
|
# Troubleshoot recent deployment
|
||||||
provisioning ai troubleshoot deploy-2025-01-13-001
|
provisioning ai troubleshoot deploy-2025-01-13-001
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ provisioning ai troubleshoot deploy-2025-01-13-001 --alternatives
|
|||||||
|
|
||||||
### Working with Logs
|
### Working with Logs
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Troubleshoot from custom logs
|
# Troubleshoot from custom logs
|
||||||
provisioning ai troubleshoot
|
provisioning ai troubleshoot
|
||||||
| --logs "$(journalctl -u provisioning --no-pager | tail -100)" |
|
| --logs "$(journalctl -u provisioning --no-pager | tail -100)" |
|
||||||
@ -271,7 +271,7 @@ provisioning ai troubleshoot
|
|||||||
|
|
||||||
### Generate Reports
|
### Generate Reports
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate detailed troubleshooting report
|
# Generate detailed troubleshooting report
|
||||||
provisioning ai troubleshoot deploy-123
|
provisioning ai troubleshoot deploy-123
|
||||||
--report
|
--report
|
||||||
@ -294,7 +294,7 @@ provisioning ai troubleshoot deploy-123
|
|||||||
|
|
||||||
### Shallow Analysis (Fast)
|
### Shallow Analysis (Fast)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning ai troubleshoot deploy-123 --depth shallow
|
provisioning ai troubleshoot deploy-123 --depth shallow
|
||||||
|
|
||||||
Analyzes:
|
Analyzes:
|
||||||
@ -306,7 +306,7 @@ Analyzes:
|
|||||||
|
|
||||||
### Deep Analysis (Thorough)
|
### Deep Analysis (Thorough)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning ai troubleshoot deploy-123 --depth deep
|
provisioning ai troubleshoot deploy-123 --depth deep
|
||||||
|
|
||||||
Analyzes:
|
Analyzes:
|
||||||
@ -322,7 +322,7 @@ Analyzes:
|
|||||||
|
|
||||||
### Automatic Troubleshooting
|
### Automatic Troubleshooting
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable auto-troubleshoot on failures
|
# Enable auto-troubleshoot on failures
|
||||||
provisioning config set ai.troubleshooting.auto_analyze true
|
provisioning config set ai.troubleshooting.auto_analyze true
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ provisioning config set ai.troubleshooting.auto_analyze true
|
|||||||
|
|
||||||
### WebUI Integration
|
### WebUI Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Deployment Dashboard
|
Deployment Dashboard
|
||||||
├─ deployment-123 [FAILED]
|
├─ deployment-123 [FAILED]
|
||||||
│ └─ AI Analysis
|
│ └─ AI Analysis
|
||||||
@ -349,7 +349,7 @@ Deployment Dashboard
|
|||||||
|
|
||||||
The system learns common failure patterns:
|
The system learns common failure patterns:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Collected Patterns:
|
Collected Patterns:
|
||||||
├─ Database Timeouts (25% of failures)
|
├─ Database Timeouts (25% of failures)
|
||||||
│ └─ Usually: Security group, connection pool, slow startup
|
│ └─ Usually: Security group, connection pool, slow startup
|
||||||
@ -363,7 +363,7 @@ Collected Patterns:
|
|||||||
|
|
||||||
### Improvement Tracking
|
### Improvement Tracking
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# See patterns in your deployments
|
# See patterns in your deployments
|
||||||
provisioning ai analytics failures --period month
|
provisioning ai analytics failures --period month
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ Month Summary:
|
|||||||
|
|
||||||
### Troubleshooting Settings
|
### Troubleshooting Settings
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.troubleshooting]
|
[ai.troubleshooting]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ estimate_alternative_costs = true
|
|||||||
|
|
||||||
### Failure Detection
|
### Failure Detection
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[ai.troubleshooting.detection]
|
[ai.troubleshooting.detection]
|
||||||
# Monitor logs for these patterns
|
# Monitor logs for these patterns
|
||||||
watch_patterns = [
|
watch_patterns = [
|
||||||
|
|||||||
@ -12,7 +12,7 @@ API reference for programmatic access to the Provisioning Platform.
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check API health
|
# Check API health
|
||||||
curl http://localhost:9090/health
|
curl http://localhost:9090/health
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ All extensions follow a standardized structure and API for seamless integration.
|
|||||||
|
|
||||||
### Standard Directory Layout
|
### Standard Directory Layout
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
extension-name/
|
extension-name/
|
||||||
├── manifest.toml # Extension metadata
|
├── manifest.toml # Extension metadata
|
||||||
├── schemas/ # Nickel configuration files
|
├── schemas/ # Nickel configuration files
|
||||||
@ -71,7 +71,7 @@ All providers must implement the following interface:
|
|||||||
|
|
||||||
Create `schemas/settings.ncl`:
|
Create `schemas/settings.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Provider settings schema
|
# Provider settings schema
|
||||||
{
|
{
|
||||||
ProviderSettings = {
|
ProviderSettings = {
|
||||||
@ -146,7 +146,7 @@ schema ServerConfig {
|
|||||||
|
|
||||||
Create `nulib/mod.nu`:
|
Create `nulib/mod.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std log
|
use std log
|
||||||
|
|
||||||
# Provider name and version
|
# Provider name and version
|
||||||
@ -231,7 +231,7 @@ export def "test-connection" [config: record] -> record {
|
|||||||
|
|
||||||
Create `nulib/create.nu`:
|
Create `nulib/create.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std log
|
use std log
|
||||||
use utils.nu *
|
use utils.nu *
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ def wait-for-server-ready [server_id: string] -> string {
|
|||||||
|
|
||||||
Add provider metadata in `metadata.toml`:
|
Add provider metadata in `metadata.toml`:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[extension]
|
[extension]
|
||||||
name = "my-provider"
|
name = "my-provider"
|
||||||
type = "provider"
|
type = "provider"
|
||||||
@ -429,7 +429,7 @@ Task services must implement:
|
|||||||
|
|
||||||
Create `schemas/version.ncl`:
|
Create `schemas/version.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Task service version configuration
|
# Task service version configuration
|
||||||
{
|
{
|
||||||
taskserv_version = {
|
taskserv_version = {
|
||||||
@ -483,7 +483,7 @@ Create `schemas/version.ncl`:
|
|||||||
|
|
||||||
Create `nulib/mod.nu`:
|
Create `nulib/mod.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std log
|
use std log
|
||||||
use ../../../lib_provisioning *
|
use ../../../lib_provisioning *
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ Clusters orchestrate multiple components:
|
|||||||
|
|
||||||
Create `schemas/cluster.ncl`:
|
Create `schemas/cluster.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Cluster configuration schema
|
# Cluster configuration schema
|
||||||
{
|
{
|
||||||
ClusterConfig = {
|
ClusterConfig = {
|
||||||
@ -812,7 +812,7 @@ Create `schemas/cluster.ncl`:
|
|||||||
|
|
||||||
Create `nulib/mod.nu`:
|
Create `nulib/mod.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std log
|
use std log
|
||||||
use ../../../lib_provisioning *
|
use ../../../lib_provisioning *
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ Extensions should include comprehensive tests:
|
|||||||
|
|
||||||
Create `tests/unit_tests.nu`:
|
Create `tests/unit_tests.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std testing
|
use std testing
|
||||||
|
|
||||||
export def test_provider_config_validation [] {
|
export def test_provider_config_validation [] {
|
||||||
@ -1096,7 +1096,7 @@ export def test_server_creation_check_mode [] {
|
|||||||
|
|
||||||
Create `tests/integration_tests.nu`:
|
Create `tests/integration_tests.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
use std testing
|
use std testing
|
||||||
|
|
||||||
export def test_full_server_lifecycle [] {
|
export def test_full_server_lifecycle [] {
|
||||||
@ -1127,7 +1127,7 @@ export def test_full_server_lifecycle [] {
|
|||||||
|
|
||||||
### Running Tests
|
### Running Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run unit tests
|
# Run unit tests
|
||||||
nu tests/unit_tests.nu
|
nu tests/unit_tests.nu
|
||||||
|
|
||||||
@ -1151,7 +1151,7 @@ Each extension must include:
|
|||||||
|
|
||||||
### API Documentation Template
|
### API Documentation Template
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Extension Name API
|
# Extension Name API
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@ -18,7 +18,7 @@ Provisioning offers multiple integration points:
|
|||||||
|
|
||||||
#### Full-Featured Python Client
|
#### Full-Featured Python Client
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -416,7 +416,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
#### Complete JavaScript/TypeScript Client
|
#### Complete JavaScript/TypeScript Client
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
||||||
import WebSocket from 'ws';
|
import WebSocket from 'ws';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
@ -925,7 +925,7 @@ export { ProvisioningClient, Task, BatchConfig };
|
|||||||
|
|
||||||
### Comprehensive Error Handling
|
### Comprehensive Error Handling
|
||||||
|
|
||||||
```text
|
```python
|
||||||
class ProvisioningErrorHandler:
|
class ProvisioningErrorHandler:
|
||||||
"""Centralized error handling for provisioning operations"""
|
"""Centralized error handling for provisioning operations"""
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ async def robust_workflow_execution():
|
|||||||
|
|
||||||
### Circuit Breaker Pattern
|
### Circuit Breaker Pattern
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class CircuitBreaker {
|
class CircuitBreaker {
|
||||||
private failures = 0;
|
private failures = 0;
|
||||||
private nextAttempt = Date.now();
|
private nextAttempt = Date.now();
|
||||||
@ -1104,7 +1104,7 @@ class ResilientProvisioningClient {
|
|||||||
|
|
||||||
### Connection Pooling and Caching
|
### Connection Pooling and Caching
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import asyncio
|
import asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from cachetools import TTLCache
|
from cachetools import TTLCache
|
||||||
@ -1222,7 +1222,7 @@ async def high_performance_workflow():
|
|||||||
|
|
||||||
### WebSocket Connection Pooling
|
### WebSocket Connection Pooling
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class WebSocketPool {
|
class WebSocketPool {
|
||||||
constructor(maxConnections = 5) {
|
constructor(maxConnections = 5) {
|
||||||
this.maxConnections = maxConnections;
|
this.maxConnections = maxConnections;
|
||||||
@ -1290,13 +1290,13 @@ The Python SDK provides a comprehensive interface for provisioning:
|
|||||||
|
|
||||||
#### Installation
|
#### Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
pip install provisioning-client
|
pip install provisioning-client
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Quick Start
|
#### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
from provisioning_client import ProvisioningClient
|
from provisioning_client import ProvisioningClient
|
||||||
|
|
||||||
# Initialize client
|
# Initialize client
|
||||||
@ -1319,7 +1319,7 @@ print(f"Workflow completed: {task.status}")
|
|||||||
|
|
||||||
#### Advanced Usage
|
#### Advanced Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use with async context manager
|
# Use with async context manager
|
||||||
async with ProvisioningClient() as client:
|
async with ProvisioningClient() as client:
|
||||||
# Batch operations
|
# Batch operations
|
||||||
@ -1340,13 +1340,13 @@ async with ProvisioningClient() as client:
|
|||||||
|
|
||||||
#### Installation
|
#### Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
npm install @provisioning/client
|
npm install @provisioning/client
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Usage
|
#### Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import { ProvisioningClient } from '@provisioning/client';
|
import { ProvisioningClient } from '@provisioning/client';
|
||||||
|
|
||||||
const client = new ProvisioningClient({
|
const client = new ProvisioningClient({
|
||||||
@ -1373,7 +1373,7 @@ await client.connectWebSocket();
|
|||||||
|
|
||||||
### Workflow Orchestration Pipeline
|
### Workflow Orchestration Pipeline
|
||||||
|
|
||||||
```text
|
```python
|
||||||
class WorkflowPipeline:
|
class WorkflowPipeline:
|
||||||
"""Orchestrate complex multi-step workflows"""
|
"""Orchestrate complex multi-step workflows"""
|
||||||
|
|
||||||
@ -1462,7 +1462,7 @@ async def complex_deployment():
|
|||||||
|
|
||||||
### Event-Driven Architecture
|
### Event-Driven Architecture
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class EventDrivenWorkflowManager {
|
class EventDrivenWorkflowManager {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ The provisioning platform provides a comprehensive Nushell library with reusable
|
|||||||
|
|
||||||
## Usage Example
|
## Usage Example
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Load provisioning library
|
# Load provisioning library
|
||||||
use provisioning/core/nulib/lib_provisioning *
|
use provisioning/core/nulib/lib_provisioning *
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ The path resolution system provides a hierarchical and configurable mechanism fo
|
|||||||
|
|
||||||
The system follows a specific hierarchy for loading configuration files:
|
The system follows a specific hierarchy for loading configuration files:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. System defaults (config.defaults.toml)
|
1. System defaults (config.defaults.toml)
|
||||||
2. User configuration (config.user.toml)
|
2. User configuration (config.user.toml)
|
||||||
3. Project configuration (config.project.toml)
|
3. Project configuration (config.project.toml)
|
||||||
@ -30,7 +30,7 @@ The system follows a specific hierarchy for loading configuration files:
|
|||||||
|
|
||||||
The system searches for configuration files in these locations:
|
The system searches for configuration files in these locations:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Default search paths (in order)
|
# Default search paths (in order)
|
||||||
/usr/local/provisioning/config.defaults.toml
|
/usr/local/provisioning/config.defaults.toml
|
||||||
$HOME/.config/provisioning/config.user.toml
|
$HOME/.config/provisioning/config.user.toml
|
||||||
@ -59,7 +59,7 @@ Resolves configuration file paths using the search hierarchy.
|
|||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use path-resolution.nu *
|
use path-resolution.nu *
|
||||||
let config_path = (resolve-config-path "config.user.toml" [])
|
let config_path = (resolve-config-path "config.user.toml" [])
|
||||||
# Returns: "/home/user/.config/provisioning/config.user.toml"
|
# Returns: "/home/user/.config/provisioning/config.user.toml"
|
||||||
@ -76,7 +76,7 @@ Discovers extension paths (providers, taskservs, clusters).
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
base_path: "/usr/local/provisioning/providers/upcloud",
|
base_path: "/usr/local/provisioning/providers/upcloud",
|
||||||
schemas_path: "/usr/local/provisioning/providers/upcloud/schemas",
|
schemas_path: "/usr/local/provisioning/providers/upcloud/schemas",
|
||||||
@ -92,7 +92,7 @@ Gets current workspace path configuration.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
base: "/usr/local/provisioning",
|
base: "/usr/local/provisioning",
|
||||||
current_infra: "/workspace/infra/production",
|
current_infra: "/workspace/infra/production",
|
||||||
@ -130,7 +130,7 @@ Interpolates variables in path templates.
|
|||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let template = "{{paths.base}}/infra/{{env.USER}}/{{git.branch}}"
|
let template = "{{paths.base}}/infra/{{env.USER}}/{{git.branch}}"
|
||||||
let result = (interpolate-path $template {
|
let result = (interpolate-path $template {
|
||||||
paths: { base: "/usr/local/provisioning" },
|
paths: { base: "/usr/local/provisioning" },
|
||||||
@ -150,7 +150,7 @@ Discovers all available providers.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: "upcloud",
|
name: "upcloud",
|
||||||
@ -185,7 +185,7 @@ Gets provider-specific configuration and paths.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
name: "upcloud",
|
name: "upcloud",
|
||||||
base_path: "/usr/local/provisioning/providers/upcloud",
|
base_path: "/usr/local/provisioning/providers/upcloud",
|
||||||
@ -214,7 +214,7 @@ Discovers all available task services.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: "kubernetes",
|
name: "kubernetes",
|
||||||
@ -245,7 +245,7 @@ Gets task service configuration and version information.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
name: "kubernetes",
|
name: "kubernetes",
|
||||||
path: "/usr/local/provisioning/taskservs/kubernetes",
|
path: "/usr/local/provisioning/taskservs/kubernetes",
|
||||||
@ -272,7 +272,7 @@ Discovers all available cluster configurations.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: "buildkit",
|
name: "buildkit",
|
||||||
@ -312,7 +312,7 @@ Gets environment-specific configuration.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
name: "production",
|
name: "production",
|
||||||
paths: {
|
paths: {
|
||||||
@ -359,7 +359,7 @@ Discovers available workspaces and infrastructure directories.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: "production",
|
name: "production",
|
||||||
@ -405,7 +405,7 @@ Analyzes project structure and identifies components.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
root: "/workspace/project",
|
root: "/workspace/project",
|
||||||
type: "provisioning_workspace",
|
type: "provisioning_workspace",
|
||||||
@ -458,7 +458,7 @@ Gets path resolution cache statistics.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
enabled: true,
|
enabled: true,
|
||||||
size: 150,
|
size: 150,
|
||||||
@ -485,7 +485,7 @@ Normalizes paths for cross-platform compatibility.
|
|||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# On Windows
|
# On Windows
|
||||||
normalize-path "path/to/file" # Returns: "path\to\file"
|
normalize-path "path/to/file" # Returns: "path\to\file"
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ Validates all paths in configuration.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
valid: true,
|
valid: true,
|
||||||
errors: [],
|
errors: [],
|
||||||
@ -541,7 +541,7 @@ Validates extension directory structure.
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
valid: true,
|
valid: true,
|
||||||
required_files: [
|
required_files: [
|
||||||
@ -561,7 +561,7 @@ Validates extension directory structure.
|
|||||||
|
|
||||||
The path resolution API is exposed via Nushell commands:
|
The path resolution API is exposed via Nushell commands:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Show current path configuration
|
# Show current path configuration
|
||||||
provisioning show paths
|
provisioning show paths
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ provisioning workspace set /path/to/infra
|
|||||||
|
|
||||||
### Python Integration
|
### Python Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ providers = resolver.discover_providers()
|
|||||||
|
|
||||||
### JavaScript/Node.js Integration
|
### JavaScript/Node.js Integration
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const execAsync = util.promisify(exec);
|
const execAsync = util.promisify(exec);
|
||||||
@ -697,7 +697,7 @@ The system provides graceful fallbacks:
|
|||||||
|
|
||||||
Monitor path resolution performance:
|
Monitor path resolution performance:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Get resolution statistics
|
# Get resolution statistics
|
||||||
provisioning debug path-stats
|
provisioning debug path-stats
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ All providers must implement the following interface:
|
|||||||
|
|
||||||
### Required Functions
|
### Required Functions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Provider initialization
|
# Provider initialization
|
||||||
export def init [] -> record { ... }
|
export def init [] -> record { ... }
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ export def get-pricing [plan: string] -> record { ... }
|
|||||||
|
|
||||||
Each provider requires configuration in Nickel format:
|
Each provider requires configuration in Nickel format:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Example: UpCloud provider configuration
|
# Example: UpCloud provider configuration
|
||||||
{
|
{
|
||||||
provider = {
|
provider = {
|
||||||
@ -57,7 +57,7 @@ Each provider requires configuration in Nickel format:
|
|||||||
|
|
||||||
### 1. Directory Structure
|
### 1. Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/extensions/providers/my-provider/
|
provisioning/extensions/providers/my-provider/
|
||||||
├── nulib/
|
├── nulib/
|
||||||
│ └── my_provider.nu # Provider implementation
|
│ └── my_provider.nu # Provider implementation
|
||||||
@ -69,7 +69,7 @@ provisioning/extensions/providers/my-provider/
|
|||||||
|
|
||||||
### 2. Implementation Template
|
### 2. Implementation Template
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# my_provider.nu
|
# my_provider.nu
|
||||||
export def init [] {
|
export def init [] {
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ export def list-servers [] {
|
|||||||
|
|
||||||
### 3. Nickel Schema
|
### 3. Nickel Schema
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# main.ncl
|
# main.ncl
|
||||||
{
|
{
|
||||||
MyProvider = {
|
MyProvider = {
|
||||||
@ -118,7 +118,7 @@ Providers are automatically discovered from:
|
|||||||
- `provisioning/extensions/providers/*/nu/*.nu`
|
- `provisioning/extensions/providers/*/nu/*.nu`
|
||||||
- User workspace: `workspace/extensions/providers/*/nu/*.nu`
|
- User workspace: `workspace/extensions/providers/*/nu/*.nu`
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Discover available providers
|
# Discover available providers
|
||||||
provisioning module discover providers
|
provisioning module discover providers
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ provisioning module load providers workspace my-provider
|
|||||||
|
|
||||||
### Create Servers
|
### Create Servers
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use my_provider.nu *
|
use my_provider.nu *
|
||||||
|
|
||||||
let plan = {
|
let plan = {
|
||||||
@ -144,13 +144,13 @@ create-servers $plan
|
|||||||
|
|
||||||
### List Servers
|
### List Servers
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
list-servers | where status == "running" | select hostname ip_address
|
list-servers | where status == "running" | select hostname ip_address
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get Pricing
|
### Get Pricing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
get-pricing "small" | to yaml
|
get-pricing "small" | to yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ get-pricing "small" | to yaml
|
|||||||
|
|
||||||
Use the test environment system to test providers:
|
Use the test environment system to test providers:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test provider without real resources
|
# Test provider without real resources
|
||||||
provisioning test env single my-provider --check
|
provisioning test env single my-provider --check
|
||||||
```
|
```
|
||||||
|
|||||||
@ -20,13 +20,13 @@ Provisioning exposes two main REST APIs:
|
|||||||
|
|
||||||
All API endpoints (except health checks) require JWT authentication via the Authorization header:
|
All API endpoints (except health checks) require JWT authentication via the Authorization header:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Authorization: Bearer <jwt_token>
|
Authorization: Bearer <jwt_token>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Getting Access Token
|
### Getting Access Token
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
POST /auth/login
|
POST /auth/login
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Check orchestrator health status.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "Orchestrator is healthy"
|
"data": "Orchestrator is healthy"
|
||||||
@ -68,7 +68,7 @@ List all workflow tasks.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -99,7 +99,7 @@ Get specific task status and details.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -126,7 +126,7 @@ Submit server creation workflow.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"infra": "production",
|
"infra": "production",
|
||||||
"settings": "config.ncl",
|
"settings": "config.ncl",
|
||||||
@ -137,7 +137,7 @@ Submit server creation workflow.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "uuid-task-id"
|
"data": "uuid-task-id"
|
||||||
@ -150,7 +150,7 @@ Submit task service workflow.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"operation": "create",
|
"operation": "create",
|
||||||
"taskserv": "kubernetes",
|
"taskserv": "kubernetes",
|
||||||
@ -163,7 +163,7 @@ Submit task service workflow.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "uuid-task-id"
|
"data": "uuid-task-id"
|
||||||
@ -176,7 +176,7 @@ Submit cluster workflow.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"operation": "create",
|
"operation": "create",
|
||||||
"cluster_type": "buildkit",
|
"cluster_type": "buildkit",
|
||||||
@ -189,7 +189,7 @@ Submit cluster workflow.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "uuid-task-id"
|
"data": "uuid-task-id"
|
||||||
@ -204,7 +204,7 @@ Execute batch workflow operation.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "multi_cloud_deployment",
|
"name": "multi_cloud_deployment",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -235,7 +235,7 @@ Execute batch workflow operation.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -263,7 +263,7 @@ List all batch operations.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -288,7 +288,7 @@ Get batch operation status.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -317,7 +317,7 @@ Cancel running batch operation.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "Operation cancelled"
|
"data": "Operation cancelled"
|
||||||
@ -336,7 +336,7 @@ Get real-time workflow progress.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -360,7 +360,7 @@ Get workflow state snapshots.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -380,7 +380,7 @@ Get system-wide metrics.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -403,7 +403,7 @@ Get system health status.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -424,7 +424,7 @@ Get state manager statistics.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -444,7 +444,7 @@ Create new checkpoint.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "before_major_update",
|
"name": "before_major_update",
|
||||||
"description": "Checkpoint before deploying v2.0.0"
|
"description": "Checkpoint before deploying v2.0.0"
|
||||||
@ -453,7 +453,7 @@ Create new checkpoint.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "checkpoint-uuid"
|
"data": "checkpoint-uuid"
|
||||||
@ -466,7 +466,7 @@ List all checkpoints.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -491,7 +491,7 @@ Get specific checkpoint details.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -511,7 +511,7 @@ Execute rollback operation.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"checkpoint_id": "checkpoint-uuid"
|
"checkpoint_id": "checkpoint-uuid"
|
||||||
}
|
}
|
||||||
@ -519,7 +519,7 @@ Execute rollback operation.
|
|||||||
|
|
||||||
Or for partial rollback:
|
Or for partial rollback:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"operation_ids": ["op-1", "op-2", "op-3"]
|
"operation_ids": ["op-1", "op-2", "op-3"]
|
||||||
}
|
}
|
||||||
@ -527,7 +527,7 @@ Or for partial rollback:
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -550,7 +550,7 @@ Restore system state from checkpoint.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "State restored from checkpoint checkpoint-uuid"
|
"data": "State restored from checkpoint checkpoint-uuid"
|
||||||
@ -563,7 +563,7 @@ Get rollback system statistics.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -585,7 +585,7 @@ Authenticate user and get JWT token.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"username": "admin",
|
"username": "admin",
|
||||||
"password": "secure_password",
|
"password": "secure_password",
|
||||||
@ -595,7 +595,7 @@ Authenticate user and get JWT token.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -617,7 +617,7 @@ Refresh JWT token.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"token": "current-jwt-token"
|
"token": "current-jwt-token"
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ Refresh JWT token.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -641,7 +641,7 @@ Logout and invalidate token.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "Successfully logged out"
|
"data": "Successfully logged out"
|
||||||
@ -661,7 +661,7 @@ List all users.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -684,7 +684,7 @@ Create new user.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"username": "newuser",
|
"username": "newuser",
|
||||||
"email": "newuser@example.com",
|
"email": "newuser@example.com",
|
||||||
@ -696,7 +696,7 @@ Create new user.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -719,7 +719,7 @@ Update existing user.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"email": "updated@example.com",
|
"email": "updated@example.com",
|
||||||
"roles": ["admin", "operator"],
|
"roles": ["admin", "operator"],
|
||||||
@ -729,7 +729,7 @@ Update existing user.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "User updated successfully"
|
"data": "User updated successfully"
|
||||||
@ -746,7 +746,7 @@ Delete user.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "User deleted successfully"
|
"data": "User deleted successfully"
|
||||||
@ -761,7 +761,7 @@ List all policies.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -783,7 +783,7 @@ Create new policy.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "new_policy",
|
"name": "new_policy",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -800,7 +800,7 @@ Create new policy.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
@ -821,7 +821,7 @@ Update policy.
|
|||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "updated_policy",
|
"name": "updated_policy",
|
||||||
"rules": [...]
|
"rules": [...]
|
||||||
@ -830,7 +830,7 @@ Update policy.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": "Policy updated successfully"
|
"data": "Policy updated successfully"
|
||||||
@ -855,7 +855,7 @@ Get audit logs.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": [
|
"data": [
|
||||||
@ -876,7 +876,7 @@ Get audit logs.
|
|||||||
|
|
||||||
All endpoints may return error responses in this format:
|
All endpoints may return error responses in this format:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"success": false,
|
"success": false,
|
||||||
"error": "Detailed error message"
|
"error": "Detailed error message"
|
||||||
@ -904,7 +904,7 @@ API endpoints are rate-limited:
|
|||||||
|
|
||||||
Rate limit headers are included in responses:
|
Rate limit headers are included in responses:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
X-RateLimit-Limit: 100
|
X-RateLimit-Limit: 100
|
||||||
X-RateLimit-Remaining: 95
|
X-RateLimit-Remaining: 95
|
||||||
X-RateLimit-Reset: 1632150000
|
X-RateLimit-Reset: 1632150000
|
||||||
@ -918,7 +918,7 @@ Prometheus-compatible metrics endpoint.
|
|||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# HELP orchestrator_tasks_total Total number of tasks
|
# HELP orchestrator_tasks_total Total number of tasks
|
||||||
# TYPE orchestrator_tasks_total counter
|
# TYPE orchestrator_tasks_total counter
|
||||||
orchestrator_tasks_total{status="completed"} 150
|
orchestrator_tasks_total{status="completed"} 150
|
||||||
@ -937,7 +937,7 @@ Real-time event streaming via WebSocket connection.
|
|||||||
|
|
||||||
**Connection:**
|
**Connection:**
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt-token');
|
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt-token');
|
||||||
|
|
||||||
ws.onmessage = function(event) {
|
ws.onmessage = function(event) {
|
||||||
@ -948,7 +948,7 @@ ws.onmessage = function(event) {
|
|||||||
|
|
||||||
**Event Format:**
|
**Event Format:**
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "TaskStatusChanged",
|
"event_type": "TaskStatusChanged",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -967,7 +967,7 @@ ws.onmessage = function(event) {
|
|||||||
|
|
||||||
### Python SDK Example
|
### Python SDK Example
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
class ProvisioningClient:
|
class ProvisioningClient:
|
||||||
@ -1007,7 +1007,7 @@ print(f"Task ID: {result['data']}")
|
|||||||
|
|
||||||
### JavaScript/Node.js SDK Example
|
### JavaScript/Node.js SDK Example
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
|
||||||
class ProvisioningClient {
|
class ProvisioningClient {
|
||||||
@ -1051,7 +1051,7 @@ The system supports webhooks for external integrations:
|
|||||||
|
|
||||||
Configure webhooks in the system configuration:
|
Configure webhooks in the system configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[webhooks]
|
[webhooks]
|
||||||
enabled = true
|
enabled = true
|
||||||
endpoints = [
|
endpoints = [
|
||||||
@ -1065,7 +1065,7 @@ endpoints = [
|
|||||||
|
|
||||||
### Webhook Payload
|
### Webhook Payload
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event": "task.completed",
|
"event": "task.completed",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -1087,7 +1087,7 @@ For endpoints that return lists, use pagination parameters:
|
|||||||
|
|
||||||
Pagination metadata is included in response headers:
|
Pagination metadata is included in response headers:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
X-Total-Count: 1500
|
X-Total-Count: 1500
|
||||||
X-Limit: 50
|
X-Limit: 50
|
||||||
X-Offset: 100
|
X-Offset: 100
|
||||||
@ -1098,7 +1098,7 @@ Link: </api/endpoint?offset=150&limit=50>; rel="next"
|
|||||||
|
|
||||||
The API uses header-based versioning:
|
The API uses header-based versioning:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Accept: application/vnd.provisioning.v1+json
|
Accept: application/vnd.provisioning.v1+json
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1108,7 +1108,7 @@ Current version: v1
|
|||||||
|
|
||||||
Use the included test suite to validate API functionality:
|
Use the included test suite to validate API functionality:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run API integration tests
|
# Run API integration tests
|
||||||
cd src/orchestrator
|
cd src/orchestrator
|
||||||
cargo test --test api_tests
|
cargo test --test api_tests
|
||||||
|
|||||||
@ -23,7 +23,7 @@ Provisioning provides SDKs in multiple languages to facilitate integration:
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install from PyPI
|
# Install from PyPI
|
||||||
pip install provisioning-client
|
pip install provisioning-client
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ pip install git+https://github.com/provisioning-systems/python-client.git
|
|||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
from provisioning_client import ProvisioningClient
|
from provisioning_client import ProvisioningClient
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
#### WebSocket Integration
|
#### WebSocket Integration
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
async def monitor_workflows():
|
async def monitor_workflows():
|
||||||
client = ProvisioningClient()
|
client = ProvisioningClient()
|
||||||
await client.authenticate()
|
await client.authenticate()
|
||||||
@ -103,7 +103,7 @@ async def monitor_workflows():
|
|||||||
|
|
||||||
#### Batch Operations
|
#### Batch Operations
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
async def execute_batch_deployment():
|
async def execute_batch_deployment():
|
||||||
client = ProvisioningClient()
|
client = ProvisioningClient()
|
||||||
await client.authenticate()
|
await client.authenticate()
|
||||||
@ -158,7 +158,7 @@ async def execute_batch_deployment():
|
|||||||
|
|
||||||
#### Error Handling with Retries
|
#### Error Handling with Retries
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
from provisioning_client.exceptions import (
|
from provisioning_client.exceptions import (
|
||||||
ProvisioningAPIError,
|
ProvisioningAPIError,
|
||||||
AuthenticationError,
|
AuthenticationError,
|
||||||
@ -209,7 +209,7 @@ async def robust_workflow():
|
|||||||
|
|
||||||
#### ProvisioningClient Class
|
#### ProvisioningClient Class
|
||||||
|
|
||||||
```text
|
```python
|
||||||
class ProvisioningClient:
|
class ProvisioningClient:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
base_url: str = "http://localhost:9090",
|
base_url: str = "http://localhost:9090",
|
||||||
@ -258,7 +258,7 @@ class ProvisioningClient:
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# npm
|
# npm
|
||||||
npm install @provisioning/client
|
npm install @provisioning/client
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ pnpm add @provisioning/client
|
|||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import { ProvisioningClient } from '@provisioning/client';
|
import { ProvisioningClient } from '@provisioning/client';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@ -308,7 +308,7 @@ main();
|
|||||||
|
|
||||||
### React Integration
|
### React Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { ProvisioningClient } from '@provisioning/client';
|
import { ProvisioningClient } from '@provisioning/client';
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ export default WorkflowDashboard;
|
|||||||
|
|
||||||
### Node.js CLI Tool
|
### Node.js CLI Tool
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { Command } from 'commander';
|
import { Command } from 'commander';
|
||||||
@ -591,7 +591,7 @@ program.parse();
|
|||||||
|
|
||||||
### API Reference
|
### API Reference
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
interface ProvisioningClientOptions {
|
interface ProvisioningClientOptions {
|
||||||
baseUrl?: string;
|
baseUrl?: string;
|
||||||
authUrl?: string;
|
authUrl?: string;
|
||||||
@ -645,13 +645,13 @@ class ProvisioningClient extends EventEmitter {
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
go get github.com/provisioning-systems/go-client
|
go get github.com/provisioning-systems/go-client
|
||||||
```
|
```
|
||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -717,7 +717,7 @@ func main() {
|
|||||||
|
|
||||||
### WebSocket Integration
|
### WebSocket Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -785,7 +785,7 @@ func main() {
|
|||||||
|
|
||||||
### HTTP Client with Retry Logic
|
### HTTP Client with Retry Logic
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -877,7 +877,7 @@ func main() {
|
|||||||
|
|
||||||
Add to your `Cargo.toml`:
|
Add to your `Cargo.toml`:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
provisioning-rs = "2.0.0"
|
provisioning-rs = "2.0.0"
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
@ -885,7 +885,7 @@ tokio = { version = "1.0", features = ["full"] }
|
|||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use provisioning_rs::{ProvisioningClient, Config, CreateServerRequest};
|
use provisioning_rs::{ProvisioningClient, Config, CreateServerRequest};
|
||||||
use tokio;
|
use tokio;
|
||||||
|
|
||||||
@ -941,7 +941,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
### WebSocket Integration
|
### WebSocket Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use provisioning_rs::{ProvisioningClient, Config, WebSocketEvent};
|
use provisioning_rs::{ProvisioningClient, Config, WebSocketEvent};
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use tokio;
|
use tokio;
|
||||||
@ -997,7 +997,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
### Batch Operations
|
### Batch Operations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use provisioning_rs::{BatchOperationRequest, BatchOperation};
|
use provisioning_rs::{BatchOperationRequest, BatchOperation};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@ -30,7 +30,7 @@ The main WebSocket endpoint for real-time events and monitoring.
|
|||||||
|
|
||||||
**Example Connection:**
|
**Example Connection:**
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt-token&events=task,batch,system');
|
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt-token&events=task,batch,system');
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ Live log streaming endpoint.
|
|||||||
|
|
||||||
All WebSocket connections require authentication via JWT token:
|
All WebSocket connections require authentication via JWT token:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Include token in connection URL
|
// Include token in connection URL
|
||||||
const ws = new WebSocket('ws://localhost:9090/ws?token=' + jwtToken);
|
const ws = new WebSocket('ws://localhost:9090/ws?token=' + jwtToken);
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ ws.onopen = function() {
|
|||||||
|
|
||||||
Fired when a workflow task status changes.
|
Fired when a workflow task status changes.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "TaskStatusChanged",
|
"event_type": "TaskStatusChanged",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -116,7 +116,7 @@ Fired when a workflow task status changes.
|
|||||||
|
|
||||||
Fired when batch operation status changes.
|
Fired when batch operation status changes.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "BatchOperationUpdate",
|
"event_type": "BatchOperationUpdate",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -150,7 +150,7 @@ Fired when batch operation status changes.
|
|||||||
|
|
||||||
Fired when system health status changes.
|
Fired when system health status changes.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "SystemHealthUpdate",
|
"event_type": "SystemHealthUpdate",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -185,7 +185,7 @@ Fired when system health status changes.
|
|||||||
|
|
||||||
Fired when workflow progress changes.
|
Fired when workflow progress changes.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "WorkflowProgressUpdate",
|
"event_type": "WorkflowProgressUpdate",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -215,7 +215,7 @@ Fired when workflow progress changes.
|
|||||||
|
|
||||||
Real-time log streaming.
|
Real-time log streaming.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "LogEntry",
|
"event_type": "LogEntry",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -241,7 +241,7 @@ Real-time log streaming.
|
|||||||
|
|
||||||
Real-time metrics streaming.
|
Real-time metrics streaming.
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "MetricUpdate",
|
"event_type": "MetricUpdate",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -266,7 +266,7 @@ Real-time metrics streaming.
|
|||||||
|
|
||||||
Applications can define custom event types:
|
Applications can define custom event types:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"event_type": "CustomApplicationEvent",
|
"event_type": "CustomApplicationEvent",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -283,7 +283,7 @@ Applications can define custom event types:
|
|||||||
|
|
||||||
### Connection Management
|
### Connection Management
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class ProvisioningWebSocket {
|
class ProvisioningWebSocket {
|
||||||
constructor(baseUrl, token, options = {}) {
|
constructor(baseUrl, token, options = {}) {
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
@ -430,7 +430,7 @@ ws.subscribe(['TaskStatusChanged', 'WorkflowProgressUpdate']);
|
|||||||
|
|
||||||
### Real-Time Dashboard Example
|
### Real-Time Dashboard Example
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class ProvisioningDashboard {
|
class ProvisioningDashboard {
|
||||||
constructor(wsUrl, token) {
|
constructor(wsUrl, token) {
|
||||||
this.ws = new ProvisioningWebSocket(wsUrl, token);
|
this.ws = new ProvisioningWebSocket(wsUrl, token);
|
||||||
@ -542,7 +542,7 @@ const dashboard = new ProvisioningDashboard('ws://localhost:9090', jwtToken);
|
|||||||
|
|
||||||
The orchestrator implements WebSocket support using Axum and Tokio:
|
The orchestrator implements WebSocket support using Axum and Tokio:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{ws::WebSocket, ws::WebSocketUpgrade, Query, State},
|
extract::{ws::WebSocket, ws::WebSocketUpgrade, Query, State},
|
||||||
response::Response,
|
response::Response,
|
||||||
@ -702,7 +702,7 @@ fn has_event_permission(claims: &Claims, event_type: &str) -> bool {
|
|||||||
|
|
||||||
### Client-Side Filtering
|
### Client-Side Filtering
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Subscribe to specific event types
|
// Subscribe to specific event types
|
||||||
ws.subscribe(['TaskStatusChanged', 'WorkflowProgressUpdate']);
|
ws.subscribe(['TaskStatusChanged', 'WorkflowProgressUpdate']);
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ Events can be filtered on the server side based on:
|
|||||||
|
|
||||||
### Connection Errors
|
### Connection Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
ws.on('error', (error) => {
|
ws.on('error', (error) => {
|
||||||
console.error('WebSocket error:', error);
|
console.error('WebSocket error:', error);
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ ws.on('disconnected', (event) => {
|
|||||||
|
|
||||||
### Heartbeat and Keep-Alive
|
### Heartbeat and Keep-Alive
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
class ProvisioningWebSocket {
|
class ProvisioningWebSocket {
|
||||||
constructor(baseUrl, token, options = {}) {
|
constructor(baseUrl, token, options = {}) {
|
||||||
// ... existing code ...
|
// ... existing code ...
|
||||||
@ -835,7 +835,7 @@ class ProvisioningWebSocket {
|
|||||||
|
|
||||||
To improve performance, the server can batch multiple events into single WebSocket messages:
|
To improve performance, the server can batch multiple events into single WebSocket messages:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"type": "batch",
|
"type": "batch",
|
||||||
"timestamp": "2025-09-26T10:00:00Z",
|
"timestamp": "2025-09-26T10:00:00Z",
|
||||||
@ -856,7 +856,7 @@ To improve performance, the server can batch multiple events into single WebSock
|
|||||||
|
|
||||||
Enable message compression for large events:
|
Enable message compression for large events:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt&compression=true');
|
const ws = new WebSocket('ws://localhost:9090/ws?token=jwt&compression=true');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ The system needed a clear, maintainable structure that supports:
|
|||||||
|
|
||||||
Adopt a **domain-driven hybrid structure** organized around functional boundaries:
|
Adopt a **domain-driven hybrid structure** organized around functional boundaries:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
src/
|
src/
|
||||||
├── core/ # Core system and CLI entry point
|
├── core/ # Core system and CLI entry point
|
||||||
├── platform/ # High-performance coordination layer (Rust orchestrator)
|
├── platform/ # High-performance coordination layer (Rust orchestrator)
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Implement a **layered distribution strategy** with clear separation between deve
|
|||||||
|
|
||||||
### Distribution Structure
|
### Distribution Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# User Distribution
|
# User Distribution
|
||||||
/usr/local/bin/
|
/usr/local/bin/
|
||||||
├── provisioning # Main CLI entry point
|
├── provisioning # Main CLI entry point
|
||||||
@ -153,7 +153,7 @@ Use environment variables to control what gets installed.
|
|||||||
|
|
||||||
### Configuration Hierarchy
|
### Configuration Hierarchy
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
System Defaults (lowest precedence)
|
System Defaults (lowest precedence)
|
||||||
└── User Configuration
|
└── User Configuration
|
||||||
└── Project Configuration
|
└── Project Configuration
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Implement **isolated user workspaces** with clear boundaries and hierarchical co
|
|||||||
|
|
||||||
### Workspace Structure
|
### Workspace Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
~/workspace/provisioning/ # User workspace root
|
~/workspace/provisioning/ # User workspace root
|
||||||
├── config/
|
├── config/
|
||||||
│ ├── user.toml # User preferences and overrides
|
│ ├── user.toml # User preferences and overrides
|
||||||
@ -141,7 +141,7 @@ Store all user configuration in database.
|
|||||||
|
|
||||||
### Workspace Initialization
|
### Workspace Initialization
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Automatic workspace creation on first run
|
# Automatic workspace creation on first run
|
||||||
provisioning workspace init
|
provisioning workspace init
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ provisioning workspace validate
|
|||||||
|
|
||||||
### Backup and Migration
|
### Backup and Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup entire workspace
|
# Backup entire workspace
|
||||||
provisioning workspace backup --output ~/backup/provisioning-workspace.tar.gz
|
provisioning workspace backup --output ~/backup/provisioning-workspace.tar.gz
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Implement a **Hybrid Rust/Nushell Architecture** with clear separation of concer
|
|||||||
|
|
||||||
#### Rust → Nushell Communication
|
#### Rust → Nushell Communication
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
// Rust orchestrator invokes Nushell scripts via process execution
|
// Rust orchestrator invokes Nushell scripts via process execution
|
||||||
let result = Command::new("nu")
|
let result = Command::new("nu")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
@ -64,7 +64,7 @@ let result = Command::new("nu")
|
|||||||
|
|
||||||
#### Nushell → Rust Communication
|
#### Nushell → Rust Communication
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Nushell submits workflows to Rust orchestrator via HTTP API
|
# Nushell submits workflows to Rust orchestrator via HTTP API
|
||||||
http post "http://localhost:9090/workflows/servers/create" {
|
http post "http://localhost:9090/workflows/servers/create" {
|
||||||
name: "server-name",
|
name: "server-name",
|
||||||
|
|||||||
@ -45,7 +45,7 @@ Implement a **registry-based extension framework** with structured discovery and
|
|||||||
|
|
||||||
### Extension Structure
|
### Extension Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
extensions/
|
extensions/
|
||||||
├── providers/ # Provider extensions
|
├── providers/ # Provider extensions
|
||||||
│ └── custom-cloud/
|
│ └── custom-cloud/
|
||||||
@ -75,7 +75,7 @@ extensions/
|
|||||||
|
|
||||||
### Extension Manifest (extension.toml)
|
### Extension Manifest (extension.toml)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[extension]
|
[extension]
|
||||||
name = "custom-provider"
|
name = "custom-provider"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -186,7 +186,7 @@ Traditional plugin architecture with dynamic loading.
|
|||||||
|
|
||||||
### Extension Loading Lifecycle
|
### Extension Loading Lifecycle
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Extension discovery and validation
|
# Extension discovery and validation
|
||||||
provisioning extension discover
|
provisioning extension discover
|
||||||
provisioning extension validate --extension custom-provider
|
provisioning extension validate --extension custom-provider
|
||||||
@ -208,7 +208,7 @@ provisioning extension update custom-provider
|
|||||||
|
|
||||||
Extensions integrate with hierarchical configuration system:
|
Extensions integrate with hierarchical configuration system:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# System configuration includes extension settings
|
# System configuration includes extension settings
|
||||||
[custom_provider]
|
[custom_provider]
|
||||||
api_endpoint = "https://api.custom-cloud.com"
|
api_endpoint = "https://api.custom-cloud.com"
|
||||||
@ -238,7 +238,7 @@ timeout = 30
|
|||||||
|
|
||||||
### Provider Extension Pattern
|
### Provider Extension Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# extensions/providers/custom-cloud/nulib/provider.nu
|
# extensions/providers/custom-cloud/nulib/provider.nu
|
||||||
export def list-servers [] -> table {
|
export def list-servers [] -> table {
|
||||||
http get $"($config.custom_provider.api_endpoint)/servers"
|
http get $"($config.custom_provider.api_endpoint)/servers"
|
||||||
@ -260,7 +260,7 @@ export def create-server [name: string, config: record] -> record {
|
|||||||
|
|
||||||
### Task Service Extension Pattern
|
### Task Service Extension Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# extensions/taskservs/custom-service/nulib/service.nu
|
# extensions/taskservs/custom-service/nulib/service.nu
|
||||||
export def install [server: string] -> nothing {
|
export def install [server: string] -> nothing {
|
||||||
let manifest_data = open ./manifests/deployment.yaml
|
let manifest_data = open ./manifests/deployment.yaml
|
||||||
|
|||||||
@ -40,7 +40,7 @@ monolithic structure created multiple critical problems:
|
|||||||
|
|
||||||
We refactored the monolithic CLI into a **modular, domain-driven architecture** with the following structure:
|
We refactored the monolithic CLI into a **modular, domain-driven architecture** with the following structure:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/core/nulib/
|
provisioning/core/nulib/
|
||||||
├── provisioning (211 lines) ⬅️ 84% reduction
|
├── provisioning (211 lines) ⬅️ 84% reduction
|
||||||
├── main_provisioning/
|
├── main_provisioning/
|
||||||
@ -63,7 +63,7 @@ provisioning/core/nulib/
|
|||||||
|
|
||||||
Single source of truth for all flag parsing and argument building:
|
Single source of truth for all flag parsing and argument building:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def parse_common_flags [flags: record]: nothing -> record
|
export def parse_common_flags [flags: record]: nothing -> record
|
||||||
export def build_module_args [flags: record, extra: string = ""]: nothing -> string
|
export def build_module_args [flags: record, extra: string = ""]: nothing -> string
|
||||||
export def set_debug_env [flags: record]
|
export def set_debug_env [flags: record]
|
||||||
@ -81,7 +81,7 @@ export def get_debug_flag [flags: record]: nothing -> string
|
|||||||
|
|
||||||
Central routing with 80+ command mappings:
|
Central routing with 80+ command mappings:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def get_command_registry []: nothing -> record # 80+ shortcuts
|
export def get_command_registry []: nothing -> record # 80+ shortcuts
|
||||||
export def dispatch_command [args: list, flags: record] # Main router
|
export def dispatch_command [args: list, flags: record] # Main router
|
||||||
```
|
```
|
||||||
@ -148,7 +148,7 @@ Eliminated repetition:
|
|||||||
|
|
||||||
All handlers depend on abstractions (flag records, not concrete flags):
|
All handlers depend on abstractions (flag records, not concrete flags):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Handler signature
|
# Handler signature
|
||||||
export def handle_infrastructure_command [
|
export def handle_infrastructure_command [
|
||||||
command: string
|
command: string
|
||||||
@ -182,7 +182,7 @@ export def handle_infrastructure_command [
|
|||||||
|
|
||||||
Users can now access help in multiple ways:
|
Users can now access help in multiple ways:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# All these work equivalently:
|
# All these work equivalently:
|
||||||
provisioning help workspace
|
provisioning help workspace
|
||||||
provisioning workspace help # ⬅️ NEW: Bi-directional
|
provisioning workspace help # ⬅️ NEW: Bi-directional
|
||||||
@ -192,7 +192,7 @@ provisioning help ws # ⬅️ NEW: Shortcut in help
|
|||||||
|
|
||||||
**Implementation:**
|
**Implementation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Intercept "command help" → "help command"
|
# Intercept "command help" → "help command"
|
||||||
let first_op = if ($ops_list | length) > 0 { ($ops_list | get 0) } else { "" }
|
let first_op = if ($ops_list | length) > 0 { ($ops_list | get 0) } else { "" }
|
||||||
if $first_op in ["help" "h"] {
|
if $first_op in ["help" "h"] {
|
||||||
@ -242,7 +242,7 @@ Comprehensive test suite created (`tests/test_provisioning_refactor.nu`):
|
|||||||
|
|
||||||
### Test Results
|
### Test Results
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📋 Testing main help... ✅
|
📋 Testing main help... ✅
|
||||||
📋 Testing category help... ✅
|
📋 Testing category help... ✅
|
||||||
🔄 Testing bi-directional help... ✅
|
🔄 Testing bi-directional help... ✅
|
||||||
@ -319,7 +319,7 @@ Comprehensive test suite created (`tests/test_provisioning_refactor.nu`):
|
|||||||
|
|
||||||
### Before: Repetitive Flag Handling
|
### Before: Repetitive Flag Handling
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
"server" => {
|
"server" => {
|
||||||
let use_check = if $check { "--check "} else { "" }
|
let use_check = if $check { "--check "} else { "" }
|
||||||
let use_yes = if $yes { "--yes" } else { "" }
|
let use_yes = if $yes { "--yes" } else { "" }
|
||||||
@ -335,7 +335,7 @@ Comprehensive test suite created (`tests/test_provisioning_refactor.nu`):
|
|||||||
|
|
||||||
### After: Clean, Reusable
|
### After: Clean, Reusable
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_server [ops: string, flags: record] {
|
def handle_server [ops: string, flags: record] {
|
||||||
let args = build_module_args $flags $ops
|
let args = build_module_args $flags $ops
|
||||||
run_module $args "server" --exec
|
run_module $args "server" --exec
|
||||||
|
|||||||
@ -128,7 +128,7 @@ Remove support for:
|
|||||||
|
|
||||||
### For Development
|
### For Development
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Install Age
|
# 1. Install Age
|
||||||
brew install age # or apt install age
|
brew install age # or apt install age
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ age-keygen -y ~/.config/provisioning/age/private_key.txt > ~/.config/provisionin
|
|||||||
|
|
||||||
### For Production
|
### For Production
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Set up Cosmian KMS (cloud or self-hosted)
|
# 1. Set up Cosmian KMS (cloud or self-hosted)
|
||||||
# 2. Create master key in Cosmian
|
# 2. Create master key in Cosmian
|
||||||
# 3. Migrate secrets from Vault/AWS to Cosmian
|
# 3. Migrate secrets from Vault/AWS to Cosmian
|
||||||
|
|||||||
@ -117,7 +117,7 @@ Use Casbin authorization library.
|
|||||||
|
|
||||||
#### Architecture
|
#### Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────┐
|
||||||
│ Orchestrator │
|
│ Orchestrator │
|
||||||
├─────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────┤
|
||||||
@ -143,7 +143,7 @@ Use Casbin authorization library.
|
|||||||
|
|
||||||
#### Policy Organization
|
#### Policy Organization
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/config/cedar-policies/
|
provisioning/config/cedar-policies/
|
||||||
├── schema.cedar # Entity and action definitions
|
├── schema.cedar # Entity and action definitions
|
||||||
├── production.cedar # Production environment policies
|
├── production.cedar # Production environment policies
|
||||||
@ -154,7 +154,7 @@ provisioning/config/cedar-policies/
|
|||||||
|
|
||||||
#### Rust Implementation
|
#### Rust Implementation
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
provisioning/platform/orchestrator/src/security/
|
provisioning/platform/orchestrator/src/security/
|
||||||
├── cedar.rs # Cedar engine integration (450 lines)
|
├── cedar.rs # Cedar engine integration (450 lines)
|
||||||
├── policy_loader.rs # Policy loading with hot reload (320 lines)
|
├── policy_loader.rs # Policy loading with hot reload (320 lines)
|
||||||
@ -190,7 +190,7 @@ provisioning/platform/orchestrator/src/security/
|
|||||||
|
|
||||||
#### Context Variables
|
#### Context Variables
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
AuthorizationContext {
|
AuthorizationContext {
|
||||||
mfa_verified: bool, // MFA verification status
|
mfa_verified: bool, // MFA verification status
|
||||||
ip_address: String, // Client IP address
|
ip_address: String, // Client IP address
|
||||||
@ -204,7 +204,7 @@ AuthorizationContext {
|
|||||||
|
|
||||||
#### Example Policy
|
#### Example Policy
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Production deployments require MFA verification
|
// Production deployments require MFA verification
|
||||||
@id("prod-deploy-mfa")
|
@id("prod-deploy-mfa")
|
||||||
@description("All production deployments must have MFA verification")
|
@description("All production deployments must have MFA verification")
|
||||||
|
|||||||
@ -249,7 +249,7 @@ Implement a complete security architecture using 12 specialized components organ
|
|||||||
|
|
||||||
### End-to-End Request Flow
|
### End-to-End Request Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. User Request
|
1. User Request
|
||||||
↓
|
↓
|
||||||
2. Rate Limiting (100 req/min per IP)
|
2. Rate Limiting (100 req/min per IP)
|
||||||
@ -271,7 +271,7 @@ Implement a complete security architecture using 12 specialized components organ
|
|||||||
|
|
||||||
### Emergency Access Flow
|
### Emergency Access Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Emergency Request (reason + justification)
|
1. Emergency Request (reason + justification)
|
||||||
↓
|
↓
|
||||||
2. Multi-Party Approval (2+ approvers, different teams)
|
2. Multi-Party Approval (2+ approvers, different teams)
|
||||||
@ -382,7 +382,7 @@ Implement a complete security architecture using 12 specialized components organ
|
|||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start all services
|
# Start all services
|
||||||
cd provisioning/platform/kms-service && cargo run &
|
cd provisioning/platform/kms-service && cargo run &
|
||||||
cd provisioning/platform/orchestrator && cargo run &
|
cd provisioning/platform/orchestrator && cargo run &
|
||||||
@ -391,7 +391,7 @@ cd provisioning/platform/control-center && cargo run &
|
|||||||
|
|
||||||
### Production
|
### Production
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Kubernetes deployment
|
# Kubernetes deployment
|
||||||
kubectl apply -f k8s/security-stack.yaml
|
kubectl apply -f k8s/security-stack.yaml
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ systemctl start provisioning-control-center
|
|||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# JWT
|
# JWT
|
||||||
export JWT_ISSUER="control-center"
|
export JWT_ISSUER="control-center"
|
||||||
export JWT_AUDIENCE="orchestrator,cli"
|
export JWT_AUDIENCE="orchestrator,cli"
|
||||||
@ -433,7 +433,7 @@ export MFA_WEBAUTHN_RP_ID="provisioning.example.com"
|
|||||||
|
|
||||||
### Config Files
|
### Config Files
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# provisioning/config/security.toml
|
# provisioning/config/security.toml
|
||||||
[jwt]
|
[jwt]
|
||||||
issuer = "control-center"
|
issuer = "control-center"
|
||||||
@ -470,7 +470,7 @@ pii_anonymization = true
|
|||||||
|
|
||||||
### Run All Tests
|
### Run All Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Control Center (JWT, MFA)
|
# Control Center (JWT, MFA)
|
||||||
cd provisioning/platform/control-center
|
cd provisioning/platform/control-center
|
||||||
cargo test
|
cargo test
|
||||||
@ -489,7 +489,7 @@ nu provisioning/core/nulib/lib_provisioning/config/encryption_tests.nu
|
|||||||
|
|
||||||
### Integration Tests
|
### Integration Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Full security flow
|
# Full security flow
|
||||||
cd provisioning/platform/orchestrator
|
cd provisioning/platform/orchestrator
|
||||||
cargo test --test security_integration_tests
|
cargo test --test security_integration_tests
|
||||||
|
|||||||
@ -65,7 +65,7 @@ Define and document the three-format approach through:
|
|||||||
|
|
||||||
**Move template files to proper directory structure and correct extensions**:
|
**Move template files to proper directory structure and correct extensions**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Previous (KCL):
|
Previous (KCL):
|
||||||
provisioning/kcl/templates/*.k (had Nushell/Jinja2 code, not KCL)
|
provisioning/kcl/templates/*.k (had Nushell/Jinja2 code, not KCL)
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ Current (Nickel):
|
|||||||
|
|
||||||
Currently, 15/16 files in `provisioning/kcl/templates/` have `.k` extension but contain Nushell/Jinja2 code, not KCL:
|
Currently, 15/16 files in `provisioning/kcl/templates/` have `.k` extension but contain Nushell/Jinja2 code, not KCL:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
provisioning/kcl/templates/
|
provisioning/kcl/templates/
|
||||||
├── server.ncl # Actually Nushell/Jinja2 template
|
├── server.ncl # Actually Nushell/Jinja2 template
|
||||||
├── taskserv.ncl # Actually Nushell/Jinja2 template
|
├── taskserv.ncl # Actually Nushell/Jinja2 template
|
||||||
@ -343,7 +343,7 @@ This causes:
|
|||||||
|
|
||||||
Reorganize into type-specific directories:
|
Reorganize into type-specific directories:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/templates/
|
provisioning/templates/
|
||||||
├── nushell/ # Nushell code generation (*.nu.j2)
|
├── nushell/ # Nushell code generation (*.nu.j2)
|
||||||
│ ├── server.nu.j2
|
│ ├── server.nu.j2
|
||||||
|
|||||||
@ -112,7 +112,7 @@ The provisioning system required:
|
|||||||
|
|
||||||
**Example - UpCloud Provider**:
|
**Example - UpCloud Provider**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# upcloud/nickel/main.ncl (migrated from upcloud/kcl/)
|
# upcloud/nickel/main.ncl (migrated from upcloud/kcl/)
|
||||||
let contracts = import "./contracts.ncl" in
|
let contracts = import "./contracts.ncl" in
|
||||||
let defaults = import "./defaults.ncl" in
|
let defaults = import "./defaults.ncl" in
|
||||||
@ -171,7 +171,7 @@ let defaults = import "./defaults.ncl" in
|
|||||||
|
|
||||||
**File 1: Contracts** (`batch_contracts.ncl`):
|
**File 1: Contracts** (`batch_contracts.ncl`):
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
BatchScheduler = {
|
BatchScheduler = {
|
||||||
strategy | String,
|
strategy | String,
|
||||||
@ -184,7 +184,7 @@ let defaults = import "./defaults.ncl" in
|
|||||||
|
|
||||||
**File 2: Defaults** (`batch_defaults.ncl`):
|
**File 2: Defaults** (`batch_defaults.ncl`):
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
scheduler = {
|
scheduler = {
|
||||||
strategy = "dependency_first",
|
strategy = "dependency_first",
|
||||||
@ -197,7 +197,7 @@ let defaults = import "./defaults.ncl" in
|
|||||||
|
|
||||||
**File 3: Main** (`batch.ncl`):
|
**File 3: Main** (`batch.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts = import "./batch_contracts.ncl" in
|
let contracts = import "./batch_contracts.ncl" in
|
||||||
let defaults = import "./batch_defaults.ncl" in
|
let defaults = import "./batch_defaults.ncl" in
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ let defaults = import "./batch_defaults.ncl" in
|
|||||||
|
|
||||||
### Domain-Organized Architecture
|
### Domain-Organized Architecture
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
provisioning/schemas/
|
provisioning/schemas/
|
||||||
├── lib/ # Storage, TaskServDef, ClusterDef
|
├── lib/ # Storage, TaskServDef, ClusterDef
|
||||||
├── config/ # Settings, defaults, workspace_config
|
├── config/ # Settings, defaults, workspace_config
|
||||||
@ -233,7 +233,7 @@ provisioning/schemas/
|
|||||||
|
|
||||||
**Import pattern**:
|
**Import pattern**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let provisioning = import "./main.ncl" in
|
let provisioning = import "./main.ncl" in
|
||||||
provisioning.lib # For Storage, TaskServDef
|
provisioning.lib # For Storage, TaskServDef
|
||||||
provisioning.config.settings # For Settings, Defaults
|
provisioning.config.settings # For Settings, Defaults
|
||||||
@ -254,7 +254,7 @@ provisioning.operations.workflows
|
|||||||
- No snapshot overhead
|
- No snapshot overhead
|
||||||
- Usage: Local development, testing, experimentation
|
- Usage: Local development, testing, experimentation
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# workspace_librecloud/nickel/main.ncl
|
# workspace_librecloud/nickel/main.ncl
|
||||||
import "../../provisioning/schemas/main.ncl"
|
import "../../provisioning/schemas/main.ncl"
|
||||||
import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
||||||
@ -264,13 +264,13 @@ import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
|||||||
|
|
||||||
Create immutable snapshots for reproducible deployments:
|
Create immutable snapshots for reproducible deployments:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
provisioning workspace freeze --version "2025-12-15-prod-v1" --env production
|
provisioning workspace freeze --version "2025-12-15-prod-v1" --env production
|
||||||
```
|
```
|
||||||
|
|
||||||
**Frozen structure** (`.frozen/{version}/`):
|
**Frozen structure** (`.frozen/{version}/`):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
├── provisioning/schemas/ # Snapshot of central schemas
|
├── provisioning/schemas/ # Snapshot of central schemas
|
||||||
├── extensions/ # Snapshot of all extensions
|
├── extensions/ # Snapshot of all extensions
|
||||||
└── workspace/ # Snapshot of workspace configs
|
└── workspace/ # Snapshot of workspace configs
|
||||||
@ -285,7 +285,7 @@ provisioning workspace freeze --version "2025-12-15-prod-v1" --env production
|
|||||||
|
|
||||||
**Deploy from frozen snapshot**:
|
**Deploy from frozen snapshot**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
provisioning deploy --frozen "2025-12-15-prod-v1" --infra wuji
|
provisioning deploy --frozen "2025-12-15-prod-v1" --infra wuji
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ provisioning deploy --frozen "2025-12-15-prod-v1" --infra wuji
|
|||||||
|
|
||||||
**Key Feature**: Nickel schemas → Type-safe UIs → Nickel output
|
**Key Feature**: Nickel schemas → Type-safe UIs → Nickel output
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Nickel schema → Interactive form
|
# Nickel schema → Interactive form
|
||||||
typedialog form --schema server.ncl --output json
|
typedialog form --schema server.ncl --output json
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ The architectural decision was whether the plugin should:
|
|||||||
|
|
||||||
Nickel configurations in provisioning use the **module system**:
|
Nickel configurations in provisioning use the **module system**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# config/database.ncl
|
# config/database.ncl
|
||||||
import "lib/defaults" as defaults
|
import "lib/defaults" as defaults
|
||||||
import "lib/validation" as valid
|
import "lib/validation" as valid
|
||||||
@ -47,7 +47,7 @@ Implement the `nu_plugin_nickel` plugin as a **CLI wrapper** that invokes the ex
|
|||||||
|
|
||||||
### Architecture Diagram
|
### Architecture Diagram
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
┌─────────────────────────────┐
|
┌─────────────────────────────┐
|
||||||
│ Nushell Script │
|
│ Nushell Script │
|
||||||
│ │
|
│ │
|
||||||
@ -288,7 +288,7 @@ This makes direct usage risky. The CLI is the documented, proven interface.
|
|||||||
|
|
||||||
The plugin uses the **correct Nickel command syntax**:
|
The plugin uses the **correct Nickel command syntax**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
// Correct:
|
// Correct:
|
||||||
cmd.arg("export").arg(file).arg("--format").arg(format);
|
cmd.arg("export").arg(file).arg("--format").arg(format);
|
||||||
// Results in: "nickel export /file --format json"
|
// Results in: "nickel export /file --format json"
|
||||||
@ -323,7 +323,7 @@ Plugin correctly processes JSON output:
|
|||||||
|
|
||||||
This enables Nushell cell path access:
|
This enables Nushell cell path access:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nickel-export json /config.ncl | .database.host # ✅ Works
|
nickel-export json /config.ncl | .database.host # ✅ Works
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ nickel-export json /config.ncl | .database.host # ✅ Works
|
|||||||
|
|
||||||
**Manual Verification**:
|
**Manual Verification**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Test module imports
|
# Test module imports
|
||||||
nickel-export json /workspace/config.ncl
|
nickel-export json /workspace/config.ncl
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ integration with the provisioning orchestrator.
|
|||||||
|
|
||||||
### Architecture Diagram
|
### Architecture Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────┐
|
┌─────────────────────────────────────────┐
|
||||||
│ Nushell Script │
|
│ Nushell Script │
|
||||||
│ │
|
│ │
|
||||||
@ -167,7 +167,7 @@ integration with the provisioning orchestrator.
|
|||||||
|
|
||||||
Nushell's `input` command is limited:
|
Nushell's `input` command is limited:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Current: No validation, no security
|
# Current: No validation, no security
|
||||||
let password = input "Password: " # ❌ Shows in terminal
|
let password = input "Password: " # ❌ Shows in terminal
|
||||||
let region = input "AWS Region: " # ❌ No autocomplete/validation
|
let region = input "AWS Region: " # ❌ No autocomplete/validation
|
||||||
@ -184,7 +184,7 @@ let region = input "AWS Region: " # ❌ No autocomplete/validation
|
|||||||
|
|
||||||
Nickel is declarative and cannot prompt users:
|
Nickel is declarative and cannot prompt users:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Nickel defines what the config looks like, NOT how to get it
|
# Nickel defines what the config looks like, NOT how to get it
|
||||||
{
|
{
|
||||||
database = {
|
database = {
|
||||||
@ -243,7 +243,7 @@ Nickel is declarative and cannot prompt users:
|
|||||||
### Mitigation Strategies
|
### Mitigation Strategies
|
||||||
|
|
||||||
**Non-Interactive Mode**:
|
**Non-Interactive Mode**:
|
||||||
```text
|
```bash
|
||||||
// Support both interactive and non-interactive
|
// Support both interactive and non-interactive
|
||||||
if terminal::is_interactive() {
|
if terminal::is_interactive() {
|
||||||
// Show TUI dialog
|
// Show TUI dialog
|
||||||
@ -255,7 +255,7 @@ if terminal::is_interactive() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Testing**:
|
**Testing**:
|
||||||
```text
|
```bash
|
||||||
// Unit tests: Test form validation logic (no TUI)
|
// Unit tests: Test form validation logic (no TUI)
|
||||||
#[test]
|
#[test]
|
||||||
fn test_validate_workspace_name() {
|
fn test_validate_workspace_name() {
|
||||||
@ -267,7 +267,7 @@ fn test_validate_workspace_name() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Scriptability**:
|
**Scriptability**:
|
||||||
```text
|
```bash
|
||||||
# Batch mode: Provide config via file
|
# Batch mode: Provide config via file
|
||||||
provisioning workspace init --config workspace.toml
|
provisioning workspace init --config workspace.toml
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ provisioning workspace init --interactive
|
|||||||
|
|
||||||
### Form Definition Pattern
|
### Form Definition Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use typdialog::Form;
|
use typdialog::Form;
|
||||||
|
|
||||||
pub fn workspace_initialization_form() -> Result<WorkspaceConfig> {
|
pub fn workspace_initialization_form() -> Result<WorkspaceConfig> {
|
||||||
@ -353,7 +353,7 @@ pub fn workspace_initialization_form() -> Result<WorkspaceConfig> {
|
|||||||
|
|
||||||
### Integration with Nickel
|
### Integration with Nickel
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
// 1. Get validated input from TUI dialog
|
// 1. Get validated input from TUI dialog
|
||||||
let config = workspace_initialization_form()?;
|
let config = workspace_initialization_form()?;
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ fs::write("workspace/config.toml", config_toml)?;
|
|||||||
|
|
||||||
### CLI Command Structure
|
### CLI Command Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// provisioning/core/cli/src/commands/workspace.rs
|
// provisioning/core/cli/src/commands/workspace.rs
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
@ -404,7 +404,7 @@ pub fn handle_workspace_init(args: InitArgs) -> Result<()> {
|
|||||||
|
|
||||||
### Validation Rules
|
### Validation Rules
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub fn validate_workspace_name(name: &str) -> Result<(), String> {
|
pub fn validate_workspace_name(name: &str) -> Result<(), String> {
|
||||||
// Alphanumeric, hyphens, 3-32 chars
|
// Alphanumeric, hyphens, 3-32 chars
|
||||||
let re = Regex::new(r"^[a-z0-9-]{3,32}$").unwrap();
|
let re = Regex::new(r"^[a-z0-9-]{3,32}$").unwrap();
|
||||||
@ -425,7 +425,7 @@ pub fn validate_region(region: &str) -> Result<(), String> {
|
|||||||
|
|
||||||
### Security: Password Handling
|
### Security: Password Handling
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use zeroize::Zeroizing;
|
use zeroize::Zeroizing;
|
||||||
|
|
||||||
pub fn get_secure_password() -> Result<Zeroizing<String>> {
|
pub fn get_secure_password() -> Result<Zeroizing<String>> {
|
||||||
@ -447,7 +447,7 @@ pub fn get_secure_password() -> Result<Zeroizing<String>> {
|
|||||||
## Testing Strategy
|
## Testing Strategy
|
||||||
|
|
||||||
**Unit Tests**:
|
**Unit Tests**:
|
||||||
```text
|
```bash
|
||||||
#[test]
|
#[test]
|
||||||
fn test_workspace_name_validation() {
|
fn test_workspace_name_validation() {
|
||||||
assert!(validate_workspace_name("my-workspace").is_ok());
|
assert!(validate_workspace_name("my-workspace").is_ok());
|
||||||
@ -457,7 +457,7 @@ fn test_workspace_name_validation() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Integration Tests**:
|
**Integration Tests**:
|
||||||
```text
|
```bash
|
||||||
// Use non-interactive mode with config files
|
// Use non-interactive mode with config files
|
||||||
#[test]
|
#[test]
|
||||||
fn test_workspace_init_non_interactive() {
|
fn test_workspace_init_non_interactive() {
|
||||||
@ -481,7 +481,7 @@ fn test_workspace_init_non_interactive() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Manual Testing**:
|
**Manual Testing**:
|
||||||
```text
|
```bash
|
||||||
# Test interactive flow
|
# Test interactive flow
|
||||||
cargo build --release
|
cargo build --release
|
||||||
./target/release/provisioning workspace init --interactive
|
./target/release/provisioning workspace init --interactive
|
||||||
@ -495,7 +495,7 @@ cargo build --release
|
|||||||
## Configuration Integration
|
## Configuration Integration
|
||||||
|
|
||||||
**CLI Flag**:
|
**CLI Flag**:
|
||||||
```text
|
```toml
|
||||||
# provisioning/config/config.defaults.toml
|
# provisioning/config/config.defaults.toml
|
||||||
[ui]
|
[ui]
|
||||||
interactive_mode = "auto" # "auto" | "always" | "never"
|
interactive_mode = "auto" # "auto" | "always" | "never"
|
||||||
@ -503,7 +503,7 @@ dialog_theme = "default" # "default" | "minimal" | "colorful"
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Environment Override**:
|
**Environment Override**:
|
||||||
```text
|
```bash
|
||||||
# Force non-interactive mode (for CI/CD)
|
# Force non-interactive mode (for CI/CD)
|
||||||
export PROVISIONING_INTERACTIVE=false
|
export PROVISIONING_INTERACTIVE=false
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ export PROVISIONING_INTERACTIVE=true
|
|||||||
- Validation rule patterns
|
- Validation rule patterns
|
||||||
|
|
||||||
**Configuration Schema**:
|
**Configuration Schema**:
|
||||||
```text
|
```toml
|
||||||
# provisioning/schemas/workspace.ncl
|
# provisioning/schemas/workspace.ncl
|
||||||
{
|
{
|
||||||
WorkspaceConfig = {
|
WorkspaceConfig = {
|
||||||
|
|||||||
@ -93,7 +93,7 @@ Integrate **SecretumVault** as the centralized secrets management system for the
|
|||||||
|
|
||||||
### Architecture Diagram
|
### Architecture Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
│ Provisioning CLI / Orchestrator / Services │
|
│ Provisioning CLI / Orchestrator / Services │
|
||||||
│ │
|
│ │
|
||||||
@ -273,7 +273,7 @@ SOPS is excellent for **static secrets in git**, but inadequate for:
|
|||||||
### Mitigation Strategies
|
### Mitigation Strategies
|
||||||
|
|
||||||
**High Availability**:
|
**High Availability**:
|
||||||
```text
|
```bash
|
||||||
# Deploy SecretumVault cluster (3 nodes)
|
# Deploy SecretumVault cluster (3 nodes)
|
||||||
provisioning deploy secretum-vault --ha --replicas 3
|
provisioning deploy secretum-vault --ha --replicas 3
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ provisioning deploy secretum-vault --ha --replicas 3
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Migration from SOPS**:
|
**Migration from SOPS**:
|
||||||
```text
|
```bash
|
||||||
# Phase 1: Import existing SOPS secrets into SecretumVault
|
# Phase 1: Import existing SOPS secrets into SecretumVault
|
||||||
provisioning secrets migrate --from-sops config/secrets.yaml
|
provisioning secrets migrate --from-sops config/secrets.yaml
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ provisioning secrets migrate --from-sops config/secrets.yaml
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Fallback Strategy**:
|
**Fallback Strategy**:
|
||||||
```text
|
```bash
|
||||||
// Graceful degradation if vault unavailable
|
// Graceful degradation if vault unavailable
|
||||||
let secret = match vault_client.get_secret("database/password").await {
|
let secret = match vault_client.get_secret("database/password").await {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
@ -305,7 +305,7 @@ let secret = match vault_client.get_secret("database/password").await {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Operational Monitoring**:
|
**Operational Monitoring**:
|
||||||
```text
|
```bash
|
||||||
# prometheus metrics
|
# prometheus metrics
|
||||||
secretum_vault_request_duration_seconds
|
secretum_vault_request_duration_seconds
|
||||||
secretum_vault_secret_lease_expiry
|
secretum_vault_secret_lease_expiry
|
||||||
@ -351,7 +351,7 @@ secretum_vault_raft_leader_changes
|
|||||||
|
|
||||||
### SecretumVault Deployment
|
### SecretumVault Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Deploy via provisioning system
|
# Deploy via provisioning system
|
||||||
provisioning deploy secretum-vault
|
provisioning deploy secretum-vault
|
||||||
--ha
|
--ha
|
||||||
@ -367,7 +367,7 @@ provisioning vault unseal --key-shares 5 --key-threshold 3
|
|||||||
|
|
||||||
### Rust Client Library
|
### Rust Client Library
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
// provisioning/core/libs/secretum-client/src/lib.rs
|
// provisioning/core/libs/secretum-client/src/lib.rs
|
||||||
|
|
||||||
use secretum_vault::{Client, SecretEngine, Auth};
|
use secretum_vault::{Client, SecretEngine, Auth};
|
||||||
@ -402,7 +402,7 @@ impl VaultClient {
|
|||||||
|
|
||||||
### Nushell Integration
|
### Nushell Integration
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Nushell commands via Rust CLI wrapper
|
# Nushell commands via Rust CLI wrapper
|
||||||
provisioning secrets get database/prod/password
|
provisioning secrets get database/prod/password
|
||||||
provisioning secrets set api/keys/stripe --value "sk_live_xyz"
|
provisioning secrets set api/keys/stripe --value "sk_live_xyz"
|
||||||
@ -413,7 +413,7 @@ provisioning secrets list database/
|
|||||||
|
|
||||||
### Nickel Configuration Integration
|
### Nickel Configuration Integration
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# provisioning/schemas/database.ncl
|
# provisioning/schemas/database.ncl
|
||||||
{
|
{
|
||||||
database = {
|
database = {
|
||||||
@ -429,7 +429,7 @@ provisioning secrets list database/
|
|||||||
|
|
||||||
### Cedar Policy for Secret Access
|
### Cedar Policy for Secret Access
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// policy: developers can read dev secrets, not prod
|
// policy: developers can read dev secrets, not prod
|
||||||
permit(
|
permit(
|
||||||
principal in Group::"developers",
|
principal in Group::"developers",
|
||||||
@ -455,7 +455,7 @@ permit(
|
|||||||
|
|
||||||
### Dynamic Database Credentials
|
### Dynamic Database Credentials
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Application requests temporary DB credentials
|
// Application requests temporary DB credentials
|
||||||
let creds = vault_client
|
let creds = vault_client
|
||||||
.database()
|
.database()
|
||||||
@ -472,7 +472,7 @@ println!("TTL: {}", creds.lease_duration); // 1h
|
|||||||
|
|
||||||
### Secret Rotation Automation
|
### Secret Rotation Automation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# secretum-vault config
|
# secretum-vault config
|
||||||
[[rotation_policies]]
|
[[rotation_policies]]
|
||||||
path = "database/prod/password"
|
path = "database/prod/password"
|
||||||
@ -487,7 +487,7 @@ max_age = "90d"
|
|||||||
|
|
||||||
### Audit Log Format
|
### Audit Log Format
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"timestamp": "2025-01-08T12:34:56Z",
|
"timestamp": "2025-01-08T12:34:56Z",
|
||||||
"type": "request",
|
"type": "request",
|
||||||
@ -515,7 +515,7 @@ max_age = "90d"
|
|||||||
## Testing Strategy
|
## Testing Strategy
|
||||||
|
|
||||||
**Unit Tests**:
|
**Unit Tests**:
|
||||||
```text
|
```bash
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_get_secret() {
|
async fn test_get_secret() {
|
||||||
let vault = mock_vault_client();
|
let vault = mock_vault_client();
|
||||||
@ -533,7 +533,7 @@ async fn test_dynamic_credentials_generation() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Integration Tests**:
|
**Integration Tests**:
|
||||||
```text
|
```bash
|
||||||
# Test vault deployment
|
# Test vault deployment
|
||||||
provisioning deploy secretum-vault --test-mode
|
provisioning deploy secretum-vault --test-mode
|
||||||
provisioning vault init
|
provisioning vault init
|
||||||
@ -551,7 +551,7 @@ provisioning secrets rotate test/secret
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Security Tests**:
|
**Security Tests**:
|
||||||
```text
|
```bash
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_unauthorized_access_denied() {
|
async fn test_unauthorized_access_denied() {
|
||||||
let vault = vault_client_with_limited_token();
|
let vault = vault_client_with_limited_token();
|
||||||
@ -563,7 +563,7 @@ async fn test_unauthorized_access_denied() {
|
|||||||
## Configuration Integration
|
## Configuration Integration
|
||||||
|
|
||||||
**Provisioning Config**:
|
**Provisioning Config**:
|
||||||
```text
|
```toml
|
||||||
# provisioning/config/config.defaults.toml
|
# provisioning/config/config.defaults.toml
|
||||||
[secrets]
|
[secrets]
|
||||||
provider = "secretum-vault" # "secretum-vault" | "sops" | "env"
|
provider = "secretum-vault" # "secretum-vault" | "sops" | "env"
|
||||||
@ -583,7 +583,7 @@ max_size = "100MB"
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Environment Variables**:
|
**Environment Variables**:
|
||||||
```text
|
```javascript
|
||||||
export VAULT_ADDR="https://vault.example.com:8200"
|
export VAULT_ADDR="https://vault.example.com:8200"
|
||||||
export VAULT_TOKEN="s.abc123def456..."
|
export VAULT_TOKEN="s.abc123def456..."
|
||||||
export VAULT_NAMESPACE="provisioning"
|
export VAULT_NAMESPACE="provisioning"
|
||||||
|
|||||||
@ -100,7 +100,7 @@ All AI components are **schema-aware**, **security-enforced**, and **human-super
|
|||||||
|
|
||||||
### Architecture Diagram
|
### Architecture Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ User Interfaces │
|
│ User Interfaces │
|
||||||
│ │
|
│ │
|
||||||
@ -268,7 +268,7 @@ All AI components are **schema-aware**, **security-enforced**, and **human-super
|
|||||||
|
|
||||||
Traditional AI code generation fails for infrastructure because:
|
Traditional AI code generation fails for infrastructure because:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Generic AI (like GitHub Copilot):
|
Generic AI (like GitHub Copilot):
|
||||||
❌ Generates syntactically correct but semantically wrong configs
|
❌ Generates syntactically correct but semantically wrong configs
|
||||||
❌ Doesn't understand cloud provider constraints
|
❌ Doesn't understand cloud provider constraints
|
||||||
@ -278,7 +278,7 @@ Generic AI (like GitHub Copilot):
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Schema-aware AI** (our approach):
|
**Schema-aware AI** (our approach):
|
||||||
```text
|
```bash
|
||||||
# Nickel schema provides ground truth
|
# Nickel schema provides ground truth
|
||||||
{
|
{
|
||||||
Database = {
|
Database = {
|
||||||
@ -303,7 +303,7 @@ Generic AI (like GitHub Copilot):
|
|||||||
|
|
||||||
LLMs alone have limitations:
|
LLMs alone have limitations:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Pure LLM:
|
Pure LLM:
|
||||||
❌ Knowledge cutoff (no recent updates)
|
❌ Knowledge cutoff (no recent updates)
|
||||||
❌ Hallucinations (invents plausible-sounding configs)
|
❌ Hallucinations (invents plausible-sounding configs)
|
||||||
@ -312,7 +312,7 @@ Pure LLM:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**RAG-enhanced LLM**:
|
**RAG-enhanced LLM**:
|
||||||
```text
|
```bash
|
||||||
Query: "How to configure Postgres with encryption?"
|
Query: "How to configure Postgres with encryption?"
|
||||||
|
|
||||||
RAG retrieves:
|
RAG retrieves:
|
||||||
@ -332,7 +332,7 @@ LLM generates answer WITH retrieved context:
|
|||||||
|
|
||||||
AI-generated infrastructure configs require human approval:
|
AI-generated infrastructure configs require human approval:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
// All AI operations require approval
|
// All AI operations require approval
|
||||||
pub async fn ai_generate_config(request: GenerateRequest) -> Result<Config> {
|
pub async fn ai_generate_config(request: GenerateRequest) -> Result<Config> {
|
||||||
let ai_generated = ai_service.generate(request).await?;
|
let ai_generated = ai_service.generate(request).await?;
|
||||||
@ -414,7 +414,7 @@ No single LLM provider is best for all tasks:
|
|||||||
### Mitigation Strategies
|
### Mitigation Strategies
|
||||||
|
|
||||||
**Cost Control**:
|
**Cost Control**:
|
||||||
```text
|
```toml
|
||||||
[ai.rate_limiting]
|
[ai.rate_limiting]
|
||||||
requests_per_minute = 60
|
requests_per_minute = 60
|
||||||
tokens_per_day = 1000000
|
tokens_per_day = 1000000
|
||||||
@ -427,7 +427,7 @@ ttl = "1h"
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Latency Optimization**:
|
**Latency Optimization**:
|
||||||
```text
|
```bash
|
||||||
// Streaming responses for real-time feedback
|
// Streaming responses for real-time feedback
|
||||||
pub async fn ai_generate_stream(request: GenerateRequest) -> impl Stream<Item = String> {
|
pub async fn ai_generate_stream(request: GenerateRequest) -> impl Stream<Item = String> {
|
||||||
ai_service
|
ai_service
|
||||||
@ -438,7 +438,7 @@ pub async fn ai_generate_stream(request: GenerateRequest) -> impl Stream<Item =
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Privacy (Local Models)**:
|
**Privacy (Local Models)**:
|
||||||
```text
|
```toml
|
||||||
[ai]
|
[ai]
|
||||||
provider = "local"
|
provider = "local"
|
||||||
model_path = "/opt/provisioning/models/llama-3-70b"
|
model_path = "/opt/provisioning/models/llama-3-70b"
|
||||||
@ -447,7 +447,7 @@ model_path = "/opt/provisioning/models/llama-3-70b"
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Validation (Defense in Depth)**:
|
**Validation (Defense in Depth)**:
|
||||||
```text
|
```bash
|
||||||
AI generates config
|
AI generates config
|
||||||
↓
|
↓
|
||||||
Nickel schema validation (syntax, types, contracts)
|
Nickel schema validation (syntax, types, contracts)
|
||||||
@ -460,7 +460,7 @@ Deployment
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Observability**:
|
**Observability**:
|
||||||
```text
|
```toml
|
||||||
[ai.observability]
|
[ai.observability]
|
||||||
trace_all_requests = true
|
trace_all_requests = true
|
||||||
store_conversations = true
|
store_conversations = true
|
||||||
@ -510,7 +510,7 @@ conversation_retention = "30d"
|
|||||||
|
|
||||||
### AI Service API
|
### AI Service API
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// platform/crates/ai-service/src/lib.rs
|
// platform/crates/ai-service/src/lib.rs
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -609,7 +609,7 @@ impl AIService for AIServiceImpl {
|
|||||||
|
|
||||||
### MCP Server Integration
|
### MCP Server Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// platform/crates/mcp-server/src/lib.rs
|
// platform/crates/mcp-server/src/lib.rs
|
||||||
|
|
||||||
pub struct MCPClient {
|
pub struct MCPClient {
|
||||||
@ -675,7 +675,7 @@ impl ToolRegistry {
|
|||||||
|
|
||||||
### RAG System Implementation
|
### RAG System Implementation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// platform/crates/rag/src/lib.rs
|
// platform/crates/rag/src/lib.rs
|
||||||
|
|
||||||
pub struct RAGService {
|
pub struct RAGService {
|
||||||
@ -750,7 +750,7 @@ pub struct QdrantStore {
|
|||||||
|
|
||||||
### typdialog-ai Integration
|
### typdialog-ai Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// typdialog-ai/src/form_assistant.rs
|
// typdialog-ai/src/form_assistant.rs
|
||||||
|
|
||||||
pub struct FormAssistant {
|
pub struct FormAssistant {
|
||||||
@ -821,7 +821,7 @@ Generate field values:",
|
|||||||
|
|
||||||
### typdialog-ag Agents
|
### typdialog-ag Agents
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// typdialog-ag/src/agent.rs
|
// typdialog-ag/src/agent.rs
|
||||||
|
|
||||||
pub struct ProvisioningAgent {
|
pub struct ProvisioningAgent {
|
||||||
@ -899,7 +899,7 @@ impl ProvisioningAgent {
|
|||||||
|
|
||||||
### Cedar Policies for AI
|
### Cedar Policies for AI
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// AI cannot access secrets without explicit permission
|
// AI cannot access secrets without explicit permission
|
||||||
forbid(
|
forbid(
|
||||||
principal == Service::"ai-service",
|
principal == Service::"ai-service",
|
||||||
@ -939,7 +939,7 @@ forbid(
|
|||||||
## Testing Strategy
|
## Testing Strategy
|
||||||
|
|
||||||
**Unit Tests**:
|
**Unit Tests**:
|
||||||
```text
|
```bash
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_ai_config_generation_validates() {
|
async fn test_ai_config_generation_validates() {
|
||||||
let ai_service = mock_ai_service();
|
let ai_service = mock_ai_service();
|
||||||
@ -968,7 +968,7 @@ async fn test_ai_cannot_access_secrets() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Integration Tests**:
|
**Integration Tests**:
|
||||||
```text
|
```bash
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_end_to_end_ai_config_generation() {
|
async fn test_end_to_end_ai_config_generation() {
|
||||||
// User provides natural language
|
// User provides natural language
|
||||||
@ -999,7 +999,7 @@ async fn test_end_to_end_ai_config_generation() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**RAG Quality Tests**:
|
**RAG Quality Tests**:
|
||||||
```text
|
```bash
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_rag_retrieval_accuracy() {
|
async fn test_rag_retrieval_accuracy() {
|
||||||
let rag = rag_service();
|
let rag = rag_service();
|
||||||
@ -1026,7 +1026,7 @@ async fn test_rag_retrieval_accuracy() {
|
|||||||
## Security Considerations
|
## Security Considerations
|
||||||
|
|
||||||
**AI Access Control**:
|
**AI Access Control**:
|
||||||
```text
|
```bash
|
||||||
AI Service Permissions (enforced by Cedar):
|
AI Service Permissions (enforced by Cedar):
|
||||||
✅ CAN: Read Nickel schemas
|
✅ CAN: Read Nickel schemas
|
||||||
✅ CAN: Generate configurations
|
✅ CAN: Generate configurations
|
||||||
@ -1039,7 +1039,7 @@ AI Service Permissions (enforced by Cedar):
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Data Privacy**:
|
**Data Privacy**:
|
||||||
```text
|
```toml
|
||||||
[ai.privacy]
|
[ai.privacy]
|
||||||
# Sanitize before sending to LLM
|
# Sanitize before sending to LLM
|
||||||
sanitize_secrets = true
|
sanitize_secrets = true
|
||||||
@ -1056,7 +1056,7 @@ sanitize_credentials = true
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Audit Trail**:
|
**Audit Trail**:
|
||||||
```text
|
```bash
|
||||||
// Every AI operation logged
|
// Every AI operation logged
|
||||||
pub struct AIAuditLog {
|
pub struct AIAuditLog {
|
||||||
timestamp: DateTime<Utc>,
|
timestamp: DateTime<Utc>,
|
||||||
@ -1074,7 +1074,7 @@ pub struct AIAuditLog {
|
|||||||
|
|
||||||
**Estimated Costs** (per month, based on typical usage):
|
**Estimated Costs** (per month, based on typical usage):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Assumptions:
|
Assumptions:
|
||||||
- 100 active users
|
- 100 active users
|
||||||
- 10 AI config generations per user per day
|
- 10 AI config generations per user per day
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
The `lib_provisioning/config/accessor.nu` file contains 1567 lines across 187 accessor functions. Analysis reveals that 95% of these functions follow
|
The `lib_provisioning/config/accessor.nu` file contains 1567 lines across 187 accessor functions. Analysis reveals that 95% of these functions follow
|
||||||
an identical mechanical pattern:
|
an identical mechanical pattern:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def get-{field-name} [--config: record] {
|
export def get-{field-name} [--config: record] {
|
||||||
config-get "{path.to.field}" {default_value} --config $config
|
config-get "{path.to.field}" {default_value} --config $config
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ Implement **Schema-Driven Accessor Generation**: automatically generate accessor
|
|||||||
|
|
||||||
### Architecture
|
### Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Nickel Schema (contracts.ncl)
|
Nickel Schema (contracts.ncl)
|
||||||
↓
|
↓
|
||||||
[Parse & Extract Schema Structure]
|
[Parse & Extract Schema Structure]
|
||||||
|
|||||||
@ -16,7 +16,7 @@ The provisioning system integrates with four critical plugins, each with its own
|
|||||||
|
|
||||||
Analysis reveals ~90% code duplication across these wrappers:
|
Analysis reveals ~90% code duplication across these wrappers:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pattern repeated 4 times with minor variations:
|
# Pattern repeated 4 times with minor variations:
|
||||||
export def plugin-available? [] {
|
export def plugin-available? [] {
|
||||||
# Check if plugin is installed
|
# Check if plugin is installed
|
||||||
@ -53,7 +53,7 @@ Implement **Plugin Wrapper Abstraction Framework**: replace manual plugin wrappe
|
|||||||
|
|
||||||
### Architecture
|
### Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Plugin Definition (YAML)
|
Plugin Definition (YAML)
|
||||||
├─ plugin: auth
|
├─ plugin: auth
|
||||||
├─ methods:
|
├─ methods:
|
||||||
@ -89,7 +89,7 @@ Generated Wrappers
|
|||||||
|
|
||||||
**Nushell 0.109 Compliant** (do-complete pattern, no try-catch):
|
**Nushell 0.109 Compliant** (do-complete pattern, no try-catch):
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def call-plugin-with-fallback [method: string args: record] {
|
def call-plugin-with-fallback [method: string args: record] {
|
||||||
let plugin_result = (
|
let plugin_result = (
|
||||||
do {
|
do {
|
||||||
@ -175,7 +175,7 @@ def call-plugin-with-fallback [method: string args: record] {
|
|||||||
|
|
||||||
### auth.yaml Example
|
### auth.yaml Example
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
plugin: auth
|
plugin: auth
|
||||||
http_endpoint: http://localhost:8001
|
http_endpoint: http://localhost:8001
|
||||||
methods:
|
methods:
|
||||||
@ -196,7 +196,7 @@ methods:
|
|||||||
|
|
||||||
**Feature Flag Approach**:
|
**Feature Flag Approach**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use original manual wrappers
|
# Use original manual wrappers
|
||||||
export PROVISIONING_USE_GENERATED_PLUGINS=false
|
export PROVISIONING_USE_GENERATED_PLUGINS=false
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
The current help system in `main_provisioning/help_system.nu` (1303 lines) consists almost entirely of hardcoded string concatenation with embedded
|
The current help system in `main_provisioning/help_system.nu` (1303 lines) consists almost entirely of hardcoded string concatenation with embedded
|
||||||
ANSI formatting codes:
|
ANSI formatting codes:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
def help-infrastructure [] {
|
def help-infrastructure [] {
|
||||||
print "╔════════════════════════════════════════════════════╗"
|
print "╔════════════════════════════════════════════════════╗"
|
||||||
print "║ SERVER & INFRASTRUCTURE ║"
|
print "║ SERVER & INFRASTRUCTURE ║"
|
||||||
@ -45,7 +45,7 @@ Implement **Data-Driven Help with Mozilla Fluent Integration**:
|
|||||||
|
|
||||||
### Architecture
|
### Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Help Content (Fluent Files)
|
Help Content (Fluent Files)
|
||||||
├─ en-US/help.ftl (65 strings - English base)
|
├─ en-US/help.ftl (65 strings - English base)
|
||||||
└─ es-ES/help.ftl (65 strings - Spanish translations)
|
└─ es-ES/help.ftl (65 strings - Spanish translations)
|
||||||
@ -72,7 +72,7 @@ User Interface
|
|||||||
|
|
||||||
**en-US/help.ftl**:
|
**en-US/help.ftl**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
help-main-title = PROVISIONING SYSTEM
|
help-main-title = PROVISIONING SYSTEM
|
||||||
help-main-subtitle = Layered Infrastructure Automation
|
help-main-subtitle = Layered Infrastructure Automation
|
||||||
help-main-categories = COMMAND CATEGORIES
|
help-main-categories = COMMAND CATEGORIES
|
||||||
@ -99,7 +99,7 @@ help-orch-batch = Multi-Provider Batch Operations
|
|||||||
|
|
||||||
**es-ES/help.ftl** (Spanish translations):
|
**es-ES/help.ftl** (Spanish translations):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
help-main-title = SISTEMA DE PROVISIÓN
|
help-main-title = SISTEMA DE PROVISIÓN
|
||||||
help-main-subtitle = Automatización de Infraestructura por Capas
|
help-main-subtitle = Automatización de Infraestructura por Capas
|
||||||
help-main-categories = CATEGORÍAS DE COMANDOS
|
help-main-categories = CATEGORÍAS DE COMANDOS
|
||||||
@ -126,7 +126,7 @@ help-orch-batch = Operaciones por Lotes Multi-Proveedor
|
|||||||
|
|
||||||
### 2. Fluent Loading in Nushell
|
### 2. Fluent Loading in Nushell
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def load-fluent-file [category: string] {
|
def load-fluent-file [category: string] {
|
||||||
let lang = ($env.LANG? | default "en_US" | str replace "_" "-")
|
let lang = ($env.LANG? | default "en_US" | str replace "_" "-")
|
||||||
let fluent_path = $"provisioning/locales/($lang)/help.ftl"
|
let fluent_path = $"provisioning/locales/($lang)/help.ftl"
|
||||||
@ -138,7 +138,7 @@ def load-fluent-file [category: string] {
|
|||||||
|
|
||||||
### 3. Help System Wrapper
|
### 3. Help System Wrapper
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def help-infrastructure [] {
|
export def help-infrastructure [] {
|
||||||
let strings = (load-fluent-file "infrastructure")
|
let strings = (load-fluent-file "infrastructure")
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ export def help-infrastructure [] {
|
|||||||
|
|
||||||
## Language Resolution Flow
|
## Language Resolution Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Check LANG environment variable
|
1. Check LANG environment variable
|
||||||
LANG=es_ES.UTF-8 → extract "es_ES" or "es-ES"
|
LANG=es_ES.UTF-8 → extract "es_ES" or "es-ES"
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ export def help-infrastructure [] {
|
|||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test language detection
|
# Test language detection
|
||||||
LANG=en_US provisioning help infrastructure
|
LANG=en_US provisioning help infrastructure
|
||||||
# Expected: English output
|
# Expected: English output
|
||||||
@ -227,7 +227,7 @@ LANG=fr_FR provisioning help infrastructure
|
|||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/
|
provisioning/
|
||||||
├── locales/
|
├── locales/
|
||||||
│ ├── i18n-config.toml # Locale metadata & fallback chains
|
│ ├── i18n-config.toml # Locale metadata & fallback chains
|
||||||
@ -243,7 +243,7 @@ provisioning/
|
|||||||
|
|
||||||
**i18n-config.toml** defines:
|
**i18n-config.toml** defines:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[locales]
|
[locales]
|
||||||
default = "en-US"
|
default = "en-US"
|
||||||
fallback = "en-US"
|
fallback = "en-US"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
The `lib_provisioning/config/loader.nu` file (2199 lines) is a monolithic implementation mixing multiple unrelated concerns:
|
The `lib_provisioning/config/loader.nu` file (2199 lines) is a monolithic implementation mixing multiple unrelated concerns:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
Current Structure (2199 lines):
|
Current Structure (2199 lines):
|
||||||
├─ Cache lookup/storage (300 lines)
|
├─ Cache lookup/storage (300 lines)
|
||||||
├─ Nickel evaluation (400 lines)
|
├─ Nickel evaluation (400 lines)
|
||||||
@ -43,7 +43,7 @@ Implement **Layered Loader Architecture**: decompose monolithic loader into spec
|
|||||||
|
|
||||||
### Target Architecture
|
### Target Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
lib_provisioning/config/
|
lib_provisioning/config/
|
||||||
├── loader.nu # ORCHESTRATOR (< 300 lines)
|
├── loader.nu # ORCHESTRATOR (< 300 lines)
|
||||||
│ └─ Coordinates loading pipeline
|
│ └─ Coordinates loading pipeline
|
||||||
@ -165,7 +165,7 @@ Create each loader as independent module:
|
|||||||
|
|
||||||
Extract Nickel evaluation logic:
|
Extract Nickel evaluation logic:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def evaluate-nickel [file: string] {
|
export def evaluate-nickel [file: string] {
|
||||||
let result = (
|
let result = (
|
||||||
do {
|
do {
|
||||||
@ -185,7 +185,7 @@ export def evaluate-nickel [file: string] {
|
|||||||
|
|
||||||
Implement thin loader.nu:
|
Implement thin loader.nu:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def load-provisioning-config [] {
|
export def load-provisioning-config [] {
|
||||||
let env_config = (env-loader load-environment)
|
let env_config = (env-loader load-environment)
|
||||||
let toml_config = (toml-loader load-toml "config.toml")
|
let toml_config = (toml-loader load-toml "config.toml")
|
||||||
@ -207,7 +207,7 @@ export def load-provisioning-config [] {
|
|||||||
|
|
||||||
Create test for each module:
|
Create test for each module:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
tests/config/
|
tests/config/
|
||||||
├── loaders/
|
├── loaders/
|
||||||
│ ├── test_nickel_loader.nu
|
│ ├── test_nickel_loader.nu
|
||||||
@ -235,7 +235,7 @@ tests/config/
|
|||||||
## Backward Compatibility
|
## Backward Compatibility
|
||||||
|
|
||||||
**Public API Unchanged**:
|
**Public API Unchanged**:
|
||||||
```text
|
```bash
|
||||||
# Current usage (unchanged)
|
# Current usage (unchanged)
|
||||||
let config = (load-provisioning-config)
|
let config = (load-provisioning-config)
|
||||||
```
|
```
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Implement **Domain-Based Command Modules**: split monolithic handlers into focus
|
|||||||
|
|
||||||
### Target Architecture
|
### Target Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
main_provisioning/commands/
|
main_provisioning/commands/
|
||||||
├── dispatcher.nu # Routes commands to domain handlers
|
├── dispatcher.nu # Routes commands to domain handlers
|
||||||
├── utilities/ # Split by domain
|
├── utilities/ # Split by domain
|
||||||
@ -168,7 +168,7 @@ Create `integrations/` directory with 3 modules:
|
|||||||
|
|
||||||
Implement `dispatcher.nu`:
|
Implement `dispatcher.nu`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def provision-ssh [args] {
|
export def provision-ssh [args] {
|
||||||
use ./utilities/ssh.nu *
|
use ./utilities/ssh.nu *
|
||||||
handle-ssh-command $args
|
handle-ssh-command $args
|
||||||
@ -189,7 +189,7 @@ export def provision-cache [args] {
|
|||||||
|
|
||||||
Keep public exports in original files for compatibility:
|
Keep public exports in original files for compatibility:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# commands/utilities.nu (compatibility layer)
|
# commands/utilities.nu (compatibility layer)
|
||||||
use ./utilities/ssh.nu *
|
use ./utilities/ssh.nu *
|
||||||
use ./utilities/sops.nu *
|
use ./utilities/sops.nu *
|
||||||
@ -204,7 +204,7 @@ export use ./utilities/sops.nu
|
|||||||
|
|
||||||
Create test structure:
|
Create test structure:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
tests/commands/
|
tests/commands/
|
||||||
├── utilities/
|
├── utilities/
|
||||||
│ ├── test_ssh.nu
|
│ ├── test_ssh.nu
|
||||||
@ -225,7 +225,7 @@ tests/commands/
|
|||||||
|
|
||||||
**utilities/ssh.nu**:
|
**utilities/ssh.nu**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Connect to remote host
|
# Connect to remote host
|
||||||
export def ssh-connect [host: string --port: int = 22] {
|
export def ssh-connect [host: string --port: int = 22] {
|
||||||
# Implementation
|
# Implementation
|
||||||
@ -244,7 +244,7 @@ export def ssh-close [host: string] {
|
|||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
main_provisioning/commands/
|
main_provisioning/commands/
|
||||||
├── dispatcher.nu # Route to domain handlers
|
├── dispatcher.nu # Route to domain handlers
|
||||||
├── utilities/
|
├── utilities/
|
||||||
@ -269,7 +269,7 @@ main_provisioning/commands/
|
|||||||
|
|
||||||
Users see no change in CLI:
|
Users see no change in CLI:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning ssh host.example.com
|
provisioning ssh host.example.com
|
||||||
provisioning sops edit config.yaml
|
provisioning sops edit config.yaml
|
||||||
provisioning cache clear
|
provisioning cache clear
|
||||||
@ -281,7 +281,7 @@ provisioning guide from-scratch
|
|||||||
|
|
||||||
**Import Path Options**:
|
**Import Path Options**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option 1: Import from domain module (new way)
|
# Option 1: Import from domain module (new way)
|
||||||
use ./utilities/ssh.nu *
|
use ./utilities/ssh.nu *
|
||||||
connect $host
|
connect $host
|
||||||
|
|||||||
@ -43,7 +43,7 @@ The Provisioning Platform is a modern, cloud-native infrastructure automation sy
|
|||||||
|
|
||||||
### Architecture at a Glance
|
### Architecture at a Glance
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────────┐
|
||||||
│ Provisioning Platform │
|
│ Provisioning Platform │
|
||||||
├─────────────────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────────────────┤
|
||||||
@ -93,7 +93,7 @@ The Provisioning Platform is a modern, cloud-native infrastructure automation sy
|
|||||||
|
|
||||||
### High-Level Architecture
|
### High-Level Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌────────────────────────────────────────────────────────────────────────────┐
|
┌────────────────────────────────────────────────────────────────────────────┐
|
||||||
│ PRESENTATION LAYER │
|
│ PRESENTATION LAYER │
|
||||||
├────────────────────────────────────────────────────────────────────────────┤
|
├────────────────────────────────────────────────────────────────────────────┤
|
||||||
@ -191,7 +191,7 @@ The system is organized into three separate repositories:
|
|||||||
|
|
||||||
#### **provisioning-core**
|
#### **provisioning-core**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Core system functionality
|
Core system functionality
|
||||||
├── CLI interface (Nushell entry point)
|
├── CLI interface (Nushell entry point)
|
||||||
├── Core libraries (lib_provisioning)
|
├── Core libraries (lib_provisioning)
|
||||||
@ -205,7 +205,7 @@ Core system functionality
|
|||||||
|
|
||||||
#### **provisioning-extensions**
|
#### **provisioning-extensions**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
All provider, taskserv, cluster extensions
|
All provider, taskserv, cluster extensions
|
||||||
├── providers/
|
├── providers/
|
||||||
│ ├── aws/
|
│ ├── aws/
|
||||||
@ -229,7 +229,7 @@ All provider, taskserv, cluster extensions
|
|||||||
|
|
||||||
#### **provisioning-platform**
|
#### **provisioning-platform**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Platform services
|
Platform services
|
||||||
├── orchestrator/ (Rust)
|
├── orchestrator/ (Rust)
|
||||||
├── control-center/ (Rust/Yew)
|
├── control-center/ (Rust/Yew)
|
||||||
@ -255,7 +255,7 @@ Platform services
|
|||||||
|
|
||||||
**Architecture**:
|
**Architecture**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Main CLI (211 lines)
|
Main CLI (211 lines)
|
||||||
↓
|
↓
|
||||||
Command Dispatcher (264 lines)
|
Command Dispatcher (264 lines)
|
||||||
@ -281,7 +281,7 @@ Domain Handlers (7 modules)
|
|||||||
|
|
||||||
**Hierarchical Loading**:
|
**Hierarchical Loading**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. System defaults (config.defaults.toml)
|
1. System defaults (config.defaults.toml)
|
||||||
2. User config (~/.provisioning/config.user.toml)
|
2. User config (~/.provisioning/config.user.toml)
|
||||||
3. Workspace config (workspace/config/provisioning.yaml)
|
3. Workspace config (workspace/config/provisioning.yaml)
|
||||||
@ -303,7 +303,7 @@ Domain Handlers (7 modules)
|
|||||||
|
|
||||||
**Architecture**:
|
**Architecture**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
src/
|
src/
|
||||||
├── main.rs // Entry point
|
├── main.rs // Entry point
|
||||||
├── api/
|
├── api/
|
||||||
@ -342,7 +342,7 @@ src/
|
|||||||
|
|
||||||
**Workflow Types**:
|
**Workflow Types**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workflows/
|
workflows/
|
||||||
├── server_create.nu // Server provisioning
|
├── server_create.nu // Server provisioning
|
||||||
├── taskserv.nu // Task service management
|
├── taskserv.nu // Task service management
|
||||||
@ -371,7 +371,7 @@ workflows/
|
|||||||
|
|
||||||
**Extension Structure**:
|
**Extension Structure**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
extension-name/
|
extension-name/
|
||||||
├── schemas/
|
├── schemas/
|
||||||
│ ├── main.ncl // Main schema
|
│ ├── main.ncl // Main schema
|
||||||
@ -401,7 +401,7 @@ Each extension packaged as OCI artifact:
|
|||||||
|
|
||||||
**Module System**:
|
**Module System**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Discover available extensions
|
# Discover available extensions
|
||||||
provisioning module discover taskservs
|
provisioning module discover taskservs
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ provisioning module list taskserv my-workspace
|
|||||||
|
|
||||||
**Layer System** (Configuration Inheritance):
|
**Layer System** (Configuration Inheritance):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
Layer 1: Core (provisioning/extensions/{type}/{name})
|
Layer 1: Core (provisioning/extensions/{type}/{name})
|
||||||
↓
|
↓
|
||||||
Layer 2: Workspace (workspace/extensions/{type}/{name})
|
Layer 2: Workspace (workspace/extensions/{type}/{name})
|
||||||
@ -438,7 +438,7 @@ Layer 3: Infrastructure (workspace/infra/{infra}/extensions/{type}/{name})
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let { TaskservDependencies } = import "provisioning/dependencies.ncl" in
|
let { TaskservDependencies } = import "provisioning/dependencies.ncl" in
|
||||||
{
|
{
|
||||||
kubernetes = TaskservDependencies {
|
kubernetes = TaskservDependencies {
|
||||||
@ -467,7 +467,7 @@ let { TaskservDependencies } = import "provisioning/dependencies.ncl" in
|
|||||||
|
|
||||||
**Lifecycle Management**:
|
**Lifecycle Management**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start all auto-start services
|
# Start all auto-start services
|
||||||
provisioning platform start
|
provisioning platform start
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ provisioning platform logs orchestrator --follow
|
|||||||
|
|
||||||
**Architecture**:
|
**Architecture**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User Command (CLI)
|
User Command (CLI)
|
||||||
↓
|
↓
|
||||||
Test Orchestrator (Rust)
|
Test Orchestrator (Rust)
|
||||||
@ -520,7 +520,7 @@ The platform supports four operational modes that adapt the system from individu
|
|||||||
|
|
||||||
### Mode Comparison
|
### Mode Comparison
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌───────────────────────────────────────────────────────────────────────┐
|
┌───────────────────────────────────────────────────────────────────────┐
|
||||||
│ MODE ARCHITECTURE │
|
│ MODE ARCHITECTURE │
|
||||||
├───────────────┬───────────────┬───────────────┬───────────────────────┤
|
├───────────────┬───────────────┬───────────────┬───────────────────────┤
|
||||||
@ -562,7 +562,7 @@ The platform supports four operational modes that adapt the system from individu
|
|||||||
|
|
||||||
**Switching Modes**:
|
**Switching Modes**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check current mode
|
# Check current mode
|
||||||
provisioning mode current
|
provisioning mode current
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ provisioning mode validate enterprise
|
|||||||
|
|
||||||
#### Solo Mode
|
#### Solo Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Default mode, no setup needed
|
# 1. Default mode, no setup needed
|
||||||
provisioning workspace init
|
provisioning workspace init
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ provisioning server create
|
|||||||
|
|
||||||
#### Multi-User Mode
|
#### Multi-User Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Switch mode and authenticate
|
# 1. Switch mode and authenticate
|
||||||
provisioning mode switch multi-user
|
provisioning mode switch multi-user
|
||||||
provisioning auth login
|
provisioning auth login
|
||||||
@ -609,7 +609,7 @@ provisioning workspace unlock my-infra
|
|||||||
|
|
||||||
#### CI/CD Mode
|
#### CI/CD Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# GitLab CI
|
# GitLab CI
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
@ -626,7 +626,7 @@ deploy:
|
|||||||
|
|
||||||
#### Enterprise Mode
|
#### Enterprise Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Switch to enterprise, verify K8s
|
# 1. Switch to enterprise, verify K8s
|
||||||
provisioning mode switch enterprise
|
provisioning mode switch enterprise
|
||||||
kubectl get pods -n provisioning-system
|
kubectl get pods -n provisioning-system
|
||||||
@ -654,7 +654,7 @@ provisioning workspace unlock prod-deployment
|
|||||||
|
|
||||||
### Service Communication
|
### Service Communication
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌──────────────────────────────────────────────────────────────────────┐
|
┌──────────────────────────────────────────────────────────────────────┐
|
||||||
│ NETWORK LAYER │
|
│ NETWORK LAYER │
|
||||||
├──────────────────────────────────────────────────────────────────────┤
|
├──────────────────────────────────────────────────────────────────────┤
|
||||||
@ -732,7 +732,7 @@ provisioning workspace unlock prod-deployment
|
|||||||
|
|
||||||
### Data Storage
|
### Data Storage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌────────────────────────────────────────────────────────────────┐
|
┌────────────────────────────────────────────────────────────────┐
|
||||||
│ DATA LAYER │
|
│ DATA LAYER │
|
||||||
├────────────────────────────────────────────────────────────────┤
|
├────────────────────────────────────────────────────────────────┤
|
||||||
@ -813,7 +813,7 @@ provisioning workspace unlock prod-deployment
|
|||||||
|
|
||||||
**Configuration Loading**:
|
**Configuration Loading**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. Load system defaults (config.defaults.toml)
|
1. Load system defaults (config.defaults.toml)
|
||||||
2. Merge user config (~/.provisioning/config.user.toml)
|
2. Merge user config (~/.provisioning/config.user.toml)
|
||||||
3. Load workspace config (workspace/config/provisioning.yaml)
|
3. Load workspace config (workspace/config/provisioning.yaml)
|
||||||
@ -824,7 +824,7 @@ provisioning workspace unlock prod-deployment
|
|||||||
|
|
||||||
**State Persistence**:
|
**State Persistence**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Workflow execution
|
Workflow execution
|
||||||
↓
|
↓
|
||||||
Create checkpoint (JSON)
|
Create checkpoint (JSON)
|
||||||
@ -836,7 +836,7 @@ On failure, load checkpoint and resume
|
|||||||
|
|
||||||
**OCI Artifact Flow**:
|
**OCI Artifact Flow**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Package extension (oci-package.nu)
|
1. Package extension (oci-package.nu)
|
||||||
2. Push to OCI registry (provisioning oci push)
|
2. Push to OCI registry (provisioning oci push)
|
||||||
3. Extension stored as OCI artifact
|
3. Extension stored as OCI artifact
|
||||||
@ -850,7 +850,7 @@ On failure, load checkpoint and resume
|
|||||||
|
|
||||||
### Security Layers
|
### Security Layers
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ SECURITY ARCHITECTURE │
|
│ SECURITY ARCHITECTURE │
|
||||||
├─────────────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────────────┤
|
||||||
@ -921,7 +921,7 @@ On failure, load checkpoint and resume
|
|||||||
|
|
||||||
**SOPS Integration**:
|
**SOPS Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Edit encrypted file
|
# Edit encrypted file
|
||||||
provisioning sops workspace/secrets/keys.yaml.enc
|
provisioning sops workspace/secrets/keys.yaml.enc
|
||||||
|
|
||||||
@ -931,7 +931,7 @@ provisioning sops workspace/secrets/keys.yaml.enc
|
|||||||
|
|
||||||
**KMS Integration** (Enterprise):
|
**KMS Integration** (Enterprise):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# workspace/config/provisioning.yaml
|
# workspace/config/provisioning.yaml
|
||||||
secrets:
|
secrets:
|
||||||
provider: "kms"
|
provider: "kms"
|
||||||
@ -945,7 +945,7 @@ secrets:
|
|||||||
|
|
||||||
**CI/CD Mode** (Required):
|
**CI/CD Mode** (Required):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Sign OCI artifact
|
# Sign OCI artifact
|
||||||
cosign sign oci://registry/kubernetes:1.28.0
|
cosign sign oci://registry/kubernetes:1.28.0
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ cosign verify oci://registry/kubernetes:1.28.0
|
|||||||
|
|
||||||
**Enterprise Mode** (Mandatory):
|
**Enterprise Mode** (Mandatory):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pull with verification
|
# Pull with verification
|
||||||
provisioning extension pull kubernetes --verify-signature
|
provisioning extension pull kubernetes --verify-signature
|
||||||
|
|
||||||
@ -970,7 +970,7 @@ provisioning extension pull kubernetes --verify-signature
|
|||||||
|
|
||||||
#### 1. **Binary Deployment** (Solo, Multi-user)
|
#### 1. **Binary Deployment** (Solo, Multi-user)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User Machine
|
User Machine
|
||||||
├── ~/.provisioning/bin/
|
├── ~/.provisioning/bin/
|
||||||
│ ├── provisioning-orchestrator
|
│ ├── provisioning-orchestrator
|
||||||
@ -986,7 +986,7 @@ User Machine
|
|||||||
|
|
||||||
#### 2. **Docker Deployment** (Multi-user, CI/CD)
|
#### 2. **Docker Deployment** (Multi-user, CI/CD)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Docker Daemon
|
Docker Daemon
|
||||||
├── Container: provisioning-orchestrator
|
├── Container: provisioning-orchestrator
|
||||||
├── Container: provisioning-control-center
|
├── Container: provisioning-control-center
|
||||||
@ -1001,7 +1001,7 @@ Docker Daemon
|
|||||||
|
|
||||||
#### 3. **Docker Compose Deployment** (Multi-user)
|
#### 3. **Docker Compose Deployment** (Multi-user)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# provisioning/platform/docker-compose.yaml
|
# provisioning/platform/docker-compose.yaml
|
||||||
services:
|
services:
|
||||||
orchestrator:
|
orchestrator:
|
||||||
@ -1039,7 +1039,7 @@ services:
|
|||||||
|
|
||||||
#### 4. **Kubernetes Deployment** (CI/CD, Enterprise)
|
#### 4. **Kubernetes Deployment** (CI/CD, Enterprise)
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# Namespace: provisioning-system
|
# Namespace: provisioning-system
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@ -1085,7 +1085,7 @@ spec:
|
|||||||
|
|
||||||
#### 5. **Remote Deployment** (All modes)
|
#### 5. **Remote Deployment** (All modes)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Connect to remotely-running services
|
# Connect to remotely-running services
|
||||||
services:
|
services:
|
||||||
orchestrator:
|
orchestrator:
|
||||||
@ -1108,7 +1108,7 @@ services:
|
|||||||
|
|
||||||
#### 1. **Hybrid Language Integration** (Rust ↔ Nushell)
|
#### 1. **Hybrid Language Integration** (Rust ↔ Nushell)
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
Rust Orchestrator
|
Rust Orchestrator
|
||||||
↓ (HTTP API)
|
↓ (HTTP API)
|
||||||
Nushell CLI
|
Nushell CLI
|
||||||
@ -1124,7 +1124,7 @@ File-based Task Queue
|
|||||||
|
|
||||||
#### 2. **Provider Abstraction**
|
#### 2. **Provider Abstraction**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Unified Provider Interface
|
Unified Provider Interface
|
||||||
├── create_server(config) -> Server
|
├── create_server(config) -> Server
|
||||||
├── delete_server(id) -> bool
|
├── delete_server(id) -> bool
|
||||||
@ -1139,7 +1139,7 @@ Provider Implementations:
|
|||||||
|
|
||||||
#### 3. **OCI Registry Integration**
|
#### 3. **OCI Registry Integration**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Extension Development
|
Extension Development
|
||||||
↓
|
↓
|
||||||
Package (oci-package.nu)
|
Package (oci-package.nu)
|
||||||
@ -1157,7 +1157,7 @@ Load into Workspace
|
|||||||
|
|
||||||
#### 4. **Gitea Integration** (Multi-user, Enterprise)
|
#### 4. **Gitea Integration** (Multi-user, Enterprise)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Workspace Operations
|
Workspace Operations
|
||||||
↓
|
↓
|
||||||
Check Lock Status (Gitea API)
|
Check Lock Status (Gitea API)
|
||||||
@ -1179,7 +1179,7 @@ Release Lock (Delete lock file)
|
|||||||
|
|
||||||
#### 5. **CoreDNS Integration**
|
#### 5. **CoreDNS Integration**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Service Registration
|
Service Registration
|
||||||
↓
|
↓
|
||||||
Update CoreDNS Corefile
|
Update CoreDNS Corefile
|
||||||
|
|||||||
@ -86,7 +86,7 @@ Original comprehensive loader that handles:
|
|||||||
|
|
||||||
## Module Dependency Graph
|
## Module Dependency Graph
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Help/Status Commands
|
Help/Status Commands
|
||||||
↓
|
↓
|
||||||
loader-lazy.nu
|
loader-lazy.nu
|
||||||
@ -110,7 +110,7 @@ loader.nu (full configuration)
|
|||||||
|
|
||||||
### Fast Path (Help Commands)
|
### Fast Path (Help Commands)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Uses minimal loader - 23ms
|
# Uses minimal loader - 23ms
|
||||||
./provisioning help infrastructure
|
./provisioning help infrastructure
|
||||||
./provisioning workspace list
|
./provisioning workspace list
|
||||||
@ -119,7 +119,7 @@ loader.nu (full configuration)
|
|||||||
|
|
||||||
### Medium Path (Status Operations)
|
### Medium Path (Status Operations)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Uses minimal loader with some full config - ~50ms
|
# Uses minimal loader with some full config - ~50ms
|
||||||
./provisioning status
|
./provisioning status
|
||||||
./provisioning workspace active
|
./provisioning workspace active
|
||||||
@ -128,7 +128,7 @@ loader.nu (full configuration)
|
|||||||
|
|
||||||
### Full Path (Infrastructure Operations)
|
### Full Path (Infrastructure Operations)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Uses full loader - ~150ms
|
# Uses full loader - ~150ms
|
||||||
./provisioning server create --infra myinfra
|
./provisioning server create --infra myinfra
|
||||||
./provisioning taskserv create kubernetes
|
./provisioning taskserv create kubernetes
|
||||||
@ -139,7 +139,7 @@ loader.nu (full configuration)
|
|||||||
|
|
||||||
### Lazy Loading Decision Logic
|
### Lazy Loading Decision Logic
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# In loader-lazy.nu
|
# In loader-lazy.nu
|
||||||
let is_fast_command = (
|
let is_fast_command = (
|
||||||
$command == "help" or
|
$command == "help" or
|
||||||
@ -160,7 +160,7 @@ if $is_fast_command {
|
|||||||
|
|
||||||
The minimal loader returns a lightweight config record:
|
The minimal loader returns a lightweight config record:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace: {
|
workspace: {
|
||||||
name: "librecloud"
|
name: "librecloud"
|
||||||
@ -247,7 +247,7 @@ Only add if:
|
|||||||
|
|
||||||
### Performance Testing
|
### Performance Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Benchmark minimal loader
|
# Benchmark minimal loader
|
||||||
time nu -n -c "use loader-minimal.nu *; get-active-workspace"
|
time nu -n -c "use loader-minimal.nu *; get-active-workspace"
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Control-Center uses **SurrealDB with kv-mem backend**, an embedded in-memory dat
|
|||||||
|
|
||||||
### Database Configuration
|
### Database Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[database]
|
[database]
|
||||||
url = "memory" # In-memory backend
|
url = "memory" # In-memory backend
|
||||||
namespace = "control_center"
|
namespace = "control_center"
|
||||||
@ -24,7 +24,7 @@ database = "main"
|
|||||||
|
|
||||||
**Production Alternative**: Switch to remote WebSocket connection for persistent storage:
|
**Production Alternative**: Switch to remote WebSocket connection for persistent storage:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[database]
|
[database]
|
||||||
url = "ws://localhost:8000"
|
url = "ws://localhost:8000"
|
||||||
namespace = "control_center"
|
namespace = "control_center"
|
||||||
@ -79,7 +79,7 @@ Control-Center also supports (via Cargo.toml dependencies):
|
|||||||
|
|
||||||
Orchestrator uses simple file-based storage by default:
|
Orchestrator uses simple file-based storage by default:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[orchestrator.storage]
|
[orchestrator.storage]
|
||||||
type = "filesystem" # Default
|
type = "filesystem" # Default
|
||||||
backend_path = "{{orchestrator.paths.data_dir}}/queue.rkvs"
|
backend_path = "{{orchestrator.paths.data_dir}}/queue.rkvs"
|
||||||
@ -87,7 +87,7 @@ backend_path = "{{orchestrator.paths.data_dir}}/queue.rkvs"
|
|||||||
|
|
||||||
**Resolved Path**:
|
**Resolved Path**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{{workspace.path}}/.orchestrator/data/queue.rkvs
|
{{workspace.path}}/.orchestrator/data/queue.rkvs
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ backend_path = "{{orchestrator.paths.data_dir}}/queue.rkvs"
|
|||||||
|
|
||||||
For production deployments, switch to SurrealDB:
|
For production deployments, switch to SurrealDB:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[orchestrator.storage]
|
[orchestrator.storage]
|
||||||
type = "surrealdb-server" # or surrealdb-embedded
|
type = "surrealdb-server" # or surrealdb-embedded
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ password = "secret"
|
|||||||
|
|
||||||
All services load configuration in this order (priority: low → high):
|
All services load configuration in this order (priority: low → high):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. System Defaults provisioning/config/config.defaults.toml
|
1. System Defaults provisioning/config/config.defaults.toml
|
||||||
2. Service Defaults provisioning/platform/{service}/config.defaults.toml
|
2. Service Defaults provisioning/platform/{service}/config.defaults.toml
|
||||||
3. Workspace Config workspace/{name}/config/provisioning.yaml
|
3. Workspace Config workspace/{name}/config/provisioning.yaml
|
||||||
@ -128,7 +128,7 @@ All services load configuration in this order (priority: low → high):
|
|||||||
|
|
||||||
Configs support dynamic variable interpolation:
|
Configs support dynamic variable interpolation:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[paths]
|
[paths]
|
||||||
base = "/Users/Akasha/project-provisioning/provisioning"
|
base = "/Users/Akasha/project-provisioning/provisioning"
|
||||||
data_dir = "{{paths.base}}/data" # Resolves to: /Users/.../data
|
data_dir = "{{paths.base}}/data" # Resolves to: /Users/.../data
|
||||||
@ -175,7 +175,7 @@ All services use workspace-aware paths:
|
|||||||
|
|
||||||
**Orchestrator**:
|
**Orchestrator**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[orchestrator.paths]
|
[orchestrator.paths]
|
||||||
base = "{{workspace.path}}/.orchestrator"
|
base = "{{workspace.path}}/.orchestrator"
|
||||||
data_dir = "{{orchestrator.paths.base}}/data"
|
data_dir = "{{orchestrator.paths.base}}/data"
|
||||||
@ -185,7 +185,7 @@ queue_dir = "{{orchestrator.paths.data_dir}}/queue"
|
|||||||
|
|
||||||
**Control-Center**:
|
**Control-Center**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[paths]
|
[paths]
|
||||||
base = "{{workspace.path}}/.control-center"
|
base = "{{workspace.path}}/.control-center"
|
||||||
data_dir = "{{paths.base}}/data"
|
data_dir = "{{paths.base}}/data"
|
||||||
@ -194,7 +194,7 @@ logs_dir = "{{paths.base}}/logs"
|
|||||||
|
|
||||||
**Result** (workspace: `workspace-librecloud`):
|
**Result** (workspace: `workspace-librecloud`):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace-librecloud/
|
workspace-librecloud/
|
||||||
├── .orchestrator/
|
├── .orchestrator/
|
||||||
│ ├── data/
|
│ ├── data/
|
||||||
@ -214,7 +214,7 @@ Any config value can be overridden via environment variables:
|
|||||||
|
|
||||||
### Control-Center
|
### Control-Center
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Override server port
|
# Override server port
|
||||||
export CONTROL_CENTER_SERVER_PORT=8081
|
export CONTROL_CENTER_SERVER_PORT=8081
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ export CONTROL_CENTER_JWT_ISSUER="my-issuer"
|
|||||||
|
|
||||||
### Orchestrator
|
### Orchestrator
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Override orchestrator port
|
# Override orchestrator port
|
||||||
export ORCHESTRATOR_SERVER_PORT=8080
|
export ORCHESTRATOR_SERVER_PORT=8080
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ export ORCHESTRATOR_QUEUE_MAX_CONCURRENT_TASKS=10
|
|||||||
|
|
||||||
### Naming Convention
|
### Naming Convention
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{SERVICE}_{SECTION}_{KEY} = value
|
{SERVICE}_{SECTION}_{KEY} = value
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ export ORCHESTRATOR_QUEUE_MAX_CONCURRENT_TASKS=10
|
|||||||
|
|
||||||
**Container paths** (resolved inside container):
|
**Container paths** (resolved inside container):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[paths]
|
[paths]
|
||||||
base = "/app/provisioning"
|
base = "/app/provisioning"
|
||||||
data_dir = "/data" # Mounted volume
|
data_dir = "/data" # Mounted volume
|
||||||
@ -268,7 +268,7 @@ logs_dir = "/var/log/orchestrator" # Mounted volume
|
|||||||
|
|
||||||
**Docker Compose volumes**:
|
**Docker Compose volumes**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
services:
|
services:
|
||||||
orchestrator:
|
orchestrator:
|
||||||
volumes:
|
volumes:
|
||||||
@ -289,7 +289,7 @@ volumes:
|
|||||||
|
|
||||||
**Host paths** (macOS/Linux):
|
**Host paths** (macOS/Linux):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[paths]
|
[paths]
|
||||||
base = "/Users/Akasha/project-provisioning/provisioning"
|
base = "/Users/Akasha/project-provisioning/provisioning"
|
||||||
data_dir = "{{workspace.path}}/.orchestrator/data"
|
data_dir = "{{workspace.path}}/.orchestrator/data"
|
||||||
@ -302,7 +302,7 @@ logs_dir = "{{workspace.path}}/.orchestrator/logs"
|
|||||||
|
|
||||||
Check current configuration:
|
Check current configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Show effective configuration
|
# Show effective configuration
|
||||||
provisioning env
|
provisioning env
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ PROVISIONING_DEBUG=true ./orchestrator --show-config
|
|||||||
|
|
||||||
**Cosmian KMS** uses its own database (when deployed):
|
**Cosmian KMS** uses its own database (when deployed):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# KMS database location (Docker)
|
# KMS database location (Docker)
|
||||||
/data/kms.db # SQLite database inside KMS container
|
/data/kms.db # SQLite database inside KMS container
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ PROVISIONING_DEBUG=true ./orchestrator --show-config
|
|||||||
|
|
||||||
KMS also integrates with Control-Center's KMS hybrid backend (local + remote):
|
KMS also integrates with Control-Center's KMS hybrid backend (local + remote):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[kms]
|
[kms]
|
||||||
mode = "hybrid" # local, remote, or hybrid
|
mode = "hybrid" # local, remote, or hybrid
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ without code changes. Hardcoded values defeat the purpose of IaC and create main
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# ✅ PAP Compliant - Configuration-driven
|
# ✅ PAP Compliant - Configuration-driven
|
||||||
[providers.aws]
|
[providers.aws]
|
||||||
regions = ["us-west-2", "us-east-1"]
|
regions = ["us-west-2", "us-east-1"]
|
||||||
@ -62,7 +62,7 @@ configuration management and domain-specific operations.
|
|||||||
|
|
||||||
**Language Responsibility Matrix**:
|
**Language Responsibility Matrix**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Rust Layer:
|
Rust Layer:
|
||||||
├── Workflow orchestration and coordination
|
├── Workflow orchestration and coordination
|
||||||
├── REST API servers and HTTP endpoints
|
├── REST API servers and HTTP endpoints
|
||||||
@ -111,7 +111,7 @@ flexibility while maintaining predictability.
|
|||||||
|
|
||||||
**Domain Organization**:
|
**Domain Organization**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
├── core/ # Core system and library functions
|
├── core/ # Core system and library functions
|
||||||
├── platform/ # High-performance coordination layer
|
├── platform/ # High-performance coordination layer
|
||||||
├── provisioning/ # Main business logic with providers and services
|
├── provisioning/ # Main business logic with providers and services
|
||||||
@ -160,7 +160,7 @@ evolution.
|
|||||||
|
|
||||||
**Recovery Strategies**:
|
**Recovery Strategies**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Operation Level:
|
Operation Level:
|
||||||
├── Atomic operations with rollback
|
├── Atomic operations with rollback
|
||||||
├── Retry logic with exponential backoff
|
├── Retry logic with exponential backoff
|
||||||
@ -203,7 +203,7 @@ gains.
|
|||||||
|
|
||||||
**Security Implementation**:
|
**Security Implementation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Authentication & Authorization:
|
Authentication & Authorization:
|
||||||
├── API authentication for external access
|
├── API authentication for external access
|
||||||
├── Role-based access control for operations
|
├── Role-based access control for operations
|
||||||
@ -234,7 +234,7 @@ the system.
|
|||||||
|
|
||||||
**Testing Strategy**:
|
**Testing Strategy**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Unit Testing:
|
Unit Testing:
|
||||||
├── Configuration validation tests
|
├── Configuration validation tests
|
||||||
├── Individual component tests
|
├── Individual component tests
|
||||||
@ -272,7 +272,7 @@ System Testing:
|
|||||||
|
|
||||||
**Error Categories**:
|
**Error Categories**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Configuration Errors:
|
Configuration Errors:
|
||||||
├── Invalid configuration syntax
|
├── Invalid configuration syntax
|
||||||
├── Missing required configuration
|
├── Missing required configuration
|
||||||
@ -300,7 +300,7 @@ System Errors:
|
|||||||
|
|
||||||
**Observability Implementation**:
|
**Observability Implementation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Logging:
|
Logging:
|
||||||
├── Structured JSON logging
|
├── Structured JSON logging
|
||||||
├── Configurable log levels
|
├── Configurable log levels
|
||||||
@ -358,7 +358,7 @@ Monitoring:
|
|||||||
|
|
||||||
**Debt Management Strategy**:
|
**Debt Management Strategy**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Assessment:
|
Assessment:
|
||||||
├── Regular code quality reviews
|
├── Regular code quality reviews
|
||||||
├── Performance profiling and optimization
|
├── Performance profiling and optimization
|
||||||
@ -382,7 +382,7 @@ Improvement:
|
|||||||
|
|
||||||
**Trade-off Categories**:
|
**Trade-off Categories**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Performance vs. Maintainability:
|
Performance vs. Maintainability:
|
||||||
├── Rust coordination layer for performance
|
├── Rust coordination layer for performance
|
||||||
├── Nushell business logic for maintainability
|
├── Nushell business logic for maintainability
|
||||||
|
|||||||
@ -19,7 +19,7 @@ This document describes the **hybrid selective integration** of prov-ecosystem a
|
|||||||
|
|
||||||
### Three-Layer Integration
|
### Three-Layer Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────┐
|
||||||
│ Provisioning CLI (provisioning/core/cli/) │
|
│ Provisioning CLI (provisioning/core/cli/) │
|
||||||
│ ✅ 80+ command shortcuts │
|
│ ✅ 80+ command shortcuts │
|
||||||
@ -70,7 +70,7 @@ This document describes the **hybrid selective integration** of prov-ecosystem a
|
|||||||
|
|
||||||
**Key Types**:
|
**Key Types**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub enum ContainerRuntime {
|
pub enum ContainerRuntime {
|
||||||
Docker,
|
Docker,
|
||||||
Podman,
|
Podman,
|
||||||
@ -85,7 +85,7 @@ pub struct ComposeAdapter { ... }
|
|||||||
|
|
||||||
**Nushell Functions**:
|
**Nushell Functions**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
runtime-detect # Auto-detect available runtime
|
runtime-detect # Auto-detect available runtime
|
||||||
runtime-exec # Execute command in detected runtime
|
runtime-exec # Execute command in detected runtime
|
||||||
runtime-compose # Adapt docker-compose for runtime
|
runtime-compose # Adapt docker-compose for runtime
|
||||||
@ -112,7 +112,7 @@ runtime-list # List all available runtimes
|
|||||||
|
|
||||||
**Key Types**:
|
**Key Types**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct SshConfig { ... }
|
pub struct SshConfig { ... }
|
||||||
pub struct SshPool { ... }
|
pub struct SshPool { ... }
|
||||||
pub enum DeploymentStrategy {
|
pub enum DeploymentStrategy {
|
||||||
@ -124,7 +124,7 @@ pub enum DeploymentStrategy {
|
|||||||
|
|
||||||
**Nushell Functions**:
|
**Nushell Functions**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
ssh-pool-connect # Create SSH pool connection
|
ssh-pool-connect # Create SSH pool connection
|
||||||
ssh-pool-exec # Execute on SSH pool
|
ssh-pool-exec # Execute on SSH pool
|
||||||
ssh-pool-status # Check pool status
|
ssh-pool-status # Check pool status
|
||||||
@ -153,7 +153,7 @@ ssh-circuit-breaker-status # Check circuit breaker
|
|||||||
|
|
||||||
**Key Types**:
|
**Key Types**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub enum BackupBackend {
|
pub enum BackupBackend {
|
||||||
Restic,
|
Restic,
|
||||||
Borg,
|
Borg,
|
||||||
@ -169,7 +169,7 @@ pub struct BackupManager { ... }
|
|||||||
|
|
||||||
**Nushell Functions**:
|
**Nushell Functions**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
backup-create # Create backup job
|
backup-create # Create backup job
|
||||||
backup-restore # Restore from snapshot
|
backup-restore # Restore from snapshot
|
||||||
backup-list # List snapshots
|
backup-list # List snapshots
|
||||||
@ -199,7 +199,7 @@ backup-status # Check backup status
|
|||||||
|
|
||||||
**Key Types**:
|
**Key Types**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub enum GitProvider {
|
pub enum GitProvider {
|
||||||
GitHub,
|
GitHub,
|
||||||
GitLab,
|
GitLab,
|
||||||
@ -212,7 +212,7 @@ pub struct GitOpsOrchestrator { ... }
|
|||||||
|
|
||||||
**Nushell Functions**:
|
**Nushell Functions**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
gitops-rules # Load rules from config
|
gitops-rules # Load rules from config
|
||||||
gitops-watch # Watch for Git events
|
gitops-watch # Watch for Git events
|
||||||
gitops-trigger # Manually trigger deployment
|
gitops-trigger # Manually trigger deployment
|
||||||
@ -243,7 +243,7 @@ gitops-status # Get GitOps status
|
|||||||
|
|
||||||
**Nushell Functions**:
|
**Nushell Functions**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
service-install # Install service
|
service-install # Install service
|
||||||
service-start # Start service
|
service-start # Start service
|
||||||
service-stop # Stop service
|
service-stop # Stop service
|
||||||
@ -300,7 +300,7 @@ All implementations follow project standards:
|
|||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/
|
provisioning/
|
||||||
├── platform/integrations/
|
├── platform/integrations/
|
||||||
│ └── provisioning-bridge/ # Rust bridge crate
|
│ └── provisioning-bridge/ # Rust bridge crate
|
||||||
@ -338,7 +338,7 @@ provisioning/
|
|||||||
|
|
||||||
### Runtime Abstraction
|
### Runtime Abstraction
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Auto-detect available runtime
|
# Auto-detect available runtime
|
||||||
let runtime = (runtime-detect)
|
let runtime = (runtime-detect)
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ let compose_cmd = (runtime-compose "./docker-compose.yml")
|
|||||||
|
|
||||||
### SSH Advanced
|
### SSH Advanced
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Connect to SSH pool
|
# Connect to SSH pool
|
||||||
let pool = (ssh-pool-connect "server01.example.com" "root" --port 22)
|
let pool = (ssh-pool-connect "server01.example.com" "root" --port 22)
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ ssh-circuit-breaker-status
|
|||||||
|
|
||||||
### Backup System
|
### Backup System
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schedule regular backups
|
# Schedule regular backups
|
||||||
backup-schedule "daily-app-backup" "0 2 * * *"
|
backup-schedule "daily-app-backup" "0 2 * * *"
|
||||||
--paths ["/opt/app" "/var/lib/app"]
|
--paths ["/opt/app" "/var/lib/app"]
|
||||||
@ -381,7 +381,7 @@ backup-restore "snapshot-001" --restore_path "."
|
|||||||
|
|
||||||
### GitOps Events
|
### GitOps Events
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Load GitOps rules
|
# Load GitOps rules
|
||||||
let rules = (gitops-rules "./gitops-rules.yaml")
|
let rules = (gitops-rules "./gitops-rules.yaml")
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ gitops-trigger "deploy-app" --environment "prod"
|
|||||||
|
|
||||||
### Service Management
|
### Service Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install service
|
# Install service
|
||||||
service-install "my-app" "/usr/local/bin/my-app"
|
service-install "my-app" "/usr/local/bin/my-app"
|
||||||
--user "appuser"
|
--user "appuser"
|
||||||
@ -418,7 +418,7 @@ service-restart-policy "my-app" --policy "on-failure" --delay-secs 5
|
|||||||
|
|
||||||
Existing `provisioning` CLI will gain new command tree:
|
Existing `provisioning` CLI will gain new command tree:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning runtime detect|exec|compose|info|list
|
provisioning runtime detect|exec|compose|info|list
|
||||||
provisioning ssh pool connect|exec|status|strategies
|
provisioning ssh pool connect|exec|status|strategies
|
||||||
provisioning backup create|restore|list|schedule|retention|status
|
provisioning backup create|restore|list|schedule|retention|status
|
||||||
@ -430,7 +430,7 @@ provisioning service install|start|stop|restart|status|list|policy|detect-init
|
|||||||
|
|
||||||
All integrations use Nickel schemas from `provisioning/schemas/integrations/`:
|
All integrations use Nickel schemas from `provisioning/schemas/integrations/`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let { IntegrationConfig } = import "provisioning/integrations.ncl" in
|
let { IntegrationConfig } = import "provisioning/integrations.ncl" in
|
||||||
{
|
{
|
||||||
runtime = { ... },
|
runtime = { ... },
|
||||||
@ -445,7 +445,7 @@ let { IntegrationConfig } = import "provisioning/integrations.ncl" in
|
|||||||
|
|
||||||
Nushell plugins can be created for performance-critical operations:
|
Nushell plugins can be created for performance-critical operations:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
provisioning plugin list
|
provisioning plugin list
|
||||||
# [installed]
|
# [installed]
|
||||||
# nu_plugin_runtime
|
# nu_plugin_runtime
|
||||||
@ -460,7 +460,7 @@ provisioning plugin list
|
|||||||
|
|
||||||
### Rust Tests
|
### Rust Tests
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
cd provisioning/platform/integrations/provisioning-bridge
|
cd provisioning/platform/integrations/provisioning-bridge
|
||||||
cargo test --all
|
cargo test --all
|
||||||
cargo test -p provisioning-bridge --lib
|
cargo test -p provisioning-bridge --lib
|
||||||
@ -469,7 +469,7 @@ cargo test -p provisioning-bridge --doc
|
|||||||
|
|
||||||
### Nushell Tests
|
### Nushell Tests
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu provisioning/core/nulib/integrations/runtime.nu
|
nu provisioning/core/nulib/integrations/runtime.nu
|
||||||
nu provisioning/core/nulib/integrations/ssh_advanced.nu
|
nu provisioning/core/nulib/integrations/ssh_advanced.nu
|
||||||
```
|
```
|
||||||
|
|||||||
@ -15,7 +15,7 @@ workflows, and enable extensible functionality. This document outlines the key i
|
|||||||
|
|
||||||
**Implementation**:
|
**Implementation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ pub async fn execute_nushell_workflow(
|
|||||||
|
|
||||||
**Data Exchange Format**:
|
**Data Exchange Format**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"status": "success" | "error" | "partial",
|
"status": "success" | "error" | "partial",
|
||||||
"result": {
|
"result": {
|
||||||
@ -54,7 +54,7 @@ pub async fn execute_nushell_workflow(
|
|||||||
|
|
||||||
**Implementation**:
|
**Implementation**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def submit-workflow [workflow: record] -> record {
|
def submit-workflow [workflow: record] -> record {
|
||||||
let payload = $workflow | to json
|
let payload = $workflow | to json
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ def submit-workflow [workflow: record] -> record {
|
|||||||
|
|
||||||
**API Contract**:
|
**API Contract**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"workflow_id": "wf-456",
|
"workflow_id": "wf-456",
|
||||||
"name": "multi_cloud_deployment",
|
"name": "multi_cloud_deployment",
|
||||||
@ -86,7 +86,7 @@ def submit-workflow [workflow: record] -> record {
|
|||||||
|
|
||||||
**Interface Definition**:
|
**Interface Definition**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Standard provider interface that all providers must implement
|
# Standard provider interface that all providers must implement
|
||||||
export def list-servers [] -> table {
|
export def list-servers [] -> table {
|
||||||
# Provider-specific implementation
|
# Provider-specific implementation
|
||||||
@ -107,7 +107,7 @@ export def get-server [id: string] -> record {
|
|||||||
|
|
||||||
**Configuration Integration**:
|
**Configuration Integration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[providers.aws]
|
[providers.aws]
|
||||||
region = "us-west-2"
|
region = "us-west-2"
|
||||||
credentials_profile = "default"
|
credentials_profile = "default"
|
||||||
@ -125,7 +125,7 @@ network_mode = "bridge"
|
|||||||
|
|
||||||
#### Provider Discovery and Loading
|
#### Provider Discovery and Loading
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def load-providers [] -> table {
|
def load-providers [] -> table {
|
||||||
let provider_dirs = glob "providers/*/nulib"
|
let provider_dirs = glob "providers/*/nulib"
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ def load-providers [] -> table {
|
|||||||
|
|
||||||
**Implementation**:
|
**Implementation**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def resolve-configuration [context: record] -> record {
|
def resolve-configuration [context: record] -> record {
|
||||||
let base_config = open config.defaults.toml
|
let base_config = open config.defaults.toml
|
||||||
let user_config = if ("config.user.toml" | path exists) {
|
let user_config = if ("config.user.toml" | path exists) {
|
||||||
@ -173,7 +173,7 @@ def resolve-configuration [context: record] -> record {
|
|||||||
|
|
||||||
#### Variable Interpolation Pattern
|
#### Variable Interpolation Pattern
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def interpolate-variables [config: record] -> record {
|
def interpolate-variables [config: record] -> record {
|
||||||
let interpolations = {
|
let interpolations = {
|
||||||
"{{paths.base}}": ($env.PWD),
|
"{{paths.base}}": ($env.PWD),
|
||||||
@ -200,7 +200,7 @@ def interpolate-variables [config: record] -> record {
|
|||||||
|
|
||||||
**Implementation (Rust)**:
|
**Implementation (Rust)**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
use petgraph::{Graph, Direction};
|
use petgraph::{Graph, Direction};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ impl DependencyResolver {
|
|||||||
|
|
||||||
#### Parallel Execution Pattern
|
#### Parallel Execution Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
use futures::stream::{FuturesUnordered, StreamExt};
|
use futures::stream::{FuturesUnordered, StreamExt};
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ pub async fn execute_parallel_batch(
|
|||||||
|
|
||||||
**Implementation**:
|
**Implementation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct WorkflowCheckpoint {
|
pub struct WorkflowCheckpoint {
|
||||||
pub workflow_id: String,
|
pub workflow_id: String,
|
||||||
@ -309,7 +309,7 @@ impl CheckpointManager {
|
|||||||
|
|
||||||
#### Rollback Pattern
|
#### Rollback Pattern
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct RollbackManager {
|
pub struct RollbackManager {
|
||||||
rollback_stack: Vec<RollbackAction>,
|
rollback_stack: Vec<RollbackAction>,
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ impl RollbackManager {
|
|||||||
|
|
||||||
**Event Definition**:
|
**Event Definition**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub enum SystemEvent {
|
pub enum SystemEvent {
|
||||||
WorkflowStarted { workflow_id: String, name: String },
|
WorkflowStarted { workflow_id: String, name: String },
|
||||||
@ -363,7 +363,7 @@ pub enum SystemEvent {
|
|||||||
|
|
||||||
**Event Bus Implementation**:
|
**Event Bus Implementation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
|
|
||||||
pub struct EventBus {
|
pub struct EventBus {
|
||||||
@ -392,7 +392,7 @@ impl EventBus {
|
|||||||
|
|
||||||
#### Extension Discovery and Loading
|
#### Extension Discovery and Loading
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def discover-extensions [] -> table {
|
def discover-extensions [] -> table {
|
||||||
let extension_dirs = glob "extensions/*/extension.toml"
|
let extension_dirs = glob "extensions/*/extension.toml"
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ def discover-extensions [] -> table {
|
|||||||
|
|
||||||
#### Extension Interface Pattern
|
#### Extension Interface Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Standard extension interface
|
# Standard extension interface
|
||||||
export def extension-info [] -> record {
|
export def extension-info [] -> record {
|
||||||
{
|
{
|
||||||
@ -452,7 +452,7 @@ export def extension-deactivate [] -> nothing {
|
|||||||
|
|
||||||
**Base API Structure**:
|
**Base API Structure**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{Path, State},
|
extract::{Path, State},
|
||||||
response::Json,
|
response::Json,
|
||||||
@ -473,7 +473,7 @@ pub fn create_api_router(state: AppState) -> Router {
|
|||||||
|
|
||||||
**Standard Response Format**:
|
**Standard Response Format**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"status": "success" | "error" | "pending",
|
"status": "success" | "error" | "pending",
|
||||||
"data": { ... },
|
"data": { ... },
|
||||||
@ -494,7 +494,7 @@ pub fn create_api_router(state: AppState) -> Router {
|
|||||||
|
|
||||||
### Structured Error Pattern
|
### Structured Error Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum ProvisioningError {
|
pub enum ProvisioningError {
|
||||||
#[error("Configuration error: {message}")]
|
#[error("Configuration error: {message}")]
|
||||||
@ -513,7 +513,7 @@ pub enum ProvisioningError {
|
|||||||
|
|
||||||
### Error Recovery Pattern
|
### Error Recovery Pattern
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def with-retry [operation: closure, max_attempts: int = 3] {
|
def with-retry [operation: closure, max_attempts: int = 3] {
|
||||||
mut attempts = 0
|
mut attempts = 0
|
||||||
mut last_error = null
|
mut last_error = null
|
||||||
@ -540,7 +540,7 @@ def with-retry [operation: closure, max_attempts: int = 3] {
|
|||||||
|
|
||||||
### Caching Strategy Pattern
|
### Caching Strategy Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -583,7 +583,7 @@ impl<T: Clone> Cache<T> {
|
|||||||
|
|
||||||
### Streaming Pattern for Large Data
|
### Streaming Pattern for Large Data
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def process-large-dataset [source: string] -> nothing {
|
def process-large-dataset [source: string] -> nothing {
|
||||||
# Stream processing instead of loading entire dataset
|
# Stream processing instead of loading entire dataset
|
||||||
open $source
|
open $source
|
||||||
@ -600,7 +600,7 @@ def process-large-dataset [source: string] -> nothing {
|
|||||||
|
|
||||||
### Integration Test Pattern
|
### Integration Test Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod integration_tests {
|
mod integration_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ distributed extension management through OCI registry integration.
|
|||||||
|
|
||||||
**Purpose**: Core system functionality - CLI, libraries, base schemas
|
**Purpose**: Core system functionality - CLI, libraries, base schemas
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-core/
|
provisioning-core/
|
||||||
├── core/
|
├── core/
|
||||||
│ ├── cli/ # Command-line interface
|
│ ├── cli/ # Command-line interface
|
||||||
@ -82,7 +82,7 @@ provisioning-core/
|
|||||||
|
|
||||||
**Purpose**: All provider, taskserv, and cluster extensions
|
**Purpose**: All provider, taskserv, and cluster extensions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-extensions/
|
provisioning-extensions/
|
||||||
├── providers/
|
├── providers/
|
||||||
│ ├── aws/
|
│ ├── aws/
|
||||||
@ -143,7 +143,7 @@ Each extension published separately as OCI artifact:
|
|||||||
|
|
||||||
**Extension Manifest** (`manifest.yaml`):
|
**Extension Manifest** (`manifest.yaml`):
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: kubernetes
|
name: kubernetes
|
||||||
type: taskserv
|
type: taskserv
|
||||||
version: 1.28.0
|
version: 1.28.0
|
||||||
@ -183,7 +183,7 @@ min_provisioning_version: "3.0.0"
|
|||||||
|
|
||||||
**Purpose**: Platform services (orchestrator, control-center, MCP server, API gateway)
|
**Purpose**: Platform services (orchestrator, control-center, MCP server, API gateway)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-platform/
|
provisioning-platform/
|
||||||
├── orchestrator/ # Rust orchestrator service
|
├── orchestrator/ # Rust orchestrator service
|
||||||
│ ├── src/
|
│ ├── src/
|
||||||
@ -238,7 +238,7 @@ Standard Docker images in OCI registry:
|
|||||||
|
|
||||||
### Registry Structure
|
### Registry Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
OCI Registry (localhost:5000 or harbor.company.com)
|
OCI Registry (localhost:5000 or harbor.company.com)
|
||||||
├── provisioning-core/
|
├── provisioning-core/
|
||||||
│ ├── v3.5.0 # Core system artifact
|
│ ├── v3.5.0 # Core system artifact
|
||||||
@ -263,7 +263,7 @@ OCI Registry (localhost:5000 or harbor.company.com)
|
|||||||
|
|
||||||
Each extension packaged as OCI artifact:
|
Each extension packaged as OCI artifact:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
kubernetes-1.28.0.tar.gz
|
kubernetes-1.28.0.tar.gz
|
||||||
├── schemas/ # Nickel schemas
|
├── schemas/ # Nickel schemas
|
||||||
│ ├── kubernetes.ncl
|
│ ├── kubernetes.ncl
|
||||||
@ -291,7 +291,7 @@ kubernetes-1.28.0.tar.gz
|
|||||||
|
|
||||||
**File**: `workspace/config/provisioning.yaml`
|
**File**: `workspace/config/provisioning.yaml`
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# Core system dependency
|
# Core system dependency
|
||||||
dependencies:
|
dependencies:
|
||||||
core:
|
core:
|
||||||
@ -363,7 +363,7 @@ The system resolves dependencies in this order:
|
|||||||
|
|
||||||
### Dependency Resolution Commands
|
### Dependency Resolution Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Resolve and install all dependencies
|
# Resolve and install all dependencies
|
||||||
provisioning dep resolve
|
provisioning dep resolve
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ provisioning dep tree kubernetes
|
|||||||
|
|
||||||
### CLI Commands
|
### CLI Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pull extension from OCI registry
|
# Pull extension from OCI registry
|
||||||
provisioning oci pull kubernetes:1.28.0
|
provisioning oci pull kubernetes:1.28.0
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ provisioning oci copy
|
|||||||
|
|
||||||
### OCI Configuration
|
### OCI Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Show OCI configuration
|
# Show OCI configuration
|
||||||
provisioning oci config
|
provisioning oci config
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ provisioning oci config
|
|||||||
|
|
||||||
### 1. Develop Extension
|
### 1. Develop Extension
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create new extension from template
|
# Create new extension from template
|
||||||
provisioning generate extension taskserv redis
|
provisioning generate extension taskserv redis
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ provisioning generate extension taskserv redis
|
|||||||
|
|
||||||
### 2. Test Extension Locally
|
### 2. Test Extension Locally
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Load extension from local path
|
# Load extension from local path
|
||||||
provisioning module load taskserv workspace_dev redis --source local
|
provisioning module load taskserv workspace_dev redis --source local
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ provisioning test extension redis
|
|||||||
|
|
||||||
### 3. Package Extension
|
### 3. Package Extension
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate extension structure
|
# Validate extension structure
|
||||||
provisioning oci package validate ./extensions/taskservs/redis
|
provisioning oci package validate ./extensions/taskservs/redis
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ provisioning oci package ./extensions/taskservs/redis
|
|||||||
|
|
||||||
### 4. Publish Extension
|
### 4. Publish Extension
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Login to registry (one-time)
|
# Login to registry (one-time)
|
||||||
provisioning oci login localhost:5000
|
provisioning oci login localhost:5000
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ provisioning oci tags redis
|
|||||||
|
|
||||||
### 5. Use Published Extension
|
### 5. Use Published Extension
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Add to workspace configuration
|
# Add to workspace configuration
|
||||||
# workspace/config/provisioning.yaml:
|
# workspace/config/provisioning.yaml:
|
||||||
# dependencies:
|
# dependencies:
|
||||||
@ -534,7 +534,7 @@ provisioning dep resolve
|
|||||||
|
|
||||||
**Using Zot (lightweight OCI registry)**:
|
**Using Zot (lightweight OCI registry)**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start local OCI registry
|
# Start local OCI registry
|
||||||
provisioning oci-registry start
|
provisioning oci-registry start
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ provisioning oci-registry status
|
|||||||
|
|
||||||
**Using Harbor**:
|
**Using Harbor**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# workspace/config/provisioning.yaml
|
# workspace/config/provisioning.yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
registry:
|
registry:
|
||||||
@ -591,7 +591,7 @@ dependencies:
|
|||||||
|
|
||||||
### Phase 2: Gradual Migration
|
### Phase 2: Gradual Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Migrate extensions one by one
|
# Migrate extensions one by one
|
||||||
for ext in (ls provisioning/extensions/taskservs); do
|
for ext in (ls provisioning/extensions/taskservs); do
|
||||||
provisioning oci publish $ext.name
|
provisioning oci publish $ext.name
|
||||||
|
|||||||
@ -79,7 +79,7 @@ dependency model.
|
|||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-core/
|
provisioning-core/
|
||||||
├── nulib/ # Nushell libraries
|
├── nulib/ # Nushell libraries
|
||||||
│ ├── lib_provisioning/ # Core library functions
|
│ ├── lib_provisioning/ # Core library functions
|
||||||
@ -120,7 +120,7 @@ provisioning-core/
|
|||||||
|
|
||||||
**Installation Path:**
|
**Installation Path:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/
|
/usr/local/
|
||||||
├── bin/provisioning
|
├── bin/provisioning
|
||||||
├── lib/provisioning/
|
├── lib/provisioning/
|
||||||
@ -135,7 +135,7 @@ provisioning-core/
|
|||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-platform/
|
provisioning-platform/
|
||||||
├── orchestrator/ # Rust orchestrator
|
├── orchestrator/ # Rust orchestrator
|
||||||
│ ├── src/
|
│ ├── src/
|
||||||
@ -180,7 +180,7 @@ provisioning-platform/
|
|||||||
|
|
||||||
**Installation Path:**
|
**Installation Path:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/
|
/usr/local/
|
||||||
├── bin/
|
├── bin/
|
||||||
│ ├── provisioning-orchestrator
|
│ ├── provisioning-orchestrator
|
||||||
@ -203,7 +203,7 @@ provisioning-platform/
|
|||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-extensions/
|
provisioning-extensions/
|
||||||
├── registry/ # Extension registry
|
├── registry/ # Extension registry
|
||||||
│ ├── index.json # Searchable index
|
│ ├── index.json # Searchable index
|
||||||
@ -252,7 +252,7 @@ provisioning-extensions/
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install extension via core CLI
|
# Install extension via core CLI
|
||||||
provisioning extension install mongodb
|
provisioning extension install mongodb
|
||||||
provisioning extension install azure-provider
|
provisioning extension install azure-provider
|
||||||
@ -261,7 +261,7 @@ provisioning extension install azure-provider
|
|||||||
**Extension Structure:**
|
**Extension Structure:**
|
||||||
Each extension is self-contained:
|
Each extension is self-contained:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
mongodb/
|
mongodb/
|
||||||
├── manifest.toml # Extension metadata
|
├── manifest.toml # Extension metadata
|
||||||
├── taskserv.nu # Implementation
|
├── taskserv.nu # Implementation
|
||||||
@ -279,7 +279,7 @@ mongodb/
|
|||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-workspace/
|
provisioning-workspace/
|
||||||
├── templates/ # Workspace templates
|
├── templates/ # Workspace templates
|
||||||
│ ├── minimal/ # Minimal starter
|
│ ├── minimal/ # Minimal starter
|
||||||
@ -315,7 +315,7 @@ provisioning-workspace/
|
|||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create workspace from template
|
# Create workspace from template
|
||||||
provisioning workspace init my-project --template kubernetes
|
provisioning workspace init my-project --template kubernetes
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ provisioning workspace init
|
|||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-distribution/
|
provisioning-distribution/
|
||||||
├── release-automation/ # Automated release workflows
|
├── release-automation/ # Automated release workflows
|
||||||
│ ├── build-all.nu # Build all packages
|
│ ├── build-all.nu # Build all packages
|
||||||
@ -385,7 +385,7 @@ provisioning-distribution/
|
|||||||
|
|
||||||
### Package-Based Dependencies (Not Submodules)
|
### Package-Based Dependencies (Not Submodules)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
│ provisioning-distribution │
|
│ provisioning-distribution │
|
||||||
│ (Release orchestration & registry) │
|
│ (Release orchestration & registry) │
|
||||||
@ -416,7 +416,7 @@ provisioning-distribution/
|
|||||||
|
|
||||||
**Method:** Loose coupling via CLI + REST API
|
**Method:** Loose coupling via CLI + REST API
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Platform calls Core CLI (subprocess)
|
# Platform calls Core CLI (subprocess)
|
||||||
def create-server [name: string] {
|
def create-server [name: string] {
|
||||||
# Orchestrator executes Core CLI
|
# Orchestrator executes Core CLI
|
||||||
@ -431,7 +431,7 @@ def submit-workflow [workflow: record] {
|
|||||||
|
|
||||||
**Version Compatibility:**
|
**Version Compatibility:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# platform/Cargo.toml
|
# platform/Cargo.toml
|
||||||
[package.metadata.provisioning]
|
[package.metadata.provisioning]
|
||||||
core-version = "^3.0" # Compatible with core 3.x
|
core-version = "^3.0" # Compatible with core 3.x
|
||||||
@ -441,7 +441,7 @@ core-version = "^3.0" # Compatible with core 3.x
|
|||||||
|
|
||||||
**Method:** Plugin/module system
|
**Method:** Plugin/module system
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Extension manifest
|
# Extension manifest
|
||||||
# extensions/mongodb/manifest.toml
|
# extensions/mongodb/manifest.toml
|
||||||
[extension]
|
[extension]
|
||||||
@ -465,7 +465,7 @@ provisioning extension install mongodb
|
|||||||
|
|
||||||
**Method:** Git templates or package templates
|
**Method:** Git templates or package templates
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option 1: GitHub template repository
|
# Option 1: GitHub template repository
|
||||||
gh repo create my-infra --template provisioning-workspace
|
gh repo create my-infra --template provisioning-workspace
|
||||||
cd my-infra
|
cd my-infra
|
||||||
@ -486,7 +486,7 @@ provisioning workspace create my-infra --template kubernetes
|
|||||||
|
|
||||||
Each repository maintains independent semantic versioning:
|
Each repository maintains independent semantic versioning:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-core: 3.2.1
|
provisioning-core: 3.2.1
|
||||||
provisioning-platform: 2.5.3
|
provisioning-platform: 2.5.3
|
||||||
provisioning-extensions: (per-extension versioning)
|
provisioning-extensions: (per-extension versioning)
|
||||||
@ -497,7 +497,7 @@ provisioning-workspace: 1.4.0
|
|||||||
|
|
||||||
**`provisioning-distribution/version-management/versions.toml`:**
|
**`provisioning-distribution/version-management/versions.toml`:**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Version compatibility matrix
|
# Version compatibility matrix
|
||||||
[compatibility]
|
[compatibility]
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ workspace = "1.3.0"
|
|||||||
|
|
||||||
**Coordinated releases** for major versions:
|
**Coordinated releases** for major versions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Major release: All repos release together
|
# Major release: All repos release together
|
||||||
provisioning-core: 3.0.0
|
provisioning-core: 3.0.0
|
||||||
provisioning-platform: 2.0.0
|
provisioning-platform: 2.0.0
|
||||||
@ -553,7 +553,7 @@ provisioning-platform: 2.1.0 (improves orchestrator, core stays 3.1.x)
|
|||||||
|
|
||||||
### Working on Single Repository
|
### Working on Single Repository
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Developer working on core only
|
# Developer working on core only
|
||||||
git clone https://github.com/yourorg/provisioning-core
|
git clone https://github.com/yourorg/provisioning-core
|
||||||
cd provisioning-core
|
cd provisioning-core
|
||||||
@ -574,7 +574,7 @@ just install-dev
|
|||||||
|
|
||||||
### Working Across Repositories
|
### Working Across Repositories
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Scenario: Adding new feature requiring core + platform changes
|
# Scenario: Adding new feature requiring core + platform changes
|
||||||
|
|
||||||
# 1. Clone both repositories
|
# 1. Clone both repositories
|
||||||
@ -615,7 +615,7 @@ cargo test
|
|||||||
|
|
||||||
### Testing Cross-Repo Integration
|
### Testing Cross-Repo Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Integration tests in provisioning-distribution
|
# Integration tests in provisioning-distribution
|
||||||
cd provisioning-distribution
|
cd provisioning-distribution
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ just test-bundle stable-3.3
|
|||||||
|
|
||||||
Each repository releases independently:
|
Each repository releases independently:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Core release
|
# Core release
|
||||||
cd provisioning-core
|
cd provisioning-core
|
||||||
git tag v3.2.1
|
git tag v3.2.1
|
||||||
@ -656,7 +656,7 @@ git push --tags
|
|||||||
|
|
||||||
Distribution repository creates tested bundles:
|
Distribution repository creates tested bundles:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning-distribution
|
cd provisioning-distribution
|
||||||
|
|
||||||
# Create bundle
|
# Create bundle
|
||||||
@ -679,7 +679,7 @@ just publish-bundle stable-3.2
|
|||||||
|
|
||||||
#### Option 1: Bundle Installation (Recommended for Users)
|
#### Option 1: Bundle Installation (Recommended for Users)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install stable bundle (easiest)
|
# Install stable bundle (easiest)
|
||||||
curl -fsSL https://get.provisioning.io | sh
|
curl -fsSL https://get.provisioning.io | sh
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ curl -fsSL https://get.provisioning.io | sh
|
|||||||
|
|
||||||
#### Option 2: Individual Component Installation
|
#### Option 2: Individual Component Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install only core (minimal)
|
# Install only core (minimal)
|
||||||
curl -fsSL https://get.provisioning.io/core | sh
|
curl -fsSL https://get.provisioning.io/core | sh
|
||||||
|
|
||||||
@ -704,7 +704,7 @@ provisioning extension install mongodb
|
|||||||
|
|
||||||
#### Option 3: Custom Combination
|
#### Option 3: Custom Combination
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install specific versions
|
# Install specific versions
|
||||||
provisioning install core@3.1.0
|
provisioning install core@3.1.0
|
||||||
provisioning install platform@2.4.0
|
provisioning install platform@2.4.0
|
||||||
@ -760,7 +760,7 @@ provisioning install platform@2.4.0
|
|||||||
|
|
||||||
**Core CI (`provisioning-core/.github/workflows/ci.yml`):**
|
**Core CI (`provisioning-core/.github/workflows/ci.yml`):**
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Core CI
|
name: Core CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
@ -792,7 +792,7 @@ jobs:
|
|||||||
|
|
||||||
**Platform CI (`provisioning-platform/.github/workflows/ci.yml`):**
|
**Platform CI (`provisioning-platform/.github/workflows/ci.yml`):**
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Platform CI
|
name: Platform CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
@ -829,7 +829,7 @@ jobs:
|
|||||||
|
|
||||||
**Distribution CI (`provisioning-distribution/.github/workflows/integration.yml`):**
|
**Distribution CI (`provisioning-distribution/.github/workflows/integration.yml`):**
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Integration Tests
|
name: Integration Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -862,7 +862,7 @@ jobs:
|
|||||||
|
|
||||||
### Monorepo Structure
|
### Monorepo Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/ (One repo, ~500 MB)
|
provisioning/ (One repo, ~500 MB)
|
||||||
├── core/ (Nushell)
|
├── core/ (Nushell)
|
||||||
├── platform/ (Rust)
|
├── platform/ (Rust)
|
||||||
@ -873,7 +873,7 @@ provisioning/ (One repo, ~500 MB)
|
|||||||
|
|
||||||
### Multi-Repo Structure
|
### Multi-Repo Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning-core/ (Repo 1, ~50 MB)
|
provisioning-core/ (Repo 1, ~50 MB)
|
||||||
├── nulib/
|
├── nulib/
|
||||||
├── cli/
|
├── cli/
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Install Nickel
|
# Install Nickel
|
||||||
brew install nickel
|
brew install nickel
|
||||||
# or from source: https://nickel-lang.org/getting-started/
|
# or from source: https://nickel-lang.org/getting-started/
|
||||||
@ -21,7 +21,7 @@ nickel --version # Should be 1.0+
|
|||||||
|
|
||||||
### Directory Structure for Examples
|
### Directory Structure for Examples
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
mkdir -p ~/nickel-examples/{simple,complex,production}
|
mkdir -p ~/nickel-examples/{simple,complex,production}
|
||||||
cd ~/nickel-examples
|
cd ~/nickel-examples
|
||||||
```
|
```
|
||||||
@ -32,7 +32,7 @@ cd ~/nickel-examples
|
|||||||
|
|
||||||
### Step 1: Create Contract File
|
### Step 1: Create Contract File
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > simple/server_contracts.ncl << 'EOF'
|
cat > simple/server_contracts.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
ServerConfig = {
|
ServerConfig = {
|
||||||
@ -47,7 +47,7 @@ EOF
|
|||||||
|
|
||||||
### Step 2: Create Defaults File
|
### Step 2: Create Defaults File
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > simple/server_defaults.ncl << 'EOF'
|
cat > simple/server_defaults.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
web_server = {
|
web_server = {
|
||||||
@ -76,7 +76,7 @@ EOF
|
|||||||
|
|
||||||
### Step 3: Create Main Module with Hybrid Interface
|
### Step 3: Create Main Module with Hybrid Interface
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > simple/server.ncl << 'EOF'
|
cat > simple/server.ncl << 'EOF'
|
||||||
let contracts = import "./server_contracts.ncl" in
|
let contracts = import "./server_contracts.ncl" in
|
||||||
let defaults = import "./server_defaults.ncl" in
|
let defaults = import "./server_defaults.ncl" in
|
||||||
@ -110,7 +110,7 @@ EOF
|
|||||||
|
|
||||||
### Test: Export and Validate JSON
|
### Test: Export and Validate JSON
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cd simple/
|
cd simple/
|
||||||
|
|
||||||
# Export to JSON
|
# Export to JSON
|
||||||
@ -133,7 +133,7 @@ nickel export server.ncl --format json | jq '.production_web_server.cpu_cores'
|
|||||||
|
|
||||||
### Usage in Consumer Module
|
### Usage in Consumer Module
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > simple/consumer.ncl << 'EOF'
|
cat > simple/consumer.ncl << 'EOF'
|
||||||
let server = import "./server.ncl" in
|
let server = import "./server.ncl" in
|
||||||
|
|
||||||
@ -162,14 +162,14 @@ nickel export consumer.ncl --format json | jq '.staging_web'
|
|||||||
|
|
||||||
### Create Provider Structure
|
### Create Provider Structure
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
mkdir -p complex/upcloud/{contracts,defaults,main}
|
mkdir -p complex/upcloud/{contracts,defaults,main}
|
||||||
cd complex/upcloud
|
cd complex/upcloud
|
||||||
```
|
```
|
||||||
|
|
||||||
### Provider Contracts
|
### Provider Contracts
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > upcloud_contracts.ncl << 'EOF'
|
cat > upcloud_contracts.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
StorageBackup = {
|
StorageBackup = {
|
||||||
@ -196,7 +196,7 @@ EOF
|
|||||||
|
|
||||||
### Provider Defaults
|
### Provider Defaults
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > upcloud_defaults.ncl << 'EOF'
|
cat > upcloud_defaults.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
backup = {
|
backup = {
|
||||||
@ -223,7 +223,7 @@ EOF
|
|||||||
|
|
||||||
### Provider Main Module
|
### Provider Main Module
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > upcloud_main.ncl << 'EOF'
|
cat > upcloud_main.ncl << 'EOF'
|
||||||
let contracts = import "./upcloud_contracts.ncl" in
|
let contracts = import "./upcloud_contracts.ncl" in
|
||||||
let defaults = import "./upcloud_defaults.ncl" in
|
let defaults = import "./upcloud_defaults.ncl" in
|
||||||
@ -281,7 +281,7 @@ EOF
|
|||||||
|
|
||||||
### Test Provider Configuration
|
### Test Provider Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Export provider config
|
# Export provider config
|
||||||
nickel export upcloud_main.ncl --format json | jq '.production_high_availability'
|
nickel export upcloud_main.ncl --format json | jq '.production_high_availability'
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ nickel export upcloud_main.ncl --format json | jq '.production_high_availability
|
|||||||
|
|
||||||
### Consumer Using Provider
|
### Consumer Using Provider
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > upcloud_consumer.ncl << 'EOF'
|
cat > upcloud_consumer.ncl << 'EOF'
|
||||||
let upcloud = import "./upcloud_main.ncl" in
|
let upcloud = import "./upcloud_main.ncl" in
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ nickel export upcloud_consumer.ncl --format json | jq '.ha_stack | keys'
|
|||||||
|
|
||||||
### Taskserv Contracts (from wuji)
|
### Taskserv Contracts (from wuji)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/taskserv_contracts.ncl << 'EOF'
|
cat > production/taskserv_contracts.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
Dependency = {
|
Dependency = {
|
||||||
@ -352,7 +352,7 @@ EOF
|
|||||||
|
|
||||||
### Taskserv Defaults
|
### Taskserv Defaults
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/taskserv_defaults.ncl << 'EOF'
|
cat > production/taskserv_defaults.ncl << 'EOF'
|
||||||
{
|
{
|
||||||
kubernetes = {
|
kubernetes = {
|
||||||
@ -407,7 +407,7 @@ EOF
|
|||||||
|
|
||||||
### Taskserv Main
|
### Taskserv Main
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/taskserv.ncl << 'EOF'
|
cat > production/taskserv.ncl << 'EOF'
|
||||||
let contracts = import "./taskserv_contracts.ncl" in
|
let contracts = import "./taskserv_contracts.ncl" in
|
||||||
let defaults = import "./taskserv_defaults.ncl" in
|
let defaults = import "./taskserv_defaults.ncl" in
|
||||||
@ -453,7 +453,7 @@ EOF
|
|||||||
|
|
||||||
### Test Taskserv Setup
|
### Test Taskserv Setup
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Export stack
|
# Export stack
|
||||||
nickel export taskserv.ncl --format json | jq '.wuji_k8s_stack | keys'
|
nickel export taskserv.ncl --format json | jq '.wuji_k8s_stack | keys'
|
||||||
# Output: ["kubernetes", "cilium", "containerd", "etcd"]
|
# Output: ["kubernetes", "cilium", "containerd", "etcd"]
|
||||||
@ -477,7 +477,7 @@ nickel export taskserv.ncl --format json | jq '.staging_stack | length'
|
|||||||
|
|
||||||
### Base Infrastructure
|
### Base Infrastructure
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/infrastructure.ncl << 'EOF'
|
cat > production/infrastructure.ncl << 'EOF'
|
||||||
let servers = import "./server.ncl" in
|
let servers = import "./server.ncl" in
|
||||||
let taskservs = import "./taskserv.ncl" in
|
let taskservs = import "./taskserv.ncl" in
|
||||||
@ -520,7 +520,7 @@ nickel export infrastructure.ncl --format json | jq '.production.taskservs | key
|
|||||||
|
|
||||||
### Extending Infrastructure (Nickel Advantage!)
|
### Extending Infrastructure (Nickel Advantage!)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/infrastructure_extended.ncl << 'EOF'
|
cat > production/infrastructure_extended.ncl << 'EOF'
|
||||||
let infra = import "./infrastructure.ncl" in
|
let infra = import "./infrastructure.ncl" in
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ nickel export infrastructure_extended.ncl --format json |
|
|||||||
|
|
||||||
### Validation Functions
|
### Validation Functions
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/validation.ncl << 'EOF'
|
cat > production/validation.ncl << 'EOF'
|
||||||
let validate_server = fun server =>
|
let validate_server = fun server =>
|
||||||
if server.cpu_cores <= 0 then
|
if server.cpu_cores <= 0 then
|
||||||
@ -586,7 +586,7 @@ EOF
|
|||||||
|
|
||||||
### Using Validations
|
### Using Validations
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cat > production/validated_config.ncl << 'EOF'
|
cat > production/validated_config.ncl << 'EOF'
|
||||||
let server = import "./server.ncl" in
|
let server = import "./server.ncl" in
|
||||||
let taskserv = import "./taskserv.ncl" in
|
let taskserv = import "./taskserv.ncl" in
|
||||||
@ -632,7 +632,7 @@ nickel export validated_config.ncl --format json
|
|||||||
|
|
||||||
### Run All Examples
|
### Run All Examples
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test_all_examples.sh
|
# test_all_examples.sh
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ echo "=== All Tests Passed ✓ ==="
|
|||||||
|
|
||||||
### Common Nickel Operations
|
### Common Nickel Operations
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Validate Nickel syntax
|
# Validate Nickel syntax
|
||||||
nickel export config.ncl
|
nickel export config.ncl
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ nickel typecheck config.ncl
|
|||||||
|
|
||||||
### Problem: "unexpected token" with multiple let
|
### Problem: "unexpected token" with multiple let
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG
|
# ❌ WRONG
|
||||||
let A = {x = 1}
|
let A = {x = 1}
|
||||||
let B = {y = 2}
|
let B = {y = 2}
|
||||||
@ -725,7 +725,7 @@ let B = {y = 2} in
|
|||||||
|
|
||||||
### Problem: Function serialization fails
|
### Problem: Function serialization fails
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG - function will fail to serialize
|
# ❌ WRONG - function will fail to serialize
|
||||||
{
|
{
|
||||||
get_value = fun x => x + 1,
|
get_value = fun x => x + 1,
|
||||||
@ -741,7 +741,7 @@ let B = {y = 2} in
|
|||||||
|
|
||||||
### Problem: Null values cause export issues
|
### Problem: Null values cause export issues
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG
|
# ❌ WRONG
|
||||||
{ optional_field = null }
|
{ optional_field = null }
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Quick Decision Tree
|
## Quick Decision Tree
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
Need to define infrastructure/schemas?
|
Need to define infrastructure/schemas?
|
||||||
├─ New platform schemas → Use Nickel ✅
|
├─ New platform schemas → Use Nickel ✅
|
||||||
├─ New provider extensions → Use Nickel ✅
|
├─ New provider extensions → Use Nickel ✅
|
||||||
@ -26,7 +26,7 @@ Need to define infrastructure/schemas?
|
|||||||
|
|
||||||
#### KCL Approach
|
#### KCL Approach
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema ServerDefaults:
|
schema ServerDefaults:
|
||||||
name: str
|
name: str
|
||||||
cpu_cores: int = 2
|
cpu_cores: int = 2
|
||||||
@ -51,7 +51,7 @@ server_defaults: ServerDefaults = {
|
|||||||
|
|
||||||
**server_contracts.ncl**:
|
**server_contracts.ncl**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
ServerDefaults = {
|
ServerDefaults = {
|
||||||
name | String,
|
name | String,
|
||||||
@ -64,7 +64,7 @@ server_defaults: ServerDefaults = {
|
|||||||
|
|
||||||
**server_defaults.ncl**:
|
**server_defaults.ncl**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
server = {
|
server = {
|
||||||
name = "web-server",
|
name = "web-server",
|
||||||
@ -77,7 +77,7 @@ server_defaults: ServerDefaults = {
|
|||||||
|
|
||||||
**server.ncl**:
|
**server.ncl**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts = import "./server_contracts.ncl" in
|
let contracts = import "./server_contracts.ncl" in
|
||||||
let defaults = import "./server_defaults.ncl" in
|
let defaults = import "./server_defaults.ncl" in
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ let defaults = import "./server_defaults.ncl" in
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let server = import "./server.ncl" in
|
let server = import "./server.ncl" in
|
||||||
|
|
||||||
# Simple override
|
# Simple override
|
||||||
@ -117,7 +117,7 @@ my_custom = server.defaults.server & {
|
|||||||
|
|
||||||
#### KCL (from `provisioning/extensions/providers/upcloud/nickel/` - legacy approach)
|
#### KCL (from `provisioning/extensions/providers/upcloud/nickel/` - legacy approach)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema StorageBackup:
|
schema StorageBackup:
|
||||||
backup_id: str
|
backup_id: str
|
||||||
frequency: str
|
frequency: str
|
||||||
@ -145,7 +145,7 @@ provision_upcloud: ProvisionUpcloud = {
|
|||||||
|
|
||||||
**upcloud_contracts.ncl**:
|
**upcloud_contracts.ncl**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
StorageBackup = {
|
StorageBackup = {
|
||||||
backup_id | String,
|
backup_id | String,
|
||||||
@ -170,7 +170,7 @@ provision_upcloud: ProvisionUpcloud = {
|
|||||||
|
|
||||||
**upcloud_defaults.ncl**:
|
**upcloud_defaults.ncl**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
storage_backup = {
|
storage_backup = {
|
||||||
backup_id = "",
|
backup_id = "",
|
||||||
@ -195,7 +195,7 @@ provision_upcloud: ProvisionUpcloud = {
|
|||||||
|
|
||||||
**upcloud_main.ncl** (from actual codebase):
|
**upcloud_main.ncl** (from actual codebase):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts = import "./upcloud_contracts.ncl" in
|
let contracts = import "./upcloud_contracts.ncl" in
|
||||||
let defaults = import "./upcloud_defaults.ncl" in
|
let defaults = import "./upcloud_defaults.ncl" in
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ let defaults = import "./upcloud_defaults.ncl" in
|
|||||||
|
|
||||||
**Usage Comparison**:
|
**Usage Comparison**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# KCL way (KCL no lo permite bien)
|
# KCL way (KCL no lo permite bien)
|
||||||
# Cannot easily extend without schema modification
|
# Cannot easily extend without schema modification
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ production_stack = upcloud.make_provision_upcloud {
|
|||||||
|
|
||||||
**KCL (Legacy)**:
|
**KCL (Legacy)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema ServerConfig:
|
schema ServerConfig:
|
||||||
name: str
|
name: str
|
||||||
zone: str = "us-nyc1"
|
zone: str = "us-nyc1"
|
||||||
@ -300,7 +300,7 @@ web_server: ServerConfig = {
|
|||||||
|
|
||||||
**Nickel (Recommended)**:
|
**Nickel (Recommended)**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let defaults = import "./server_defaults.ncl" in
|
let defaults = import "./server_defaults.ncl" in
|
||||||
web_server = defaults.make_server { name = "web-01" }
|
web_server = defaults.make_server { name = "web-01" }
|
||||||
```
|
```
|
||||||
@ -313,7 +313,7 @@ web_server = defaults.make_server { name = "web-01" }
|
|||||||
|
|
||||||
**KCL** (from wuji infrastructure):
|
**KCL** (from wuji infrastructure):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema TaskServDependency:
|
schema TaskServDependency:
|
||||||
name: str
|
name: str
|
||||||
wait_for_health: bool = false
|
wait_for_health: bool = false
|
||||||
@ -343,7 +343,7 @@ taskserv_cilium: TaskServ = {
|
|||||||
|
|
||||||
**Nickel** (from wuji/main.ncl):
|
**Nickel** (from wuji/main.ncl):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let ts_kubernetes = import "./taskservs/kubernetes.ncl" in
|
let ts_kubernetes = import "./taskservs/kubernetes.ncl" in
|
||||||
let ts_cilium = import "./taskservs/cilium.ncl" in
|
let ts_cilium = import "./taskservs/cilium.ncl" in
|
||||||
let ts_containerd = import "./taskservs/containerd.ncl" in
|
let ts_containerd = import "./taskservs/containerd.ncl" in
|
||||||
@ -367,7 +367,7 @@ let ts_containerd = import "./taskservs/containerd.ncl" in
|
|||||||
|
|
||||||
**KCL**:
|
**KCL**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema ServerConfig:
|
schema ServerConfig:
|
||||||
name: str
|
name: str
|
||||||
# Would need to modify schema!
|
# Would need to modify schema!
|
||||||
@ -379,7 +379,7 @@ schema ServerConfig:
|
|||||||
|
|
||||||
**Nickel**:
|
**Nickel**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let server = import "./server.ncl" in
|
let server = import "./server.ncl" in
|
||||||
|
|
||||||
# Add custom fields without modifying schema!
|
# Add custom fields without modifying schema!
|
||||||
@ -402,7 +402,7 @@ my_server = server.defaults.server & {
|
|||||||
|
|
||||||
**KCL Approach (Legacy)**:
|
**KCL Approach (Legacy)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema ServerDefaults:
|
schema ServerDefaults:
|
||||||
cpu: int = 2
|
cpu: int = 2
|
||||||
memory: int = 4
|
memory: int = 4
|
||||||
@ -423,7 +423,7 @@ server: Server = {
|
|||||||
|
|
||||||
**Nickel Approach**:
|
**Nickel Approach**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# defaults.ncl
|
# defaults.ncl
|
||||||
server_defaults = {
|
server_defaults = {
|
||||||
cpu = 2,
|
cpu = 2,
|
||||||
@ -449,7 +449,7 @@ server = make_server {
|
|||||||
|
|
||||||
**KCL Validation (Legacy)** (compile-time, inline):
|
**KCL Validation (Legacy)** (compile-time, inline):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema Config:
|
schema Config:
|
||||||
timeout: int = 5
|
timeout: int = 5
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ schema Config:
|
|||||||
|
|
||||||
**Nickel Validation** (runtime, contract-based):
|
**Nickel Validation** (runtime, contract-based):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# contracts.ncl - Pure type definitions
|
# contracts.ncl - Pure type definitions
|
||||||
Config = {
|
Config = {
|
||||||
timeout | Number,
|
timeout | Number,
|
||||||
@ -495,7 +495,7 @@ my_config = validate_config { timeout = 10 }
|
|||||||
|
|
||||||
**Before (KCL - Legacy)**:
|
**Before (KCL - Legacy)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema Scheduler:
|
schema Scheduler:
|
||||||
strategy: str = "fifo"
|
strategy: str = "fifo"
|
||||||
workers: int = 4
|
workers: int = 4
|
||||||
@ -513,7 +513,7 @@ scheduler_config: Scheduler = {
|
|||||||
|
|
||||||
`scheduler_contracts.ncl`:
|
`scheduler_contracts.ncl`:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
Scheduler = {
|
Scheduler = {
|
||||||
strategy | String,
|
strategy | String,
|
||||||
@ -524,7 +524,7 @@ scheduler_config: Scheduler = {
|
|||||||
|
|
||||||
`scheduler_defaults.ncl`:
|
`scheduler_defaults.ncl`:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
scheduler = {
|
scheduler = {
|
||||||
strategy = "fifo",
|
strategy = "fifo",
|
||||||
@ -535,7 +535,7 @@ scheduler_config: Scheduler = {
|
|||||||
|
|
||||||
`scheduler.ncl`:
|
`scheduler.ncl`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts = import "./scheduler_contracts.ncl" in
|
let contracts = import "./scheduler_contracts.ncl" in
|
||||||
let defaults = import "./scheduler_defaults.ncl" in
|
let defaults = import "./scheduler_defaults.ncl" in
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ let defaults = import "./scheduler_defaults.ncl" in
|
|||||||
|
|
||||||
**Before (KCL - Legacy)**:
|
**Before (KCL - Legacy)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema Mode:
|
schema Mode:
|
||||||
deployment_type: str = "solo" # "solo" | "multiuser" | "cicd" | "enterprise"
|
deployment_type: str = "solo" # "solo" | "multiuser" | "cicd" | "enterprise"
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ schema Mode:
|
|||||||
|
|
||||||
**After (Nickel - Current)**:
|
**After (Nickel - Current)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# contracts.ncl
|
# contracts.ncl
|
||||||
{
|
{
|
||||||
Mode = {
|
Mode = {
|
||||||
@ -592,7 +592,7 @@ schema Mode:
|
|||||||
|
|
||||||
**Before (KCL - Legacy)**:
|
**Before (KCL - Legacy)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
schema ServerDefaults:
|
schema ServerDefaults:
|
||||||
cpu: int = 2
|
cpu: int = 2
|
||||||
memory: int = 4
|
memory: int = 4
|
||||||
@ -609,7 +609,7 @@ web_server: Server = {
|
|||||||
|
|
||||||
**After (Nickel - Current)**:
|
**After (Nickel - Current)**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# defaults.ncl
|
# defaults.ncl
|
||||||
{
|
{
|
||||||
server_defaults = {
|
server_defaults = {
|
||||||
@ -643,7 +643,7 @@ let make_server = fun config =>
|
|||||||
|
|
||||||
**Workflow**:
|
**Workflow**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Edit workspace config
|
# Edit workspace config
|
||||||
cd workspace_librecloud/nickel
|
cd workspace_librecloud/nickel
|
||||||
vim wuji/main.ncl
|
vim wuji/main.ncl
|
||||||
@ -658,7 +658,7 @@ nickel export wuji/main.ncl # Uses updated schemas
|
|||||||
|
|
||||||
**Imports** (relative, central):
|
**Imports** (relative, central):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
import "../../provisioning/schemas/main.ncl"
|
import "../../provisioning/schemas/main.ncl"
|
||||||
import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
||||||
```
|
```
|
||||||
@ -671,7 +671,7 @@ import "../../provisioning/extensions/taskservs/kubernetes/nickel/main.ncl"
|
|||||||
|
|
||||||
**Workflow**:
|
**Workflow**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# 1. Create immutable snapshot
|
# 1. Create immutable snapshot
|
||||||
provisioning workspace freeze
|
provisioning workspace freeze
|
||||||
--version "2025-12-15-prod-v1"
|
--version "2025-12-15-prod-v1"
|
||||||
@ -696,7 +696,7 @@ provisioning deploy
|
|||||||
|
|
||||||
**Frozen Imports** (rewritten to local):
|
**Frozen Imports** (rewritten to local):
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Original in workspace
|
# Original in workspace
|
||||||
import "../../provisioning/schemas/main.ncl"
|
import "../../provisioning/schemas/main.ncl"
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ import "./provisioning/schemas/main.ncl"
|
|||||||
|
|
||||||
**Problem**:
|
**Problem**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG
|
# ❌ WRONG
|
||||||
let A = { x = 1 }
|
let A = { x = 1 }
|
||||||
let B = { y = 2 }
|
let B = { y = 2 }
|
||||||
@ -731,7 +731,7 @@ Error: `unexpected token`
|
|||||||
|
|
||||||
**Solution**: Use `let...in` chaining:
|
**Solution**: Use `let...in` chaining:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ✅ CORRECT
|
# ✅ CORRECT
|
||||||
let A = { x = 1 } in
|
let A = { x = 1 } in
|
||||||
let B = { y = 2 } in
|
let B = { y = 2 } in
|
||||||
@ -744,7 +744,7 @@ let B = { y = 2 } in
|
|||||||
|
|
||||||
**Problem**:
|
**Problem**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG
|
# ❌ WRONG
|
||||||
let StorageVol = {
|
let StorageVol = {
|
||||||
mount_path : String | null = null,
|
mount_path : String | null = null,
|
||||||
@ -757,7 +757,7 @@ Error: `this can't be used as a contract`
|
|||||||
|
|
||||||
**Solution**: Use untyped assignment:
|
**Solution**: Use untyped assignment:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ✅ CORRECT
|
# ✅ CORRECT
|
||||||
let StorageVol = {
|
let StorageVol = {
|
||||||
mount_path = null,
|
mount_path = null,
|
||||||
@ -770,7 +770,7 @@ let StorageVol = {
|
|||||||
|
|
||||||
**Problem**:
|
**Problem**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ WRONG
|
# ❌ WRONG
|
||||||
{
|
{
|
||||||
get_value = fun x => x + 1,
|
get_value = fun x => x + 1,
|
||||||
@ -782,7 +782,7 @@ Error: Functions can't be serialized
|
|||||||
|
|
||||||
**Solution**: Mark helper functions `not_exported`:
|
**Solution**: Mark helper functions `not_exported`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ✅ CORRECT
|
# ✅ CORRECT
|
||||||
{
|
{
|
||||||
get_value | not_exported = fun x => x + 1,
|
get_value | not_exported = fun x => x + 1,
|
||||||
@ -796,7 +796,7 @@ Error: Functions can't be serialized
|
|||||||
|
|
||||||
**Problem**:
|
**Problem**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let defaults = import "./defaults.ncl" in
|
let defaults = import "./defaults.ncl" in
|
||||||
defaults.scheduler_config # But file has "scheduler"
|
defaults.scheduler_config # But file has "scheduler"
|
||||||
```
|
```
|
||||||
@ -805,7 +805,7 @@ Error: `field not found`
|
|||||||
|
|
||||||
**Solution**: Use exact field names:
|
**Solution**: Use exact field names:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let defaults = import "./defaults.ncl" in
|
let defaults = import "./defaults.ncl" in
|
||||||
defaults.scheduler # Correct name from defaults.ncl
|
defaults.scheduler # Correct name from defaults.ncl
|
||||||
```
|
```
|
||||||
@ -818,7 +818,7 @@ defaults.scheduler # Correct name from defaults.ncl
|
|||||||
|
|
||||||
**Solution**: Check for circular references or missing `not_exported`:
|
**Solution**: Check for circular references or missing `not_exported`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# ❌ Slow - functions being serialized
|
# ❌ Slow - functions being serialized
|
||||||
{
|
{
|
||||||
validate_config = fun x => x,
|
validate_config = fun x => x,
|
||||||
@ -917,7 +917,7 @@ Type-safe prompts, forms, and schemas that **bidirectionally integrate with Nick
|
|||||||
|
|
||||||
### Workflow: Nickel Schemas → Interactive UIs → Nickel Output
|
### Workflow: Nickel Schemas → Interactive UIs → Nickel Output
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# 1. Define schema in Nickel
|
# 1. Define schema in Nickel
|
||||||
cat > server.ncl << 'EOF'
|
cat > server.ncl << 'EOF'
|
||||||
let contracts = import "./contracts.ncl" in
|
let contracts = import "./contracts.ncl" in
|
||||||
@ -952,7 +952,7 @@ typedialog form --input form.toml --output nickel
|
|||||||
|
|
||||||
### Example: Infrastructure Wizard
|
### Example: Infrastructure Wizard
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# User runs
|
# User runs
|
||||||
provisioning init --wizard
|
provisioning init --wizard
|
||||||
|
|
||||||
@ -1014,7 +1014,7 @@ provisioning/schemas/config/workspace_config/main.ncl
|
|||||||
|
|
||||||
**File**: `provisioning/schemas/main.ncl` (174 lines)
|
**File**: `provisioning/schemas/main.ncl` (174 lines)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Domain-organized architecture
|
# Domain-organized architecture
|
||||||
{
|
{
|
||||||
lib | doc "Core library types"
|
lib | doc "Core library types"
|
||||||
@ -1054,7 +1054,7 @@ provisioning/schemas/config/workspace_config/main.ncl
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let provisioning = import "./main.ncl" in
|
let provisioning = import "./main.ncl" in
|
||||||
|
|
||||||
provisioning.lib.Storage
|
provisioning.lib.Storage
|
||||||
@ -1069,7 +1069,7 @@ provisioning.operations.workflows
|
|||||||
|
|
||||||
**File**: `provisioning/extensions/providers/upcloud/nickel/main.ncl` (38 lines)
|
**File**: `provisioning/extensions/providers/upcloud/nickel/main.ncl` (38 lines)
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts_lib = import "./contracts.ncl" in
|
let contracts_lib = import "./contracts.ncl" in
|
||||||
let defaults_lib = import "./defaults.ncl" in
|
let defaults_lib = import "./defaults.ncl" in
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ let defaults_lib = import "./defaults.ncl" in
|
|||||||
|
|
||||||
**File**: `workspace_librecloud/nickel/wuji/main.ncl` (53 lines)
|
**File**: `workspace_librecloud/nickel/wuji/main.ncl` (53 lines)
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let settings_config = import "./settings.ncl" in
|
let settings_config = import "./settings.ncl" in
|
||||||
let ts_cilium = import "./taskservs/cilium.ncl" in
|
let ts_cilium = import "./taskservs/cilium.ncl" in
|
||||||
let ts_containerd = import "./taskservs/containerd.ncl" in
|
let ts_containerd = import "./taskservs/containerd.ncl" in
|
||||||
|
|||||||
@ -15,7 +15,7 @@ verification, Cedar authorization, rate limiting, and audit logging) into a cohe
|
|||||||
|
|
||||||
The middleware chain is applied in this specific order to ensure proper security:
|
The middleware chain is applied in this specific order to ensure proper security:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ Incoming HTTP Request │
|
│ Incoming HTTP Request │
|
||||||
└────────────────────────┬────────────────────────────────────────┘
|
└────────────────────────┬────────────────────────────────────────┘
|
||||||
@ -90,7 +90,7 @@ The middleware chain is applied in this specific order to ensure proper security
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct SecurityContext {
|
pub struct SecurityContext {
|
||||||
pub user_id: String,
|
pub user_id: String,
|
||||||
pub token: ValidatedToken,
|
pub token: ValidatedToken,
|
||||||
@ -164,7 +164,7 @@ impl SecurityContext {
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
fn requires_mfa(method: &str, path: &str) -> bool {
|
fn requires_mfa(method: &str, path: &str) -> bool {
|
||||||
if path.contains("/production/") { return true; }
|
if path.contains("/production/") { return true; }
|
||||||
if method == "DELETE" { return true; }
|
if method == "DELETE" { return true; }
|
||||||
@ -190,7 +190,7 @@ fn requires_mfa(method: &str, path: &str) -> bool {
|
|||||||
|
|
||||||
**Resource Mapping**:
|
**Resource Mapping**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/api/v1/servers/srv-123 → Resource::Server("srv-123")
|
/api/v1/servers/srv-123 → Resource::Server("srv-123")
|
||||||
/api/v1/taskserv/kubernetes → Resource::TaskService("kubernetes")
|
/api/v1/taskserv/kubernetes → Resource::TaskService("kubernetes")
|
||||||
/api/v1/cluster/prod → Resource::Cluster("prod")
|
/api/v1/cluster/prod → Resource::Cluster("prod")
|
||||||
@ -199,7 +199,7 @@ fn requires_mfa(method: &str, path: &str) -> bool {
|
|||||||
|
|
||||||
**Action Mapping**:
|
**Action Mapping**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
GET → Action::Read
|
GET → Action::Read
|
||||||
POST → Action::Create
|
POST → Action::Create
|
||||||
PUT → Action::Update
|
PUT → Action::Update
|
||||||
@ -223,7 +223,7 @@ DELETE → Action::Delete
|
|||||||
|
|
||||||
**Configuration**:
|
**Configuration**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct RateLimitConfig {
|
pub struct RateLimitConfig {
|
||||||
pub max_requests: u32, // for example, 100
|
pub max_requests: u32, // for example, 100
|
||||||
pub window_duration: Duration, // for example, 60 seconds
|
pub window_duration: Duration, // for example, 60 seconds
|
||||||
@ -236,7 +236,7 @@ pub struct RateLimitConfig {
|
|||||||
|
|
||||||
**Statistics**:
|
**Statistics**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct RateLimitStats {
|
pub struct RateLimitStats {
|
||||||
pub total_ips: usize, // Number of tracked IPs
|
pub total_ips: usize, // Number of tracked IPs
|
||||||
pub total_requests: u32, // Total requests made
|
pub total_requests: u32, // Total requests made
|
||||||
@ -261,7 +261,7 @@ pub struct RateLimitStats {
|
|||||||
|
|
||||||
**Usage Example**:
|
**Usage Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use provisioning_orchestrator::security_integration::{
|
use provisioning_orchestrator::security_integration::{
|
||||||
SecurityComponents, SecurityConfig
|
SecurityComponents, SecurityConfig
|
||||||
};
|
};
|
||||||
@ -292,7 +292,7 @@ let secured_app = apply_security_middleware(app, &security);
|
|||||||
|
|
||||||
### Updated AppState Structure
|
### Updated AppState Structure
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
// Existing fields
|
// Existing fields
|
||||||
pub task_storage: Arc<dyn TaskStorage>,
|
pub task_storage: Arc<dyn TaskStorage>,
|
||||||
@ -317,7 +317,7 @@ pub struct AppState {
|
|||||||
|
|
||||||
### Initialization in main.rs
|
### Initialization in main.rs
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
@ -398,7 +398,7 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
### Step-by-Step Flow
|
### Step-by-Step Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. CLIENT REQUEST
|
1. CLIENT REQUEST
|
||||||
├─ Headers:
|
├─ Headers:
|
||||||
│ ├─ Authorization: Bearer <jwt_token>
|
│ ├─ Authorization: Bearer <jwt_token>
|
||||||
@ -485,7 +485,7 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# JWT Configuration
|
# JWT Configuration
|
||||||
JWT_ISSUER=control-center
|
JWT_ISSUER=control-center
|
||||||
JWT_AUDIENCE=orchestrator
|
JWT_AUDIENCE=orchestrator
|
||||||
@ -513,7 +513,7 @@ AUDIT_RETENTION_DAYS=365
|
|||||||
|
|
||||||
For development/testing, all security can be disabled:
|
For development/testing, all security can be disabled:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// In main.rs
|
// In main.rs
|
||||||
let security = if env::var("DEVELOPMENT_MODE").unwrap_or("false".to_string()) == "true" {
|
let security = if env::var("DEVELOPMENT_MODE").unwrap_or("false".to_string()) == "true" {
|
||||||
SecurityComponents::disabled(audit_logger.clone())
|
SecurityComponents::disabled(audit_logger.clone())
|
||||||
@ -544,7 +544,7 @@ Location: `provisioning/platform/orchestrator/tests/security_integration_tests.r
|
|||||||
|
|
||||||
**Run Tests**:
|
**Run Tests**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/platform/orchestrator
|
cd provisioning/platform/orchestrator
|
||||||
cargo test security_integration_tests
|
cargo test security_integration_tests
|
||||||
```
|
```
|
||||||
|
|||||||
@ -54,7 +54,7 @@ http post <http://localhost:9090/workflows/servers/create> {
|
|||||||
|
|
||||||
1. Orchestrator receives and queues:
|
1. Orchestrator receives and queues:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Orchestrator receives HTTP request
|
// Orchestrator receives HTTP request
|
||||||
async fn create_server_workflow(request) {
|
async fn create_server_workflow(request) {
|
||||||
let task = Task::new(TaskType::ServerCreate, request);
|
let task = Task::new(TaskType::ServerCreate, request);
|
||||||
@ -65,7 +65,7 @@ async fn create_server_workflow(request) {
|
|||||||
|
|
||||||
2. Orchestrator executes via Nushell subprocess:
|
2. Orchestrator executes via Nushell subprocess:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
// Orchestrator spawns Nushell to run business logic
|
// Orchestrator spawns Nushell to run business logic
|
||||||
async fn execute_task(task: Task) {
|
async fn execute_task(task: Task) {
|
||||||
let output = Command::new("nu")
|
let output = Command::new("nu")
|
||||||
@ -80,7 +80,7 @@ async fn execute_task(task: Task) {
|
|||||||
|
|
||||||
3. Nushell executes the actual work:
|
3. Nushell executes the actual work:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# servers/create.nu
|
# servers/create.nu
|
||||||
|
|
||||||
export def create-server [name: string] {
|
export def create-server [name: string] {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ functionality.
|
|||||||
|
|
||||||
**Original Issue:**
|
**Original Issue:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Deep call stack in Nushell (template.nu:71)
|
Deep call stack in Nushell (template.nu:71)
|
||||||
→ "Type not supported" errors
|
→ "Type not supported" errors
|
||||||
→ Cannot handle complex nested workflows
|
→ Cannot handle complex nested workflows
|
||||||
@ -35,7 +35,7 @@ Deep call stack in Nushell (template.nu:71)
|
|||||||
|
|
||||||
### How It Works Today (Monorepo)
|
### How It Works Today (Monorepo)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
│ User │
|
│ User │
|
||||||
└───────────────────────────┬─────────────────────────────────┘
|
└───────────────────────────┬─────────────────────────────────┘
|
||||||
@ -80,7 +80,7 @@ Deep call stack in Nushell (template.nu:71)
|
|||||||
|
|
||||||
#### Mode 1: Direct Mode (Simple Operations)
|
#### Mode 1: Direct Mode (Simple Operations)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# No orchestrator needed
|
# No orchestrator needed
|
||||||
provisioning server list
|
provisioning server list
|
||||||
provisioning env
|
provisioning env
|
||||||
@ -92,7 +92,7 @@ provisioning (CLI) → Nushell scripts → Result
|
|||||||
|
|
||||||
#### Mode 2: Orchestrated Mode (Complex Operations)
|
#### Mode 2: Orchestrated Mode (Complex Operations)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Uses orchestrator for coordination
|
# Uses orchestrator for coordination
|
||||||
provisioning server create --orchestrated
|
provisioning server create --orchestrated
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ provisioning CLI → Orchestrator API → Task Queue → Nushell executor
|
|||||||
|
|
||||||
#### Mode 3: Workflow Mode (Batch Operations)
|
#### Mode 3: Workflow Mode (Batch Operations)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Complex workflows with dependencies
|
# Complex workflows with dependencies
|
||||||
provisioning workflow submit server-cluster.ncl
|
provisioning workflow submit server-cluster.ncl
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ provisioning CLI → Orchestrator Workflow Engine → Dependency Graph
|
|||||||
|
|
||||||
**Nushell CLI (`core/nulib/workflows/server_create.nu`):**
|
**Nushell CLI (`core/nulib/workflows/server_create.nu`):**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Submit server creation workflow to orchestrator
|
# Submit server creation workflow to orchestrator
|
||||||
export def server_create_workflow [
|
export def server_create_workflow [
|
||||||
infra_name: string
|
infra_name: string
|
||||||
@ -153,7 +153,7 @@ export def server_create_workflow [
|
|||||||
|
|
||||||
**Rust Orchestrator (`platform/orchestrator/src/api/workflows.rs`):**
|
**Rust Orchestrator (`platform/orchestrator/src/api/workflows.rs`):**
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
// Receive workflow submission from Nushell CLI
|
// Receive workflow submission from Nushell CLI
|
||||||
#[axum::debug_handler]
|
#[axum::debug_handler]
|
||||||
async fn create_server_workflow(
|
async fn create_server_workflow(
|
||||||
@ -183,7 +183,7 @@ async fn create_server_workflow(
|
|||||||
|
|
||||||
**Flow:**
|
**Flow:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User → provisioning server create --orchestrated
|
User → provisioning server create --orchestrated
|
||||||
↓
|
↓
|
||||||
Nushell CLI prepares task
|
Nushell CLI prepares task
|
||||||
@ -201,7 +201,7 @@ User can monitor: provisioning workflow monitor <id>
|
|||||||
|
|
||||||
**Orchestrator Task Executor (`platform/orchestrator/src/executor.rs`):**
|
**Orchestrator Task Executor (`platform/orchestrator/src/executor.rs`):**
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
// Orchestrator spawns Nushell to execute business logic
|
// Orchestrator spawns Nushell to execute business logic
|
||||||
pub async fn execute_task(task: Task) -> Result<TaskResult> {
|
pub async fn execute_task(task: Task) -> Result<TaskResult> {
|
||||||
match task.task_type {
|
match task.task_type {
|
||||||
@ -233,7 +233,7 @@ pub async fn execute_task(task: Task) -> Result<TaskResult> {
|
|||||||
|
|
||||||
**Flow:**
|
**Flow:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Orchestrator task queue has pending task
|
Orchestrator task queue has pending task
|
||||||
↓
|
↓
|
||||||
Executor picks up task
|
Executor picks up task
|
||||||
@ -253,7 +253,7 @@ User monitors via: provisioning workflow status <id>
|
|||||||
|
|
||||||
**Nushell Calls Orchestrator API:**
|
**Nushell Calls Orchestrator API:**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Nushell script checks orchestrator status during execution
|
# Nushell script checks orchestrator status during execution
|
||||||
export def check-orchestrator-health [] {
|
export def check-orchestrator-health [] {
|
||||||
let response = (http get http://localhost:9090/health)
|
let response = (http get http://localhost:9090/health)
|
||||||
@ -276,7 +276,7 @@ export def report-progress [task_id: string, progress: int] {
|
|||||||
|
|
||||||
**Orchestrator Monitors Nushell Execution:**
|
**Orchestrator Monitors Nushell Execution:**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
// Orchestrator tracks Nushell subprocess
|
// Orchestrator tracks Nushell subprocess
|
||||||
pub async fn execute_with_monitoring(task: Task) -> Result<TaskResult> {
|
pub async fn execute_with_monitoring(task: Task) -> Result<TaskResult> {
|
||||||
let mut child = Command::new("nu")
|
let mut child = Command::new("nu")
|
||||||
@ -332,7 +332,7 @@ pub async fn execute_with_monitoring(task: Task) -> Result<TaskResult> {
|
|||||||
|
|
||||||
**Runtime Integration (Same as Monorepo):**
|
**Runtime Integration (Same as Monorepo):**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User installs both packages:
|
User installs both packages:
|
||||||
provisioning-core-3.2.1 → /usr/local/lib/provisioning/
|
provisioning-core-3.2.1 → /usr/local/lib/provisioning/
|
||||||
provisioning-platform-2.5.3 → /usr/local/bin/provisioning-orchestrator
|
provisioning-platform-2.5.3 → /usr/local/bin/provisioning-orchestrator
|
||||||
@ -347,7 +347,7 @@ No code dependencies, just runtime coordination!
|
|||||||
|
|
||||||
**Core Package (`provisioning-core`) config:**
|
**Core Package (`provisioning-core`) config:**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# /usr/local/share/provisioning/config/config.defaults.toml
|
# /usr/local/share/provisioning/config/config.defaults.toml
|
||||||
|
|
||||||
[orchestrator]
|
[orchestrator]
|
||||||
@ -363,7 +363,7 @@ fallback_to_direct = true # Fall back if orchestrator down
|
|||||||
|
|
||||||
**Platform Package (`provisioning-platform`) config:**
|
**Platform Package (`provisioning-platform`) config:**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# /usr/local/share/provisioning/platform/config.toml
|
# /usr/local/share/provisioning/platform/config.toml
|
||||||
|
|
||||||
[orchestrator]
|
[orchestrator]
|
||||||
@ -382,7 +382,7 @@ task_timeout_seconds = 3600
|
|||||||
|
|
||||||
**Compatibility Matrix (`provisioning-distribution/versions.toml`):**
|
**Compatibility Matrix (`provisioning-distribution/versions.toml`):**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[compatibility.platform."2.5.3"]
|
[compatibility.platform."2.5.3"]
|
||||||
core = "^3.2" # Platform 2.5.3 compatible with core 3.2.x
|
core = "^3.2" # Platform 2.5.3 compatible with core 3.2.x
|
||||||
min-core = "3.2.0"
|
min-core = "3.2.0"
|
||||||
@ -402,7 +402,7 @@ orchestrator-api = "v1"
|
|||||||
|
|
||||||
**No Orchestrator Needed:**
|
**No Orchestrator Needed:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server list
|
provisioning server list
|
||||||
|
|
||||||
# Flow:
|
# Flow:
|
||||||
@ -414,7 +414,7 @@ CLI → servers/list.nu → Query state → Return results
|
|||||||
|
|
||||||
**Using Orchestrator:**
|
**Using Orchestrator:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create --orchestrated --infra wuji
|
provisioning server create --orchestrated --infra wuji
|
||||||
|
|
||||||
# Detailed Flow:
|
# Detailed Flow:
|
||||||
@ -466,7 +466,7 @@ provisioning server create --orchestrated --infra wuji
|
|||||||
|
|
||||||
**Complex Workflow:**
|
**Complex Workflow:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning batch submit multi-cloud-deployment.ncl
|
provisioning batch submit multi-cloud-deployment.ncl
|
||||||
|
|
||||||
# Workflow contains:
|
# Workflow contains:
|
||||||
@ -548,8 +548,7 @@ provisioning batch submit multi-cloud-deployment.ncl
|
|||||||
|
|
||||||
1. **Reliable State Management**
|
1. **Reliable State Management**
|
||||||
|
|
||||||
```text
|
``` Orchestrator maintains:
|
||||||
Orchestrator maintains:
|
|
||||||
- Task queue (survives crashes)
|
- Task queue (survives crashes)
|
||||||
- Workflow checkpoints (resume on failure)
|
- Workflow checkpoints (resume on failure)
|
||||||
- Progress tracking (real-time monitoring)
|
- Progress tracking (real-time monitoring)
|
||||||
@ -558,8 +557,7 @@ provisioning batch submit multi-cloud-deployment.ncl
|
|||||||
|
|
||||||
1. **Clean Separation**
|
1. **Clean Separation**
|
||||||
|
|
||||||
```text
|
``` Orchestrator (Rust): Performance, concurrency, state
|
||||||
Orchestrator (Rust): Performance, concurrency, state
|
|
||||||
Business Logic (Nushell): Providers, taskservs, workflows
|
Business Logic (Nushell): Providers, taskservs, workflows
|
||||||
|
|
||||||
Each does what it's best at!
|
Each does what it's best at!
|
||||||
@ -594,7 +592,7 @@ provisioning batch submit multi-cloud-deployment.ncl
|
|||||||
|
|
||||||
**User installs bundle:**
|
**User installs bundle:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
curl -fsSL https://get.provisioning.io | sh
|
curl -fsSL https://get.provisioning.io | sh
|
||||||
|
|
||||||
# Installs:
|
# Installs:
|
||||||
@ -614,7 +612,7 @@ curl -fsSL https://get.provisioning.io | sh
|
|||||||
|
|
||||||
**Core package expects orchestrator:**
|
**Core package expects orchestrator:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# core/nulib/lib_provisioning/orchestrator/client.nu
|
# core/nulib/lib_provisioning/orchestrator/client.nu
|
||||||
|
|
||||||
# Check if orchestrator is running
|
# Check if orchestrator is running
|
||||||
@ -644,7 +642,7 @@ export def ensure-orchestrator [] {
|
|||||||
|
|
||||||
**Platform package executes core scripts:**
|
**Platform package executes core scripts:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// platform/orchestrator/src/executor/nushell.rs
|
// platform/orchestrator/src/executor/nushell.rs
|
||||||
|
|
||||||
pub struct NushellExecutor {
|
pub struct NushellExecutor {
|
||||||
@ -689,7 +687,7 @@ impl NushellExecutor {
|
|||||||
|
|
||||||
**`/usr/local/share/provisioning/config/config.defaults.toml`:**
|
**`/usr/local/share/provisioning/config/config.defaults.toml`:**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[orchestrator]
|
[orchestrator]
|
||||||
enabled = true
|
enabled = true
|
||||||
endpoint = "http://localhost:9090"
|
endpoint = "http://localhost:9090"
|
||||||
@ -722,7 +720,7 @@ force_direct = [
|
|||||||
|
|
||||||
**`/usr/local/share/provisioning/platform/config.toml`:**
|
**`/usr/local/share/provisioning/platform/config.toml`:**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[server]
|
[server]
|
||||||
host = "127.0.0.1"
|
host = "127.0.0.1"
|
||||||
port = 8080
|
port = 8080
|
||||||
@ -780,7 +778,7 @@ env_vars = { NU_LIB_DIRS = "/usr/local/lib/provisioning" }
|
|||||||
|
|
||||||
The confusing example in the multi-repo doc was **oversimplified**. The real architecture is:
|
The confusing example in the multi-repo doc was **oversimplified**. The real architecture is:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
✅ Orchestrator IS USED and IS ESSENTIAL
|
✅ Orchestrator IS USED and IS ESSENTIAL
|
||||||
✅ Platform (Rust) coordinates Core (Nushell) execution
|
✅ Platform (Rust) coordinates Core (Nushell) execution
|
||||||
✅ Loose coupling via CLI + REST API (not code dependencies)
|
✅ Loose coupling via CLI + REST API (not code dependencies)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ Contains fundamental schemas for provisioning:
|
|||||||
|
|
||||||
#### Discovery Commands
|
#### Discovery Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Discover available modules
|
# Discover available modules
|
||||||
module-loader discover taskservs # List all taskservs
|
module-loader discover taskservs # List all taskservs
|
||||||
module-loader discover providers --format yaml # List providers as YAML
|
module-loader discover providers --format yaml # List providers as YAML
|
||||||
@ -58,7 +58,7 @@ module-loader discover clusters redis # Search for redis clusters
|
|||||||
|
|
||||||
#### Loading Commands
|
#### Loading Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Load modules into workspace
|
# Load modules into workspace
|
||||||
module-loader load taskservs . [kubernetes, cilium, containerd]
|
module-loader load taskservs . [kubernetes, cilium, containerd]
|
||||||
module-loader load providers . [upcloud]
|
module-loader load providers . [upcloud]
|
||||||
@ -81,7 +81,7 @@ module-loader init workspace/infra/production
|
|||||||
|
|
||||||
### New Workspace Layout
|
### New Workspace Layout
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace/infra/my-project/
|
workspace/infra/my-project/
|
||||||
├── kcl.mod # Package dependencies
|
├── kcl.mod # Package dependencies
|
||||||
├── servers.ncl # Main server configuration
|
├── servers.ncl # Main server configuration
|
||||||
@ -110,7 +110,7 @@ workspace/infra/my-project/
|
|||||||
|
|
||||||
#### Before (Old System)
|
#### Before (Old System)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Hardcoded relative paths
|
# Hardcoded relative paths
|
||||||
import ../../../kcl/server as server
|
import ../../../kcl/server as server
|
||||||
import ../../../extensions/taskservs/kubernetes/kcl/kubernetes as k8s
|
import ../../../extensions/taskservs/kubernetes/kcl/kubernetes as k8s
|
||||||
@ -118,7 +118,7 @@ import ../../../extensions/taskservs/kubernetes/kcl/kubernetes as k8s
|
|||||||
|
|
||||||
#### After (New System)
|
#### After (New System)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Package-based imports
|
# Package-based imports
|
||||||
import provisioning.server as server
|
import provisioning.server as server
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ import .taskservs.nclubernetes.kubernetes as k8s
|
|||||||
|
|
||||||
### Building Core Package
|
### Building Core Package
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build distributable package
|
# Build distributable package
|
||||||
./provisioning/tools/kcl-packager.nu build --version 1.0.0
|
./provisioning/tools/kcl-packager.nu build --version 1.0.0
|
||||||
|
|
||||||
@ -145,21 +145,21 @@ import .taskservs.nclubernetes.kubernetes as k8s
|
|||||||
|
|
||||||
#### Method 1: Local Installation (Recommended for development)
|
#### Method 1: Local Installation (Recommended for development)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
provisioning = { path = "~/.kcl/packages/provisioning", version = "0.0.1" }
|
provisioning = { path = "~/.kcl/packages/provisioning", version = "0.0.1" }
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Method 2: Git Repository (For distributed teams)
|
#### Method 2: Git Repository (For distributed teams)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
provisioning = { git = "https://github.com/your-org/provisioning-kcl", version = "v0.0.1" }
|
provisioning = { git = "https://github.com/your-org/provisioning-kcl", version = "v0.0.1" }
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Method 3: KCL Registry (When available)
|
#### Method 3: KCL Registry (When available)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
provisioning = { version = "0.0.1" }
|
provisioning = { version = "0.0.1" }
|
||||||
```
|
```
|
||||||
@ -168,7 +168,7 @@ provisioning = { version = "0.0.1" }
|
|||||||
|
|
||||||
### 1. New Project Setup
|
### 1. New Project Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create workspace from template
|
# Create workspace from template
|
||||||
cp -r provisioning/templates/workspaces/kubernetes ./my-k8s-cluster
|
cp -r provisioning/templates/workspaces/kubernetes ./my-k8s-cluster
|
||||||
cd my-k8s-cluster
|
cd my-k8s-cluster
|
||||||
@ -187,7 +187,7 @@ provisioning server create --infra . --check
|
|||||||
|
|
||||||
### 2. Extension Development
|
### 2. Extension Development
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create new taskserv
|
# Create new taskserv
|
||||||
mkdir -p extensions/taskservs/my-service/kcl
|
mkdir -p extensions/taskservs/my-service/kcl
|
||||||
cd extensions/taskservs/my-service/kcl
|
cd extensions/taskservs/my-service/kcl
|
||||||
@ -202,7 +202,7 @@ module-loader discover taskservs # Should find your service
|
|||||||
|
|
||||||
### 3. Workspace Migration
|
### 3. Workspace Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Analyze existing workspace
|
# Analyze existing workspace
|
||||||
workspace-migrate.nu workspace/infra/old-project dry-run
|
workspace-migrate.nu workspace/infra/old-project dry-run
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ module-loader validate workspace/infra/old-project
|
|||||||
|
|
||||||
### 4. Multi-Environment Management
|
### 4. Multi-Environment Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Development environment
|
# Development environment
|
||||||
cd workspace/infra/dev
|
cd workspace/infra/dev
|
||||||
module-loader load taskservs . [redis, postgres]
|
module-loader load taskservs . [redis, postgres]
|
||||||
@ -231,7 +231,7 @@ module-loader load providers . [upcloud, aws] # Multi-cloud
|
|||||||
|
|
||||||
### Listing and Validation
|
### Listing and Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List loaded modules
|
# List loaded modules
|
||||||
module-loader list taskservs .
|
module-loader list taskservs .
|
||||||
module-loader list providers .
|
module-loader list providers .
|
||||||
@ -246,7 +246,7 @@ workspace-init.nu . info
|
|||||||
|
|
||||||
### Unloading Modules
|
### Unloading Modules
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Remove specific modules
|
# Remove specific modules
|
||||||
module-loader unload taskservs . redis
|
module-loader unload taskservs . redis
|
||||||
module-loader unload providers . aws
|
module-loader unload providers . aws
|
||||||
@ -256,7 +256,7 @@ module-loader unload providers . aws
|
|||||||
|
|
||||||
### Module Information
|
### Module Information
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Get detailed module info
|
# Get detailed module info
|
||||||
module-loader info taskservs kubernetes
|
module-loader info taskservs kubernetes
|
||||||
module-loader info providers upcloud
|
module-loader info providers upcloud
|
||||||
@ -267,7 +267,7 @@ module-loader info clusters buildkit
|
|||||||
|
|
||||||
### Pipeline Example
|
### Pipeline Example
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# deploy-pipeline.nu
|
# deploy-pipeline.nu
|
||||||
|
|
||||||
@ -292,13 +292,13 @@ provisioning server create --infra $env.WORKSPACE_PATH
|
|||||||
|
|
||||||
#### Module Import Errors
|
#### Module Import Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Error: module not found
|
Error: module not found
|
||||||
```
|
```
|
||||||
|
|
||||||
**Solution**: Verify modules are loaded and regenerate imports
|
**Solution**: Verify modules are loaded and regenerate imports
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
module-loader list taskservs .
|
module-loader list taskservs .
|
||||||
module-loader load taskservs . [kubernetes, cilium, containerd]
|
module-loader load taskservs . [kubernetes, cilium, containerd]
|
||||||
```
|
```
|
||||||
@ -311,14 +311,14 @@ module-loader load taskservs . [kubernetes, cilium, containerd]
|
|||||||
|
|
||||||
**Solution**: Verify core package installation and kcl.mod configuration
|
**Solution**: Verify core package installation and kcl.mod configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
kcl-packager.nu install --version latest
|
kcl-packager.nu install --version latest
|
||||||
kcl run --dry-run servers.ncl
|
kcl run --dry-run servers.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
### Debug Commands
|
### Debug Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show workspace structure
|
# Show workspace structure
|
||||||
tree -a workspace/infra/my-project
|
tree -a workspace/infra/my-project
|
||||||
|
|
||||||
@ -364,25 +364,25 @@ For existing workspaces, follow these steps:
|
|||||||
|
|
||||||
### 1. Backup Current Workspace
|
### 1. Backup Current Workspace
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cp -r workspace/infra/existing workspace/infra/existing-backup
|
cp -r workspace/infra/existing workspace/infra/existing-backup
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Analyze Migration Requirements
|
### 2. Analyze Migration Requirements
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace-migrate.nu workspace/infra/existing dry-run
|
workspace-migrate.nu workspace/infra/existing dry-run
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Perform Migration
|
### 3. Perform Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace-migrate.nu workspace/infra/existing
|
workspace-migrate.nu workspace/infra/existing
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Load Required Modules
|
### 4. Load Required Modules
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd workspace/infra/existing
|
cd workspace/infra/existing
|
||||||
module-loader load taskservs . [kubernetes, cilium]
|
module-loader load taskservs . [kubernetes, cilium]
|
||||||
module-loader load providers . [upcloud]
|
module-loader load providers . [upcloud]
|
||||||
@ -390,14 +390,14 @@ module-loader load providers . [upcloud]
|
|||||||
|
|
||||||
### 5. Test and Validate
|
### 5. Test and Validate
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
kcl run servers.ncl
|
kcl run servers.ncl
|
||||||
module-loader validate .
|
module-loader validate .
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. Deploy
|
### 6. Deploy
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create --infra . --check
|
provisioning server create --infra . --check
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ workflow, and user-friendly distribution.
|
|||||||
|
|
||||||
### 1. Monorepo Structure
|
### 1. Monorepo Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
project-provisioning/
|
project-provisioning/
|
||||||
│
|
│
|
||||||
├── provisioning/ # CORE SYSTEM (distribution source)
|
├── provisioning/ # CORE SYSTEM (distribution source)
|
||||||
@ -246,7 +246,7 @@ project-provisioning/
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/
|
/usr/local/
|
||||||
├── bin/
|
├── bin/
|
||||||
│ └── provisioning
|
│ └── provisioning
|
||||||
@ -275,7 +275,7 @@ project-provisioning/
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/
|
/usr/local/
|
||||||
├── bin/
|
├── bin/
|
||||||
│ ├── provisioning-orchestrator
|
│ ├── provisioning-orchestrator
|
||||||
@ -297,7 +297,7 @@ project-provisioning/
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/lib/provisioning/extensions/
|
/usr/local/lib/provisioning/extensions/
|
||||||
├── taskservs/
|
├── taskservs/
|
||||||
├── clusters/
|
├── clusters/
|
||||||
@ -317,7 +317,7 @@ project-provisioning/
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
~/.config/nushell/plugins/
|
~/.config/nushell/plugins/
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ project-provisioning/
|
|||||||
|
|
||||||
#### System Installation (Root)
|
#### System Installation (Root)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/
|
/usr/local/
|
||||||
├── bin/
|
├── bin/
|
||||||
│ ├── provisioning # Main CLI
|
│ ├── provisioning # Main CLI
|
||||||
@ -351,7 +351,7 @@ project-provisioning/
|
|||||||
|
|
||||||
#### User Configuration
|
#### User Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
~/.provisioning/
|
~/.provisioning/
|
||||||
├── config/
|
├── config/
|
||||||
│ └── config.user.toml # User overrides
|
│ └── config.user.toml # User overrides
|
||||||
@ -365,7 +365,7 @@ project-provisioning/
|
|||||||
|
|
||||||
#### Project Workspace
|
#### Project Workspace
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
./workspace/
|
./workspace/
|
||||||
├── infra/ # Infrastructure definitions
|
├── infra/ # Infrastructure definitions
|
||||||
│ ├── my-cluster/
|
│ ├── my-cluster/
|
||||||
@ -384,7 +384,7 @@ project-provisioning/
|
|||||||
|
|
||||||
### Configuration Hierarchy
|
### Configuration Hierarchy
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
Priority (highest to lowest):
|
Priority (highest to lowest):
|
||||||
1. CLI flags --debug, --infra=my-cluster
|
1. CLI flags --debug, --infra=my-cluster
|
||||||
2. Runtime overrides PROVISIONING_DEBUG=true
|
2. Runtime overrides PROVISIONING_DEBUG=true
|
||||||
@ -401,7 +401,7 @@ Priority (highest to lowest):
|
|||||||
|
|
||||||
**`provisioning/tools/build/`:**
|
**`provisioning/tools/build/`:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
build/
|
build/
|
||||||
├── build-system.nu # Main build orchestrator
|
├── build-system.nu # Main build orchestrator
|
||||||
├── package-core.nu # Core packaging
|
├── package-core.nu # Core packaging
|
||||||
@ -417,7 +417,7 @@ build/
|
|||||||
|
|
||||||
**`provisioning/tools/build/build-system.nu`:**
|
**`provisioning/tools/build/build-system.nu`:**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# Build system for provisioning project
|
# Build system for provisioning project
|
||||||
|
|
||||||
@ -597,7 +597,7 @@ Total packages: (($packages | length))"
|
|||||||
|
|
||||||
**`Justfile`:**
|
**`Justfile`:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Provisioning Build System
|
# Provisioning Build System
|
||||||
# Use 'just --list' to see all available commands
|
# Use 'just --list' to see all available commands
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ audit:
|
|||||||
|
|
||||||
**`distribution/installers/install.nu`:**
|
**`distribution/installers/install.nu`:**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# Provisioning installation script
|
# Provisioning installation script
|
||||||
|
|
||||||
@ -986,7 +986,7 @@ export def "main upgrade" [
|
|||||||
|
|
||||||
**`distribution/installers/install.sh`:**
|
**`distribution/installers/install.sh`:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Provisioning installation script (Bash version)
|
# Provisioning installation script (Bash version)
|
||||||
# This script installs Nushell first, then runs the Nushell installer
|
# This script installs Nushell first, then runs the Nushell installer
|
||||||
@ -1113,7 +1113,7 @@ main "$@"
|
|||||||
|
|
||||||
**Commands:**
|
**Commands:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup current state
|
# Backup current state
|
||||||
cp -r /Users/Akasha/project-provisioning /Users/Akasha/project-provisioning.backup
|
cp -r /Users/Akasha/project-provisioning /Users/Akasha/project-provisioning.backup
|
||||||
|
|
||||||
@ -1138,7 +1138,7 @@ fd workspace -t d > workspace-dirs.txt
|
|||||||
|
|
||||||
**Commands:**
|
**Commands:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create distribution directory
|
# Create distribution directory
|
||||||
mkdir -p distribution/{packages,installers,registry}
|
mkdir -p distribution/{packages,installers,registry}
|
||||||
|
|
||||||
@ -1412,7 +1412,7 @@ rm -rf NO/ wrks/ presentations/
|
|||||||
|
|
||||||
#### Option 1: Clean Migration
|
#### Option 1: Clean Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup current workspace
|
# Backup current workspace
|
||||||
cp -r workspace workspace.backup
|
cp -r workspace workspace.backup
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ provisioning workspace migrate --from workspace.backup --to workspace/
|
|||||||
|
|
||||||
#### Option 2: In-Place Migration
|
#### Option 2: In-Place Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run migration script
|
# Run migration script
|
||||||
provisioning migrate --check # Dry run
|
provisioning migrate --check # Dry run
|
||||||
provisioning migrate # Execute migration
|
provisioning migrate # Execute migration
|
||||||
@ -1433,7 +1433,7 @@ provisioning migrate # Execute migration
|
|||||||
|
|
||||||
### For Developers
|
### For Developers
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pull latest changes
|
# Pull latest changes
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ The system solves fundamental technical challenges through architectural innovat
|
|||||||
|
|
||||||
### System Diagram
|
### System Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ User Interface Layer │
|
│ User Interface Layer │
|
||||||
├─────────────────┬─────────────────┬─────────────────────────────┤
|
├─────────────────┬─────────────────┬─────────────────────────────┤
|
||||||
@ -149,7 +149,7 @@ The system solves fundamental technical challenges through architectural innovat
|
|||||||
|
|
||||||
**Nickel Workflow Definitions**:
|
**Nickel Workflow Definitions**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
batch_workflow = {
|
batch_workflow = {
|
||||||
name = "multi_cloud_deployment",
|
name = "multi_cloud_deployment",
|
||||||
@ -247,14 +247,14 @@ The system solves fundamental technical challenges through architectural innovat
|
|||||||
|
|
||||||
### Configuration Resolution Flow
|
### Configuration Resolution Flow
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. Workspace Discovery → 2. Configuration Loading → 3. Hierarchy Merge →
|
1. Workspace Discovery → 2. Configuration Loading → 3. Hierarchy Merge →
|
||||||
4. Variable Interpolation → 5. Schema Validation → 6. Runtime Application
|
4. Variable Interpolation → 5. Schema Validation → 6. Runtime Application
|
||||||
```
|
```
|
||||||
|
|
||||||
### Workflow Execution Flow
|
### Workflow Execution Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Workflow Submission → 2. Dependency Analysis → 3. Task Scheduling →
|
1. Workflow Submission → 2. Dependency Analysis → 3. Task Scheduling →
|
||||||
4. Parallel Execution → 5. State Tracking → 6. Result Aggregation →
|
4. Parallel Execution → 5. State Tracking → 6. Result Aggregation →
|
||||||
7. Error Handling → 8. Cleanup/Rollback
|
7. Error Handling → 8. Cleanup/Rollback
|
||||||
@ -262,7 +262,7 @@ The system solves fundamental technical challenges through architectural innovat
|
|||||||
|
|
||||||
### Provider Integration Flow
|
### Provider Integration Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Provider Discovery → 2. Configuration Validation → 3. Authentication →
|
1. Provider Discovery → 2. Configuration Validation → 3. Authentication →
|
||||||
4. Resource Planning → 5. Operation Execution → 6. State Persistence →
|
4. Resource Planning → 5. Operation Execution → 6. State Persistence →
|
||||||
7. Result Reporting
|
7. Result Reporting
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
TypeDialog generates **type-safe interactive forms** from configuration schemas with **bidirectional Nickel integration**.
|
TypeDialog generates **type-safe interactive forms** from configuration schemas with **bidirectional Nickel integration**.
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
Nickel Schema
|
Nickel Schema
|
||||||
↓
|
↓
|
||||||
TypeDialog Form (Auto-generated)
|
TypeDialog Form (Auto-generated)
|
||||||
@ -27,7 +27,7 @@ Nickel output config (Type-safe)
|
|||||||
|
|
||||||
### Three Layers
|
### Three Layers
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
CLI/TUI/Web Layer
|
CLI/TUI/Web Layer
|
||||||
↓
|
↓
|
||||||
TypeDialog Form Engine
|
TypeDialog Form Engine
|
||||||
@ -39,7 +39,7 @@ Schema Contracts
|
|||||||
|
|
||||||
### Data Flow
|
### Data Flow
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
Input (Nickel)
|
Input (Nickel)
|
||||||
↓
|
↓
|
||||||
Form Definition (TOML)
|
Form Definition (TOML)
|
||||||
@ -59,7 +59,7 @@ Output (JSON/YAML/TOML/Nickel)
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Clone TypeDialog
|
# Clone TypeDialog
|
||||||
git clone https://github.com/jesusperezlorenzo/typedialog.git
|
git clone https://github.com/jesusperezlorenzo/typedialog.git
|
||||||
cd typedialog
|
cd typedialog
|
||||||
@ -73,7 +73,7 @@ cargo install --path ./crates/typedialog
|
|||||||
|
|
||||||
### Verify Installation
|
### Verify Installation
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog --version
|
typedialog --version
|
||||||
typedialog --help
|
typedialog --help
|
||||||
```
|
```
|
||||||
@ -84,7 +84,7 @@ typedialog --help
|
|||||||
|
|
||||||
### Step 1: Define Nickel Schema
|
### Step 1: Define Nickel Schema
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# server_config.ncl
|
# server_config.ncl
|
||||||
let contracts = import "./contracts.ncl" in
|
let contracts = import "./contracts.ncl" in
|
||||||
let defaults = import "./defaults.ncl" in
|
let defaults = import "./defaults.ncl" in
|
||||||
@ -101,7 +101,7 @@ let defaults = import "./defaults.ncl" in
|
|||||||
|
|
||||||
### Step 2: Define TypeDialog Form (TOML)
|
### Step 2: Define TypeDialog Form (TOML)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# server_form.toml
|
# server_form.toml
|
||||||
[form]
|
[form]
|
||||||
title = "Server Configuration"
|
title = "Server Configuration"
|
||||||
@ -155,13 +155,13 @@ help = "Select applicable tags"
|
|||||||
|
|
||||||
### Step 3: Render Form (CLI)
|
### Step 3: Render Form (CLI)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form --config server_form.toml --backend cli
|
typedialog form --config server_form.toml --backend cli
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**:
|
**Output**:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
Server Configuration
|
Server Configuration
|
||||||
Create a new server configuration
|
Create a new server configuration
|
||||||
|
|
||||||
@ -179,14 +179,14 @@ Create a new server configuration
|
|||||||
|
|
||||||
### Step 4: Validate Against Nickel Schema
|
### Step 4: Validate Against Nickel Schema
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Validation happens automatically
|
# Validation happens automatically
|
||||||
# If input matches Nickel contract, proceeds to output
|
# If input matches Nickel contract, proceeds to output
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 5: Output to Nickel
|
### Step 5: Output to Nickel
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form
|
typedialog form
|
||||||
--config server_form.toml
|
--config server_form.toml
|
||||||
--output nickel
|
--output nickel
|
||||||
@ -195,7 +195,7 @@ typedialog form
|
|||||||
|
|
||||||
**Output file** (`server_config_output.ncl`):
|
**Output file** (`server_config_output.ncl`):
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
server_name = "web-01",
|
server_name = "web-01",
|
||||||
cpu_cores = 4,
|
cpu_cores = 4,
|
||||||
@ -216,7 +216,7 @@ You want an interactive CLI wizard for infrastructure provisioning.
|
|||||||
|
|
||||||
### Step 1: Define Nickel Schema for Infrastructure
|
### Step 1: Define Nickel Schema for Infrastructure
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# infrastructure_schema.ncl
|
# infrastructure_schema.ncl
|
||||||
{
|
{
|
||||||
InfrastructureConfig = {
|
InfrastructureConfig = {
|
||||||
@ -245,7 +245,7 @@ You want an interactive CLI wizard for infrastructure provisioning.
|
|||||||
|
|
||||||
### Step 2: Create Comprehensive Form
|
### Step 2: Create Comprehensive Form
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# infrastructure_wizard.toml
|
# infrastructure_wizard.toml
|
||||||
[form]
|
[form]
|
||||||
title = "Infrastructure Provisioning Wizard"
|
title = "Infrastructure Provisioning Wizard"
|
||||||
@ -334,7 +334,7 @@ placeholder = "admin@company.com"
|
|||||||
|
|
||||||
### Step 3: Run Interactive Wizard
|
### Step 3: Run Interactive Wizard
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form
|
typedialog form
|
||||||
--config infrastructure_wizard.toml
|
--config infrastructure_wizard.toml
|
||||||
--backend tui
|
--backend tui
|
||||||
@ -343,7 +343,7 @@ typedialog form
|
|||||||
|
|
||||||
**Output** (`infrastructure_config.ncl`):
|
**Output** (`infrastructure_config.ncl`):
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace_name = "production-eu",
|
workspace_name = "production-eu",
|
||||||
deployment_mode = 'enterprise,
|
deployment_mode = 'enterprise,
|
||||||
@ -358,7 +358,7 @@ typedialog form
|
|||||||
|
|
||||||
### Step 4: Use Output in Infrastructure
|
### Step 4: Use Output in Infrastructure
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# main_infrastructure.ncl
|
# main_infrastructure.ncl
|
||||||
let config = import "./infrastructure_config.ncl" in
|
let config = import "./infrastructure_config.ncl" in
|
||||||
let schemas = import "../../provisioning/schemas/main.ncl" in
|
let schemas = import "../../provisioning/schemas/main.ncl" in
|
||||||
@ -398,7 +398,7 @@ let schemas = import "../../provisioning/schemas/main.ncl" in
|
|||||||
|
|
||||||
### Form Definition (Advanced)
|
### Form Definition (Advanced)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# server_advanced_form.toml
|
# server_advanced_form.toml
|
||||||
[form]
|
[form]
|
||||||
title = "Server Configuration"
|
title = "Server Configuration"
|
||||||
@ -532,7 +532,7 @@ options = ["production", "staging", "testing", "development"]
|
|||||||
|
|
||||||
### Output Structure
|
### Output Structure
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
# Basic
|
# Basic
|
||||||
server_name = "web-prod-01",
|
server_name = "web-prod-01",
|
||||||
@ -562,7 +562,7 @@ options = ["production", "staging", "testing", "development"]
|
|||||||
|
|
||||||
### TypeDialog REST Endpoints
|
### TypeDialog REST Endpoints
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Start TypeDialog server
|
# Start TypeDialog server
|
||||||
typedialog server --port 8080
|
typedialog server --port 8080
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ curl -X POST http://localhost:8080/forms
|
|||||||
|
|
||||||
### Response Format
|
### Response Format
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"form_id": "srv_abc123",
|
"form_id": "srv_abc123",
|
||||||
"status": "rendered",
|
"status": "rendered",
|
||||||
@ -592,7 +592,7 @@ curl -X POST http://localhost:8080/forms
|
|||||||
|
|
||||||
### Submit Form
|
### Submit Form
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
curl -X POST http://localhost:8080/forms/srv_abc123/submit
|
curl -X POST http://localhost:8080/forms/srv_abc123/submit
|
||||||
-H "Content-Type: application/json"
|
-H "Content-Type: application/json"
|
||||||
-d '{
|
-d '{
|
||||||
@ -607,7 +607,7 @@ curl -X POST http://localhost:8080/forms/srv_abc123/submit
|
|||||||
|
|
||||||
### Response
|
### Response
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"validation": "passed",
|
"validation": "passed",
|
||||||
@ -631,7 +631,7 @@ curl -X POST http://localhost:8080/forms/srv_abc123/submit
|
|||||||
|
|
||||||
TypeDialog validates user input against Nickel contracts:
|
TypeDialog validates user input against Nickel contracts:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Nickel contract
|
# Nickel contract
|
||||||
ServerConfig = {
|
ServerConfig = {
|
||||||
cpu_cores | Number, # Must be number
|
cpu_cores | Number, # Must be number
|
||||||
@ -645,7 +645,7 @@ ServerConfig = {
|
|||||||
|
|
||||||
### Validation Rules in Form
|
### Validation Rules in Form
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "cpu_cores"
|
name = "cpu_cores"
|
||||||
type = "number"
|
type = "number"
|
||||||
@ -661,7 +661,7 @@ help = "Must be 1-32 cores"
|
|||||||
|
|
||||||
### Use Case: Infrastructure Initialization
|
### Use Case: Infrastructure Initialization
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# 1. User runs initialization
|
# 1. User runs initialization
|
||||||
provisioning init --wizard
|
provisioning init --wizard
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ provisioning init --wizard
|
|||||||
|
|
||||||
### Implementation in Nushell
|
### Implementation in Nushell
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# provisioning/core/nulib/provisioning_init.nu
|
# provisioning/core/nulib/provisioning_init.nu
|
||||||
|
|
||||||
def provisioning_init_wizard [] {
|
def provisioning_init_wizard [] {
|
||||||
@ -714,7 +714,7 @@ def provisioning_init_wizard [] {
|
|||||||
|
|
||||||
Show/hide fields based on user selections:
|
Show/hide fields based on user selections:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "backup_retention"
|
name = "backup_retention"
|
||||||
label = "Backup Retention (days)"
|
label = "Backup Retention (days)"
|
||||||
@ -726,7 +726,7 @@ visible_if = "enable_backup == true" # Only shown if backup enabled
|
|||||||
|
|
||||||
Set defaults based on other fields:
|
Set defaults based on other fields:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "deployment_mode"
|
name = "deployment_mode"
|
||||||
type = "select"
|
type = "select"
|
||||||
@ -741,7 +741,7 @@ default_from = "deployment_mode" # Can reference other fields
|
|||||||
|
|
||||||
### Custom Validation
|
### Custom Validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "memory_gb"
|
name = "memory_gb"
|
||||||
type = "number"
|
type = "number"
|
||||||
@ -755,7 +755,7 @@ help = "Memory must be at least 2 GB per CPU core"
|
|||||||
|
|
||||||
TypeDialog can output to multiple formats:
|
TypeDialog can output to multiple formats:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Output to Nickel (recommended for IaC)
|
# Output to Nickel (recommended for IaC)
|
||||||
typedialog form --config form.toml --output nickel
|
typedialog form --config form.toml --output nickel
|
||||||
|
|
||||||
@ -777,7 +777,7 @@ TypeDialog supports three rendering backends:
|
|||||||
|
|
||||||
### 1. CLI (Command-line prompts)
|
### 1. CLI (Command-line prompts)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form --config form.toml --backend cli
|
typedialog form --config form.toml --backend cli
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ typedialog form --config form.toml --backend cli
|
|||||||
|
|
||||||
### 2. TUI (Terminal User Interface - Ratatui)
|
### 2. TUI (Terminal User Interface - Ratatui)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form --config form.toml --backend tui
|
typedialog form --config form.toml --backend tui
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ typedialog form --config form.toml --backend tui
|
|||||||
|
|
||||||
### 3. Web (HTTP Server - Axum)
|
### 3. Web (HTTP Server - Axum)
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
typedialog form --config form.toml --backend web --port 3000
|
typedialog form --config form.toml --backend web --port 3000
|
||||||
# Opens http://localhost:3000
|
# Opens http://localhost:3000
|
||||||
```
|
```
|
||||||
@ -813,7 +813,7 @@ typedialog form --config form.toml --backend web --port 3000
|
|||||||
|
|
||||||
**Solution**: Verify field definitions match Nickel schema:
|
**Solution**: Verify field definitions match Nickel schema:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Form field
|
# Form field
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "cpu_cores" # Must match Nickel field name
|
name = "cpu_cores" # Must match Nickel field name
|
||||||
@ -826,7 +826,7 @@ type = "number" # Must match Nickel type
|
|||||||
|
|
||||||
**Solution**: Add help text and validation rules:
|
**Solution**: Add help text and validation rules:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "cpu_cores"
|
name = "cpu_cores"
|
||||||
validation_pattern = "^[1-9][0-9]*$"
|
validation_pattern = "^[1-9][0-9]*$"
|
||||||
@ -839,7 +839,7 @@ help = "Must be positive integer"
|
|||||||
|
|
||||||
**Solution**: Ensure all required fields in form:
|
**Solution**: Ensure all required fields in form:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "required_field"
|
name = "required_field"
|
||||||
required = true # User must provide value
|
required = true # User must provide value
|
||||||
@ -851,7 +851,7 @@ required = true # User must provide value
|
|||||||
|
|
||||||
### Step 1: Define Nickel Schema
|
### Step 1: Define Nickel Schema
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# workspace_schema.ncl
|
# workspace_schema.ncl
|
||||||
{
|
{
|
||||||
workspace = {
|
workspace = {
|
||||||
@ -866,7 +866,7 @@ required = true # User must provide value
|
|||||||
|
|
||||||
### Step 2: Define Form
|
### Step 2: Define Form
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# workspace_form.toml
|
# workspace_form.toml
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "name"
|
name = "name"
|
||||||
@ -895,14 +895,14 @@ required = true
|
|||||||
|
|
||||||
### Step 3: User Interaction
|
### Step 3: User Interaction
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
$ typedialog form --config workspace_form.toml --backend tui
|
$ typedialog form --config workspace_form.toml --backend tui
|
||||||
# User fills form interactively
|
# User fills form interactively
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Output
|
### Step 4: Output
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace = {
|
workspace = {
|
||||||
name = "production",
|
name = "production",
|
||||||
@ -916,7 +916,7 @@ $ typedialog form --config workspace_form.toml --backend tui
|
|||||||
|
|
||||||
### Step 5: Use in Provisioning
|
### Step 5: Use in Provisioning
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# main.ncl
|
# main.ncl
|
||||||
let config = import "./workspace.ncl" in
|
let config = import "./workspace.ncl" in
|
||||||
let schemas = import "provisioning/schemas/main.ncl" in
|
let schemas = import "provisioning/schemas/main.ncl" in
|
||||||
|
|||||||
@ -10,7 +10,7 @@ The new configuration system includes comprehensive schema validation to catch e
|
|||||||
|
|
||||||
Ensures all required fields are present:
|
Ensures all required fields are present:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schema definition
|
# Schema definition
|
||||||
[required]
|
[required]
|
||||||
fields = ["name", "version", "enabled"]
|
fields = ["name", "version", "enabled"]
|
||||||
@ -30,7 +30,7 @@ version = "1.0.0"
|
|||||||
|
|
||||||
Validates field types:
|
Validates field types:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schema
|
# Schema
|
||||||
[fields.port]
|
[fields.port]
|
||||||
type = "int"
|
type = "int"
|
||||||
@ -54,7 +54,7 @@ port = "8080" # Error: Expected int, got string
|
|||||||
|
|
||||||
Restricts values to predefined set:
|
Restricts values to predefined set:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schema
|
# Schema
|
||||||
[fields.environment]
|
[fields.environment]
|
||||||
type = "string"
|
type = "string"
|
||||||
@ -71,7 +71,7 @@ environment = "production" # Error: Must be one of: dev, staging, prod
|
|||||||
|
|
||||||
Validates numeric ranges:
|
Validates numeric ranges:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schema
|
# Schema
|
||||||
[fields.port]
|
[fields.port]
|
||||||
type = "int"
|
type = "int"
|
||||||
@ -92,7 +92,7 @@ port = 70000 # Error: Must be <= 65535
|
|||||||
|
|
||||||
Validates string patterns using regex:
|
Validates string patterns using regex:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Schema
|
# Schema
|
||||||
[fields.email]
|
[fields.email]
|
||||||
type = "string"
|
type = "string"
|
||||||
@ -109,7 +109,7 @@ email = "not-an-email" # Error: Does not match pattern
|
|||||||
|
|
||||||
Warns about deprecated configuration:
|
Warns about deprecated configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Schema
|
# Schema
|
||||||
[deprecated]
|
[deprecated]
|
||||||
fields = ["old_field"]
|
fields = ["old_field"]
|
||||||
@ -125,7 +125,7 @@ old_field = "value" # Warning: old_field is deprecated. Use new_field instead.
|
|||||||
|
|
||||||
### Command Line
|
### Command Line
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate workspace config
|
# Validate workspace config
|
||||||
provisioning workspace config validate
|
provisioning workspace config validate
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ provisioning workspace config validate --verbose
|
|||||||
|
|
||||||
### Programmatic Usage
|
### Programmatic Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use provisioning/core/nulib/lib_provisioning/config/schema_validator.nu *
|
use provisioning/core/nulib/lib_provisioning/config/schema_validator.nu *
|
||||||
|
|
||||||
# Load config
|
# Load config
|
||||||
@ -171,7 +171,7 @@ if ($result.warnings | length) > 0 {
|
|||||||
|
|
||||||
### Pretty Print Results
|
### Pretty Print Results
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate and print formatted results
|
# Validate and print formatted results
|
||||||
let result = (validate-workspace-config $config)
|
let result = (validate-workspace-config $config)
|
||||||
print-validation-results $result
|
print-validation-results $result
|
||||||
@ -183,7 +183,7 @@ print-validation-results $result
|
|||||||
|
|
||||||
File: `/Users/Akasha/project-provisioning/provisioning/config/workspace.schema.toml`
|
File: `/Users/Akasha/project-provisioning/provisioning/config/workspace.schema.toml`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[required]
|
[required]
|
||||||
fields = ["workspace", "paths"]
|
fields = ["workspace", "paths"]
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ enum = ["debug", "info", "warn", "error"]
|
|||||||
|
|
||||||
File: `/Users/Akasha/project-provisioning/provisioning/extensions/providers/aws/config.schema.toml`
|
File: `/Users/Akasha/project-provisioning/provisioning/extensions/providers/aws/config.schema.toml`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[required]
|
[required]
|
||||||
fields = ["provider", "credentials"]
|
fields = ["provider", "credentials"]
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ old_region_field = "provider.region"
|
|||||||
|
|
||||||
File: `/Users/Akasha/project-provisioning/provisioning/platform/orchestrator/config.schema.toml`
|
File: `/Users/Akasha/project-provisioning/provisioning/platform/orchestrator/config.schema.toml`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[required]
|
[required]
|
||||||
fields = ["service", "server"]
|
fields = ["service", "server"]
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ type = "string"
|
|||||||
|
|
||||||
File: `/Users/Akasha/project-provisioning/provisioning/core/services/kms/config.schema.toml`
|
File: `/Users/Akasha/project-provisioning/provisioning/core/services/kms/config.schema.toml`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[required]
|
[required]
|
||||||
fields = ["kms", "encryption"]
|
fields = ["kms", "encryption"]
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ old_kms_type = "kms.provider"
|
|||||||
|
|
||||||
### 1. Development
|
### 1. Development
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create new config
|
# Create new config
|
||||||
vim ~/workspaces/dev/config/provisioning.yaml
|
vim ~/workspaces/dev/config/provisioning.yaml
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ provisioning workspace config validate
|
|||||||
|
|
||||||
### 2. CI/CD Pipeline
|
### 2. CI/CD Pipeline
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# GitLab CI
|
# GitLab CI
|
||||||
validate-config:
|
validate-config:
|
||||||
stage: validate
|
stage: validate
|
||||||
@ -402,7 +402,7 @@ validate-config:
|
|||||||
|
|
||||||
### 3. Pre-Deployment
|
### 3. Pre-Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate all configurations before deployment
|
# Validate all configurations before deployment
|
||||||
provisioning workspace config validate --verbose
|
provisioning workspace config validate --verbose
|
||||||
provisioning provider validate --all
|
provisioning provider validate --all
|
||||||
@ -418,7 +418,7 @@ fi
|
|||||||
|
|
||||||
### Clear Error Format
|
### Clear Error Format
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
❌ Validation failed
|
❌ Validation failed
|
||||||
|
|
||||||
Errors:
|
Errors:
|
||||||
@ -445,7 +445,7 @@ Each error includes:
|
|||||||
|
|
||||||
### Pattern 1: Hostname Validation
|
### Pattern 1: Hostname Validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.hostname]
|
[fields.hostname]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
|
pattern = "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
|
||||||
@ -453,7 +453,7 @@ pattern = "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
|
|||||||
|
|
||||||
### Pattern 2: Email Validation
|
### Pattern 2: Email Validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.email]
|
[fields.email]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
|
pattern = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
|
||||||
@ -461,7 +461,7 @@ pattern = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
|
|||||||
|
|
||||||
### Pattern 3: Semantic Version
|
### Pattern 3: Semantic Version
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.version]
|
[fields.version]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9]+)?$"
|
pattern = "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9]+)?$"
|
||||||
@ -469,7 +469,7 @@ pattern = "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9]+)?$"
|
|||||||
|
|
||||||
### Pattern 4: URL Validation
|
### Pattern 4: URL Validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.url]
|
[fields.url]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^https?://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$"
|
pattern = "^https?://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$"
|
||||||
@ -477,7 +477,7 @@ pattern = "^https?://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$"
|
|||||||
|
|
||||||
### Pattern 5: IPv4 Address
|
### Pattern 5: IPv4 Address
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.ip_address]
|
[fields.ip_address]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"
|
pattern = "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"
|
||||||
@ -485,7 +485,7 @@ pattern = "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"
|
|||||||
|
|
||||||
### Pattern 6: AWS Resource ID
|
### Pattern 6: AWS Resource ID
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[fields.instance_id]
|
[fields.instance_id]
|
||||||
type = "string"
|
type = "string"
|
||||||
pattern = "^i-[a-f0-9]{8,17}$"
|
pattern = "^i-[a-f0-9]{8,17}$"
|
||||||
@ -503,14 +503,14 @@ pattern = "^vpc-[a-f0-9]{8,17}$"
|
|||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run validation test suite
|
# Run validation test suite
|
||||||
nu provisioning/tests/config_validation_tests.nu
|
nu provisioning/tests/config_validation_tests.nu
|
||||||
```
|
```
|
||||||
|
|
||||||
### Integration Tests
|
### Integration Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test with real configs
|
# Test with real configs
|
||||||
provisioning test validate --workspace dev
|
provisioning test validate --workspace dev
|
||||||
provisioning test validate --workspace staging
|
provisioning test validate --workspace staging
|
||||||
@ -519,7 +519,7 @@ provisioning test validate --workspace prod
|
|||||||
|
|
||||||
### Custom Validation
|
### Custom Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create custom validation function
|
# Create custom validation function
|
||||||
def validate-custom-config [config: record] {
|
def validate-custom-config [config: record] {
|
||||||
let result = (validate-workspace-config $config)
|
let result = (validate-workspace-config $config)
|
||||||
@ -543,7 +543,7 @@ def validate-custom-config [config: record] {
|
|||||||
|
|
||||||
### 1. Validate Early
|
### 1. Validate Early
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate during development
|
# Validate during development
|
||||||
provisioning workspace config validate
|
provisioning workspace config validate
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ provisioning workspace config validate
|
|||||||
|
|
||||||
### 2. Use Strict Schemas
|
### 2. Use Strict Schemas
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Be explicit about types and constraints
|
# Be explicit about types and constraints
|
||||||
[fields.port]
|
[fields.port]
|
||||||
type = "int"
|
type = "int"
|
||||||
@ -564,7 +564,7 @@ max = 65535
|
|||||||
|
|
||||||
### 3. Document Patterns
|
### 3. Document Patterns
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Include examples in schema
|
# Include examples in schema
|
||||||
[fields.email]
|
[fields.email]
|
||||||
type = "string"
|
type = "string"
|
||||||
@ -574,7 +574,7 @@ pattern = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
|
|||||||
|
|
||||||
### 4. Handle Deprecation
|
### 4. Handle Deprecation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Always provide replacement guidance
|
# Always provide replacement guidance
|
||||||
[deprecated_replacements]
|
[deprecated_replacements]
|
||||||
old_field = "new_field" # Clear migration path
|
old_field = "new_field" # Clear migration path
|
||||||
@ -582,7 +582,7 @@ old_field = "new_field" # Clear migration path
|
|||||||
|
|
||||||
### 5. Test Schemas
|
### 5. Test Schemas
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Include test cases in comments
|
# Include test cases in comments
|
||||||
# Valid: "admin@example.com"
|
# Valid: "admin@example.com"
|
||||||
# Invalid: "not-an-email"
|
# Invalid: "not-an-email"
|
||||||
@ -592,7 +592,7 @@ old_field = "new_field" # Clear migration path
|
|||||||
|
|
||||||
### Schema File Not Found
|
### Schema File Not Found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Error: Schema file not found: /path/to/schema.toml
|
# Error: Schema file not found: /path/to/schema.toml
|
||||||
|
|
||||||
# Solution: Ensure schema exists
|
# Solution: Ensure schema exists
|
||||||
@ -601,7 +601,7 @@ ls -la /Users/Akasha/project-provisioning/provisioning/config/*.schema.toml
|
|||||||
|
|
||||||
### Pattern Not Matching
|
### Pattern Not Matching
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Error: Field hostname does not match pattern
|
# Error: Field hostname does not match pattern
|
||||||
|
|
||||||
# Debug: Test pattern separately
|
# Debug: Test pattern separately
|
||||||
@ -610,7 +610,7 @@ echo "my-hostname" | grep -E "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
|
|||||||
|
|
||||||
### Type Mismatch
|
### Type Mismatch
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Error: Expected int, got string
|
# Error: Expected int, got string
|
||||||
|
|
||||||
# Check config
|
# Check config
|
||||||
|
|||||||
@ -28,7 +28,7 @@ This guide describes the metadata-driven authentication system implemented over
|
|||||||
|
|
||||||
### System Components
|
### System Components
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────┐
|
||||||
│ User Command │
|
│ User Command │
|
||||||
└────────────────────────────────┬──────────────────────────────┘
|
└────────────────────────────────┬──────────────────────────────┘
|
||||||
@ -89,7 +89,7 @@ This guide describes the metadata-driven authentication system implemented over
|
|||||||
|
|
||||||
### Installation Steps
|
### Installation Steps
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Clone or update repository
|
# 1. Clone or update repository
|
||||||
git clone https://github.com/your-org/project-provisioning.git
|
git clone https://github.com/your-org/project-provisioning.git
|
||||||
cd project-provisioning
|
cd project-provisioning
|
||||||
@ -113,7 +113,7 @@ nu tests/test-metadata-cache-benchmark.nu
|
|||||||
|
|
||||||
### Basic Commands
|
### Basic Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize authentication
|
# Initialize authentication
|
||||||
provisioning login
|
provisioning login
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ provisioning server create --name test --check
|
|||||||
|
|
||||||
### Authentication Flow
|
### Authentication Flow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Login (required for production operations)
|
# 1. Login (required for production operations)
|
||||||
$ provisioning login
|
$ provisioning login
|
||||||
Username: alice@example.com
|
Username: alice@example.com
|
||||||
@ -160,7 +160,7 @@ Auth check: Check auth for destructive operation
|
|||||||
|
|
||||||
### Check Mode (Bypass Auth for Testing)
|
### Check Mode (Bypass Auth for Testing)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dry-run without auth checks
|
# Dry-run without auth checks
|
||||||
provisioning server create --name test --check
|
provisioning server create --name test --check
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ Dry-run mode - no changes will be made
|
|||||||
|
|
||||||
### Non-Interactive CI/CD Mode
|
### Non-Interactive CI/CD Mode
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Automated mode - skip confirmations
|
# Automated mode - skip confirmations
|
||||||
provisioning server create --name web-01 --yes
|
provisioning server create --name web-01 --yes
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ PROVISIONING_NON_INTERACTIVE=1 provisioning server create --name web-02 --yes
|
|||||||
|
|
||||||
**Old Pattern** (Before Fase 5):
|
**Old Pattern** (Before Fase 5):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Hardcoded auth check
|
# Hardcoded auth check
|
||||||
let response = (input "Delete server? (yes/no): ")
|
let response = (input "Delete server? (yes/no): ")
|
||||||
if $response != "yes" { exit 1 }
|
if $response != "yes" { exit 1 }
|
||||||
@ -203,7 +203,7 @@ export def delete-server [name: string, --yes] {
|
|||||||
|
|
||||||
**New Pattern** (After Fase 5):
|
**New Pattern** (After Fase 5):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Metadata header
|
# Metadata header
|
||||||
# [command]
|
# [command]
|
||||||
# name = "server delete"
|
# name = "server delete"
|
||||||
@ -226,7 +226,7 @@ export def delete-server [name: string, --yes] {
|
|||||||
|
|
||||||
1. Add metadata header after shebang:
|
1. Add metadata header after shebang:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# [command]
|
# [command]
|
||||||
# name = "server create"
|
# name = "server create"
|
||||||
@ -241,7 +241,7 @@ export def create-server [name: string] {
|
|||||||
|
|
||||||
1. Register in `provisioning/schemas/main.ncl`:
|
1. Register in `provisioning/schemas/main.ncl`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let server_create = {
|
let server_create = {
|
||||||
name = "server create",
|
name = "server create",
|
||||||
domain = "infrastructure",
|
domain = "infrastructure",
|
||||||
@ -259,7 +259,7 @@ server_create
|
|||||||
|
|
||||||
1. Handler integration (happens in dispatcher):
|
1. Handler integration (happens in dispatcher):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dispatcher automatically:
|
# Dispatcher automatically:
|
||||||
# 1. Loads metadata for "server create"
|
# 1. Loads metadata for "server create"
|
||||||
# 2. Validates auth based on requirements
|
# 2. Validates auth based on requirements
|
||||||
@ -269,7 +269,7 @@ server_create
|
|||||||
|
|
||||||
### Phase 3: Validating Migration
|
### Phase 3: Validating Migration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate metadata headers
|
# Validate metadata headers
|
||||||
nu utils/validate-metadata-headers.nu
|
nu utils/validate-metadata-headers.nu
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ nu utils/search-scripts.nu list
|
|||||||
|
|
||||||
**Step 1: Create metadata in main.ncl**
|
**Step 1: Create metadata in main.ncl**
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let new_feature_command = {
|
let new_feature_command = {
|
||||||
name = "feature command",
|
name = "feature command",
|
||||||
domain = "infrastructure",
|
domain = "infrastructure",
|
||||||
@ -310,7 +310,7 @@ new_feature_command
|
|||||||
|
|
||||||
**Step 2: Add metadata header to script**
|
**Step 2: Add metadata header to script**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# [command]
|
# [command]
|
||||||
# name = "feature command"
|
# name = "feature command"
|
||||||
@ -325,7 +325,7 @@ export def feature-command [param: string] {
|
|||||||
|
|
||||||
**Step 3: Implement handler function**
|
**Step 3: Implement handler function**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Handler registered in dispatcher
|
# Handler registered in dispatcher
|
||||||
export def handle-feature-command [
|
export def handle-feature-command [
|
||||||
action: string
|
action: string
|
||||||
@ -342,7 +342,7 @@ export def handle-feature-command [
|
|||||||
|
|
||||||
**Step 4: Test with check mode**
|
**Step 4: Test with check mode**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dry-run without auth
|
# Dry-run without auth
|
||||||
provisioning feature command --check
|
provisioning feature command --check
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ provisioning feature command --yes
|
|||||||
|
|
||||||
**Pattern 1: For Long Operations**
|
**Pattern 1: For Long Operations**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use orchestrator for operations >2 seconds
|
# Use orchestrator for operations >2 seconds
|
||||||
if (get-operation-duration "my-operation") > 2000 {
|
if (get-operation-duration "my-operation") > 2000 {
|
||||||
submit-to-orchestrator $operation
|
submit-to-orchestrator $operation
|
||||||
@ -399,7 +399,7 @@ if (get-operation-duration "my-operation") > 2000 {
|
|||||||
|
|
||||||
**Pattern 2: For Batch Operations**
|
**Pattern 2: For Batch Operations**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use batch workflows for multiple operations
|
# Use batch workflows for multiple operations
|
||||||
nu -c "
|
nu -c "
|
||||||
use core/nulib/workflows/batch.nu *
|
use core/nulib/workflows/batch.nu *
|
||||||
@ -409,7 +409,7 @@ batch submit workflows/batch-deploy.ncl --parallel-limit 5
|
|||||||
|
|
||||||
**Pattern 3: For Metadata Overhead**
|
**Pattern 3: For Metadata Overhead**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Cache hit rate optimization
|
# Cache hit rate optimization
|
||||||
# Current: 40-100x faster with warm cache
|
# Current: 40-100x faster with warm cache
|
||||||
# Target: >95% cache hit rate
|
# Target: >95% cache hit rate
|
||||||
@ -420,7 +420,7 @@ batch submit workflows/batch-deploy.ncl --parallel-limit 5
|
|||||||
|
|
||||||
### Running Tests
|
### Running Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# End-to-End Integration Tests
|
# End-to-End Integration Tests
|
||||||
nu tests/test-fase5-e2e.nu
|
nu tests/test-fase5-e2e.nu
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ for test in tests/test-*.nu { nu $test }
|
|||||||
|
|
||||||
**Solution**: Ensure metadata is registered in `main.ncl`
|
**Solution**: Ensure metadata is registered in `main.ncl`
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Check if command is in metadata
|
# Check if command is in metadata
|
||||||
grep "command_name" provisioning/schemas/main.ncl
|
grep "command_name" provisioning/schemas/main.ncl
|
||||||
```
|
```
|
||||||
@ -465,7 +465,7 @@ grep "command_name" provisioning/schemas/main.ncl
|
|||||||
|
|
||||||
**Solution**: Verify user has required permission level
|
**Solution**: Verify user has required permission level
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check current user permissions
|
# Check current user permissions
|
||||||
provisioning auth whoami
|
provisioning auth whoami
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ get-command-metadata 'server create'
|
|||||||
|
|
||||||
**Solution**: Check cache status
|
**Solution**: Check cache status
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Force cache reload
|
# Force cache reload
|
||||||
rm ~/.cache/provisioning/command_metadata.json
|
rm ~/.cache/provisioning/command_metadata.json
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ nu tests/test-metadata-cache-benchmark.nu
|
|||||||
|
|
||||||
**Solution**: Run compliance check
|
**Solution**: Run compliance check
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate Nushell compliance
|
# Validate Nushell compliance
|
||||||
nu --ide-check 100 <file.nu>
|
nu --ide-check 100 <file.nu>
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ grep "let mut" <file.nu> # Should be empty
|
|||||||
|
|
||||||
### Real-World Impact
|
### Real-World Impact
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Scenario: 20 sequential commands
|
Scenario: 20 sequential commands
|
||||||
Without cache: 20 × 200 ms = 4 seconds
|
Without cache: 20 × 200 ms = 4 seconds
|
||||||
With cache: 1 × 200 ms + 19 × 5 ms = 295 ms
|
With cache: 1 × 200 ms + 19 × 5 ms = 295 ms
|
||||||
|
|||||||
@ -30,7 +30,7 @@ The build system is a comprehensive, Makefile-based solution that orchestrates:
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Navigate to build system
|
# Navigate to build system
|
||||||
cd src/tools
|
cd src/tools
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ make status
|
|||||||
|
|
||||||
**Variables**:
|
**Variables**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Project metadata
|
# Project metadata
|
||||||
PROJECT_NAME := provisioning
|
PROJECT_NAME := provisioning
|
||||||
VERSION := $(git describe --tags --always --dirty)
|
VERSION := $(git describe --tags --always --dirty)
|
||||||
@ -95,7 +95,7 @@ PARALLEL := true
|
|||||||
|
|
||||||
**`make build-platform`** - Build platform binaries for all targets
|
**`make build-platform`** - Build platform binaries for all targets
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make build-platform
|
make build-platform
|
||||||
# Equivalent to:
|
# Equivalent to:
|
||||||
nu tools/build/compile-platform.nu
|
nu tools/build/compile-platform.nu
|
||||||
@ -107,7 +107,7 @@ nu tools/build/compile-platform.nu
|
|||||||
|
|
||||||
**`make build-core`** - Bundle core Nushell libraries
|
**`make build-core`** - Bundle core Nushell libraries
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
make build-core
|
make build-core
|
||||||
# Equivalent to:
|
# Equivalent to:
|
||||||
nu tools/build/bundle-core.nu
|
nu tools/build/bundle-core.nu
|
||||||
@ -119,7 +119,7 @@ nu tools/build/bundle-core.nu
|
|||||||
|
|
||||||
**`make validate-nickel`** - Validate and compile Nickel schemas
|
**`make validate-nickel`** - Validate and compile Nickel schemas
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
make validate-nickel
|
make validate-nickel
|
||||||
# Equivalent to:
|
# Equivalent to:
|
||||||
nu tools/build/validate-nickel.nu
|
nu tools/build/validate-nickel.nu
|
||||||
@ -142,7 +142,7 @@ nu tools/build/validate-nickel.nu
|
|||||||
|
|
||||||
**`make dist-generate`** - Generate complete distributions
|
**`make dist-generate`** - Generate complete distributions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make dist-generate
|
make dist-generate
|
||||||
# Advanced usage:
|
# Advanced usage:
|
||||||
make dist-generate PLATFORMS=linux-amd64,macos-amd64 VARIANTS=complete
|
make dist-generate PLATFORMS=linux-amd64,macos-amd64 VARIANTS=complete
|
||||||
@ -176,7 +176,7 @@ make dist-generate PLATFORMS=linux-amd64,macos-amd64 VARIANTS=complete
|
|||||||
|
|
||||||
**`make release`** - Create a complete release (requires VERSION)
|
**`make release`** - Create a complete release (requires VERSION)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make release VERSION=2.1.0
|
make release VERSION=2.1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ Features:
|
|||||||
|
|
||||||
**`make dev-build`** - Quick development build
|
**`make dev-build`** - Quick development build
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make dev-build
|
make dev-build
|
||||||
# Fast build with minimal validation
|
# Fast build with minimal validation
|
||||||
```
|
```
|
||||||
@ -250,7 +250,7 @@ make dev-build
|
|||||||
|
|
||||||
**`make docs`** - Generate documentation
|
**`make docs`** - Generate documentation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make docs
|
make docs
|
||||||
# Generates API docs, user guides, and examples
|
# Generates API docs, user guides, and examples
|
||||||
```
|
```
|
||||||
@ -265,7 +265,7 @@ make docs
|
|||||||
|
|
||||||
**`make clean`** - Clean all build artifacts
|
**`make clean`** - Clean all build artifacts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make clean
|
make clean
|
||||||
# Removes all build, distribution, and package directories
|
# Removes all build, distribution, and package directories
|
||||||
```
|
```
|
||||||
@ -290,7 +290,7 @@ make clean
|
|||||||
|
|
||||||
**`make status`** - Show build system status
|
**`make status`** - Show build system status
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make status
|
make status
|
||||||
# Output:
|
# Output:
|
||||||
# Build System Status
|
# Build System Status
|
||||||
@ -345,21 +345,21 @@ make status
|
|||||||
|
|
||||||
**`make linux`** - Build for Linux only
|
**`make linux`** - Build for Linux only
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make linux
|
make linux
|
||||||
# Sets PLATFORMS=linux-amd64
|
# Sets PLATFORMS=linux-amd64
|
||||||
```
|
```
|
||||||
|
|
||||||
**`make macos`** - Build for macOS only
|
**`make macos`** - Build for macOS only
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make macos
|
make macos
|
||||||
# Sets PLATFORMS=macos-amd64
|
# Sets PLATFORMS=macos-amd64
|
||||||
```
|
```
|
||||||
|
|
||||||
**`make windows`** - Build for Windows only
|
**`make windows`** - Build for Windows only
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make windows
|
make windows
|
||||||
# Sets PLATFORMS=windows-amd64
|
# Sets PLATFORMS=windows-amd64
|
||||||
```
|
```
|
||||||
@ -368,7 +368,7 @@ make windows
|
|||||||
|
|
||||||
**`make debug`** - Build with debug information
|
**`make debug`** - Build with debug information
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make debug
|
make debug
|
||||||
# Sets BUILD_MODE=debug VERBOSE=true
|
# Sets BUILD_MODE=debug VERBOSE=true
|
||||||
```
|
```
|
||||||
@ -398,7 +398,7 @@ All build tools are implemented as Nushell scripts with comprehensive parameter
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu compile-platform.nu [options]
|
nu compile-platform.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -412,7 +412,7 @@ Options:
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu compile-platform.nu
|
nu compile-platform.nu
|
||||||
--target x86_64-apple-darwin
|
--target x86_64-apple-darwin
|
||||||
--release
|
--release
|
||||||
@ -435,7 +435,7 @@ nu compile-platform.nu
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu bundle-core.nu [options]
|
nu bundle-core.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -468,7 +468,7 @@ Options:
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu validate-nickel.nu [options]
|
nu validate-nickel.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -490,7 +490,7 @@ Options:
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu test-distribution.nu [options]
|
nu test-distribution.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -514,7 +514,7 @@ Options:
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu clean-build.nu [options]
|
nu clean-build.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -544,7 +544,7 @@ Options:
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu generate-distribution.nu [command] [options]
|
nu generate-distribution.nu [command] [options]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
@ -566,7 +566,7 @@ Options:
|
|||||||
|
|
||||||
**Advanced Examples**:
|
**Advanced Examples**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Complete multi-platform release
|
# Complete multi-platform release
|
||||||
nu generate-distribution.nu
|
nu generate-distribution.nu
|
||||||
--version 2.1.0
|
--version 2.1.0
|
||||||
@ -599,7 +599,7 @@ nu generate-distribution.nu status
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu create-installer.nu DISTRIBUTION_DIR [options]
|
nu create-installer.nu DISTRIBUTION_DIR [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -660,7 +660,7 @@ Options:
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu create-release.nu [options]
|
nu create-release.nu [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -694,7 +694,7 @@ Options:
|
|||||||
|
|
||||||
**Install Rust Targets**:
|
**Install Rust Targets**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
# Install additional targets
|
# Install additional targets
|
||||||
rustup target add x86_64-apple-darwin
|
rustup target add x86_64-apple-darwin
|
||||||
rustup target add x86_64-pc-windows-gnu
|
rustup target add x86_64-pc-windows-gnu
|
||||||
@ -706,7 +706,7 @@ rustup target add aarch64-apple-darwin
|
|||||||
|
|
||||||
**macOS Cross-Compilation**:
|
**macOS Cross-Compilation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install osxcross toolchain
|
# Install osxcross toolchain
|
||||||
brew install FiloSottile/musl-cross/musl-cross
|
brew install FiloSottile/musl-cross/musl-cross
|
||||||
brew install mingw-w64
|
brew install mingw-w64
|
||||||
@ -714,7 +714,7 @@ brew install mingw-w64
|
|||||||
|
|
||||||
**Windows Cross-Compilation**:
|
**Windows Cross-Compilation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Windows dependencies
|
# Install Windows dependencies
|
||||||
brew install mingw-w64
|
brew install mingw-w64
|
||||||
# or on Linux:
|
# or on Linux:
|
||||||
@ -725,7 +725,7 @@ sudo apt-get install gcc-mingw-w64
|
|||||||
|
|
||||||
**Single Platform**:
|
**Single Platform**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build for macOS from Linux
|
# Build for macOS from Linux
|
||||||
make build-platform RUST_TARGET=x86_64-apple-darwin
|
make build-platform RUST_TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
@ -735,7 +735,7 @@ make build-platform RUST_TARGET=x86_64-pc-windows-gnu
|
|||||||
|
|
||||||
**Multiple Platforms**:
|
**Multiple Platforms**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build for all configured platforms
|
# Build for all configured platforms
|
||||||
make build-cross
|
make build-cross
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ make build-cross PLATFORMS=linux-amd64,macos-amd64,windows-amd64
|
|||||||
|
|
||||||
**Platform-Specific Targets**:
|
**Platform-Specific Targets**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Quick platform builds
|
# Quick platform builds
|
||||||
make linux # Linux AMD64
|
make linux # Linux AMD64
|
||||||
make macos # macOS AMD64
|
make macos # macOS AMD64
|
||||||
@ -775,7 +775,7 @@ make windows # Windows AMD64
|
|||||||
|
|
||||||
**Check Dependencies**:
|
**Check Dependencies**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
make info
|
make info
|
||||||
# Shows versions of all required tools
|
# Shows versions of all required tools
|
||||||
|
|
||||||
@ -789,7 +789,7 @@ make info
|
|||||||
|
|
||||||
**Install Missing Dependencies**:
|
**Install Missing Dependencies**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Nushell
|
# Install Nushell
|
||||||
cargo install nu
|
cargo install nu
|
||||||
|
|
||||||
@ -810,7 +810,7 @@ cargo install cross
|
|||||||
|
|
||||||
**Build Cache Management**:
|
**Build Cache Management**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean Cargo cache
|
# Clean Cargo cache
|
||||||
cargo clean
|
cargo clean
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ make clean SCOPE=cache
|
|||||||
|
|
||||||
**Error**: `linker 'cc' not found`
|
**Error**: `linker 'cc' not found`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Install build essentials
|
# Solution: Install build essentials
|
||||||
sudo apt-get install build-essential # Linux
|
sudo apt-get install build-essential # Linux
|
||||||
xcode-select --install # macOS
|
xcode-select --install # macOS
|
||||||
@ -837,14 +837,14 @@ xcode-select --install # macOS
|
|||||||
|
|
||||||
**Error**: `target not found`
|
**Error**: `target not found`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Install target
|
# Solution: Install target
|
||||||
rustup target add x86_64-unknown-linux-gnu
|
rustup target add x86_64-unknown-linux-gnu
|
||||||
```
|
```
|
||||||
|
|
||||||
**Error**: Cross-compilation linking errors
|
**Error**: Cross-compilation linking errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Use cross instead of cargo
|
# Solution: Use cross instead of cargo
|
||||||
cargo install cross
|
cargo install cross
|
||||||
make build-platform CROSS=true
|
make build-platform CROSS=true
|
||||||
@ -854,7 +854,7 @@ make build-platform CROSS=true
|
|||||||
|
|
||||||
**Error**: `command not found`
|
**Error**: `command not found`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Ensure Nushell is in PATH
|
# Solution: Ensure Nushell is in PATH
|
||||||
which nu
|
which nu
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
@ -862,14 +862,14 @@ export PATH="$HOME/.cargo/bin:$PATH"
|
|||||||
|
|
||||||
**Error**: Permission denied
|
**Error**: Permission denied
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Make scripts executable
|
# Solution: Make scripts executable
|
||||||
chmod +x src/tools/build/*.nu
|
chmod +x src/tools/build/*.nu
|
||||||
```
|
```
|
||||||
|
|
||||||
**Error**: Module not found
|
**Error**: Module not found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Check working directory
|
# Solution: Check working directory
|
||||||
cd src/tools
|
cd src/tools
|
||||||
nu build/compile-platform.nu --help
|
nu build/compile-platform.nu --help
|
||||||
@ -879,7 +879,7 @@ nu build/compile-platform.nu --help
|
|||||||
|
|
||||||
**Error**: `nickel command not found`
|
**Error**: `nickel command not found`
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Solution: Install Nickel
|
# Solution: Install Nickel
|
||||||
cargo install nickel
|
cargo install nickel
|
||||||
# or
|
# or
|
||||||
@ -888,7 +888,7 @@ brew install nickel
|
|||||||
|
|
||||||
**Error**: Schema validation failed
|
**Error**: Schema validation failed
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Check Nickel syntax
|
# Solution: Check Nickel syntax
|
||||||
nickel fmt schemas/
|
nickel fmt schemas/
|
||||||
nickel check schemas/
|
nickel check schemas/
|
||||||
@ -900,7 +900,7 @@ nickel check schemas/
|
|||||||
|
|
||||||
**Optimizations**:
|
**Optimizations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable parallel builds
|
# Enable parallel builds
|
||||||
make build-all PARALLEL=true
|
make build-all PARALLEL=true
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ export CARGO_BUILD_JOBS=8
|
|||||||
|
|
||||||
**Cargo Configuration** (`~/.cargo/config.toml`):
|
**Cargo Configuration** (`~/.cargo/config.toml`):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[build]
|
[build]
|
||||||
jobs = 8
|
jobs = 8
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ linker = "lld"
|
|||||||
|
|
||||||
**Solutions**:
|
**Solutions**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Reduce parallel jobs
|
# Reduce parallel jobs
|
||||||
export CARGO_BUILD_JOBS=2
|
export CARGO_BUILD_JOBS=2
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ make clean-dist
|
|||||||
|
|
||||||
**Validation**:
|
**Validation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test distribution
|
# Test distribution
|
||||||
make test-dist
|
make test-dist
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ nu src/tools/package/validate-package.nu dist/
|
|||||||
|
|
||||||
**Optimizations**:
|
**Optimizations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Strip binaries
|
# Strip binaries
|
||||||
make package-binaries STRIP=true
|
make package-binaries STRIP=true
|
||||||
|
|
||||||
@ -969,7 +969,7 @@ make dist-generate VARIANTS=minimal
|
|||||||
|
|
||||||
**Enable Debug Logging**:
|
**Enable Debug Logging**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment
|
# Set environment
|
||||||
export PROVISIONING_DEBUG=true
|
export PROVISIONING_DEBUG=true
|
||||||
export RUST_LOG=debug
|
export RUST_LOG=debug
|
||||||
@ -983,7 +983,7 @@ make build-all VERBOSE=true
|
|||||||
|
|
||||||
**Debug Information**:
|
**Debug Information**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show debug information
|
# Show debug information
|
||||||
make debug-info
|
make debug-info
|
||||||
|
|
||||||
@ -1000,7 +1000,7 @@ make info
|
|||||||
|
|
||||||
**Example Workflow** (`.github/workflows/build.yml`):
|
**Example Workflow** (`.github/workflows/build.yml`):
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Build and Test
|
name: Build and Test
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
@ -1034,7 +1034,7 @@ jobs:
|
|||||||
|
|
||||||
**Release Workflow**:
|
**Release Workflow**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
name: Release
|
name: Release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -1061,7 +1061,7 @@ jobs:
|
|||||||
|
|
||||||
**Test CI Pipeline Locally**:
|
**Test CI Pipeline Locally**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run CI build pipeline
|
# Run CI build pipeline
|
||||||
make ci-build
|
make ci-build
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ work with this architecture.
|
|||||||
|
|
||||||
### Architecture Components
|
### Architecture Components
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/core/nulib/
|
provisioning/core/nulib/
|
||||||
├── provisioning (211 lines) - Main entry point
|
├── provisioning (211 lines) - Main entry point
|
||||||
├── main_provisioning/
|
├── main_provisioning/
|
||||||
@ -58,7 +58,7 @@ Commands are organized by domain. Choose the appropriate handler:
|
|||||||
|
|
||||||
Edit `provisioning/core/nulib/main_provisioning/commands/infrastructure.nu`:
|
Edit `provisioning/core/nulib/main_provisioning/commands/infrastructure.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Add to the handle_infrastructure_command match statement
|
# Add to the handle_infrastructure_command match statement
|
||||||
export def handle_infrastructure_command [
|
export def handle_infrastructure_command [
|
||||||
command: string
|
command: string
|
||||||
@ -102,7 +102,7 @@ If you want shortcuts like `provisioning s status`:
|
|||||||
|
|
||||||
Edit `provisioning/core/nulib/main_provisioning/dispatcher.nu`:
|
Edit `provisioning/core/nulib/main_provisioning/dispatcher.nu`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def get_command_registry []: nothing -> record {
|
export def get_command_registry []: nothing -> record {
|
||||||
{
|
{
|
||||||
# Infrastructure commands
|
# Infrastructure commands
|
||||||
@ -127,7 +127,7 @@ Let's say you want to add better error handling to the taskserv command:
|
|||||||
|
|
||||||
**Before:**
|
**Before:**
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_taskserv [ops: string, flags: record] {
|
def handle_taskserv [ops: string, flags: record] {
|
||||||
let args = build_module_args $flags $ops
|
let args = build_module_args $flags $ops
|
||||||
run_module $args "taskserv" --exec
|
run_module $args "taskserv" --exec
|
||||||
@ -136,7 +136,7 @@ def handle_taskserv [ops: string, flags: record] {
|
|||||||
|
|
||||||
**After:**
|
**After:**
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_taskserv [ops: string, flags: record] {
|
def handle_taskserv [ops: string, flags: record] {
|
||||||
# Validate taskserv name if provided
|
# Validate taskserv name if provided
|
||||||
let first_arg = ($ops | split row " " | get -o 0)
|
let first_arg = ($ops | split row " " | get -o 0)
|
||||||
@ -163,7 +163,7 @@ def handle_taskserv [ops: string, flags: record] {
|
|||||||
|
|
||||||
The `flags.nu` module provides centralized flag handling:
|
The `flags.nu` module provides centralized flag handling:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Parse all flags into normalized record
|
# Parse all flags into normalized record
|
||||||
let parsed_flags = (parse_common_flags {
|
let parsed_flags = (parse_common_flags {
|
||||||
version: $version, v: $v, info: $info,
|
version: $version, v: $v, info: $info,
|
||||||
@ -210,7 +210,7 @@ If you need to add a new flag:
|
|||||||
|
|
||||||
**Example: Adding `--timeout` flag**
|
**Example: Adding `--timeout` flag**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. In provisioning main file (parameter list)
|
# 1. In provisioning main file (parameter list)
|
||||||
def main [
|
def main [
|
||||||
# ... existing parameters
|
# ... existing parameters
|
||||||
@ -253,7 +253,7 @@ export def build_module_args [flags: record, extra: string = ""]: nothing -> str
|
|||||||
|
|
||||||
Edit `provisioning/core/nulib/main_provisioning/dispatcher.nu`:
|
Edit `provisioning/core/nulib/main_provisioning/dispatcher.nu`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def get_command_registry []: nothing -> record {
|
export def get_command_registry []: nothing -> record {
|
||||||
{
|
{
|
||||||
# ... existing shortcuts
|
# ... existing shortcuts
|
||||||
@ -273,7 +273,7 @@ export def get_command_registry []: nothing -> record {
|
|||||||
|
|
||||||
### Running the Test Suite
|
### Running the Test Suite
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run comprehensive test suite
|
# Run comprehensive test suite
|
||||||
nu tests/test_provisioning_refactor.nu
|
nu tests/test_provisioning_refactor.nu
|
||||||
```
|
```
|
||||||
@ -293,7 +293,7 @@ The test suite validates:
|
|||||||
|
|
||||||
Edit `tests/test_provisioning_refactor.nu`:
|
Edit `tests/test_provisioning_refactor.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Add your test function
|
# Add your test function
|
||||||
export def test_my_new_feature [] {
|
export def test_my_new_feature [] {
|
||||||
print "
|
print "
|
||||||
@ -318,7 +318,7 @@ export def main [] {
|
|||||||
|
|
||||||
### Manual Testing
|
### Manual Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test command execution
|
# Test command execution
|
||||||
provisioning/core/cli/provisioning my-command test --check
|
provisioning/core/cli/provisioning my-command test --check
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ provisioning/core/cli/provisioning help my-command # Bi-directional
|
|||||||
|
|
||||||
**Use Case**: Command just needs to execute a module with standard flags
|
**Use Case**: Command just needs to execute a module with standard flags
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_simple_command [ops: string, flags: record] {
|
def handle_simple_command [ops: string, flags: record] {
|
||||||
let args = build_module_args $flags $ops
|
let args = build_module_args $flags $ops
|
||||||
run_module $args "module_name" --exec
|
run_module $args "module_name" --exec
|
||||||
@ -347,7 +347,7 @@ def handle_simple_command [ops: string, flags: record] {
|
|||||||
|
|
||||||
**Use Case**: Need to validate input before execution
|
**Use Case**: Need to validate input before execution
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_validated_command [ops: string, flags: record] {
|
def handle_validated_command [ops: string, flags: record] {
|
||||||
# Validate
|
# Validate
|
||||||
let first_arg = ($ops | split row " " | get -o 0)
|
let first_arg = ($ops | split row " " | get -o 0)
|
||||||
@ -367,7 +367,7 @@ def handle_validated_command [ops: string, flags: record] {
|
|||||||
|
|
||||||
**Use Case**: Command has multiple subcommands (like `server create`, `server delete`)
|
**Use Case**: Command has multiple subcommands (like `server create`, `server delete`)
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_complex_command [ops: string, flags: record] {
|
def handle_complex_command [ops: string, flags: record] {
|
||||||
let subcommand = ($ops | split row " " | get -o 0)
|
let subcommand = ($ops | split row " " | get -o 0)
|
||||||
let rest_ops = ($ops | split row " " | skip 1 | str join " ")
|
let rest_ops = ($ops | split row " " | skip 1 | str join " ")
|
||||||
@ -389,7 +389,7 @@ def handle_complex_command [ops: string, flags: record] {
|
|||||||
|
|
||||||
**Use Case**: Command behavior changes based on flags
|
**Use Case**: Command behavior changes based on flags
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def handle_flag_routed_command [ops: string, flags: record] {
|
def handle_flag_routed_command [ops: string, flags: record] {
|
||||||
if $flags.check_mode {
|
if $flags.check_mode {
|
||||||
# Dry-run mode
|
# Dry-run mode
|
||||||
@ -415,7 +415,7 @@ Each handler should do **one thing well**:
|
|||||||
|
|
||||||
### 2. Use Descriptive Error Messages
|
### 2. Use Descriptive Error Messages
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# ❌ Bad
|
# ❌ Bad
|
||||||
print "Error"
|
print "Error"
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ print "Use 'provisioning taskserv list' to see all available taskservs"
|
|||||||
|
|
||||||
Don't repeat code - use centralized functions:
|
Don't repeat code - use centralized functions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# ❌ Bad: Repeating flag handling
|
# ❌ Bad: Repeating flag handling
|
||||||
def handle_bad [ops: string, flags: record] {
|
def handle_bad [ops: string, flags: record] {
|
||||||
let use_check = if $flags.check_mode { "--check " } else { "" }
|
let use_check = if $flags.check_mode { "--check " } else { "" }
|
||||||
@ -479,7 +479,7 @@ Before committing:
|
|||||||
|
|
||||||
**Fix**: Use relative imports with `.nu` extension:
|
**Fix**: Use relative imports with `.nu` extension:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# ✅ Correct
|
# ✅ Correct
|
||||||
use ../flags.nu *
|
use ../flags.nu *
|
||||||
use ../../lib_provisioning *
|
use ../../lib_provisioning *
|
||||||
@ -495,7 +495,7 @@ use lib_provisioning *
|
|||||||
|
|
||||||
**Fix**: Use proper Nushell 0.107 type signature:
|
**Fix**: Use proper Nushell 0.107 type signature:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# ✅ Correct
|
# ✅ Correct
|
||||||
export def my_function [param: string]: nothing -> string {
|
export def my_function [param: string]: nothing -> string {
|
||||||
"result"
|
"result"
|
||||||
@ -513,7 +513,7 @@ export def my_function [param: string] -> string {
|
|||||||
|
|
||||||
**Fix**: Add to `dispatcher.nu:get_command_registry`:
|
**Fix**: Add to `dispatcher.nu:get_command_registry`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
"myshortcut" => "domain command"
|
"myshortcut" => "domain command"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ export def my_function [param: string] -> string {
|
|||||||
|
|
||||||
**Fix**: Use centralized flag builder:
|
**Fix**: Use centralized flag builder:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let args = build_module_args $flags $ops
|
let args = build_module_args $flags $ops
|
||||||
run_module $args "module" --exec
|
run_module $args "module" --exec
|
||||||
```
|
```
|
||||||
@ -532,7 +532,7 @@ run_module $args "module" --exec
|
|||||||
|
|
||||||
### File Locations
|
### File Locations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/core/nulib/
|
provisioning/core/nulib/
|
||||||
├── provisioning - Main entry, flag definitions
|
├── provisioning - Main entry, flag definitions
|
||||||
├── main_provisioning/
|
├── main_provisioning/
|
||||||
@ -551,7 +551,7 @@ docs/
|
|||||||
|
|
||||||
### Key Functions
|
### Key Functions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# In flags.nu
|
# In flags.nu
|
||||||
parse_common_flags [flags: record]: nothing -> record
|
parse_common_flags [flags: record]: nothing -> record
|
||||||
build_module_args [flags: record, extra: string = ""]: nothing -> string
|
build_module_args [flags: record, extra: string = ""]: nothing -> string
|
||||||
@ -575,7 +575,7 @@ handle_*_command [command: string, ops: string, flags: record]
|
|||||||
|
|
||||||
### Testing Commands
|
### Testing Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run full test suite
|
# Run full test suite
|
||||||
nu tests/test_provisioning_refactor.nu
|
nu tests/test_provisioning_refactor.nu
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ This guide includes:
|
|||||||
|
|
||||||
### Essential Commands
|
### Essential Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# System status
|
# System status
|
||||||
provisioning status
|
provisioning status
|
||||||
provisioning health
|
provisioning health
|
||||||
|
|||||||
@ -44,7 +44,7 @@ to signal cancellation and let each layer of the call stack handle it gracefully
|
|||||||
|
|
||||||
### 1. Helper Functions (ssh.nu:11-32)
|
### 1. Helper Functions (ssh.nu:11-32)
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def check_sudo_cached []: nothing -> bool {
|
def check_sudo_cached []: nothing -> bool {
|
||||||
let result = (do --ignore-errors { ^sudo -n true } | complete)
|
let result = (do --ignore-errors { ^sudo -n true } | complete)
|
||||||
$result.exit_code == 0
|
$result.exit_code == 0
|
||||||
@ -71,7 +71,7 @@ def run_sudo_with_interrupt_check [
|
|||||||
|
|
||||||
### 2. Pre-emptive Warning (ssh.nu:155-160)
|
### 2. Pre-emptive Warning (ssh.nu:155-160)
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
if $server.fix_local_hosts and not (check_sudo_cached) {
|
if $server.fix_local_hosts and not (check_sudo_cached) {
|
||||||
print "
|
print "
|
||||||
⚠ Sudo access required for --fix-local-hosts"
|
⚠ Sudo access required for --fix-local-hosts"
|
||||||
@ -87,7 +87,7 @@ if $server.fix_local_hosts and not (check_sudo_cached) {
|
|||||||
|
|
||||||
All sudo commands wrapped with detection:
|
All sudo commands wrapped with detection:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let result = (do --ignore-errors { ^sudo <command> } | complete)
|
let result = (do --ignore-errors { ^sudo <command> } | complete)
|
||||||
if $result.exit_code == 1 and ($result.stderr | str contains "password is required") {
|
if $result.exit_code == 1 and ($result.stderr | str contains "password is required") {
|
||||||
print "
|
print "
|
||||||
@ -102,7 +102,7 @@ if $result.exit_code == 1 and ($result.stderr | str contains "password is requir
|
|||||||
|
|
||||||
Using Nushell's `reduce` instead of mutable variables:
|
Using Nushell's `reduce` instead of mutable variables:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let all_succeeded = ($settings.data.servers | reduce -f true { |server, acc|
|
let all_succeeded = ($settings.data.servers | reduce -f true { |server, acc|
|
||||||
if $text_match == null or $server.hostname == $text_match {
|
if $text_match == null or $server.hostname == $text_match {
|
||||||
let result = (on_server_ssh $settings $server $ip_type $request_from $run)
|
let result = (on_server_ssh $settings $server $ip_type $request_from $run)
|
||||||
@ -117,7 +117,7 @@ let all_succeeded = ($settings.data.servers | reduce -f true { |server, acc|
|
|||||||
|
|
||||||
### 5. Caller Handling (create.nu:262-266, generate.nu:269-273)
|
### 5. Caller Handling (create.nu:262-266, generate.nu:269-273)
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let ssh_result = (on_server_ssh $settings $server "pub" "create" false)
|
let ssh_result = (on_server_ssh $settings $server "pub" "create" false)
|
||||||
if not $ssh_result {
|
if not $ssh_result {
|
||||||
_print "
|
_print "
|
||||||
@ -130,7 +130,7 @@ if not $ssh_result {
|
|||||||
|
|
||||||
## Error Flow Diagram
|
## Error Flow Diagram
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
User presses CTRL-C during password prompt
|
User presses CTRL-C during password prompt
|
||||||
↓
|
↓
|
||||||
sudo exits with code 1, stderr: "password is required"
|
sudo exits with code 1, stderr: "password is required"
|
||||||
@ -162,7 +162,7 @@ Clean exit, no cryptic errors
|
|||||||
|
|
||||||
Captures both stdout, stderr, and exit code without throwing:
|
Captures both stdout, stderr, and exit code without throwing:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let result = (do --ignore-errors { ^sudo command } | complete)
|
let result = (do --ignore-errors { ^sudo command } | complete)
|
||||||
# result = { stdout: "...", stderr: "...", exit_code: 1 }
|
# result = { stdout: "...", stderr: "...", exit_code: 1 }
|
||||||
```
|
```
|
||||||
@ -171,7 +171,7 @@ let result = (do --ignore-errors { ^sudo command } | complete)
|
|||||||
|
|
||||||
Instead of mutable variables in loops:
|
Instead of mutable variables in loops:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# ❌ BAD - mutable capture in closure
|
# ❌ BAD - mutable capture in closure
|
||||||
mut all_succeeded = true
|
mut all_succeeded = true
|
||||||
$servers | each { |s|
|
$servers | each { |s|
|
||||||
@ -186,7 +186,7 @@ let all_succeeded = ($servers | reduce -f true { |s, acc|
|
|||||||
|
|
||||||
### 3. Early Returns for Error Handling
|
### 3. Early Returns for Error Handling
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
if not $condition {
|
if not $condition {
|
||||||
print "Error message"
|
print "Error message"
|
||||||
return false
|
return false
|
||||||
@ -198,7 +198,7 @@ if not $condition {
|
|||||||
|
|
||||||
### Scenario 1: CTRL-C During First Sudo Command
|
### Scenario 1: CTRL-C During First Sudo Command
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning -c server create
|
provisioning -c server create
|
||||||
# Password: [CTRL-C]
|
# Password: [CTRL-C]
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ provisioning -c server create
|
|||||||
|
|
||||||
### Scenario 2: Pre-cached Credentials
|
### Scenario 2: Pre-cached Credentials
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
sudo -v
|
sudo -v
|
||||||
provisioning -c server create
|
provisioning -c server create
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ provisioning -c server create
|
|||||||
|
|
||||||
### Scenario 3: Wrong Password 3 Times
|
### Scenario 3: Wrong Password 3 Times
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning -c server create
|
provisioning -c server create
|
||||||
# Password: [wrong]
|
# Password: [wrong]
|
||||||
# Password: [wrong]
|
# Password: [wrong]
|
||||||
@ -230,7 +230,7 @@ provisioning -c server create
|
|||||||
|
|
||||||
### Scenario 4: Multiple Servers, Cancel on Second
|
### Scenario 4: Multiple Servers, Cancel on Second
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# If creating multiple servers and CTRL-C on second:
|
# If creating multiple servers and CTRL-C on second:
|
||||||
# - First server completes successfully
|
# - First server completes successfully
|
||||||
# - Second server shows cancellation message
|
# - Second server shows cancellation message
|
||||||
@ -250,7 +250,7 @@ When adding new sudo commands to the codebase:
|
|||||||
|
|
||||||
Example template:
|
Example template:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let result = (do --ignore-errors { ^sudo new-command } | complete)
|
let result = (do --ignore-errors { ^sudo new-command } | complete)
|
||||||
if $result.exit_code == 1 and ($result.stderr | str contains "password is required") {
|
if $result.exit_code == 1 and ($result.stderr | str contains "password is required") {
|
||||||
print "
|
print "
|
||||||
|
|||||||
@ -42,7 +42,7 @@ hierarchical TOML configuration system with comprehensive validation and interpo
|
|||||||
|
|
||||||
The configuration system implements a clear precedence hierarchy (lowest to highest precedence):
|
The configuration system implements a clear precedence hierarchy (lowest to highest precedence):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
Configuration Hierarchy (Low → High Precedence)
|
Configuration Hierarchy (Low → High Precedence)
|
||||||
┌─────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────┐
|
||||||
│ 1. config.defaults.toml │ ← System defaults
|
│ 1. config.defaults.toml │ ← System defaults
|
||||||
@ -69,7 +69,7 @@ Configuration Hierarchy (Low → High Precedence)
|
|||||||
|
|
||||||
**Configuration Accessor Functions**:
|
**Configuration Accessor Functions**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Core configuration access
|
# Core configuration access
|
||||||
use core/nulib/lib_provisioning/config/accessor.nu
|
use core/nulib/lib_provisioning/config/accessor.nu
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ let data_path = (get-config-interpolated "paths.data") # Resolves {{paths.base}
|
|||||||
|
|
||||||
**Before (ENV-based)**:
|
**Before (ENV-based)**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export PROVISIONING_UPCLOUD_API_KEY="your-key"
|
export PROVISIONING_UPCLOUD_API_KEY="your-key"
|
||||||
export PROVISIONING_UPCLOUD_API_URL="https://api.upcloud.com"
|
export PROVISIONING_UPCLOUD_API_URL="https://api.upcloud.com"
|
||||||
export PROVISIONING_LOG_LEVEL="debug"
|
export PROVISIONING_LOG_LEVEL="debug"
|
||||||
@ -102,7 +102,7 @@ export PROVISIONING_BASE_PATH="/usr/local/provisioning"
|
|||||||
|
|
||||||
**After (Config-based)**:
|
**After (Config-based)**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# config.user.toml
|
# config.user.toml
|
||||||
[providers.upcloud]
|
[providers.upcloud]
|
||||||
api_key = "your-key"
|
api_key = "your-key"
|
||||||
@ -123,7 +123,7 @@ base = "/usr/local/provisioning"
|
|||||||
**Location**: Root of the repository
|
**Location**: Root of the repository
|
||||||
**Modification**: Should only be modified by system maintainers
|
**Modification**: Should only be modified by system maintainers
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# System-wide defaults - DO NOT MODIFY in production
|
# System-wide defaults - DO NOT MODIFY in production
|
||||||
# Copy values to config.user.toml for customization
|
# Copy values to config.user.toml for customization
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ sample_rate = 0.1
|
|||||||
**Location**: User's configuration directory
|
**Location**: User's configuration directory
|
||||||
**Modification**: Users should customize this file for their needs
|
**Modification**: Users should customize this file for their needs
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# User configuration - customizations and personal preferences
|
# User configuration - customizations and personal preferences
|
||||||
# This file overrides system defaults
|
# This file overrides system defaults
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ commit_prefix = "[{{env.USER}}]"
|
|||||||
**Location**: Project root directory
|
**Location**: Project root directory
|
||||||
**Version Control**: Should be committed to version control
|
**Version Control**: Should be committed to version control
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Project-specific configuration
|
# Project-specific configuration
|
||||||
# Shared settings for this project/repository
|
# Shared settings for this project/repository
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ developers = ["dev-team@company.com"]
|
|||||||
**Location**: Infrastructure directory
|
**Location**: Infrastructure directory
|
||||||
**Usage**: Overrides for specific infrastructure deployments
|
**Usage**: Overrides for specific infrastructure deployments
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Infrastructure-specific configuration
|
# Infrastructure-specific configuration
|
||||||
# Overrides for this specific infrastructure deployment
|
# Overrides for this specific infrastructure deployment
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ retention_days = 30
|
|||||||
**Purpose**: Development-optimized settings
|
**Purpose**: Development-optimized settings
|
||||||
**Features**: Enhanced debugging, local providers, relaxed validation
|
**Features**: Enhanced debugging, local providers, relaxed validation
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Development environment configuration
|
# Development environment configuration
|
||||||
# Optimized for local development and testing
|
# Optimized for local development and testing
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ mock_external_apis = true
|
|||||||
**Purpose**: Testing-specific configuration
|
**Purpose**: Testing-specific configuration
|
||||||
**Features**: Mock services, isolated environments, comprehensive logging
|
**Features**: Mock services, isolated environments, comprehensive logging
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Testing environment configuration
|
# Testing environment configuration
|
||||||
# Optimized for automated testing and CI/CD
|
# Optimized for automated testing and CI/CD
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ fail_fast = true
|
|||||||
**Purpose**: Production-optimized settings
|
**Purpose**: Production-optimized settings
|
||||||
**Features**: Performance optimization, security hardening, comprehensive monitoring
|
**Features**: Performance optimization, security hardening, comprehensive monitoring
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Production environment configuration
|
# Production environment configuration
|
||||||
# Optimized for performance, reliability, and security
|
# Optimized for performance, reliability, and security
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ connection_pooling = true
|
|||||||
|
|
||||||
**Creating User Configuration**:
|
**Creating User Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create user config directory
|
# Create user config directory
|
||||||
mkdir -p ~/.config/provisioning
|
mkdir -p ~/.config/provisioning
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ $EDITOR ~/.config/provisioning/config.toml
|
|||||||
|
|
||||||
**Common User Customizations**:
|
**Common User Customizations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Personal configuration customizations
|
# Personal configuration customizations
|
||||||
|
|
||||||
[paths]
|
[paths]
|
||||||
@ -561,7 +561,7 @@ slack_webhook = "{{env.SLACK_WEBHOOK_URL}}"
|
|||||||
|
|
||||||
**Workspace Integration**:
|
**Workspace Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Workspace-aware configuration
|
# Workspace-aware configuration
|
||||||
# workspace/config/developer.toml
|
# workspace/config/developer.toml
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ auto_create = true
|
|||||||
|
|
||||||
**Built-in Validation**:
|
**Built-in Validation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate current configuration
|
# Validate current configuration
|
||||||
provisioning validate config
|
provisioning validate config
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ provisioning config debug
|
|||||||
|
|
||||||
**Validation Rules**:
|
**Validation Rules**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Configuration validation in Nushell
|
# Configuration validation in Nushell
|
||||||
def validate_configuration [config: record] -> record {
|
def validate_configuration [config: record] -> record {
|
||||||
let errors = []
|
let errors = []
|
||||||
@ -645,7 +645,7 @@ def validate_configuration [config: record] -> record {
|
|||||||
|
|
||||||
**Configuration-Driven Error Handling**:
|
**Configuration-Driven Error Handling**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Never patch with hardcoded fallbacks - use configuration
|
# Never patch with hardcoded fallbacks - use configuration
|
||||||
def get_api_endpoint [provider: string] -> string {
|
def get_api_endpoint [provider: string] -> string {
|
||||||
# Good: Configuration-driven with clear error
|
# Good: Configuration-driven with clear error
|
||||||
@ -675,7 +675,7 @@ def get_api_endpoint_bad [provider: string] -> string {
|
|||||||
|
|
||||||
**Comprehensive Error Context**:
|
**Comprehensive Error Context**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def load_provider_config [provider: string] -> record {
|
def load_provider_config [provider: string] -> record {
|
||||||
let config_section = $"providers.($provider)"
|
let config_section = $"providers.($provider)"
|
||||||
|
|
||||||
@ -704,7 +704,7 @@ def load_provider_config [provider: string] -> record {
|
|||||||
|
|
||||||
**Supported Interpolation Variables**:
|
**Supported Interpolation Variables**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Environment variables
|
# Environment variables
|
||||||
base_path = "{{env.HOME}}/provisioning"
|
base_path = "{{env.HOME}}/provisioning"
|
||||||
user_name = "{{env.USER}}"
|
user_name = "{{env.USER}}"
|
||||||
@ -732,7 +732,7 @@ architecture = "{{system.arch}}"
|
|||||||
|
|
||||||
**Dynamic Path Resolution**:
|
**Dynamic Path Resolution**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[paths]
|
[paths]
|
||||||
base = "{{env.HOME}}/.local/share/provisioning"
|
base = "{{env.HOME}}/.local/share/provisioning"
|
||||||
config = "{{paths.base}}/config"
|
config = "{{paths.base}}/config"
|
||||||
@ -747,7 +747,7 @@ log_file = "{{paths.logs}}/upcloud-{{now.date}}.log"
|
|||||||
|
|
||||||
**Environment-Aware Configuration**:
|
**Environment-Aware Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[core]
|
[core]
|
||||||
name = "provisioning-{{system.hostname}}-{{env.USER}}"
|
name = "provisioning-{{system.hostname}}-{{env.USER}}"
|
||||||
version = "{{release.version}}+{{git.commit}}.{{now.timestamp}}"
|
version = "{{release.version}}+{{git.commit}}.{{now.timestamp}}"
|
||||||
@ -770,7 +770,7 @@ tags = {
|
|||||||
|
|
||||||
**Custom Interpolation Logic**:
|
**Custom Interpolation Logic**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Interpolation resolver
|
# Interpolation resolver
|
||||||
def resolve_interpolation [template: string, context: record] -> string {
|
def resolve_interpolation [template: string, context: record] -> string {
|
||||||
let interpolations = ($template | parse --regex '\{\{([^}]+)\}\}')
|
let interpolations = ($template | parse --regex '\{\{([^}]+)\}\}')
|
||||||
@ -816,7 +816,7 @@ def resolve_interpolation_key [key_path: string, context: record] -> string {
|
|||||||
|
|
||||||
**Backward Compatibility**:
|
**Backward Compatibility**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Configuration accessor with ENV fallback
|
# Configuration accessor with ENV fallback
|
||||||
def get-config-with-env-fallback [
|
def get-config-with-env-fallback [
|
||||||
config_key: string,
|
config_key: string,
|
||||||
@ -855,7 +855,7 @@ def get-config-with-env-fallback [
|
|||||||
|
|
||||||
**Available Migration Scripts**:
|
**Available Migration Scripts**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Migrate existing ENV-based setup to configuration
|
# Migrate existing ENV-based setup to configuration
|
||||||
nu src/tools/migration/env-to-config.nu --scan-environment --create-config
|
nu src/tools/migration/env-to-config.nu --scan-environment --create-config
|
||||||
|
|
||||||
@ -874,7 +874,7 @@ nu src/tools/migration/generate-config.nu --output-file config.migrated.toml
|
|||||||
|
|
||||||
**Error**: `Configuration file not found`
|
**Error**: `Configuration file not found`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Solution: Check configuration file paths
|
# Solution: Check configuration file paths
|
||||||
provisioning config paths
|
provisioning config paths
|
||||||
|
|
||||||
@ -889,7 +889,7 @@ provisioning config debug
|
|||||||
|
|
||||||
**Error**: `Invalid TOML syntax in configuration file`
|
**Error**: `Invalid TOML syntax in configuration file`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Solution: Validate TOML syntax
|
# Solution: Validate TOML syntax
|
||||||
nu -c "open config.user.toml | from toml"
|
nu -c "open config.user.toml | from toml"
|
||||||
|
|
||||||
@ -904,7 +904,7 @@ provisioning config check --verbose
|
|||||||
|
|
||||||
**Error**: `Failed to resolve interpolation: {{env.MISSING_VAR}}`
|
**Error**: `Failed to resolve interpolation: {{env.MISSING_VAR}}`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Check available interpolation variables
|
# Solution: Check available interpolation variables
|
||||||
provisioning config interpolation --list-variables
|
provisioning config interpolation --list-variables
|
||||||
|
|
||||||
@ -919,7 +919,7 @@ provisioning config debug --show-interpolation
|
|||||||
|
|
||||||
**Error**: `Provider 'upcloud' configuration invalid`
|
**Error**: `Provider 'upcloud' configuration invalid`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Solution: Validate provider configuration
|
# Solution: Validate provider configuration
|
||||||
provisioning validate config --section providers.upcloud
|
provisioning validate config --section providers.upcloud
|
||||||
|
|
||||||
@ -934,7 +934,7 @@ provisioning providers upcloud test --dry-run
|
|||||||
|
|
||||||
**Configuration Debugging**:
|
**Configuration Debugging**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Show complete resolved configuration
|
# Show complete resolved configuration
|
||||||
provisioning config show --resolved
|
provisioning config show --resolved
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ provisioning config interpolation --debug "{{paths.data}}/{{env.USER}}"
|
|||||||
|
|
||||||
**Configuration Caching**:
|
**Configuration Caching**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Enable configuration caching
|
# Enable configuration caching
|
||||||
export PROVISIONING_CONFIG_CACHE=true
|
export PROVISIONING_CONFIG_CACHE=true
|
||||||
|
|
||||||
@ -968,7 +968,7 @@ provisioning config cache --stats
|
|||||||
|
|
||||||
**Startup Optimization**:
|
**Startup Optimization**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Optimize configuration loading
|
# Optimize configuration loading
|
||||||
[performance]
|
[performance]
|
||||||
lazy_loading = true
|
lazy_loading = true
|
||||||
|
|||||||
@ -34,7 +34,7 @@ The workspace system provides isolated development environments for the provisio
|
|||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace/
|
workspace/
|
||||||
├── config/ # Development configuration
|
├── config/ # Development configuration
|
||||||
│ ├── dev-defaults.toml # Development environment defaults
|
│ ├── dev-defaults.toml # Development environment defaults
|
||||||
@ -97,7 +97,7 @@ workspace/
|
|||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Navigate to workspace
|
# Navigate to workspace
|
||||||
cd workspace/tools
|
cd workspace/tools
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ nu workspace.nu init --user-name developer --infra-name my-dev-infra
|
|||||||
|
|
||||||
### Complete Initialization
|
### Complete Initialization
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Full initialization with all options
|
# Full initialization with all options
|
||||||
nu workspace.nu init
|
nu workspace.nu init
|
||||||
--user-name developer
|
--user-name developer
|
||||||
@ -134,7 +134,7 @@ nu workspace.nu init
|
|||||||
|
|
||||||
**Verify Installation**:
|
**Verify Installation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check workspace health
|
# Check workspace health
|
||||||
nu workspace.nu health --detailed
|
nu workspace.nu health --detailed
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ nu workspace.nu list
|
|||||||
|
|
||||||
**Configure Development Environment**:
|
**Configure Development Environment**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create user-specific configuration
|
# Create user-specific configuration
|
||||||
cp workspace/config/local-overrides.toml.example workspace/config/$USER.toml
|
cp workspace/config/local-overrides.toml.example workspace/config/$USER.toml
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ The workspace implements a sophisticated path resolution system that prioritizes
|
|||||||
|
|
||||||
### Using Path Resolution
|
### Using Path Resolution
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Import path resolver
|
# Import path resolver
|
||||||
use workspace/lib/path-resolver.nu
|
use workspace/lib/path-resolver.nu
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ let new_path = (path-resolver resolve_path "infra" "my-infra" --create-missing)
|
|||||||
|
|
||||||
**Hierarchical Configuration Loading**:
|
**Hierarchical Configuration Loading**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Resolve configuration with full hierarchy
|
# Resolve configuration with full hierarchy
|
||||||
let config = (path-resolver resolve_config "user" --workspace-user "developer")
|
let config = (path-resolver resolve_config "user" --workspace-user "developer")
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ let merged = (path-resolver resolve_config "merged" --workspace-user "developer"
|
|||||||
|
|
||||||
**Automatic Extension Discovery**:
|
**Automatic Extension Discovery**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Find custom provider extension
|
# Find custom provider extension
|
||||||
let provider = (path-resolver resolve_extension "providers" "my-aws-provider")
|
let provider = (path-resolver resolve_extension "providers" "my-aws-provider")
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ let cluster = (path-resolver resolve_extension "clusters" "development-cluster")
|
|||||||
|
|
||||||
**Workspace Health Validation**:
|
**Workspace Health Validation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check workspace health with automatic fixes
|
# Check workspace health with automatic fixes
|
||||||
let health = (path-resolver check_workspace_health --workspace-user "developer" --fix-issues)
|
let health = (path-resolver check_workspace_health --workspace-user "developer" --fix-issues)
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ let runtime_status = (path-resolver check_runtime_health --workspace-user "devel
|
|||||||
|
|
||||||
**Development Environment** (`workspace/config/dev-defaults.toml`):
|
**Development Environment** (`workspace/config/dev-defaults.toml`):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[core]
|
[core]
|
||||||
name = "provisioning-dev"
|
name = "provisioning-dev"
|
||||||
version = "dev-${git.branch}"
|
version = "dev-${git.branch}"
|
||||||
@ -273,7 +273,7 @@ max_size = "10 MB"
|
|||||||
|
|
||||||
**Testing Environment** (`workspace/config/test-defaults.toml`):
|
**Testing Environment** (`workspace/config/test-defaults.toml`):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[core]
|
[core]
|
||||||
name = "provisioning-test"
|
name = "provisioning-test"
|
||||||
version = "test-${build.timestamp}"
|
version = "test-${build.timestamp}"
|
||||||
@ -302,7 +302,7 @@ test_output = true
|
|||||||
|
|
||||||
**User-Specific Configuration** (`workspace/config/{user}.toml`):
|
**User-Specific Configuration** (`workspace/config/{user}.toml`):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[core]
|
[core]
|
||||||
name = "provisioning-${workspace.user}"
|
name = "provisioning-${workspace.user}"
|
||||||
version = "1.0.0-dev"
|
version = "1.0.0-dev"
|
||||||
@ -339,7 +339,7 @@ email = "developer@company.com"
|
|||||||
|
|
||||||
**Workspace Configuration Management**:
|
**Workspace Configuration Management**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Show current configuration
|
# Show current configuration
|
||||||
nu workspace.nu config show
|
nu workspace.nu config show
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ The workspace provides templates and tools for developing three types of extensi
|
|||||||
|
|
||||||
**Create New Provider**:
|
**Create New Provider**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Copy template
|
# Copy template
|
||||||
cp -r workspace/extensions/providers/template workspace/extensions/providers/my-provider
|
cp -r workspace/extensions/providers/template workspace/extensions/providers/my-provider
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ nu init.nu --provider-name my-provider --author developer
|
|||||||
|
|
||||||
**Provider Structure**:
|
**Provider Structure**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace/extensions/providers/my-provider/
|
workspace/extensions/providers/my-provider/
|
||||||
├── kcl/
|
├── kcl/
|
||||||
│ ├── provider.ncl # Provider configuration schema
|
│ ├── provider.ncl # Provider configuration schema
|
||||||
@ -402,7 +402,7 @@ workspace/extensions/providers/my-provider/
|
|||||||
|
|
||||||
**Test Provider**:
|
**Test Provider**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run provider tests
|
# Run provider tests
|
||||||
nu workspace/extensions/providers/my-provider/nulib/provider.nu test
|
nu workspace/extensions/providers/my-provider/nulib/provider.nu test
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ nu workspace/extensions/providers/my-provider/tests/integration/basic-test.nu
|
|||||||
|
|
||||||
**Create New Task Service**:
|
**Create New Task Service**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Copy template
|
# Copy template
|
||||||
cp -r workspace/extensions/taskservs/template workspace/extensions/taskservs/my-service
|
cp -r workspace/extensions/taskservs/template workspace/extensions/taskservs/my-service
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ nu init.nu --service-name my-service --service-type database
|
|||||||
|
|
||||||
**Task Service Structure**:
|
**Task Service Structure**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace/extensions/taskservs/my-service/
|
workspace/extensions/taskservs/my-service/
|
||||||
├── kcl/
|
├── kcl/
|
||||||
│ ├── taskserv.ncl # Service configuration schema
|
│ ├── taskserv.ncl # Service configuration schema
|
||||||
@ -452,7 +452,7 @@ workspace/extensions/taskservs/my-service/
|
|||||||
|
|
||||||
**Create New Cluster**:
|
**Create New Cluster**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Copy template
|
# Copy template
|
||||||
cp -r workspace/extensions/clusters/template workspace/extensions/clusters/my-cluster
|
cp -r workspace/extensions/clusters/template workspace/extensions/clusters/my-cluster
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ nu init.nu --cluster-name my-cluster --cluster-type web-stack
|
|||||||
|
|
||||||
**Testing Extensions**:
|
**Testing Extensions**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test extension syntax
|
# Test extension syntax
|
||||||
nu workspace.nu tools validate-extension providers/my-provider
|
nu workspace.nu tools validate-extension providers/my-provider
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ nu workspace.nu tools deploy-test clusters/my-cluster --infra test-env
|
|||||||
|
|
||||||
**Per-User Isolation**:
|
**Per-User Isolation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
runtime/
|
runtime/
|
||||||
├── workspaces/
|
├── workspaces/
|
||||||
│ ├── developer/ # Developer's workspace data
|
│ ├── developer/ # Developer's workspace data
|
||||||
@ -516,7 +516,7 @@ runtime/
|
|||||||
|
|
||||||
**Initialize Runtime Environment**:
|
**Initialize Runtime Environment**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize for current user
|
# Initialize for current user
|
||||||
nu workspace/tools/runtime-manager.nu init
|
nu workspace/tools/runtime-manager.nu init
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ nu workspace/tools/runtime-manager.nu init --user-name developer
|
|||||||
|
|
||||||
**Runtime Cleanup**:
|
**Runtime Cleanup**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean cache older than 30 days
|
# Clean cache older than 30 days
|
||||||
nu workspace/tools/runtime-manager.nu cleanup --type cache --age 30d
|
nu workspace/tools/runtime-manager.nu cleanup --type cache --age 30d
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ nu workspace/tools/runtime-manager.nu cleanup --type temp --force
|
|||||||
|
|
||||||
**Log Management**:
|
**Log Management**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View recent logs
|
# View recent logs
|
||||||
nu workspace/tools/runtime-manager.nu logs --action tail --lines 100
|
nu workspace/tools/runtime-manager.nu logs --action tail --lines 100
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ nu workspace/tools/runtime-manager.nu logs --action archive --older-than 7d
|
|||||||
|
|
||||||
**Cache Management**:
|
**Cache Management**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show cache statistics
|
# Show cache statistics
|
||||||
nu workspace/tools/runtime-manager.nu cache --action stats
|
nu workspace/tools/runtime-manager.nu cache --action stats
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ nu workspace/tools/runtime-manager.nu cache --action refresh --selective
|
|||||||
|
|
||||||
**Monitoring**:
|
**Monitoring**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monitor runtime usage
|
# Monitor runtime usage
|
||||||
nu workspace/tools/runtime-manager.nu monitor --duration 5m --interval 30s
|
nu workspace/tools/runtime-manager.nu monitor --duration 5m --interval 30s
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ The workspace provides comprehensive health monitoring with automatic repair cap
|
|||||||
|
|
||||||
**Basic Health Check**:
|
**Basic Health Check**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Quick health check
|
# Quick health check
|
||||||
nu workspace.nu health
|
nu workspace.nu health
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ nu workspace.nu health --report-format json > health-report.json
|
|||||||
|
|
||||||
**Component-Specific Health Checks**:
|
**Component-Specific Health Checks**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check directory structure
|
# Check directory structure
|
||||||
nu workspace/tools/workspace-health.nu check-directories --workspace-user developer
|
nu workspace/tools/workspace-health.nu check-directories --workspace-user developer
|
||||||
|
|
||||||
@ -635,7 +635,7 @@ nu workspace/tools/workspace-health.nu check-extensions --workspace-user develop
|
|||||||
|
|
||||||
**Example Health Report**:
|
**Example Health Report**:
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"workspace_health": {
|
"workspace_health": {
|
||||||
"user": "developer",
|
"user": "developer",
|
||||||
@ -704,7 +704,7 @@ nu workspace/tools/workspace-health.nu check-extensions --workspace-user develop
|
|||||||
|
|
||||||
**Create Backup**:
|
**Create Backup**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Basic backup
|
# Basic backup
|
||||||
nu workspace.nu backup
|
nu workspace.nu backup
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ nu workspace.nu backup --components config,extensions --name my-backup
|
|||||||
|
|
||||||
**List Available Backups**:
|
**List Available Backups**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all backups
|
# List all backups
|
||||||
nu workspace.nu restore --list-backups
|
nu workspace.nu restore --list-backups
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ nu workspace.nu restore --show-contents --backup-name workspace-developer-202509
|
|||||||
|
|
||||||
**Restore Operations**:
|
**Restore Operations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Restore latest backup
|
# Restore latest backup
|
||||||
nu workspace.nu restore --latest
|
nu workspace.nu restore --latest
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ nu workspace.nu restore --backup-name my-backup --restore-to different-user
|
|||||||
|
|
||||||
**Workspace Reset**:
|
**Workspace Reset**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Reset with backup
|
# Reset with backup
|
||||||
nu workspace.nu reset --backup-first
|
nu workspace.nu reset --backup-first
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ nu workspace.nu reset --force --no-backup
|
|||||||
|
|
||||||
**Cleanup Operations**:
|
**Cleanup Operations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean old data with dry-run
|
# Clean old data with dry-run
|
||||||
nu workspace.nu cleanup --type old --age 14d --dry-run
|
nu workspace.nu cleanup --type old --age 14d --dry-run
|
||||||
|
|
||||||
@ -803,7 +803,7 @@ nu workspace.nu cleanup --user-name old-user --type all
|
|||||||
|
|
||||||
**Error**: `Workspace for user 'developer' not found`
|
**Error**: `Workspace for user 'developer' not found`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Initialize workspace
|
# Solution: Initialize workspace
|
||||||
nu workspace.nu init --user-name developer
|
nu workspace.nu init --user-name developer
|
||||||
```
|
```
|
||||||
@ -812,7 +812,7 @@ nu workspace.nu init --user-name developer
|
|||||||
|
|
||||||
**Error**: `Path resolution failed for config/user`
|
**Error**: `Path resolution failed for config/user`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Solution: Fix with health check
|
# Solution: Fix with health check
|
||||||
nu workspace.nu health --fix-issues
|
nu workspace.nu health --fix-issues
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ nu workspace/lib/path-resolver.nu resolve_path "config" "user" --create-missing
|
|||||||
|
|
||||||
**Error**: `Invalid configuration syntax in user.toml`
|
**Error**: `Invalid configuration syntax in user.toml`
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Solution: Validate and fix configuration
|
# Solution: Validate and fix configuration
|
||||||
nu workspace.nu config validate --user-name developer
|
nu workspace.nu config validate --user-name developer
|
||||||
|
|
||||||
@ -836,7 +836,7 @@ cp workspace/config/local-overrides.toml.example workspace/config/developer.toml
|
|||||||
|
|
||||||
**Error**: `Runtime directory permissions error`
|
**Error**: `Runtime directory permissions error`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Reinitialize runtime
|
# Solution: Reinitialize runtime
|
||||||
nu workspace/tools/runtime-manager.nu init --user-name developer --force
|
nu workspace/tools/runtime-manager.nu init --user-name developer --force
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ chmod -R 755 workspace/runtime/workspaces/developer
|
|||||||
|
|
||||||
**Error**: `Extension 'my-provider' not found or invalid`
|
**Error**: `Extension 'my-provider' not found or invalid`
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Validate extension
|
# Solution: Validate extension
|
||||||
nu workspace.nu tools validate-extension providers/my-provider
|
nu workspace.nu tools validate-extension providers/my-provider
|
||||||
|
|
||||||
@ -860,7 +860,7 @@ cp -r workspace/extensions/providers/template workspace/extensions/providers/my-
|
|||||||
|
|
||||||
**Enable Debug Logging**:
|
**Enable Debug Logging**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set debug environment
|
# Set debug environment
|
||||||
export PROVISIONING_DEBUG=true
|
export PROVISIONING_DEBUG=true
|
||||||
export PROVISIONING_LOG_LEVEL=debug
|
export PROVISIONING_LOG_LEVEL=debug
|
||||||
@ -874,7 +874,7 @@ nu workspace.nu health --detailed
|
|||||||
|
|
||||||
**Slow Operations**:
|
**Slow Operations**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check disk space
|
# Check disk space
|
||||||
df -h workspace/
|
df -h workspace/
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ nu workspace/tools/runtime-manager.nu cache --action optimize
|
|||||||
|
|
||||||
**Corrupted Workspace**:
|
**Corrupted Workspace**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Backup current state
|
# 1. Backup current state
|
||||||
nu workspace.nu backup --name corrupted-backup --force
|
nu workspace.nu backup --name corrupted-backup --force
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ automated release management.
|
|||||||
|
|
||||||
### Distribution Components
|
### Distribution Components
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Distribution Ecosystem
|
Distribution Ecosystem
|
||||||
├── Core Components
|
├── Core Components
|
||||||
│ ├── Platform Binaries # Rust-compiled binaries
|
│ ├── Platform Binaries # Rust-compiled binaries
|
||||||
@ -59,7 +59,7 @@ Distribution Ecosystem
|
|||||||
|
|
||||||
### Build Pipeline
|
### Build Pipeline
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Build Pipeline Flow
|
Build Pipeline Flow
|
||||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||||
│ Source Code │ -> │ Build Stage │ -> │ Package Stage │
|
│ Source Code │ -> │ Build Stage │ -> │ Package Stage │
|
||||||
@ -116,7 +116,7 @@ Build Pipeline Flow
|
|||||||
|
|
||||||
**Pre-Release Checklist**:
|
**Pre-Release Checklist**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update dependencies and security
|
# Update dependencies and security
|
||||||
cargo update
|
cargo update
|
||||||
cargo audit
|
cargo audit
|
||||||
@ -133,7 +133,7 @@ make validate-all
|
|||||||
|
|
||||||
**Version Planning**:
|
**Version Planning**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check current version
|
# Check current version
|
||||||
git describe --tags --always
|
git describe --tags --always
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ nu src/tools/release/create-release.nu --dry-run --version 2.1.0
|
|||||||
|
|
||||||
**Complete Build**:
|
**Complete Build**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean build environment
|
# Clean build environment
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ make test-dist
|
|||||||
|
|
||||||
**Build with Specific Parameters**:
|
**Build with Specific Parameters**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build for specific platforms
|
# Build for specific platforms
|
||||||
make all PLATFORMS=linux-amd64,macos-amd64 VARIANTS=complete
|
make all PLATFORMS=linux-amd64,macos-amd64 VARIANTS=complete
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ make all PARALLEL=true
|
|||||||
|
|
||||||
**Create Distribution Packages**:
|
**Create Distribution Packages**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate complete distributions
|
# Generate complete distributions
|
||||||
make dist-generate
|
make dist-generate
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ make create-installers
|
|||||||
|
|
||||||
**Package Validation**:
|
**Package Validation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate packages
|
# Validate packages
|
||||||
make test-dist
|
make test-dist
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ make uninstall
|
|||||||
|
|
||||||
**Automated Release**:
|
**Automated Release**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create complete release
|
# Create complete release
|
||||||
make release VERSION=2.1.0
|
make release VERSION=2.1.0
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ nu src/tools/release/create-release.nu
|
|||||||
|
|
||||||
**Upload Artifacts**:
|
**Upload Artifacts**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Upload to GitHub Releases
|
# Upload to GitHub Releases
|
||||||
make upload-artifacts
|
make upload-artifacts
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ make notify-release
|
|||||||
|
|
||||||
**Registry Updates**:
|
**Registry Updates**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update Homebrew formula
|
# Update Homebrew formula
|
||||||
nu src/tools/release/update-registry.nu
|
nu src/tools/release/update-registry.nu
|
||||||
--registries homebrew
|
--registries homebrew
|
||||||
@ -266,7 +266,7 @@ nu src/tools/release/update-registry.nu
|
|||||||
|
|
||||||
**Complete Automated Release**:
|
**Complete Automated Release**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Full release pipeline
|
# Full release pipeline
|
||||||
make cd-deploy VERSION=2.1.0
|
make cd-deploy VERSION=2.1.0
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ make notify-release
|
|||||||
|
|
||||||
**Create Binary Packages**:
|
**Create Binary Packages**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Standard binary packages
|
# Standard binary packages
|
||||||
make package-binaries
|
make package-binaries
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ nu src/tools/package/package-binaries.nu
|
|||||||
|
|
||||||
**Container Build Process**:
|
**Container Build Process**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build container images
|
# Build container images
|
||||||
make package-containers
|
make package-containers
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ nu src/tools/package/build-containers.nu
|
|||||||
|
|
||||||
**Create Installers**:
|
**Create Installers**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate all installer types
|
# Generate all installer types
|
||||||
make create-installers
|
make create-installers
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ nu src/tools/distribution/create-installer.nu
|
|||||||
|
|
||||||
**Cross-Compilation Setup**:
|
**Cross-Compilation Setup**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install cross-compilation targets
|
# Install cross-compilation targets
|
||||||
rustup target add aarch64-unknown-linux-gnu
|
rustup target add aarch64-unknown-linux-gnu
|
||||||
rustup target add x86_64-apple-darwin
|
rustup target add x86_64-apple-darwin
|
||||||
@ -424,7 +424,7 @@ cargo install cross
|
|||||||
|
|
||||||
**Platform-Specific Builds**:
|
**Platform-Specific Builds**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build for specific platform
|
# Build for specific platform
|
||||||
make build-platform RUST_TARGET=aarch64-apple-darwin
|
make build-platform RUST_TARGET=aarch64-apple-darwin
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ make windows
|
|||||||
|
|
||||||
**Generated Distributions**:
|
**Generated Distributions**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Distribution Matrix:
|
Distribution Matrix:
|
||||||
provisioning-{version}-{platform}-{variant}.{format}
|
provisioning-{version}-{platform}-{variant}.{format}
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ Examples:
|
|||||||
|
|
||||||
**Validation Pipeline**:
|
**Validation Pipeline**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Complete validation
|
# Complete validation
|
||||||
make test-dist
|
make test-dist
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ nu src/tools/build/test-distribution.nu
|
|||||||
|
|
||||||
**Test Execution**:
|
**Test Execution**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run all tests
|
# Run all tests
|
||||||
make ci-test
|
make ci-test
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ nu src/tools/build/test-distribution.nu --test-types complete
|
|||||||
|
|
||||||
**Package Integrity**:
|
**Package Integrity**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate package structure
|
# Validate package structure
|
||||||
nu src/tools/package/validate-package.nu dist/
|
nu src/tools/package/validate-package.nu dist/
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ gpg --verify packages/provisioning-2.1.0.tar.gz.sig
|
|||||||
|
|
||||||
**Installation Testing**:
|
**Installation Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test installation process
|
# Test installation process
|
||||||
./packages/installers/install-provisioning-2.1.0.sh --dry-run
|
./packages/installers/install-provisioning-2.1.0.sh --dry-run
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ docker run --rm provisioning:2.1.0 provisioning --version
|
|||||||
|
|
||||||
**GitHub Release Integration**:
|
**GitHub Release Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create GitHub release
|
# Create GitHub release
|
||||||
nu src/tools/release/create-release.nu
|
nu src/tools/release/create-release.nu
|
||||||
--version 2.1.0
|
--version 2.1.0
|
||||||
@ -568,7 +568,7 @@ nu src/tools/release/create-release.nu
|
|||||||
|
|
||||||
**Version Detection**:
|
**Version Detection**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Auto-detect next version
|
# Auto-detect next version
|
||||||
nu src/tools/release/create-release.nu --release-type minor
|
nu src/tools/release/create-release.nu --release-type minor
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ nu src/tools/release/create-release.nu --version 2.1.0-rc.1 --pre-release
|
|||||||
|
|
||||||
**Upload and Distribution**:
|
**Upload and Distribution**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Upload to GitHub Releases
|
# Upload to GitHub Releases
|
||||||
make upload-artifacts
|
make upload-artifacts
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ make update-registry
|
|||||||
|
|
||||||
**Automated Rollback**:
|
**Automated Rollback**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Rollback latest release
|
# Rollback latest release
|
||||||
nu src/tools/release/rollback-release.nu --version 2.1.0
|
nu src/tools/release/rollback-release.nu --version 2.1.0
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ nu src/tools/release/rollback-release.nu
|
|||||||
|
|
||||||
**Manual Rollback Steps**:
|
**Manual Rollback Steps**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Identify target version
|
# 1. Identify target version
|
||||||
git tag -l | grep -v 2.1.0 | tail -5
|
git tag -l | grep -v 2.1.0 | tail -5
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ nu src/tools/release/notify-users.nu
|
|||||||
|
|
||||||
**Rollback Testing**:
|
**Rollback Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test rollback in staging
|
# Test rollback in staging
|
||||||
nu src/tools/release/rollback-release.nu
|
nu src/tools/release/rollback-release.nu
|
||||||
--version 2.1.0
|
--version 2.1.0
|
||||||
@ -681,7 +681,7 @@ make test-dist DIST_VERSION=2.0.5
|
|||||||
|
|
||||||
**Critical Security Rollback**:
|
**Critical Security Rollback**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Emergency rollback (bypasses normal procedures)
|
# Emergency rollback (bypasses normal procedures)
|
||||||
nu src/tools/release/rollback-release.nu
|
nu src/tools/release/rollback-release.nu
|
||||||
--version 2.1.0
|
--version 2.1.0
|
||||||
@ -692,7 +692,7 @@ nu src/tools/release/rollback-release.nu
|
|||||||
|
|
||||||
**Infrastructure Failure Recovery**:
|
**Infrastructure Failure Recovery**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Failover to backup infrastructure
|
# Failover to backup infrastructure
|
||||||
nu src/tools/release/rollback-release.nu
|
nu src/tools/release/rollback-release.nu
|
||||||
--infrastructure-failover
|
--infrastructure-failover
|
||||||
@ -706,7 +706,7 @@ nu src/tools/release/rollback-release.nu
|
|||||||
|
|
||||||
**Build Workflow** (`.github/workflows/build.yml`):
|
**Build Workflow** (`.github/workflows/build.yml`):
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Build and Distribute
|
name: Build and Distribute
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -745,7 +745,7 @@ jobs:
|
|||||||
|
|
||||||
**Release Workflow** (`.github/workflows/release.yml`):
|
**Release Workflow** (`.github/workflows/release.yml`):
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
name: Release
|
name: Release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -777,7 +777,7 @@ jobs:
|
|||||||
|
|
||||||
**GitLab CI Configuration** (`.gitlab-ci.yml`):
|
**GitLab CI Configuration** (`.gitlab-ci.yml`):
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- package
|
- package
|
||||||
@ -817,7 +817,7 @@ release:
|
|||||||
|
|
||||||
**Jenkinsfile**:
|
**Jenkinsfile**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
@ -860,7 +860,7 @@ pipeline {
|
|||||||
|
|
||||||
**Rust Compilation Errors**:
|
**Rust Compilation Errors**:
|
||||||
|
|
||||||
```text
|
```rust
|
||||||
# Solution: Clean and rebuild
|
# Solution: Clean and rebuild
|
||||||
make clean
|
make clean
|
||||||
cargo clean
|
cargo clean
|
||||||
@ -873,7 +873,7 @@ rustup update
|
|||||||
|
|
||||||
**Cross-Compilation Issues**:
|
**Cross-Compilation Issues**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Install missing targets
|
# Solution: Install missing targets
|
||||||
rustup target list --installed
|
rustup target list --installed
|
||||||
rustup target add x86_64-apple-darwin
|
rustup target add x86_64-apple-darwin
|
||||||
@ -887,7 +887,7 @@ make build-platform CROSS=true
|
|||||||
|
|
||||||
**Missing Dependencies**:
|
**Missing Dependencies**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Install build tools
|
# Solution: Install build tools
|
||||||
sudo apt-get install build-essential
|
sudo apt-get install build-essential
|
||||||
brew install gnu-tar
|
brew install gnu-tar
|
||||||
@ -898,7 +898,7 @@ make info
|
|||||||
|
|
||||||
**Permission Errors**:
|
**Permission Errors**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Fix permissions
|
# Solution: Fix permissions
|
||||||
chmod +x src/tools/build/*.nu
|
chmod +x src/tools/build/*.nu
|
||||||
chmod +x src/tools/distribution/*.nu
|
chmod +x src/tools/distribution/*.nu
|
||||||
@ -909,7 +909,7 @@ chmod +x src/tools/package/*.nu
|
|||||||
|
|
||||||
**Package Integrity Issues**:
|
**Package Integrity Issues**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Regenerate packages
|
# Solution: Regenerate packages
|
||||||
make clean-dist
|
make clean-dist
|
||||||
make package-all
|
make package-all
|
||||||
@ -920,7 +920,7 @@ sha256sum packages/*.tar.gz
|
|||||||
|
|
||||||
**Installation Test Failures**:
|
**Installation Test Failures**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Test in clean environment
|
# Solution: Test in clean environment
|
||||||
docker run --rm -v $(pwd):/work ubuntu:latest /work/packages/installers/install.sh
|
docker run --rm -v $(pwd):/work ubuntu:latest /work/packages/installers/install.sh
|
||||||
|
|
||||||
@ -934,7 +934,7 @@ docker run --rm -v $(pwd):/work ubuntu:latest /work/packages/installers/install.
|
|||||||
|
|
||||||
**Network Issues**:
|
**Network Issues**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Retry with backoff
|
# Solution: Retry with backoff
|
||||||
nu src/tools/release/upload-artifacts.nu
|
nu src/tools/release/upload-artifacts.nu
|
||||||
--retry-count 5
|
--retry-count 5
|
||||||
@ -946,7 +946,7 @@ gh release upload v2.1.0 packages/*.tar.gz
|
|||||||
|
|
||||||
**Authentication Failures**:
|
**Authentication Failures**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Refresh tokens
|
# Solution: Refresh tokens
|
||||||
gh auth refresh
|
gh auth refresh
|
||||||
docker login ghcr.io
|
docker login ghcr.io
|
||||||
@ -960,7 +960,7 @@ docker system info
|
|||||||
|
|
||||||
**Homebrew Formula Issues**:
|
**Homebrew Formula Issues**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Solution: Manual PR creation
|
# Solution: Manual PR creation
|
||||||
git clone https://github.com/Homebrew/homebrew-core
|
git clone https://github.com/Homebrew/homebrew-core
|
||||||
cd homebrew-core
|
cd homebrew-core
|
||||||
@ -973,7 +973,7 @@ git commit -m "provisioning 2.1.0"
|
|||||||
|
|
||||||
**Debug Mode**:
|
**Debug Mode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable debug logging
|
# Enable debug logging
|
||||||
export PROVISIONING_DEBUG=true
|
export PROVISIONING_DEBUG=true
|
||||||
export RUST_LOG=debug
|
export RUST_LOG=debug
|
||||||
@ -989,7 +989,7 @@ nu src/tools/distribution/generate-distribution.nu
|
|||||||
|
|
||||||
**Monitoring Build Progress**:
|
**Monitoring Build Progress**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monitor build logs
|
# Monitor build logs
|
||||||
tail -f src/tools/build.log
|
tail -f src/tools/build.log
|
||||||
|
|
||||||
|
|||||||
@ -137,7 +137,7 @@ orchestrator).
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning batch submit workflow.ncl
|
provisioning batch submit workflow.ncl
|
||||||
provisioning batch list
|
provisioning batch list
|
||||||
provisioning batch status <id>
|
provisioning batch status <id>
|
||||||
@ -161,7 +161,7 @@ provisioning batch status <id>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning break-glass request "reason"
|
provisioning break-glass request "reason"
|
||||||
provisioning break-glass approve <id>
|
provisioning break-glass approve <id>
|
||||||
```
|
```
|
||||||
@ -220,7 +220,7 @@ provisioning break-glass approve <id>
|
|||||||
|
|
||||||
**Examples**:
|
**Examples**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create
|
provisioning server create
|
||||||
provisioning taskserv install kubernetes
|
provisioning taskserv install kubernetes
|
||||||
provisioning workspace switch prod
|
provisioning workspace switch prod
|
||||||
@ -249,7 +249,7 @@ provisioning workspace switch prod
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning cluster create <name>
|
provisioning cluster create <name>
|
||||||
provisioning cluster list
|
provisioning cluster list
|
||||||
provisioning cluster delete <name>
|
provisioning cluster delete <name>
|
||||||
@ -383,7 +383,7 @@ provisioning cluster delete <name>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning status
|
provisioning status
|
||||||
provisioning diagnostics run
|
provisioning diagnostics run
|
||||||
```
|
```
|
||||||
@ -427,7 +427,7 @@ provisioning diagnostics run
|
|||||||
|
|
||||||
**Usage**:
|
**Usage**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
PROVISIONING_ENV=prod provisioning server list
|
PROVISIONING_ENV=prod provisioning server list
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ PROVISIONING_ENV=prod provisioning server list
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning compliance gdpr export <user>
|
provisioning compliance gdpr export <user>
|
||||||
provisioning compliance gdpr delete <user>
|
provisioning compliance gdpr delete <user>
|
||||||
```
|
```
|
||||||
@ -529,7 +529,7 @@ provisioning compliance gdpr delete <user>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning guide from-scratch
|
provisioning guide from-scratch
|
||||||
provisioning guide update
|
provisioning guide update
|
||||||
provisioning guide customize
|
provisioning guide customize
|
||||||
@ -555,7 +555,7 @@ provisioning guide customize
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
health_check = {
|
health_check = {
|
||||||
endpoint = "http://localhost:6443/healthz"
|
endpoint = "http://localhost:6443/healthz"
|
||||||
timeout = 30
|
timeout = 30
|
||||||
@ -602,7 +602,7 @@ health_check = {
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning infra list
|
provisioning infra list
|
||||||
provisioning generate infra --new <name>
|
provisioning generate infra --new <name>
|
||||||
```
|
```
|
||||||
@ -719,7 +719,7 @@ provisioning generate infra --new <name>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning taskserv create kubernetes
|
provisioning taskserv create kubernetes
|
||||||
provisioning test quick kubernetes
|
provisioning test quick kubernetes
|
||||||
```
|
```
|
||||||
@ -778,7 +778,7 @@ provisioning test quick kubernetes
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning mfa totp enroll
|
provisioning mfa totp enroll
|
||||||
provisioning mfa webauthn enroll
|
provisioning mfa webauthn enroll
|
||||||
provisioning mfa verify <code>
|
provisioning mfa verify <code>
|
||||||
@ -818,7 +818,7 @@ provisioning mfa verify <code>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning module discover provider
|
provisioning module discover provider
|
||||||
provisioning module load provider <ws> <name>
|
provisioning module load provider <ws> <name>
|
||||||
provisioning module list taskserv
|
provisioning module list taskserv
|
||||||
@ -896,7 +896,7 @@ provisioning module list taskserv
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/platform/orchestrator
|
cd provisioning/platform/orchestrator
|
||||||
./scripts/start-orchestrator.nu --background
|
./scripts/start-orchestrator.nu --background
|
||||||
```
|
```
|
||||||
@ -953,7 +953,7 @@ cd provisioning/platform/orchestrator
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning plugin list
|
provisioning plugin list
|
||||||
provisioning plugin install
|
provisioning plugin install
|
||||||
```
|
```
|
||||||
@ -980,7 +980,7 @@ provisioning plugin install
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning module discover provider
|
provisioning module discover provider
|
||||||
provisioning providers list
|
provisioning providers list
|
||||||
```
|
```
|
||||||
@ -1005,7 +1005,7 @@ provisioning providers list
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning sc # Fastest
|
provisioning sc # Fastest
|
||||||
provisioning guide quickstart
|
provisioning guide quickstart
|
||||||
```
|
```
|
||||||
@ -1080,7 +1080,7 @@ provisioning guide quickstart
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning batch rollback <workflow-id>
|
provisioning batch rollback <workflow-id>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1118,7 +1118,7 @@ provisioning batch rollback <workflow-id>
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let ServerConfig = {
|
let ServerConfig = {
|
||||||
hostname | string,
|
hostname | string,
|
||||||
cores | number,
|
cores | number,
|
||||||
@ -1177,7 +1177,7 @@ ServerConfig
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create
|
provisioning server create
|
||||||
provisioning server list
|
provisioning server list
|
||||||
provisioning server ssh <hostname>
|
provisioning server ssh <hostname>
|
||||||
@ -1241,7 +1241,7 @@ provisioning server ssh <hostname>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning sops edit <file>
|
provisioning sops edit <file>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1261,7 +1261,7 @@ provisioning sops edit <file>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server ssh <hostname>
|
provisioning server ssh <hostname>
|
||||||
provisioning ssh connect <server>
|
provisioning ssh connect <server>
|
||||||
```
|
```
|
||||||
@ -1316,7 +1316,7 @@ provisioning ssh connect <server>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning taskserv create <name>
|
provisioning taskserv create <name>
|
||||||
provisioning taskserv list
|
provisioning taskserv list
|
||||||
provisioning test quick <taskserv>
|
provisioning test quick <taskserv>
|
||||||
@ -1356,7 +1356,7 @@ provisioning test quick <taskserv>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning test quick <taskserv>
|
provisioning test quick <taskserv>
|
||||||
provisioning test env single <taskserv>
|
provisioning test env single <taskserv>
|
||||||
provisioning test env cluster <cluster>
|
provisioning test env cluster <cluster>
|
||||||
@ -1396,7 +1396,7 @@ provisioning test env cluster <cluster>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning mfa totp enroll
|
provisioning mfa totp enroll
|
||||||
provisioning mfa totp verify <code>
|
provisioning mfa totp verify <code>
|
||||||
```
|
```
|
||||||
@ -1449,7 +1449,7 @@ provisioning mfa totp verify <code>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning version check
|
provisioning version check
|
||||||
provisioning version apply
|
provisioning version apply
|
||||||
```
|
```
|
||||||
@ -1474,7 +1474,7 @@ provisioning version apply
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning validate config
|
provisioning validate config
|
||||||
provisioning validate infrastructure
|
provisioning validate infrastructure
|
||||||
```
|
```
|
||||||
@ -1497,7 +1497,7 @@ provisioning validate infrastructure
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning version
|
provisioning version
|
||||||
provisioning version check
|
provisioning version check
|
||||||
provisioning taskserv check-updates
|
provisioning taskserv check-updates
|
||||||
@ -1521,7 +1521,7 @@ provisioning taskserv check-updates
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning mfa webauthn enroll
|
provisioning mfa webauthn enroll
|
||||||
provisioning mfa webauthn verify
|
provisioning mfa webauthn verify
|
||||||
```
|
```
|
||||||
@ -1542,7 +1542,7 @@ provisioning mfa webauthn verify
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning workflow list
|
provisioning workflow list
|
||||||
provisioning workflow status <id>
|
provisioning workflow status <id>
|
||||||
provisioning workflow monitor <id>
|
provisioning workflow monitor <id>
|
||||||
@ -1568,7 +1568,7 @@ provisioning workflow monitor <id>
|
|||||||
|
|
||||||
**Commands**:
|
**Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning workspace list
|
provisioning workspace list
|
||||||
provisioning workspace switch <name>
|
provisioning workspace switch <name>
|
||||||
provisioning workspace create <name>
|
provisioning workspace create <name>
|
||||||
|
|||||||
@ -43,7 +43,7 @@ specific commands, validation steps, and rollback procedures.
|
|||||||
|
|
||||||
#### Step 1.1: Create Complete Backup
|
#### Step 1.1: Create Complete Backup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create timestamped backup
|
# Create timestamped backup
|
||||||
BACKUP_DIR="/Users/Akasha/project-provisioning-backup-$(date +%Y%m%d)"
|
BACKUP_DIR="/Users/Akasha/project-provisioning-backup-$(date +%Y%m%d)"
|
||||||
cp -r /Users/Akasha/project-provisioning "$BACKUP_DIR"
|
cp -r /Users/Akasha/project-provisioning "$BACKUP_DIR"
|
||||||
@ -59,7 +59,7 @@ echo "✅ Backup created: $BACKUP_DIR"
|
|||||||
|
|
||||||
#### Step 1.2: Analyze Current State
|
#### Step 1.2: Analyze Current State
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd /Users/Akasha/project-provisioning
|
cd /Users/Akasha/project-provisioning
|
||||||
|
|
||||||
# Count workspace directories
|
# Count workspace directories
|
||||||
@ -96,7 +96,7 @@ echo "✅ Analysis complete: docs/development/current-state-analysis.txt"
|
|||||||
|
|
||||||
#### Step 1.3: Identify Dependencies
|
#### Step 1.3: Identify Dependencies
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Find all hardcoded paths
|
# Find all hardcoded paths
|
||||||
echo "=== Hardcoded Paths in Nushell Scripts ==="
|
echo "=== Hardcoded Paths in Nushell Scripts ==="
|
||||||
rg -t nu "workspace/|_workspace/|backup-workspace/" provisioning/core/nulib/ | tee hardcoded-paths.txt
|
rg -t nu "workspace/|_workspace/|backup-workspace/" provisioning/core/nulib/ | tee hardcoded-paths.txt
|
||||||
@ -114,7 +114,7 @@ echo "✅ Dependencies mapped"
|
|||||||
|
|
||||||
#### Step 1.4: Create Implementation Branch
|
#### Step 1.4: Create Implementation Branch
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create and switch to implementation branch
|
# Create and switch to implementation branch
|
||||||
git checkout -b feat/repo-restructure
|
git checkout -b feat/repo-restructure
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ echo "✅ Implementation branch created: feat/repo-restructure"
|
|||||||
|
|
||||||
#### Step 2.1: Create New Directory Structure
|
#### Step 2.1: Create New Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd /Users/Akasha/project-provisioning
|
cd /Users/Akasha/project-provisioning
|
||||||
|
|
||||||
# Create distribution directory structure
|
# Create distribution directory structure
|
||||||
@ -156,7 +156,7 @@ tree -L 2 distribution/ workspace/
|
|||||||
|
|
||||||
#### Step 2.2: Move Build Artifacts
|
#### Step 2.2: Move Build Artifacts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Move Rust build artifacts
|
# Move Rust build artifacts
|
||||||
if [ -d "target" ]; then
|
if [ -d "target" ]; then
|
||||||
mv target distribution/target
|
mv target distribution/target
|
||||||
@ -178,7 +178,7 @@ done
|
|||||||
|
|
||||||
#### Step 2.3: Consolidate Workspaces
|
#### Step 2.3: Consolidate Workspaces
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Identify active workspace
|
# Identify active workspace
|
||||||
echo "=== Current Workspace Status ==="
|
echo "=== Current Workspace Status ==="
|
||||||
ls -la workspace/ _workspace/ backup-workspace/ 2>/dev/null
|
ls -la workspace/ _workspace/ backup-workspace/ 2>/dev/null
|
||||||
@ -221,7 +221,7 @@ echo "✅ Workspaces consolidated"
|
|||||||
|
|
||||||
#### Step 2.4: Remove Obsolete Directories
|
#### Step 2.4: Remove Obsolete Directories
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Remove build artifacts (already moved)
|
# Remove build artifacts (already moved)
|
||||||
rm -rf wrks/
|
rm -rf wrks/
|
||||||
echo "✅ Removed wrks/"
|
echo "✅ Removed wrks/"
|
||||||
@ -248,7 +248,7 @@ echo "✅ Cleanup complete"
|
|||||||
|
|
||||||
#### Step 2.5: Update .gitignore
|
#### Step 2.5: Update .gitignore
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup existing .gitignore
|
# Backup existing .gitignore
|
||||||
cp .gitignore .gitignore.backup
|
cp .gitignore .gitignore.backup
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ echo "✅ Updated .gitignore"
|
|||||||
|
|
||||||
#### Step 2.6: Commit Restructuring
|
#### Step 2.6: Commit Restructuring
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Stage changes
|
# Stage changes
|
||||||
git add -A
|
git add -A
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ echo "✅ Restructuring committed"
|
|||||||
|
|
||||||
#### Step 3.1: Create Path Update Script
|
#### Step 3.1: Create Path Update Script
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create migration script
|
# Create migration script
|
||||||
cat > provisioning/tools/migration/update-paths.nu << 'EOF'
|
cat > provisioning/tools/migration/update-paths.nu << 'EOF'
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
@ -407,7 +407,7 @@ chmod +x provisioning/tools/migration/update-paths.nu
|
|||||||
|
|
||||||
#### Step 3.2: Run Path Updates
|
#### Step 3.2: Run Path Updates
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create backup before updates
|
# Create backup before updates
|
||||||
git stash
|
git stash
|
||||||
git checkout -b feat/path-updates
|
git checkout -b feat/path-updates
|
||||||
@ -424,7 +424,7 @@ nu -c "use provisioning/core/nulib/servers/create.nu; print 'OK'"
|
|||||||
|
|
||||||
#### Step 3.3: Update CLAUDE.md
|
#### Step 3.3: Update CLAUDE.md
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update CLAUDE.md with new paths
|
# Update CLAUDE.md with new paths
|
||||||
cat > CLAUDE.md.new << 'EOF'
|
cat > CLAUDE.md.new << 'EOF'
|
||||||
# CLAUDE.md
|
# CLAUDE.md
|
||||||
@ -461,7 +461,7 @@ mv CLAUDE.md.new CLAUDE.md
|
|||||||
|
|
||||||
#### Step 3.4: Update Documentation
|
#### Step 3.4: Update Documentation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Find all documentation files
|
# Find all documentation files
|
||||||
fd -e md . docs/
|
fd -e md . docs/
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ echo "Files listed in: docs-to-update.txt"
|
|||||||
|
|
||||||
#### Step 3.5: Commit Path Updates
|
#### Step 3.5: Commit Path Updates
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "refactor: update all path references for new structure
|
git commit -m "refactor: update all path references for new structure
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ echo "✅ Path updates committed"
|
|||||||
|
|
||||||
#### Step 4.1: Automated Validation
|
#### Step 4.1: Automated Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create validation script
|
# Create validation script
|
||||||
cat > provisioning/tools/validation/validate-structure.nu << 'EOF'
|
cat > provisioning/tools/validation/validate-structure.nu << 'EOF'
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
@ -592,7 +592,7 @@ nu provisioning/tools/validation/validate-structure.nu
|
|||||||
|
|
||||||
#### Step 4.2: Functional Testing
|
#### Step 4.2: Functional Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test core commands
|
# Test core commands
|
||||||
echo "=== Testing Core Commands ==="
|
echo "=== Testing Core Commands ==="
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ echo "✅ Functional tests passed"
|
|||||||
|
|
||||||
#### Step 4.3: Integration Testing
|
#### Step 4.3: Integration Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test workflow system
|
# Test workflow system
|
||||||
echo "=== Testing Workflow System ==="
|
echo "=== Testing Workflow System ==="
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ echo "✅ Integration tests passed"
|
|||||||
|
|
||||||
#### Step 4.4: Create Test Report
|
#### Step 4.4: Create Test Report
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
echo "# Repository Restructuring - Validation Report"
|
echo "# Repository Restructuring - Validation Report"
|
||||||
echo "Date: $(date)"
|
echo "Date: $(date)"
|
||||||
@ -669,7 +669,7 @@ echo "✅ Test report created: docs/development/phase1-validation-report.md"
|
|||||||
|
|
||||||
#### Step 4.5: Update README
|
#### Step 4.5: Update README
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update main README with new structure
|
# Update main README with new structure
|
||||||
# This is manual - review and update README.md
|
# This is manual - review and update README.md
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ echo " - Update quick start guide"
|
|||||||
|
|
||||||
#### Step 4.6: Finalize Phase 1
|
#### Step 4.6: Finalize Phase 1
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Commit validation and reports
|
# Commit validation and reports
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "test: add validation for repository restructuring
|
git commit -m "test: add validation for repository restructuring
|
||||||
@ -718,7 +718,7 @@ echo "✅ Phase 1 complete and merged"
|
|||||||
|
|
||||||
#### Step 5.1: Create Build Tools Directory
|
#### Step 5.1: Create Build Tools Directory
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
mkdir -p provisioning/tools/build
|
mkdir -p provisioning/tools/build
|
||||||
cd provisioning/tools/build
|
cd provisioning/tools/build
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ echo "✅ Build tools directory created"
|
|||||||
|
|
||||||
#### Step 5.2: Implement Core Build System
|
#### Step 5.2: Implement Core Build System
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create main build orchestrator
|
# Create main build orchestrator
|
||||||
# See full implementation in repo-dist-analysis.md
|
# See full implementation in repo-dist-analysis.md
|
||||||
# Copy build-system.nu from the analysis document
|
# Copy build-system.nu from the analysis document
|
||||||
@ -741,7 +741,7 @@ nu build-system.nu status
|
|||||||
|
|
||||||
#### Step 5.3: Implement Core Packaging
|
#### Step 5.3: Implement Core Packaging
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create package-core.nu
|
# Create package-core.nu
|
||||||
# This packages Nushell libraries, KCL schemas, templates
|
# This packages Nushell libraries, KCL schemas, templates
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ nu build-system.nu build-core --version dev
|
|||||||
|
|
||||||
#### Step 5.4: Create Justfile
|
#### Step 5.4: Create Justfile
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create Justfile in project root
|
# Create Justfile in project root
|
||||||
# See full Justfile in repo-dist-analysis.md
|
# See full Justfile in repo-dist-analysis.md
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ just status
|
|||||||
|
|
||||||
#### Step 9.1: Create install.nu
|
#### Step 9.1: Create install.nu
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
mkdir -p distribution/installers
|
mkdir -p distribution/installers
|
||||||
|
|
||||||
# Create install.nu
|
# Create install.nu
|
||||||
@ -788,7 +788,7 @@ mkdir -p distribution/installers
|
|||||||
|
|
||||||
#### Step 9.2: Test Installation
|
#### Step 9.2: Test Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test installation to /tmp
|
# Test installation to /tmp
|
||||||
nu distribution/installers/install.nu --prefix /tmp/provisioning-test
|
nu distribution/installers/install.nu --prefix /tmp/provisioning-test
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ nu distribution/installers/install.nu uninstall --prefix /tmp/provisioning-test
|
|||||||
|
|
||||||
### If Phase 1 Fails
|
### If Phase 1 Fails
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Restore from backup
|
# Restore from backup
|
||||||
rm -rf /Users/Akasha/project-provisioning
|
rm -rf /Users/Akasha/project-provisioning
|
||||||
cp -r "$BACKUP_DIR" /Users/Akasha/project-provisioning
|
cp -r "$BACKUP_DIR" /Users/Akasha/project-provisioning
|
||||||
@ -825,7 +825,7 @@ git branch -D feat/repo-restructure
|
|||||||
|
|
||||||
### If Build System Fails
|
### If Build System Fails
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Revert build system commits
|
# Revert build system commits
|
||||||
git checkout feat/repo-restructure
|
git checkout feat/repo-restructure
|
||||||
git revert <commit-hash>
|
git revert <commit-hash>
|
||||||
@ -833,7 +833,7 @@ git revert <commit-hash>
|
|||||||
|
|
||||||
### If Installation Fails
|
### If Installation Fails
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean up test installation
|
# Clean up test installation
|
||||||
rm -rf /tmp/provisioning-test
|
rm -rf /tmp/provisioning-test
|
||||||
sudo rm -rf /usr/local/lib/provisioning
|
sudo rm -rf /usr/local/lib/provisioning
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Before creating custom extensions, assess your infrastructure requirements:
|
|||||||
|
|
||||||
#### 1. Application Inventory
|
#### 1. Application Inventory
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Document existing applications
|
# Document existing applications
|
||||||
cat > infrastructure-assessment.yaml << EOF
|
cat > infrastructure-assessment.yaml << EOF
|
||||||
applications:
|
applications:
|
||||||
@ -75,7 +75,7 @@ EOF
|
|||||||
|
|
||||||
#### 2. Gap Analysis
|
#### 2. Gap Analysis
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Analyze what standard modules don't cover
|
# Analyze what standard modules don't cover
|
||||||
./provisioning/core/cli/module-loader discover taskservs > available-modules.txt
|
./provisioning/core/cli/module-loader discover taskservs > available-modules.txt
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ EOF
|
|||||||
|
|
||||||
#### Business Requirements Template
|
#### Business Requirements Template
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
"""
|
"""
|
||||||
Business Requirements Schema for Custom Extensions
|
Business Requirements Schema for Custom Extensions
|
||||||
Use this template to document requirements before development
|
Use this template to document requirements before development
|
||||||
@ -179,7 +179,7 @@ schema Integration:
|
|||||||
|
|
||||||
#### Example: Legacy ERP System Integration
|
#### Example: Legacy ERP System Integration
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create company-specific taskserv
|
# Create company-specific taskserv
|
||||||
mkdir -p extensions/taskservs/company-specific/legacy-erp/nickel
|
mkdir -p extensions/taskservs/company-specific/legacy-erp/nickel
|
||||||
cd extensions/taskservs/company-specific/legacy-erp/nickel
|
cd extensions/taskservs/company-specific/legacy-erp/nickel
|
||||||
@ -187,7 +187,7 @@ cd extensions/taskservs/company-specific/legacy-erp/nickel
|
|||||||
|
|
||||||
Create `legacy-erp.ncl`:
|
Create `legacy-erp.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
"""
|
"""
|
||||||
Legacy ERP System Taskserv
|
Legacy ERP System Taskserv
|
||||||
Handles deployment and management of company's legacy ERP system
|
Handles deployment and management of company's legacy ERP system
|
||||||
@ -437,7 +437,7 @@ legacy_erp_default: LegacyERPTaskserv = {
|
|||||||
|
|
||||||
Create `compliance-monitor.ncl`:
|
Create `compliance-monitor.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
"""
|
"""
|
||||||
Compliance Monitoring Taskserv
|
Compliance Monitoring Taskserv
|
||||||
Automated compliance checking and reporting for regulated environments
|
Automated compliance checking and reporting for regulated environments
|
||||||
@ -607,7 +607,7 @@ compliance_monitor_default: ComplianceMonitorTaskserv = {
|
|||||||
|
|
||||||
When working with specialized or private cloud providers:
|
When working with specialized or private cloud providers:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create custom provider extension
|
# Create custom provider extension
|
||||||
mkdir -p extensions/providers/company-private-cloud/nickel
|
mkdir -p extensions/providers/company-private-cloud/nickel
|
||||||
cd extensions/providers/company-private-cloud/nickel
|
cd extensions/providers/company-private-cloud/nickel
|
||||||
@ -615,7 +615,7 @@ cd extensions/providers/company-private-cloud/nickel
|
|||||||
|
|
||||||
Create `provision_company-private-cloud.ncl`:
|
Create `provision_company-private-cloud.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
"""
|
"""
|
||||||
Company Private Cloud Provider
|
Company Private Cloud Provider
|
||||||
Integration with company's private cloud infrastructure
|
Integration with company's private cloud infrastructure
|
||||||
@ -762,7 +762,7 @@ company_private_cloud_defaults: defaults.ServerDefaults = {
|
|||||||
|
|
||||||
Create environment-specific extensions that handle different deployment patterns:
|
Create environment-specific extensions that handle different deployment patterns:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create environment management extension
|
# Create environment management extension
|
||||||
mkdir -p extensions/clusters/company-environments/nickel
|
mkdir -p extensions/clusters/company-environments/nickel
|
||||||
cd extensions/clusters/company-environments/nickel
|
cd extensions/clusters/company-environments/nickel
|
||||||
@ -770,7 +770,7 @@ cd extensions/clusters/company-environments/nickel
|
|||||||
|
|
||||||
Create `company-environments.ncl`:
|
Create `company-environments.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
"""
|
"""
|
||||||
Company Environment Management
|
Company Environment Management
|
||||||
Standardized environment configurations for different deployment stages
|
Standardized environment configurations for different deployment stages
|
||||||
@ -950,7 +950,7 @@ environment_templates = {
|
|||||||
|
|
||||||
Create integration patterns for common legacy system scenarios:
|
Create integration patterns for common legacy system scenarios:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create integration patterns
|
# Create integration patterns
|
||||||
mkdir -p extensions/taskservs/integrations/legacy-bridge/nickel
|
mkdir -p extensions/taskservs/integrations/legacy-bridge/nickel
|
||||||
cd extensions/taskservs/integrations/legacy-bridge/nickel
|
cd extensions/taskservs/integrations/legacy-bridge/nickel
|
||||||
@ -958,7 +958,7 @@ cd extensions/taskservs/integrations/legacy-bridge/nickel
|
|||||||
|
|
||||||
Create `legacy-bridge.ncl`:
|
Create `legacy-bridge.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
"""
|
"""
|
||||||
Legacy System Integration Bridge
|
Legacy System Integration Bridge
|
||||||
Provides standardized integration patterns for legacy systems
|
Provides standardized integration patterns for legacy systems
|
||||||
@ -1161,21 +1161,21 @@ legacy_bridge_dependencies: deps.TaskservDependencies = {
|
|||||||
|
|
||||||
### Example 1: Financial Services Company
|
### Example 1: Financial Services Company
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Financial services specific extensions
|
# Financial services specific extensions
|
||||||
mkdir -p extensions/taskservs/financial-services/{trading-system,risk-engine,compliance-reporter}/nickel
|
mkdir -p extensions/taskservs/financial-services/{trading-system,risk-engine,compliance-reporter}/nickel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example 2: Healthcare Organization
|
### Example 2: Healthcare Organization
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Healthcare specific extensions
|
# Healthcare specific extensions
|
||||||
mkdir -p extensions/taskservs/healthcare/{hl7-processor,dicom-storage,hipaa-audit}/nickel
|
mkdir -p extensions/taskservs/healthcare/{hl7-processor,dicom-storage,hipaa-audit}/nickel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example 3: Manufacturing Company
|
### Example 3: Manufacturing Company
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Manufacturing specific extensions
|
# Manufacturing specific extensions
|
||||||
mkdir -p extensions/taskservs/manufacturing/{iot-gateway,scada-bridge,quality-system}/nickel
|
mkdir -p extensions/taskservs/manufacturing/{iot-gateway,scada-bridge,quality-system}/nickel
|
||||||
```
|
```
|
||||||
@ -1184,7 +1184,7 @@ mkdir -p extensions/taskservs/manufacturing/{iot-gateway,scada-bridge,quality-sy
|
|||||||
|
|
||||||
#### Loading Infrastructure-Specific Extensions
|
#### Loading Infrastructure-Specific Extensions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Load company-specific extensions
|
# Load company-specific extensions
|
||||||
cd workspace/infra/production
|
cd workspace/infra/production
|
||||||
module-loader load taskservs . [legacy-erp, compliance-monitor, legacy-bridge]
|
module-loader load taskservs . [legacy-erp, compliance-monitor, legacy-bridge]
|
||||||
@ -1198,7 +1198,7 @@ module-loader validate .
|
|||||||
|
|
||||||
#### Using in Server Configuration
|
#### Using in Server Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Import loaded extensions
|
# Import loaded extensions
|
||||||
import .taskservs.legacy-erp.legacy-erp as erp
|
import .taskservs.legacy-erp.legacy-erp as erp
|
||||||
import .taskservs.compliance-monitor.compliance-monitor as compliance
|
import .taskservs.compliance-monitor.compliance-monitor as compliance
|
||||||
|
|||||||
@ -30,7 +30,7 @@ existing production systems while providing clear migration pathways.
|
|||||||
|
|
||||||
**Integration Architecture**:
|
**Integration Architecture**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Integration Ecosystem
|
Integration Ecosystem
|
||||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||||
│ Legacy Core │ ←→ │ Bridge Layer │ ←→ │ New Systems │
|
│ Legacy Core │ ←→ │ Bridge Layer │ ←→ │ New Systems │
|
||||||
@ -48,7 +48,7 @@ Integration Ecosystem
|
|||||||
|
|
||||||
**Seamless CLI Compatibility**:
|
**Seamless CLI Compatibility**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# All existing commands continue to work unchanged
|
# All existing commands continue to work unchanged
|
||||||
./core/nulib/provisioning server create web-01 2xCPU-4 GB
|
./core/nulib/provisioning server create web-01 2xCPU-4 GB
|
||||||
./core/nulib/provisioning taskserv install kubernetes
|
./core/nulib/provisioning taskserv install kubernetes
|
||||||
@ -61,7 +61,7 @@ nu workspace/tools/workspace.nu health --detailed
|
|||||||
|
|
||||||
**Path Resolution Integration**:
|
**Path Resolution Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Automatic path resolution between systems
|
# Automatic path resolution between systems
|
||||||
use workspace/lib/path-resolver.nu
|
use workspace/lib/path-resolver.nu
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ let provider_path = (path-resolver resolve_extension "providers" "upcloud")
|
|||||||
|
|
||||||
**Dual Configuration Support**:
|
**Dual Configuration Support**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Configuration bridge supports both ENV and TOML
|
# Configuration bridge supports both ENV and TOML
|
||||||
def get-config-value-bridge [key: string, default: string = ""] -> string {
|
def get-config-value-bridge [key: string, default: string = ""] -> string {
|
||||||
# Try new TOML configuration first
|
# Try new TOML configuration first
|
||||||
@ -113,7 +113,7 @@ def get-config-value-bridge [key: string, default: string = ""] -> string {
|
|||||||
|
|
||||||
**Shared Data Access**:
|
**Shared Data Access**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Unified data access across old and new systems
|
# Unified data access across old and new systems
|
||||||
def get-server-info [server_name: string] -> record {
|
def get-server-info [server_name: string] -> record {
|
||||||
# Try new orchestrator data store first
|
# Try new orchestrator data store first
|
||||||
@ -142,7 +142,7 @@ def get-server-info [server_name: string] -> record {
|
|||||||
|
|
||||||
**Hybrid Process Management**:
|
**Hybrid Process Management**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Orchestrator-aware process management
|
# Orchestrator-aware process management
|
||||||
def create-server-integrated [
|
def create-server-integrated [
|
||||||
name: string,
|
name: string,
|
||||||
@ -179,7 +179,7 @@ def check-orchestrator-available [] -> bool {
|
|||||||
|
|
||||||
**Version Header Support**:
|
**Version Header Support**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# API calls with version specification
|
# API calls with version specification
|
||||||
curl -H "API-Version: v1" http://localhost:9090/servers
|
curl -H "API-Version: v1" http://localhost:9090/servers
|
||||||
curl -H "API-Version: v2" http://localhost:9090/workflows/servers/create
|
curl -H "API-Version: v2" http://localhost:9090/workflows/servers/create
|
||||||
@ -190,7 +190,7 @@ curl -H "API-Version: v3" http://localhost:9090/workflows/batch/submit
|
|||||||
|
|
||||||
**Backward Compatible Endpoints**:
|
**Backward Compatible Endpoints**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Rust API compatibility layer
|
// Rust API compatibility layer
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
struct ApiRequest {
|
struct ApiRequest {
|
||||||
@ -233,7 +233,7 @@ async fn handle_v1_request(payload: serde_json::Value) -> Result<ApiResponse, Ap
|
|||||||
|
|
||||||
**Backward Compatible Schema Changes**:
|
**Backward Compatible Schema Changes**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# API schema with version support
|
# API schema with version support
|
||||||
let ServerCreateRequest = {
|
let ServerCreateRequest = {
|
||||||
# V1 fields (always supported)
|
# V1 fields (always supported)
|
||||||
@ -267,7 +267,7 @@ WorkflowOptions
|
|||||||
|
|
||||||
**Multi-Version Client Support**:
|
**Multi-Version Client Support**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Nushell client with version support
|
# Nushell client with version support
|
||||||
def "client create-server" [
|
def "client create-server" [
|
||||||
name: string,
|
name: string,
|
||||||
@ -309,7 +309,7 @@ def "client create-server" [
|
|||||||
|
|
||||||
**Migration Strategy**:
|
**Migration Strategy**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Database Evolution Path
|
Database Evolution Path
|
||||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||||
│ File-based │ → │ SQLite │ → │ SurrealDB │
|
│ File-based │ → │ SQLite │ → │ SurrealDB │
|
||||||
@ -325,7 +325,7 @@ Database Evolution Path
|
|||||||
|
|
||||||
**Automated Database Migration**:
|
**Automated Database Migration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Database migration orchestration
|
# Database migration orchestration
|
||||||
def migrate-database [
|
def migrate-database [
|
||||||
--from: string = "filesystem",
|
--from: string = "filesystem",
|
||||||
@ -366,7 +366,7 @@ def migrate-database [
|
|||||||
|
|
||||||
**File System to SurrealDB Migration**:
|
**File System to SurrealDB Migration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def migrate_filesystem_to_surrealdb [] -> record {
|
def migrate_filesystem_to_surrealdb [] -> record {
|
||||||
# Initialize SurrealDB connection
|
# Initialize SurrealDB connection
|
||||||
let db = (connect-surrealdb)
|
let db = (connect-surrealdb)
|
||||||
@ -420,7 +420,7 @@ def migrate_filesystem_to_surrealdb [] -> record {
|
|||||||
|
|
||||||
**Migration Verification**:
|
**Migration Verification**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def verify-migration [from: string, to: string] -> record {
|
def verify-migration [from: string, to: string] -> record {
|
||||||
print "Verifying data integrity..."
|
print "Verifying data integrity..."
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ def verify-migration [from: string, to: string] -> record {
|
|||||||
|
|
||||||
**Hybrid Deployment Model**:
|
**Hybrid Deployment Model**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Deployment Architecture
|
Deployment Architecture
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ Load Balancer / Reverse Proxy │
|
│ Load Balancer / Reverse Proxy │
|
||||||
@ -488,7 +488,7 @@ Deployment Architecture
|
|||||||
|
|
||||||
**Blue-Green Deployment**:
|
**Blue-Green Deployment**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Blue-Green deployment with integration bridge
|
# Blue-Green deployment with integration bridge
|
||||||
# Phase 1: Deploy new system alongside existing (Green environment)
|
# Phase 1: Deploy new system alongside existing (Green environment)
|
||||||
cd src/tools
|
cd src/tools
|
||||||
@ -519,7 +519,7 @@ nginx-traffic-split --new-backend 100%
|
|||||||
|
|
||||||
**Rolling Update**:
|
**Rolling Update**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def rolling-deployment [
|
def rolling-deployment [
|
||||||
--target-version: string,
|
--target-version: string,
|
||||||
--batch-size: int = 3,
|
--batch-size: int = 3,
|
||||||
@ -576,7 +576,7 @@ def rolling-deployment [
|
|||||||
|
|
||||||
**Environment-Specific Deployment**:
|
**Environment-Specific Deployment**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Development deployment
|
# Development deployment
|
||||||
PROVISIONING_ENV=dev ./deploy.sh
|
PROVISIONING_ENV=dev ./deploy.sh
|
||||||
--config-source config.dev.toml
|
--config-source config.dev.toml
|
||||||
@ -602,7 +602,7 @@ PROVISIONING_ENV=prod ./deploy.sh
|
|||||||
|
|
||||||
**Docker Deployment with Bridge**:
|
**Docker Deployment with Bridge**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Multi-stage Docker build supporting both systems
|
# Multi-stage Docker build supporting both systems
|
||||||
FROM rust:1.70 as builder
|
FROM rust:1.70 as builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -630,7 +630,7 @@ CMD ["/app/bin/bridge-start.sh"]
|
|||||||
|
|
||||||
**Kubernetes Integration**:
|
**Kubernetes Integration**:
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# Kubernetes deployment with bridge sidecar
|
# Kubernetes deployment with bridge sidecar
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@ -678,7 +678,7 @@ spec:
|
|||||||
|
|
||||||
**Monitoring Stack Integration**:
|
**Monitoring Stack Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Observability Architecture
|
Observability Architecture
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────────────────────────┐
|
||||||
│ Monitoring Dashboard │
|
│ Monitoring Dashboard │
|
||||||
@ -714,7 +714,7 @@ Observability Architecture
|
|||||||
|
|
||||||
**Unified Metrics Collection**:
|
**Unified Metrics Collection**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Metrics bridge for legacy and new systems
|
# Metrics bridge for legacy and new systems
|
||||||
def collect-system-metrics [] -> record {
|
def collect-system-metrics [] -> record {
|
||||||
let legacy_metrics = collect-legacy-metrics
|
let legacy_metrics = collect-legacy-metrics
|
||||||
@ -770,7 +770,7 @@ def collect-new-metrics [] -> record {
|
|||||||
|
|
||||||
**Unified Logging Strategy**:
|
**Unified Logging Strategy**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Structured logging bridge
|
# Structured logging bridge
|
||||||
def log-integrated [
|
def log-integrated [
|
||||||
level: string,
|
level: string,
|
||||||
@ -805,7 +805,7 @@ def log-integrated [
|
|||||||
|
|
||||||
**Comprehensive Health Monitoring**:
|
**Comprehensive Health Monitoring**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def health-check-integrated [] -> record {
|
def health-check-integrated [] -> record {
|
||||||
let health_checks = [
|
let health_checks = [
|
||||||
{name: "legacy-system", check: (check-legacy-health)},
|
{name: "legacy-system", check: (check-legacy-health)},
|
||||||
@ -844,7 +844,7 @@ def health-check-integrated [] -> record {
|
|||||||
|
|
||||||
**Bridge Component Design**:
|
**Bridge Component Design**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Legacy system bridge module
|
# Legacy system bridge module
|
||||||
export module bridge {
|
export module bridge {
|
||||||
# Bridge state management
|
# Bridge state management
|
||||||
@ -905,7 +905,7 @@ export module bridge {
|
|||||||
|
|
||||||
**Compatibility Mode**:
|
**Compatibility Mode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Full compatibility with legacy system
|
# Full compatibility with legacy system
|
||||||
def run-compatibility-mode [] {
|
def run-compatibility-mode [] {
|
||||||
print "Starting bridge in compatibility mode..."
|
print "Starting bridge in compatibility mode..."
|
||||||
@ -931,7 +931,7 @@ def run-compatibility-mode [] {
|
|||||||
|
|
||||||
**Migration Mode**:
|
**Migration Mode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Gradual migration with traffic splitting
|
# Gradual migration with traffic splitting
|
||||||
def run-migration-mode [
|
def run-migration-mode [
|
||||||
--new-system-percentage: int = 50
|
--new-system-percentage: int = 50
|
||||||
@ -986,7 +986,7 @@ def run-migration-mode [
|
|||||||
|
|
||||||
**Automated Migration Orchestration**:
|
**Automated Migration Orchestration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def execute-migration-plan [
|
def execute-migration-plan [
|
||||||
migration_plan: string,
|
migration_plan: string,
|
||||||
--dry-run: bool = false,
|
--dry-run: bool = false,
|
||||||
@ -1041,7 +1041,7 @@ def execute-migration-plan [
|
|||||||
|
|
||||||
**Migration Validation**:
|
**Migration Validation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def validate-migration-readiness [] -> record {
|
def validate-migration-readiness [] -> record {
|
||||||
let checks = [
|
let checks = [
|
||||||
{name: "backup-available", check: (check-backup-exists)},
|
{name: "backup-available", check: (check-backup-exists)},
|
||||||
@ -1079,7 +1079,7 @@ def validate-migration-readiness [] -> record {
|
|||||||
|
|
||||||
**Problem**: Version mismatch between client and server
|
**Problem**: Version mismatch between client and server
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Diagnosis
|
# Diagnosis
|
||||||
curl -H "API-Version: v1" http://localhost:9090/health
|
curl -H "API-Version: v1" http://localhost:9090/health
|
||||||
curl -H "API-Version: v2" http://localhost:9090/health
|
curl -H "API-Version: v2" http://localhost:9090/health
|
||||||
@ -1095,7 +1095,7 @@ export PROVISIONING_API_VERSION=v2
|
|||||||
|
|
||||||
**Problem**: Configuration not found in either system
|
**Problem**: Configuration not found in either system
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Diagnosis
|
# Diagnosis
|
||||||
def diagnose-config-issue [key: string] -> record {
|
def diagnose-config-issue [key: string] -> record {
|
||||||
let toml_result = try {
|
let toml_result = try {
|
||||||
@ -1131,7 +1131,7 @@ def migrate-single-config [key: string] {
|
|||||||
|
|
||||||
**Problem**: Data inconsistency between systems
|
**Problem**: Data inconsistency between systems
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Diagnosis and repair
|
# Diagnosis and repair
|
||||||
def repair-data-consistency [] -> record {
|
def repair-data-consistency [] -> record {
|
||||||
let legacy_data = (read-legacy-data)
|
let legacy_data = (read-legacy-data)
|
||||||
@ -1166,7 +1166,7 @@ def repair-data-consistency [] -> record {
|
|||||||
|
|
||||||
**Integration Debug Mode**:
|
**Integration Debug Mode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable comprehensive debugging
|
# Enable comprehensive debugging
|
||||||
export PROVISIONING_DEBUG=true
|
export PROVISIONING_DEBUG=true
|
||||||
export PROVISIONING_LOG_LEVEL=debug
|
export PROVISIONING_LOG_LEVEL=debug
|
||||||
@ -1179,7 +1179,7 @@ provisioning server create test-server 2xCPU-4 GB --debug-integration
|
|||||||
|
|
||||||
**Health Check Debugging**:
|
**Health Check Debugging**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def debug-integration-health [] -> record {
|
def debug-integration-health [] -> record {
|
||||||
print "=== Integration Health Debug ==="
|
print "=== Integration Health Debug ==="
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ If you were using **Vault** or **AWS KMS** for development:
|
|||||||
|
|
||||||
#### Step 1: Install Age
|
#### Step 1: Install Age
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# macOS
|
# macOS
|
||||||
brew install age
|
brew install age
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ go install filippo.io/age/cmd/...@latest
|
|||||||
|
|
||||||
#### Step 2: Generate Age Keys
|
#### Step 2: Generate Age Keys
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
mkdir -p ~/.config/provisioning/age
|
mkdir -p ~/.config/provisioning/age
|
||||||
age-keygen -o ~/.config/provisioning/age/private_key.txt
|
age-keygen -o ~/.config/provisioning/age/private_key.txt
|
||||||
age-keygen -y ~/.config/provisioning/age/private_key.txt > ~/.config/provisioning/age/public_key.txt
|
age-keygen -y ~/.config/provisioning/age/private_key.txt > ~/.config/provisioning/age/public_key.txt
|
||||||
@ -91,7 +91,7 @@ Replace your old Vault/AWS config:
|
|||||||
|
|
||||||
**Old (Vault)**:
|
**Old (Vault)**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[kms]
|
[kms]
|
||||||
type = "vault"
|
type = "vault"
|
||||||
address = "http://localhost:8200"
|
address = "http://localhost:8200"
|
||||||
@ -101,7 +101,7 @@ mount_point = "transit"
|
|||||||
|
|
||||||
**New (Age)**:
|
**New (Age)**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[kms]
|
[kms]
|
||||||
environment = "dev"
|
environment = "dev"
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ private_key_path = "~/.config/provisioning/age/private_key.txt"
|
|||||||
|
|
||||||
#### Step 4: Re-encrypt Development Secrets
|
#### Step 4: Re-encrypt Development Secrets
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Export old secrets (if using Vault)
|
# Export old secrets (if using Vault)
|
||||||
vault kv get -format=json secret/dev > dev-secrets.json
|
vault kv get -format=json secret/dev > dev-secrets.json
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ Choose one of these options:
|
|||||||
|
|
||||||
**Option A: Cosmian Cloud (Managed)**
|
**Option A: Cosmian Cloud (Managed)**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Sign up at https://cosmian.com
|
# Sign up at https://cosmian.com
|
||||||
# Get API credentials
|
# Get API credentials
|
||||||
export COSMIAN_KMS_URL=https://kms.cosmian.cloud
|
export COSMIAN_KMS_URL=https://kms.cosmian.cloud
|
||||||
@ -142,7 +142,7 @@ export COSMIAN_API_KEY=your-api-key
|
|||||||
|
|
||||||
**Option B: Self-Hosted Cosmian KMS**
|
**Option B: Self-Hosted Cosmian KMS**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Deploy Cosmian KMS server
|
# Deploy Cosmian KMS server
|
||||||
# See: https://docs.cosmian.com/kms/deployment/
|
# See: https://docs.cosmian.com/kms/deployment/
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ export COSMIAN_API_KEY=your-api-key
|
|||||||
|
|
||||||
#### Step 2: Create Master Key in Cosmian
|
#### Step 2: Create Master Key in Cosmian
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Using Cosmian CLI
|
# Using Cosmian CLI
|
||||||
cosmian-kms create-key
|
cosmian-kms create-key
|
||||||
--algorithm AES
|
--algorithm AES
|
||||||
@ -175,7 +175,7 @@ curl -X POST $COSMIAN_KMS_URL/api/v1/keys
|
|||||||
|
|
||||||
**From Vault to Cosmian**:
|
**From Vault to Cosmian**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Export secrets from Vault
|
# Export secrets from Vault
|
||||||
vault kv get -format=json secret/prod > prod-secrets.json
|
vault kv get -format=json secret/prod > prod-secrets.json
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ cat prod-secrets.enc |
|
|||||||
|
|
||||||
**From AWS KMS to Cosmian**:
|
**From AWS KMS to Cosmian**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Decrypt with AWS KMS
|
# Decrypt with AWS KMS
|
||||||
aws kms decrypt
|
aws kms decrypt
|
||||||
--ciphertext-blob fileb://encrypted-data
|
--ciphertext-blob fileb://encrypted-data
|
||||||
@ -216,7 +216,7 @@ curl -X POST $COSMIAN_KMS_URL/api/v1/encrypt
|
|||||||
|
|
||||||
**Old (AWS KMS)**:
|
**Old (AWS KMS)**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[kms]
|
[kms]
|
||||||
type = "aws-kms"
|
type = "aws-kms"
|
||||||
region = "us-east-1"
|
region = "us-east-1"
|
||||||
@ -225,7 +225,7 @@ key_id = "arn:aws:kms:us-east-1:123456789012:key/..."
|
|||||||
|
|
||||||
**New (Cosmian)**:
|
**New (Cosmian)**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[kms]
|
[kms]
|
||||||
environment = "prod"
|
environment = "prod"
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ use_confidential_computing = false # Enable if using SGX/SEV
|
|||||||
|
|
||||||
#### Step 5: Test Production Setup
|
#### Step 5: Test Production Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment
|
# Set environment
|
||||||
export PROVISIONING_ENV=prod
|
export PROVISIONING_ENV=prod
|
||||||
export COSMIAN_KMS_URL=https://kms.example.com
|
export COSMIAN_KMS_URL=https://kms.example.com
|
||||||
@ -263,7 +263,7 @@ curl -X POST http://localhost:8082/api/v1/kms/decrypt
|
|||||||
|
|
||||||
### Before (4 Backends)
|
### Before (4 Backends)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Development could use any backend
|
# Development could use any backend
|
||||||
[kms]
|
[kms]
|
||||||
type = "vault" # or "aws-kms"
|
type = "vault" # or "aws-kms"
|
||||||
@ -279,7 +279,7 @@ key_id = "arn:aws:kms:..."
|
|||||||
|
|
||||||
### After (2 Backends)
|
### After (2 Backends)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clear environment-based selection
|
# Clear environment-based selection
|
||||||
[kms]
|
[kms]
|
||||||
dev_backend = "age"
|
dev_backend = "age"
|
||||||
@ -314,14 +314,14 @@ tls_verify = true
|
|||||||
|
|
||||||
**Before**:
|
**Before**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
KmsError::VaultError(String)
|
KmsError::VaultError(String)
|
||||||
KmsError::AwsKmsError(String)
|
KmsError::AwsKmsError(String)
|
||||||
```
|
```
|
||||||
|
|
||||||
**After**:
|
**After**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
KmsError::AgeError(String)
|
KmsError::AgeError(String)
|
||||||
KmsError::CosmianError(String)
|
KmsError::CosmianError(String)
|
||||||
```
|
```
|
||||||
@ -330,7 +330,7 @@ KmsError::CosmianError(String)
|
|||||||
|
|
||||||
**Before**:
|
**Before**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
enum KmsBackendConfig {
|
enum KmsBackendConfig {
|
||||||
Vault { address, token, mount_point, ... },
|
Vault { address, token, mount_point, ... },
|
||||||
AwsKms { region, key_id, assume_role },
|
AwsKms { region, key_id, assume_role },
|
||||||
@ -339,7 +339,7 @@ enum KmsBackendConfig {
|
|||||||
|
|
||||||
**After**:
|
**After**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
enum KmsBackendConfig {
|
enum KmsBackendConfig {
|
||||||
Age { public_key_path, private_key_path },
|
Age { public_key_path, private_key_path },
|
||||||
Cosmian { server_url, api_key, default_key_id, tls_verify },
|
Cosmian { server_url, api_key, default_key_id, tls_verify },
|
||||||
@ -352,7 +352,7 @@ enum KmsBackendConfig {
|
|||||||
|
|
||||||
**Before (AWS KMS)**:
|
**Before (AWS KMS)**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use kms_service::{KmsService, KmsBackendConfig};
|
use kms_service::{KmsService, KmsBackendConfig};
|
||||||
|
|
||||||
let config = KmsBackendConfig::AwsKms {
|
let config = KmsBackendConfig::AwsKms {
|
||||||
@ -366,7 +366,7 @@ let kms = KmsService::new(config).await?;
|
|||||||
|
|
||||||
**After (Cosmian)**:
|
**After (Cosmian)**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use kms_service::{KmsService, KmsBackendConfig};
|
use kms_service::{KmsService, KmsBackendConfig};
|
||||||
|
|
||||||
let config = KmsBackendConfig::Cosmian {
|
let config = KmsBackendConfig::Cosmian {
|
||||||
@ -383,7 +383,7 @@ let kms = KmsService::new(config).await?;
|
|||||||
|
|
||||||
**Before (Vault)**:
|
**Before (Vault)**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set Vault environment
|
# Set Vault environment
|
||||||
$env.VAULT_ADDR = "http://localhost:8200"
|
$env.VAULT_ADDR = "http://localhost:8200"
|
||||||
$env.VAULT_TOKEN = "root"
|
$env.VAULT_TOKEN = "root"
|
||||||
@ -394,7 +394,7 @@ kms encrypt "secret-data"
|
|||||||
|
|
||||||
**After (Age for dev)**:
|
**After (Age for dev)**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment
|
# Set environment
|
||||||
$env.PROVISIONING_ENV = "dev"
|
$env.PROVISIONING_ENV = "dev"
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ kms encrypt "secret-data"
|
|||||||
|
|
||||||
If you need to rollback to Vault/AWS KMS:
|
If you need to rollback to Vault/AWS KMS:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Checkout previous version
|
# Checkout previous version
|
||||||
git checkout tags/v0.1.0
|
git checkout tags/v0.1.0
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ cp provisioning/config/kms.toml.backup provisioning/config/kms.toml
|
|||||||
|
|
||||||
### Development Testing
|
### Development Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Generate Age keys
|
# 1. Generate Age keys
|
||||||
age-keygen -o /tmp/test_private.txt
|
age-keygen -o /tmp/test_private.txt
|
||||||
age-keygen -y /tmp/test_private.txt > /tmp/test_public.txt
|
age-keygen -y /tmp/test_private.txt > /tmp/test_public.txt
|
||||||
@ -442,7 +442,7 @@ cargo run --bin kms-service
|
|||||||
|
|
||||||
### Production Testing
|
### Production Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Set up test Cosmian instance
|
# 1. Set up test Cosmian instance
|
||||||
export COSMIAN_KMS_URL=https://kms-staging.example.com
|
export COSMIAN_KMS_URL=https://kms-staging.example.com
|
||||||
export COSMIAN_API_KEY=test-api-key
|
export COSMIAN_API_KEY=test-api-key
|
||||||
@ -464,7 +464,7 @@ cargo run --bin kms-service
|
|||||||
|
|
||||||
### Age Keys Not Found
|
### Age Keys Not Found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check keys exist
|
# Check keys exist
|
||||||
ls -la ~/.config/provisioning/age/
|
ls -la ~/.config/provisioning/age/
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ age-keygen -y ~/.config/provisioning/age/private_key.txt > ~/.config/provisionin
|
|||||||
|
|
||||||
### Cosmian Connection Failed
|
### Cosmian Connection Failed
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check network connectivity
|
# Check network connectivity
|
||||||
curl -v $COSMIAN_KMS_URL/api/v1/health
|
curl -v $COSMIAN_KMS_URL/api/v1/health
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ openssl s_client -connect kms.example.com:443
|
|||||||
|
|
||||||
### Compilation Errors
|
### Compilation Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean and rebuild
|
# Clean and rebuild
|
||||||
cd provisioning/platform/kms-service
|
cd provisioning/platform/kms-service
|
||||||
cargo clean
|
cargo clean
|
||||||
|
|||||||
@ -11,7 +11,7 @@ Replaces the Python implementation with significant performance improvements whi
|
|||||||
|
|
||||||
## Performance Results
|
## Performance Results
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
🚀 Rust MCP Server Performance Analysis
|
🚀 Rust MCP Server Performance Analysis
|
||||||
==================================================
|
==================================================
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ Replaces the Python implementation with significant performance improvements whi
|
|||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
src/
|
src/
|
||||||
├── simple_main.rs # Lightweight MCP server entry point
|
├── simple_main.rs # Lightweight MCP server entry point
|
||||||
├── main.rs # Full MCP server (with SDK integration)
|
├── main.rs # Full MCP server (with SDK integration)
|
||||||
@ -67,7 +67,7 @@ src/
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build and run
|
# Build and run
|
||||||
cargo run --bin provisioning-mcp-server --release
|
cargo run --bin provisioning-mcp-server --release
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ cargo run --bin provisioning-mcp-server --release
|
|||||||
|
|
||||||
Set via environment variables:
|
Set via environment variables:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export PROVISIONING_PATH=/path/to/provisioning
|
export PROVISIONING_PATH=/path/to/provisioning
|
||||||
export PROVISIONING_AI_PROVIDER=openai
|
export PROVISIONING_AI_PROVIDER=openai
|
||||||
export OPENAI_API_KEY=your-key
|
export OPENAI_API_KEY=your-key
|
||||||
|
|||||||
@ -27,7 +27,7 @@ This reorganization enables efficient development workflows while maintaining fu
|
|||||||
|
|
||||||
### New Development Structure (`/src/`)
|
### New Development Structure (`/src/`)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
src/
|
src/
|
||||||
├── config/ # System configuration
|
├── config/ # System configuration
|
||||||
├── control-center/ # Control center application
|
├── control-center/ # Control center application
|
||||||
@ -47,7 +47,7 @@ src/
|
|||||||
|
|
||||||
### Legacy Structure (Preserved)
|
### Legacy Structure (Preserved)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
repo-cnz/
|
repo-cnz/
|
||||||
├── cluster/ # Cluster configurations (preserved)
|
├── cluster/ # Cluster configurations (preserved)
|
||||||
├── core/ # Core system (preserved)
|
├── core/ # Core system (preserved)
|
||||||
@ -62,7 +62,7 @@ repo-cnz/
|
|||||||
|
|
||||||
### Development Workspace (`/workspace/`)
|
### Development Workspace (`/workspace/`)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
workspace/
|
workspace/
|
||||||
├── config/ # Development configuration
|
├── config/ # Development configuration
|
||||||
├── extensions/ # Extension development
|
├── extensions/ # Extension development
|
||||||
@ -92,7 +92,7 @@ workspace/
|
|||||||
|
|
||||||
**Key Components**:
|
**Key Components**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
tools/
|
tools/
|
||||||
├── build/ # Build tools
|
├── build/ # Build tools
|
||||||
│ ├── compile-platform.nu # Platform-specific compilation
|
│ ├── compile-platform.nu # Platform-specific compilation
|
||||||
@ -163,20 +163,20 @@ The workspace provides a sophisticated development environment:
|
|||||||
|
|
||||||
**Initialization**:
|
**Initialization**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd workspace/tools
|
cd workspace/tools
|
||||||
nu workspace.nu init --user-name developer --infra-name my-infra
|
nu workspace.nu init --user-name developer --infra-name my-infra
|
||||||
```
|
```
|
||||||
|
|
||||||
**Health Monitoring**:
|
**Health Monitoring**:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu workspace.nu health --detailed --fix-issues
|
nu workspace.nu health --detailed --fix-issues
|
||||||
```
|
```
|
||||||
|
|
||||||
**Path Resolution**:
|
**Path Resolution**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use lib/path-resolver.nu
|
use lib/path-resolver.nu
|
||||||
let config = (path-resolver resolve_config "user" --workspace-user "john")
|
let config = (path-resolver resolve_config "user" --workspace-user "john")
|
||||||
```
|
```
|
||||||
@ -232,7 +232,7 @@ The workspace implements a sophisticated configuration cascade:
|
|||||||
|
|
||||||
**Core System Entry Points**:
|
**Core System Entry Points**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Main CLI (development version)
|
# Main CLI (development version)
|
||||||
/src/core/nulib/provisioning
|
/src/core/nulib/provisioning
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ The workspace implements a sophisticated configuration cascade:
|
|||||||
|
|
||||||
**Build System**:
|
**Build System**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Main build system
|
# Main build system
|
||||||
cd /src/tools && make help
|
cd /src/tools && make help
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ make all
|
|||||||
|
|
||||||
**Configuration Files**:
|
**Configuration Files**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# System defaults
|
# System defaults
|
||||||
/config.defaults.toml
|
/config.defaults.toml
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ make all
|
|||||||
|
|
||||||
**Extension Development**:
|
**Extension Development**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Provider template
|
# Provider template
|
||||||
/workspace/extensions/providers/template/
|
/workspace/extensions/providers/template/
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ make all
|
|||||||
|
|
||||||
**1. Development Setup**:
|
**1. Development Setup**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize workspace
|
# Initialize workspace
|
||||||
cd workspace/tools
|
cd workspace/tools
|
||||||
nu workspace.nu init --user-name $USER
|
nu workspace.nu init --user-name $USER
|
||||||
@ -297,7 +297,7 @@ nu workspace.nu health --detailed
|
|||||||
|
|
||||||
**2. Building Distribution**:
|
**2. Building Distribution**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Complete build
|
# Complete build
|
||||||
cd src/tools
|
cd src/tools
|
||||||
make all
|
make all
|
||||||
@ -310,7 +310,7 @@ make windows
|
|||||||
|
|
||||||
**3. Extension Development**:
|
**3. Extension Development**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create new provider
|
# Create new provider
|
||||||
cp -r workspace/extensions/providers/template workspace/extensions/providers/my-provider
|
cp -r workspace/extensions/providers/template workspace/extensions/providers/my-provider
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ nu workspace/extensions/providers/my-provider/nulib/provider.nu test
|
|||||||
|
|
||||||
**Existing Commands Still Work**:
|
**Existing Commands Still Work**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# All existing commands preserved
|
# All existing commands preserved
|
||||||
./core/nulib/provisioning server create
|
./core/nulib/provisioning server create
|
||||||
./core/nulib/provisioning taskserv install kubernetes
|
./core/nulib/provisioning taskserv install kubernetes
|
||||||
|
|||||||
@ -15,7 +15,7 @@ backup)
|
|||||||
|
|
||||||
Defines the contract that all providers must implement:
|
Defines the contract that all providers must implement:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Standard interface functions
|
# Standard interface functions
|
||||||
- query_servers
|
- query_servers
|
||||||
- server_info
|
- server_info
|
||||||
@ -38,7 +38,7 @@ Defines the contract that all providers must implement:
|
|||||||
|
|
||||||
Manages provider discovery and registration:
|
Manages provider discovery and registration:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize registry
|
# Initialize registry
|
||||||
init-provider-registry
|
init-provider-registry
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ is-provider-available "aws"
|
|||||||
|
|
||||||
Handles dynamic provider loading and validation:
|
Handles dynamic provider loading and validation:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Load provider dynamically
|
# Load provider dynamically
|
||||||
load-provider "aws"
|
load-provider "aws"
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ call-provider-function "aws" "query_servers" $find $cols
|
|||||||
|
|
||||||
Each provider implements a standard adapter:
|
Each provider implements a standard adapter:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/extensions/providers/
|
provisioning/extensions/providers/
|
||||||
├── aws/provider.nu # AWS adapter
|
├── aws/provider.nu # AWS adapter
|
||||||
├── upcloud/provider.nu # UpCloud adapter
|
├── upcloud/provider.nu # UpCloud adapter
|
||||||
@ -92,7 +92,7 @@ provisioning/extensions/providers/
|
|||||||
|
|
||||||
**Adapter Structure:**
|
**Adapter Structure:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# AWS Provider Adapter
|
# AWS Provider Adapter
|
||||||
export def query_servers [find?: string, cols?: string] {
|
export def query_servers [find?: string, cols?: string] {
|
||||||
aws_query_servers $find $cols
|
aws_query_servers $find $cols
|
||||||
@ -107,7 +107,7 @@ export def create_server [settings: record, server: record, check: bool, wait: b
|
|||||||
|
|
||||||
The new middleware that uses dynamic dispatch:
|
The new middleware that uses dynamic dispatch:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# No hardcoded imports!
|
# No hardcoded imports!
|
||||||
export def mw_query_servers [settings: record, find?: string, cols?: string] {
|
export def mw_query_servers [settings: record, find?: string, cols?: string] {
|
||||||
$settings.data.servers | each { |server|
|
$settings.data.servers | each { |server|
|
||||||
@ -121,7 +121,7 @@ export def mw_query_servers [settings: record, find?: string, cols?: string] {
|
|||||||
|
|
||||||
### Example: Mixed Provider Infrastructure
|
### Example: Mixed Provider Infrastructure
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let servers = [
|
let servers = [
|
||||||
{
|
{
|
||||||
hostname = "compute-01",
|
hostname = "compute-01",
|
||||||
@ -144,7 +144,7 @@ servers
|
|||||||
|
|
||||||
### Multi-Provider Deployment
|
### Multi-Provider Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Deploy across multiple providers automatically
|
# Deploy across multiple providers automatically
|
||||||
mw_deploy_multi_provider_infra $settings $deployment_plan
|
mw_deploy_multi_provider_infra $settings $deployment_plan
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ mw_suggest_deployment_strategy {
|
|||||||
|
|
||||||
Providers declare their capabilities:
|
Providers declare their capabilities:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
capabilities: {
|
capabilities: {
|
||||||
server_management: true
|
server_management: true
|
||||||
network_management: true
|
network_management: true
|
||||||
@ -177,7 +177,7 @@ capabilities: {
|
|||||||
|
|
||||||
**Before (hardcoded):**
|
**Before (hardcoded):**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# middleware.nu
|
# middleware.nu
|
||||||
use ../aws/nulib/aws/servers.nu *
|
use ../aws/nulib/aws/servers.nu *
|
||||||
use ../upcloud/nulib/upcloud/servers.nu *
|
use ../upcloud/nulib/upcloud/servers.nu *
|
||||||
@ -190,7 +190,7 @@ match $server.provider {
|
|||||||
|
|
||||||
**After (provider-agnostic):**
|
**After (provider-agnostic):**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# middleware_provider_agnostic.nu
|
# middleware_provider_agnostic.nu
|
||||||
# No hardcoded imports!
|
# No hardcoded imports!
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ dispatch_provider_function $server.provider "query_servers" $find $cols
|
|||||||
|
|
||||||
Create `provisioning/extensions/providers/{name}/provider.nu`:
|
Create `provisioning/extensions/providers/{name}/provider.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Digital Ocean Provider Example
|
# Digital Ocean Provider Example
|
||||||
export def get-provider-metadata [] {
|
export def get-provider-metadata [] {
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ The registry will automatically discover the new provider on next initialization
|
|||||||
|
|
||||||
### 3. Test New Provider
|
### 3. Test New Provider
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check if discovered
|
# Check if discovered
|
||||||
is-provider-available "digitalocean"
|
is-provider-available "digitalocean"
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ check-provider-health "digitalocean"
|
|||||||
|
|
||||||
### Profile-Based Security
|
### Profile-Based Security
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Environment profiles can restrict providers
|
# Environment profiles can restrict providers
|
||||||
PROVISIONING_PROFILE=production # Only allows certified providers
|
PROVISIONING_PROFILE=production # Only allows certified providers
|
||||||
PROVISIONING_PROFILE=development # Allows all providers including local
|
PROVISIONING_PROFILE=development # Allows all providers including local
|
||||||
@ -310,7 +310,7 @@ PROVISIONING_PROFILE=development # Allows all providers including local
|
|||||||
|
|
||||||
### Debug Commands
|
### Debug Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Registry diagnostics
|
# Registry diagnostics
|
||||||
get-provider-stats
|
get-provider-stats
|
||||||
list-providers --verbose
|
list-providers --verbose
|
||||||
@ -341,7 +341,7 @@ get-loader-stats
|
|||||||
|
|
||||||
See the interface specification for complete function documentation:
|
See the interface specification for complete function documentation:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
get-provider-interface-docs | table
|
get-provider-interface-docs | table
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -374,7 +374,7 @@ Outbound data transfer (per GB):
|
|||||||
|
|
||||||
Use this matrix to quickly select a provider:
|
Use this matrix to quickly select a provider:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
If you need: Then use:
|
If you need: Then use:
|
||||||
─────────────────────────────────────────────────────────────
|
─────────────────────────────────────────────────────────────
|
||||||
Lowest cost compute Hetzner
|
Lowest cost compute Hetzner
|
||||||
|
|||||||
@ -19,7 +19,7 @@ A cloud provider is **production-ready** when it completes all 4 tasks:
|
|||||||
|
|
||||||
### Execution Sequence
|
### Execution Sequence
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Tarea 4 (5 min) ──────┐
|
Tarea 4 (5 min) ──────┐
|
||||||
Tarea 1 (main) ───┐ ├──> Tarea 2 (tests)
|
Tarea 1 (main) ───┐ ├──> Tarea 2 (tests)
|
||||||
Tarea 3 (parallel)┘ │
|
Tarea 3 (parallel)┘ │
|
||||||
@ -33,19 +33,19 @@ Tarea 3 (parallel)┘ │
|
|||||||
These rules are **mandatory** for all provider Nushell code:
|
These rules are **mandatory** for all provider Nushell code:
|
||||||
|
|
||||||
### Rule 1: Module System & Imports
|
### Rule 1: Module System & Imports
|
||||||
```text
|
```nushell
|
||||||
use mod.nu
|
use mod.nu
|
||||||
use api.nu
|
use api.nu
|
||||||
use servers.nu
|
use servers.nu
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rule 2: Function Signatures
|
### Rule 2: Function Signatures
|
||||||
```text
|
```python
|
||||||
def function_name [param: type, optional: type = default] { }
|
def function_name [param: type, optional: type = default] { }
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rule 3: Return Early, Fail Fast
|
### Rule 3: Return Early, Fail Fast
|
||||||
```text
|
```python
|
||||||
def operation [resource: record] {
|
def operation [resource: record] {
|
||||||
if ($resource | get -o id | is-empty) {
|
if ($resource | get -o id | is-empty) {
|
||||||
error make {msg: "Resource ID required"}
|
error make {msg: "Resource ID required"}
|
||||||
@ -56,7 +56,7 @@ def operation [resource: record] {
|
|||||||
### Rule 4: Modern Error Handling (CRITICAL)
|
### Rule 4: Modern Error Handling (CRITICAL)
|
||||||
|
|
||||||
**❌ FORBIDDEN** - Deprecated try-catch:
|
**❌ FORBIDDEN** - Deprecated try-catch:
|
||||||
```text
|
```bash
|
||||||
try {
|
try {
|
||||||
^external_command
|
^external_command
|
||||||
} catch {|err|
|
} catch {|err|
|
||||||
@ -65,7 +65,7 @@ try {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**✅ REQUIRED** - Modern do/complete pattern:
|
**✅ REQUIRED** - Modern do/complete pattern:
|
||||||
```text
|
```javascript
|
||||||
let result = (do { ^external_command } | complete)
|
let result = (do { ^external_command } | complete)
|
||||||
|
|
||||||
if $result.exit_code != 0 {
|
if $result.exit_code != 0 {
|
||||||
@ -79,7 +79,7 @@ $result.stdout
|
|||||||
All operations must fully succeed or fully fail. No partial state changes.
|
All operations must fully succeed or fully fail. No partial state changes.
|
||||||
|
|
||||||
### Rule 12: Structured Error Returns
|
### Rule 12: Structured Error Returns
|
||||||
```text
|
```bash
|
||||||
error make {
|
error make {
|
||||||
msg: "Human-readable message",
|
msg: "Human-readable message",
|
||||||
label: {text: "Error context", span: (metadata error).span}
|
label: {text: "Error context", span: (metadata error).span}
|
||||||
@ -103,7 +103,7 @@ All Nickel schemas follow this pattern:
|
|||||||
|
|
||||||
### contracts.ncl: Type Definitions
|
### contracts.ncl: Type Definitions
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
Server = {
|
Server = {
|
||||||
id | String,
|
id | String,
|
||||||
@ -123,7 +123,7 @@ All Nickel schemas follow this pattern:
|
|||||||
|
|
||||||
### defaults.ncl: Default Values
|
### defaults.ncl: Default Values
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
Server = {
|
Server = {
|
||||||
instance_type = "t3.micro",
|
instance_type = "t3.micro",
|
||||||
@ -139,7 +139,7 @@ All Nickel schemas follow this pattern:
|
|||||||
|
|
||||||
### main.ncl: Public API
|
### main.ncl: Public API
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let contracts = import "contracts.ncl" in
|
let contracts = import "contracts.ncl" in
|
||||||
let defaults = import "defaults.ncl" in
|
let defaults = import "defaults.ncl" in
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ let defaults = import "defaults.ncl" in
|
|||||||
|
|
||||||
### version.ncl: Version Tracking
|
### version.ncl: Version Tracking
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
provider_version = "1.0.0",
|
provider_version = "1.0.0",
|
||||||
cli_tools = {
|
cli_tools = {
|
||||||
@ -162,7 +162,7 @@ let defaults = import "defaults.ncl" in
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Validation**:
|
**Validation**:
|
||||||
```text
|
```bash
|
||||||
nickel typecheck nickel/contracts.ncl
|
nickel typecheck nickel/contracts.ncl
|
||||||
nickel typecheck nickel/defaults.ncl
|
nickel typecheck nickel/defaults.ncl
|
||||||
nickel typecheck nickel/main.ncl
|
nickel typecheck nickel/main.ncl
|
||||||
@ -176,7 +176,7 @@ nickel export nickel/main.ncl
|
|||||||
|
|
||||||
### Identify Violations
|
### Identify Violations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
|
|
||||||
grep -r "try {" nulib/ --include="*.nu" | wc -l
|
grep -r "try {" nulib/ --include="*.nu" | wc -l
|
||||||
@ -188,7 +188,7 @@ All three commands should return `0`.
|
|||||||
|
|
||||||
### Fix Mutable Loops: Accumulation Pattern
|
### Fix Mutable Loops: Accumulation Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def retry_with_backoff [
|
def retry_with_backoff [
|
||||||
closure: closure,
|
closure: closure,
|
||||||
max_attempts: int
|
max_attempts: int
|
||||||
@ -226,7 +226,7 @@ def retry_with_backoff [
|
|||||||
|
|
||||||
### Fix Mutable Loops: Recursive Pattern
|
### Fix Mutable Loops: Recursive Pattern
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def _wait_for_state [
|
def _wait_for_state [
|
||||||
resource_id: string,
|
resource_id: string,
|
||||||
target_state: string,
|
target_state: string,
|
||||||
@ -252,7 +252,7 @@ def _wait_for_state [
|
|||||||
|
|
||||||
### Fix Error Handling
|
### Fix Error Handling
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def create_server [config: record] {
|
def create_server [config: record] {
|
||||||
if ($config | get -o name | is-empty) {
|
if ($config | get -o name | is-empty) {
|
||||||
error make {msg: "Server name required"}
|
error make {msg: "Server name required"}
|
||||||
@ -280,7 +280,7 @@ def create_server [config: record] {
|
|||||||
|
|
||||||
### Validation
|
### Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
|
|
||||||
for file in nulib/*/\*.nu; do
|
for file in nulib/*/\*.nu; do
|
||||||
@ -298,7 +298,7 @@ echo "✅ Nushell compliance complete"
|
|||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
tests/
|
tests/
|
||||||
├── mocks/
|
├── mocks/
|
||||||
│ └── mock_api_responses.json
|
│ └── mock_api_responses.json
|
||||||
@ -313,7 +313,7 @@ tests/
|
|||||||
|
|
||||||
### Mock API Responses
|
### Mock API Responses
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"list_servers": {
|
"list_servers": {
|
||||||
"servers": [
|
"servers": [
|
||||||
@ -335,7 +335,7 @@ tests/
|
|||||||
|
|
||||||
### Unit Tests: 14 Tests
|
### Unit Tests: 14 Tests
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def test-result [name: string, result: bool] {
|
def test-result [name: string, result: bool] {
|
||||||
if $result {
|
if $result {
|
||||||
print $"✓ ($name)"
|
print $"✓ ($name)"
|
||||||
@ -529,7 +529,7 @@ main
|
|||||||
|
|
||||||
### Test Orchestrator
|
### Test Orchestrator
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def main [] {
|
def main [] {
|
||||||
print "=== Provider Test Suite ==="
|
print "=== Provider Test Suite ==="
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ exit (if $result.success {0} else {1})
|
|||||||
|
|
||||||
### Validation
|
### Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
nu tests/run_{provider}_tests.nu
|
nu tests/run_{provider}_tests.nu
|
||||||
```
|
```
|
||||||
@ -580,7 +580,7 @@ Expected: 51 tests passing, exit code 0
|
|||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
templates/
|
templates/
|
||||||
├── {provider}_servers.j2
|
├── {provider}_servers.j2
|
||||||
├── {provider}_networks.j2
|
├── {provider}_networks.j2
|
||||||
@ -589,7 +589,8 @@ templates/
|
|||||||
|
|
||||||
### Template Example
|
### Template Example
|
||||||
|
|
||||||
```jinja2
|
```bash
|
||||||
|
jinja2
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# {{ provider_name }} Server Provisioning
|
# {{ provider_name }} Server Provisioning
|
||||||
set -e
|
set -e
|
||||||
@ -627,7 +628,7 @@ echo "Server provisioning complete"
|
|||||||
|
|
||||||
### Validation
|
### Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
|
|
||||||
for template in templates/*.j2; do
|
for template in templates/*.j2; do
|
||||||
@ -641,7 +642,7 @@ echo "✅ Templates valid"
|
|||||||
|
|
||||||
## Tarea 4: Nickel Schema Validation
|
## Tarea 4: Nickel Schema Validation
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
|
|
||||||
nickel typecheck nickel/contracts.ncl || exit 1
|
nickel typecheck nickel/contracts.ncl || exit 1
|
||||||
@ -658,7 +659,7 @@ echo "✅ Nickel schemas validated"
|
|||||||
|
|
||||||
## Complete Validation Script
|
## Complete Validation Script
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -705,7 +706,7 @@ Use these as templates for new providers.
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/extensions/providers/{PROVIDER}
|
cd provisioning/extensions/providers/{PROVIDER}
|
||||||
|
|
||||||
# Validate completeness
|
# Validate completeness
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Fast, local development with direct access to provider source code.
|
|||||||
|
|
||||||
### How It Works
|
### How It Works
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install provider for infrastructure (creates symlinks)
|
# Install provider for infrastructure (creates symlinks)
|
||||||
provisioning providers install upcloud wuji
|
provisioning providers install upcloud wuji
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ provisioning providers install upcloud wuji
|
|||||||
|
|
||||||
### Example Workflow
|
### Example Workflow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. List available providers
|
# 1. List available providers
|
||||||
provisioning providers list
|
provisioning providers list
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ provisioning providers remove upcloud wuji
|
|||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
extensions/providers/upcloud/
|
extensions/providers/upcloud/
|
||||||
├── nickel/
|
├── nickel/
|
||||||
│ ├── manifest.toml
|
│ ├── manifest.toml
|
||||||
@ -117,7 +117,7 @@ Create versioned, distributable artifacts for production deployments and team co
|
|||||||
|
|
||||||
### How It Works
|
### How It Works
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Package providers into distributable artifacts
|
# Package providers into distributable artifacts
|
||||||
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
||||||
./provisioning/core/cli/pack providers
|
./provisioning/core/cli/pack providers
|
||||||
@ -148,7 +148,7 @@ export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
|||||||
|
|
||||||
### Example Workflow
|
### Example Workflow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment variable
|
# Set environment variable
|
||||||
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
|||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/
|
provisioning/
|
||||||
├── distribution/
|
├── distribution/
|
||||||
│ ├── packages/
|
│ ├── packages/
|
||||||
@ -194,7 +194,7 @@ provisioning/
|
|||||||
|
|
||||||
### Package Metadata Example
|
### Package Metadata Example
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"name": "upcloud_prov",
|
"name": "upcloud_prov",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
@ -232,7 +232,7 @@ provisioning/
|
|||||||
|
|
||||||
### Development Phase
|
### Development Phase
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Start with module-loader for development
|
# 1. Start with module-loader for development
|
||||||
provisioning providers list
|
provisioning providers list
|
||||||
provisioning providers install upcloud wuji
|
provisioning providers install upcloud wuji
|
||||||
@ -248,7 +248,7 @@ nickel export workspace/infra/wuji/main.ncl
|
|||||||
|
|
||||||
### Release Phase
|
### Release Phase
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 4. Create release packages
|
# 4. Create release packages
|
||||||
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
||||||
./provisioning/core/cli/pack providers
|
./provisioning/core/cli/pack providers
|
||||||
@ -266,7 +266,7 @@ rsync distribution/packages/*.tar user@repo.jesusperez.pro:/registry/v0.0.2/
|
|||||||
|
|
||||||
### Production Deployment
|
### Production Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 8. Download specific version from registry
|
# 8. Download specific version from registry
|
||||||
wget https://repo.jesusperez.pro/registry/v0.0.2/upcloud_prov_0.0.2.tar
|
wget https://repo.jesusperez.pro/registry/v0.0.2/upcloud_prov_0.0.2.tar
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ tar -xf upcloud_prov_0.0.2.tar -C infrastructure/providers/
|
|||||||
|
|
||||||
### Module-Loader Commands
|
### Module-Loader Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all available providers
|
# List all available providers
|
||||||
provisioning providers list [--kcl] [--format table|json|yaml]
|
provisioning providers list [--kcl] [--format table|json|yaml]
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ provisioning providers validate <infra>
|
|||||||
|
|
||||||
### Provider Pack Commands
|
### Provider Pack Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment variable (required)
|
# Set environment variable (required)
|
||||||
export PROVISIONING=/path/to/provisioning
|
export PROVISIONING=/path/to/provisioning
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ export PROVISIONING=/path/to/provisioning
|
|||||||
|
|
||||||
**Recommendation**: Module-Loader only
|
**Recommendation**: Module-Loader only
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Simple and fast
|
# Simple and fast
|
||||||
providers install upcloud homelab
|
providers install upcloud homelab
|
||||||
providers install aws cloud-backup
|
providers install aws cloud-backup
|
||||||
@ -355,7 +355,7 @@ providers install aws cloud-backup
|
|||||||
|
|
||||||
**Recommendation**: Module-Loader + Git
|
**Recommendation**: Module-Loader + Git
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Each developer
|
# Each developer
|
||||||
git clone repo
|
git clone repo
|
||||||
providers install upcloud project-x
|
providers install upcloud project-x
|
||||||
@ -377,7 +377,7 @@ git pull
|
|||||||
|
|
||||||
**Recommendation**: Hybrid (Module-Loader dev + Provider Packs releases)
|
**Recommendation**: Hybrid (Module-Loader dev + Provider Packs releases)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Development (team member)
|
# Development (team member)
|
||||||
providers install upcloud staging-env
|
providers install upcloud staging-env
|
||||||
# Make changes...
|
# Make changes...
|
||||||
@ -402,7 +402,7 @@ git tag v0.2.0
|
|||||||
|
|
||||||
**Recommendation**: Provider Packs only
|
**Recommendation**: Provider Packs only
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# CI/CD Pipeline
|
# CI/CD Pipeline
|
||||||
pack providers # Build artifacts
|
pack providers # Build artifacts
|
||||||
# Run tests on packages
|
# Run tests on packages
|
||||||
@ -426,7 +426,7 @@ pack providers # Build artifacts
|
|||||||
|
|
||||||
**Recommendation**: Provider Packs + Registry
|
**Recommendation**: Provider Packs + Registry
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Maintainer
|
# Maintainer
|
||||||
pack providers
|
pack providers
|
||||||
# Create release on GitHub
|
# Create release on GitHub
|
||||||
@ -521,7 +521,7 @@ wget https://github.com/project/releases/v1.0.0/upcloud_prov_1.0.0.tar
|
|||||||
|
|
||||||
When you're ready to move to production:
|
When you're ready to move to production:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Clean up development setup
|
# 1. Clean up development setup
|
||||||
providers remove upcloud wuji
|
providers remove upcloud wuji
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ nickel eval defs/servers.ncl
|
|||||||
|
|
||||||
When you need to debug or develop:
|
When you need to debug or develop:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Remove vendored version
|
# 1. Remove vendored version
|
||||||
rm -rf workspace/infra/wuji/vendor/upcloud_prov
|
rm -rf workspace/infra/wuji/vendor/upcloud_prov
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ nickel eval defs/servers.ncl
|
|||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Required for pack commands
|
# Required for pack commands
|
||||||
export PROVISIONING=/path/to/provisioning
|
export PROVISIONING=/path/to/provisioning
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ export PROVISIONING_CONFIG=/path/to/provisioning
|
|||||||
|
|
||||||
Distribution settings in `provisioning/config/config.defaults.toml`:
|
Distribution settings in `provisioning/config/config.defaults.toml`:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[distribution]
|
[distribution]
|
||||||
pack_path = "{{paths.base}}/distribution/packages"
|
pack_path = "{{paths.base}}/distribution/packages"
|
||||||
registry_path = "{{paths.base}}/distribution/registry"
|
registry_path = "{{paths.base}}/distribution/registry"
|
||||||
@ -605,7 +605,7 @@ modules_dir = ".kcl-modules"
|
|||||||
|
|
||||||
**Problem**: Provider not found after install
|
**Problem**: Provider not found after install
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check provider exists
|
# Check provider exists
|
||||||
providers list | grep upcloud
|
providers list | grep upcloud
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ ls -la workspace/infra/wuji/.kcl-modules/
|
|||||||
|
|
||||||
**Problem**: Changes not reflected
|
**Problem**: Changes not reflected
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Verify symlink is correct
|
# Verify symlink is correct
|
||||||
readlink workspace/infra/wuji/.kcl-modules/upcloud_prov
|
readlink workspace/infra/wuji/.kcl-modules/upcloud_prov
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ readlink workspace/infra/wuji/.kcl-modules/upcloud_prov
|
|||||||
|
|
||||||
**Problem**: No .tar file created
|
**Problem**: No .tar file created
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check KCL version (need 0.11.3+)
|
# Check KCL version (need 0.11.3+)
|
||||||
kcl version
|
kcl version
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ ls extensions/providers/upcloud/kcl/kcl.mod
|
|||||||
|
|
||||||
**Problem**: PROVISIONING environment variable not set
|
**Problem**: PROVISIONING environment variable not set
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set it
|
# Set it
|
||||||
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
export PROVISIONING=/Users/Akasha/project-provisioning/provisioning
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,14 @@ This guide shows how to quickly add a new provider to the provider-agnostic infr
|
|||||||
|
|
||||||
### Step 1: Create Provider Directory
|
### Step 1: Create Provider Directory
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
mkdir -p provisioning/extensions/providers/{provider_name}
|
mkdir -p provisioning/extensions/providers/{provider_name}
|
||||||
mkdir -p provisioning/extensions/providers/{provider_name}/nulib/{provider_name}
|
mkdir -p provisioning/extensions/providers/{provider_name}/nulib/{provider_name}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Copy Template and Customize
|
### Step 2: Copy Template and Customize
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Copy the local provider as a template
|
# Copy the local provider as a template
|
||||||
cp provisioning/extensions/providers/local/provider.nu
|
cp provisioning/extensions/providers/local/provider.nu
|
||||||
provisioning/extensions/providers/{provider_name}/provider.nu
|
provisioning/extensions/providers/{provider_name}/provider.nu
|
||||||
@ -29,7 +29,7 @@ cp provisioning/extensions/providers/local/provider.nu
|
|||||||
|
|
||||||
Edit `provisioning/extensions/providers/{provider_name}/provider.nu`:
|
Edit `provisioning/extensions/providers/{provider_name}/provider.nu`:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def get-provider-metadata []: nothing -> record {
|
export def get-provider-metadata []: nothing -> record {
|
||||||
{
|
{
|
||||||
name: "your_provider_name"
|
name: "your_provider_name"
|
||||||
@ -51,7 +51,7 @@ export def get-provider-metadata []: nothing -> record {
|
|||||||
|
|
||||||
The provider interface requires these essential functions:
|
The provider interface requires these essential functions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Required: Server operations
|
# Required: Server operations
|
||||||
export def query_servers [find?: string, cols?: string]: nothing -> list {
|
export def query_servers [find?: string, cols?: string]: nothing -> list {
|
||||||
# Call your provider's server listing API
|
# Call your provider's server listing API
|
||||||
@ -87,7 +87,7 @@ export def server_state [server: record, new_state: string, error_exit: bool, wa
|
|||||||
|
|
||||||
Create `provisioning/extensions/providers/{provider_name}/nulib/{provider_name}/servers.nu`:
|
Create `provisioning/extensions/providers/{provider_name}/nulib/{provider_name}/servers.nu`:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Example: DigitalOcean provider functions
|
# Example: DigitalOcean provider functions
|
||||||
export def digitalocean_query_servers [find?: string, cols?: string]: nothing -> list {
|
export def digitalocean_query_servers [find?: string, cols?: string]: nothing -> list {
|
||||||
# Use DigitalOcean API to list droplets
|
# Use DigitalOcean API to list droplets
|
||||||
@ -122,7 +122,7 @@ export def digitalocean_create_server [settings: record, server: record, check:
|
|||||||
|
|
||||||
### Step 6: Test Your Provider
|
### Step 6: Test Your Provider
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test provider discovery
|
# Test provider discovery
|
||||||
nu -c "use provisioning/core/nulib/lib_provisioning/providers/registry.nu *; init-provider-registry; list-providers"
|
nu -c "use provisioning/core/nulib/lib_provisioning/providers/registry.nu *; init-provider-registry; list-providers"
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ nu -c "use provisioning/extensions/providers/your_provider_name/provider.nu *; q
|
|||||||
|
|
||||||
Add to your Nickel configuration:
|
Add to your Nickel configuration:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# workspace/infra/example/servers.ncl
|
# workspace/infra/example/servers.ncl
|
||||||
let servers = [
|
let servers = [
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ servers
|
|||||||
|
|
||||||
For cloud providers (AWS, GCP, Azure, etc.):
|
For cloud providers (AWS, GCP, Azure, etc.):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use HTTP calls to cloud APIs
|
# Use HTTP calls to cloud APIs
|
||||||
export def cloud_query_servers [find?: string, cols?: string]: nothing -> list {
|
export def cloud_query_servers [find?: string, cols?: string]: nothing -> list {
|
||||||
let auth_header = { Authorization: $"Bearer ($env.PROVIDER_TOKEN)" }
|
let auth_header = { Authorization: $"Bearer ($env.PROVIDER_TOKEN)" }
|
||||||
@ -170,7 +170,7 @@ export def cloud_query_servers [find?: string, cols?: string]: nothing -> list {
|
|||||||
|
|
||||||
For container platforms (Docker, Podman, etc.):
|
For container platforms (Docker, Podman, etc.):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use CLI commands for container platforms
|
# Use CLI commands for container platforms
|
||||||
export def container_query_servers [find?: string, cols?: string]: nothing -> list {
|
export def container_query_servers [find?: string, cols?: string]: nothing -> list {
|
||||||
let containers = (docker ps --format json | from json)
|
let containers = (docker ps --format json | from json)
|
||||||
@ -183,7 +183,7 @@ export def container_query_servers [find?: string, cols?: string]: nothing -> li
|
|||||||
|
|
||||||
For bare metal or existing servers:
|
For bare metal or existing servers:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use SSH or local commands
|
# Use SSH or local commands
|
||||||
export def baremetal_query_servers [find?: string, cols?: string]: nothing -> list {
|
export def baremetal_query_servers [find?: string, cols?: string]: nothing -> list {
|
||||||
# Read from inventory file or ping servers
|
# Read from inventory file or ping servers
|
||||||
@ -197,7 +197,7 @@ export def baremetal_query_servers [find?: string, cols?: string]: nothing -> li
|
|||||||
|
|
||||||
### 1. Error Handling
|
### 1. Error Handling
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export def provider_operation []: nothing -> any {
|
export def provider_operation []: nothing -> any {
|
||||||
try {
|
try {
|
||||||
# Your provider operation
|
# Your provider operation
|
||||||
@ -212,7 +212,7 @@ export def provider_operation []: nothing -> any {
|
|||||||
|
|
||||||
### 2. Authentication
|
### 2. Authentication
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check for required environment variables
|
# Check for required environment variables
|
||||||
def check_auth []: nothing -> bool {
|
def check_auth []: nothing -> bool {
|
||||||
if ($env | get -o PROVIDER_TOKEN) == null {
|
if ($env | get -o PROVIDER_TOKEN) == null {
|
||||||
@ -225,7 +225,7 @@ def check_auth []: nothing -> bool {
|
|||||||
|
|
||||||
### 3. Rate Limiting
|
### 3. Rate Limiting
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Add delays for API rate limits
|
# Add delays for API rate limits
|
||||||
def api_call_with_retry [url: string]: nothing -> any {
|
def api_call_with_retry [url: string]: nothing -> any {
|
||||||
mut attempts = 0
|
mut attempts = 0
|
||||||
@ -248,7 +248,7 @@ def api_call_with_retry [url: string]: nothing -> any {
|
|||||||
|
|
||||||
Set capabilities accurately:
|
Set capabilities accurately:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
capabilities: {
|
capabilities: {
|
||||||
server_management: true # Can create/delete servers
|
server_management: true # Can create/delete servers
|
||||||
network_management: true # Can manage networks/VPCs
|
network_management: true # Can manage networks/VPCs
|
||||||
@ -281,7 +281,7 @@ capabilities: {
|
|||||||
|
|
||||||
### Provider Not Found
|
### Provider Not Found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check provider directory structure
|
# Check provider directory structure
|
||||||
ls -la provisioning/extensions/providers/your_provider_name/
|
ls -la provisioning/extensions/providers/your_provider_name/
|
||||||
|
|
||||||
@ -291,14 +291,14 @@ grep "get-provider-metadata" provisioning/extensions/providers/your_provider_nam
|
|||||||
|
|
||||||
### Interface Validation Failed
|
### Interface Validation Failed
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check which functions are missing
|
# Check which functions are missing
|
||||||
nu -c "use provisioning/core/nulib/lib_provisioning/providers/interface.nu *; validate-provider-interface 'your_provider_name'"
|
nu -c "use provisioning/core/nulib/lib_provisioning/providers/interface.nu *; validate-provider-interface 'your_provider_name'"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Authentication Errors
|
### Authentication Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check environment variables
|
# Check environment variables
|
||||||
env | grep PROVIDER
|
env | grep PROVIDER
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
### Create a New Taskserv (Interactive)
|
### Create a New Taskserv (Interactive)
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu provisioning/tools/create-taskserv-helper.nu interactive
|
nu provisioning/tools/create-taskserv-helper.nu interactive
|
||||||
```
|
```
|
||||||
|
|
||||||
### Create a New Taskserv (Direct)
|
### Create a New Taskserv (Direct)
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
nu provisioning/tools/create-taskserv-helper.nu create my-api
|
nu provisioning/tools/create-taskserv-helper.nu create my-api
|
||||||
--category development
|
--category development
|
||||||
--port 8080
|
--port 8080
|
||||||
@ -27,7 +27,7 @@ nu provisioning/tools/create-taskserv-helper.nu create my-api
|
|||||||
|
|
||||||
### 2. Basic Structure
|
### 2. Basic Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
my-service/
|
my-service/
|
||||||
├── nickel/
|
├── nickel/
|
||||||
│ ├── manifest.toml # Package definition
|
│ ├── manifest.toml # Package definition
|
||||||
@ -43,7 +43,7 @@ my-service/
|
|||||||
|
|
||||||
**manifest.toml** (package definition):
|
**manifest.toml** (package definition):
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[package]
|
[package]
|
||||||
name = "my-service"
|
name = "my-service"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -55,7 +55,7 @@ k8s = { oci = "oci://ghcr.io/kcl-lang/k8s", tag = "1.30" }
|
|||||||
|
|
||||||
**my-service.ncl** (main schema):
|
**my-service.ncl** (main schema):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let MyService = {
|
let MyService = {
|
||||||
name | String,
|
name | String,
|
||||||
version | String,
|
version | String,
|
||||||
@ -75,7 +75,7 @@ let MyService = {
|
|||||||
|
|
||||||
### 4. Test Your Taskserv
|
### 4. Test Your Taskserv
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Discover your taskserv
|
# Discover your taskserv
|
||||||
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; get-taskserv-info my-service"
|
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; get-taskserv-info my-service"
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ provisioning/core/cli/provisioning taskserv create my-service --infra wuji --che
|
|||||||
|
|
||||||
### Web Service
|
### Web Service
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let WebService = {
|
let WebService = {
|
||||||
name | String,
|
name | String,
|
||||||
version | String | default = "latest",
|
version | String | default = "latest",
|
||||||
@ -111,7 +111,7 @@ WebService
|
|||||||
|
|
||||||
### Database Service
|
### Database Service
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let DatabaseService = {
|
let DatabaseService = {
|
||||||
name | String,
|
name | String,
|
||||||
version | String | default = "latest",
|
version | String | default = "latest",
|
||||||
@ -132,7 +132,7 @@ DatabaseService
|
|||||||
|
|
||||||
### Background Worker
|
### Background Worker
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let BackgroundWorker = {
|
let BackgroundWorker = {
|
||||||
name | String,
|
name | String,
|
||||||
version | String | default = "latest",
|
version | String | default = "latest",
|
||||||
@ -154,7 +154,7 @@ BackgroundWorker
|
|||||||
|
|
||||||
### Discovery
|
### Discovery
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all taskservs
|
# List all taskservs
|
||||||
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; discover-taskservs | select name group"
|
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; discover-taskservs | select name group"
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ nu -c "use provisioning/workspace/tools/layer-utils.nu *; show_layer_stats"
|
|||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Nickel syntax
|
# Check Nickel syntax
|
||||||
nickel typecheck provisioning/extensions/taskservs/{category}/{name}/schemas/{name}.ncl
|
nickel typecheck provisioning/extensions/taskservs/{category}/{name}/schemas/{name}.ncl
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ provisioning/core/cli/provisioning taskserv check-updates
|
|||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dry run deployment
|
# Dry run deployment
|
||||||
provisioning/core/cli/provisioning taskserv create {name} --infra {infra} --check
|
provisioning/core/cli/provisioning taskserv create {name} --infra {infra} --check
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ nu -c "use provisioning/workspace/tools/layer-utils.nu *; test_layer_resolution
|
|||||||
|
|
||||||
### Taskserv Not Found
|
### Taskserv Not Found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check if discovered
|
# Check if discovered
|
||||||
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; discover-taskservs | where name == my-service"
|
nu -c "use provisioning/core/nulib/taskservs/discover.nu *; discover-taskservs | where name == my-service"
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ ls provisioning/extensions/taskservs/{category}/my-service/kcl/kcl.mod
|
|||||||
|
|
||||||
### Layer Resolution Issues
|
### Layer Resolution Issues
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Debug resolution
|
# Debug resolution
|
||||||
nu -c "use provisioning/workspace/tools/layer-utils.nu *; test_layer_resolution my-service wuji upcloud"
|
nu -c "use provisioning/workspace/tools/layer-utils.nu *; test_layer_resolution my-service wuji upcloud"
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ ls provisioning/workspace/templates/taskservs/{category}/my-service.ncl
|
|||||||
|
|
||||||
### Nickel Syntax Errors
|
### Nickel Syntax Errors
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Check syntax
|
# Check syntax
|
||||||
nickel typecheck provisioning/extensions/taskservs/{category}/my-service/schemas/my-service.ncl
|
nickel typecheck provisioning/extensions/taskservs/{category}/my-service/schemas/my-service.ncl
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ files, you answer questions in an interactive form, and TypeDialog generates val
|
|||||||
|
|
||||||
### 1. Configure a Platform Service (5 minutes)
|
### 1. Configure a Platform Service (5 minutes)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Launch interactive form for orchestrator
|
# Launch interactive form for orchestrator
|
||||||
provisioning config platform orchestrator
|
provisioning config platform orchestrator
|
||||||
|
|
||||||
@ -51,14 +51,14 @@ This opens an interactive form with sections for:
|
|||||||
|
|
||||||
After completing the form, TypeDialog generates `config.ncl`:
|
After completing the form, TypeDialog generates `config.ncl`:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# View what was generated
|
# View what was generated
|
||||||
cat workspace_librecloud/config/config.ncl
|
cat workspace_librecloud/config/config.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Validate Configuration
|
### 3. Validate Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Check Nickel syntax is valid
|
# Check Nickel syntax is valid
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl
|
nickel typecheck workspace_librecloud/config/config.ncl
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ provisioning config export
|
|||||||
|
|
||||||
Platform services automatically load the exported TOML:
|
Platform services automatically load the exported TOML:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Orchestrator reads config/generated/platform/orchestrator.toml
|
# Orchestrator reads config/generated/platform/orchestrator.toml
|
||||||
provisioning start orchestrator
|
provisioning start orchestrator
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ cat workspace_librecloud/config/generated/platform/orchestrator.toml
|
|||||||
|
|
||||||
All configuration lives in one Nickel file with three sections:
|
All configuration lives in one Nickel file with three sections:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# workspace_librecloud/config/config.ncl
|
# workspace_librecloud/config/config.ncl
|
||||||
{
|
{
|
||||||
# SECTION 1: Workspace metadata
|
# SECTION 1: Workspace metadata
|
||||||
@ -186,7 +186,7 @@ All configuration lives in one Nickel file with three sections:
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
platform = {
|
platform = {
|
||||||
orchestrator = {
|
orchestrator = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -223,7 +223,7 @@ platform = {
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
platform = {
|
platform = {
|
||||||
kms = {
|
kms = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -246,7 +246,7 @@ platform = {
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
platform = {
|
platform = {
|
||||||
control_center = {
|
control_center = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -271,7 +271,7 @@ All platform services support four deployment modes, each with different resourc
|
|||||||
|
|
||||||
**Mode-based Configuration Loading**:
|
**Mode-based Configuration Loading**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Load a specific mode's configuration
|
# Load a specific mode's configuration
|
||||||
export VAULT_MODE=enterprise
|
export VAULT_MODE=enterprise
|
||||||
export REGISTRY_MODE=multiuser
|
export REGISTRY_MODE=multiuser
|
||||||
@ -308,7 +308,7 @@ export RAG_MODE=cicd
|
|||||||
|
|
||||||
**Environment Variable Overrides**:
|
**Environment Variable Overrides**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
VAULT_CONFIG=/path/to/vault.toml # Explicit config path
|
VAULT_CONFIG=/path/to/vault.toml # Explicit config path
|
||||||
VAULT_MODE=enterprise # Mode-specific config
|
VAULT_MODE=enterprise # Mode-specific config
|
||||||
VAULT_SERVER_URL=http://localhost:8200 # Server URL
|
VAULT_SERVER_URL=http://localhost:8200 # Server URL
|
||||||
@ -319,7 +319,7 @@ VAULT_TLS_VERIFY=true # TLS verification
|
|||||||
|
|
||||||
**Example Configuration**:
|
**Example Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
platform = {
|
platform = {
|
||||||
vault_service = {
|
vault_service = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -366,7 +366,7 @@ platform = {
|
|||||||
|
|
||||||
**Environment Variable Overrides**:
|
**Environment Variable Overrides**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
REGISTRY_CONFIG=/path/to/registry.toml # Explicit config path
|
REGISTRY_CONFIG=/path/to/registry.toml # Explicit config path
|
||||||
REGISTRY_MODE=multiuser # Mode-specific config
|
REGISTRY_MODE=multiuser # Mode-specific config
|
||||||
REGISTRY_SERVER_HOST=0.0.0.0 # Server host
|
REGISTRY_SERVER_HOST=0.0.0.0 # Server host
|
||||||
@ -380,7 +380,7 @@ REGISTRY_OCI_NAMESPACE=provisioning # OCI namespace
|
|||||||
|
|
||||||
**Example Configuration**:
|
**Example Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
platform = {
|
platform = {
|
||||||
extension_registry = {
|
extension_registry = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -428,7 +428,7 @@ platform = {
|
|||||||
|
|
||||||
**Environment Variable Overrides**:
|
**Environment Variable Overrides**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
RAG_CONFIG=/path/to/rag.toml # Explicit config path
|
RAG_CONFIG=/path/to/rag.toml # Explicit config path
|
||||||
RAG_MODE=multiuser # Mode-specific config
|
RAG_MODE=multiuser # Mode-specific config
|
||||||
RAG_ENABLED=true # Enable/disable RAG
|
RAG_ENABLED=true # Enable/disable RAG
|
||||||
@ -442,7 +442,7 @@ RAG_VECTOR_DB_TYPE=surrealdb # Vector DB type
|
|||||||
|
|
||||||
**Example Configuration**:
|
**Example Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
platform = {
|
platform = {
|
||||||
rag = {
|
rag = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -489,7 +489,7 @@ platform = {
|
|||||||
|
|
||||||
**Environment Variable Overrides**:
|
**Environment Variable Overrides**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
AI_SERVICE_CONFIG=/path/to/ai.toml # Explicit config path
|
AI_SERVICE_CONFIG=/path/to/ai.toml # Explicit config path
|
||||||
AI_SERVICE_MODE=enterprise # Mode-specific config
|
AI_SERVICE_MODE=enterprise # Mode-specific config
|
||||||
AI_SERVICE_SERVER_PORT=8082 # Server port
|
AI_SERVICE_SERVER_PORT=8082 # Server port
|
||||||
@ -501,7 +501,7 @@ AI_SERVICE_DAG_MAX_CONCURRENT_TASKS=50 # Max concurrent tasks
|
|||||||
|
|
||||||
**Example Configuration**:
|
**Example Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
platform = {
|
platform = {
|
||||||
ai_service = {
|
ai_service = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -550,7 +550,7 @@ platform = {
|
|||||||
|
|
||||||
**Environment Variable Overrides**:
|
**Environment Variable Overrides**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
DAEMON_CONFIG=/path/to/daemon.toml # Explicit config path
|
DAEMON_CONFIG=/path/to/daemon.toml # Explicit config path
|
||||||
DAEMON_MODE=enterprise # Mode-specific config
|
DAEMON_MODE=enterprise # Mode-specific config
|
||||||
DAEMON_POLL_INTERVAL=30 # Polling interval (seconds)
|
DAEMON_POLL_INTERVAL=30 # Polling interval (seconds)
|
||||||
@ -562,7 +562,7 @@ DAEMON_AUTO_UPDATE=true # Enable auto updates
|
|||||||
|
|
||||||
**Example Configuration**:
|
**Example Configuration**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
platform = {
|
platform = {
|
||||||
provisioning_daemon = {
|
provisioning_daemon = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -607,21 +607,21 @@ platform = {
|
|||||||
|
|
||||||
**Environment Variables**:
|
**Environment Variables**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
api_user = "{{env.UPCLOUD_USER}}"
|
api_user = "{{env.UPCLOUD_USER}}"
|
||||||
api_password = "{{env.UPCLOUD_PASSWORD}}"
|
api_password = "{{env.UPCLOUD_PASSWORD}}"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Workspace Paths**:
|
**Workspace Paths**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
data_dir = "{{workspace.path}}/.orchestrator/data"
|
data_dir = "{{workspace.path}}/.orchestrator/data"
|
||||||
logs_dir = "{{workspace.path}}/.orchestrator/logs"
|
logs_dir = "{{workspace.path}}/.orchestrator/logs"
|
||||||
```
|
```
|
||||||
|
|
||||||
**KMS Decryption**:
|
**KMS Decryption**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
api_password = "{{kms.decrypt('upcloud_pass')}}"
|
api_password = "{{kms.decrypt('upcloud_pass')}}"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ api_password = "{{kms.decrypt('upcloud_pass')}}"
|
|||||||
|
|
||||||
### Validating Configuration
|
### Validating Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Check Nickel syntax
|
# Check Nickel syntax
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl
|
nickel typecheck workspace_librecloud/config/config.ncl
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ provisioning config export
|
|||||||
|
|
||||||
### Exporting to Service Formats
|
### Exporting to Service Formats
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# One-time export
|
# One-time export
|
||||||
provisioning config export
|
provisioning config export
|
||||||
|
|
||||||
@ -693,7 +693,7 @@ provisioning/schemas/platform/
|
|||||||
|
|
||||||
All 5 new services come with pre-built TOML configs for each deployment mode:
|
All 5 new services come with pre-built TOML configs for each deployment mode:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# View available schemas for vault service
|
# View available schemas for vault service
|
||||||
ls -la provisioning/schemas/platform/schemas/vault-service.ncl
|
ls -la provisioning/schemas/platform/schemas/vault-service.ncl
|
||||||
ls -la provisioning/schemas/platform/defaults/vault-service-defaults.ncl
|
ls -la provisioning/schemas/platform/defaults/vault-service-defaults.ncl
|
||||||
@ -725,7 +725,7 @@ export DAEMON_MODE=multiuser
|
|||||||
|
|
||||||
If you prefer interactive updating:
|
If you prefer interactive updating:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Re-run TypeDialog form (overwrites config.ncl)
|
# Re-run TypeDialog form (overwrites config.ncl)
|
||||||
provisioning config platform orchestrator
|
provisioning config platform orchestrator
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ typedialog form .typedialog/provisioning/platform/orchestrator/form.toml
|
|||||||
|
|
||||||
**Solution**: Check form.toml syntax and verify required fields are present (name, description, locales_path, templates_path)
|
**Solution**: Check form.toml syntax and verify required fields are present (name, description, locales_path, templates_path)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
head -10 .typedialog/provisioning/platform/orchestrator/form.toml
|
head -10 .typedialog/provisioning/platform/orchestrator/form.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ head -10 .typedialog/provisioning/platform/orchestrator/form.toml
|
|||||||
|
|
||||||
**Solution**: Check for syntax errors and correct field names
|
**Solution**: Check for syntax errors and correct field names
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl 2>&1 | less
|
nickel typecheck workspace_librecloud/config/config.ncl 2>&1 | less
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ Common issues: Missing closing braces, incorrect field names, wrong data types
|
|||||||
|
|
||||||
**Solution**: Verify config.ncl exports to JSON and check all required sections exist
|
**Solution**: Verify config.ncl exports to JSON and check all required sections exist
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
|||||||
|
|
||||||
### Development Setup
|
### Development Setup
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace = {
|
workspace = {
|
||||||
name = "dev",
|
name = "dev",
|
||||||
@ -815,7 +815,7 @@ nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
|||||||
|
|
||||||
### Production Setup
|
### Production Setup
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace = {
|
workspace = {
|
||||||
name = "prod",
|
name = "prod",
|
||||||
@ -859,7 +859,7 @@ nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
|||||||
|
|
||||||
### Multi-Provider Setup
|
### Multi-Provider Setup
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
workspace = {
|
workspace = {
|
||||||
name = "multi",
|
name = "multi",
|
||||||
@ -904,7 +904,7 @@ nickel export --format json workspace_librecloud/config/config.ncl | head -20
|
|||||||
|
|
||||||
Start with TypeDialog forms for the best experience:
|
Start with TypeDialog forms for the best experience:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning config platform orchestrator
|
provisioning config platform orchestrator
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ Only edit the source `.ncl` file, not the generated TOML files.
|
|||||||
|
|
||||||
Always validate before deploying changes:
|
Always validate before deploying changes:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl
|
nickel typecheck workspace_librecloud/config/config.ncl
|
||||||
provisioning config export
|
provisioning config export
|
||||||
```
|
```
|
||||||
@ -973,14 +973,14 @@ Add comments explaining custom settings in the Nickel file.
|
|||||||
|
|
||||||
Get detailed error messages and check available fields:
|
Get detailed error messages and check available fields:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl 2>&1 | less
|
nickel typecheck workspace_librecloud/config/config.ncl 2>&1 | less
|
||||||
grep "prompt =" .typedialog/provisioning/platform/orchestrator/form.toml
|
grep "prompt =" .typedialog/provisioning/platform/orchestrator/form.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration Questions
|
### Configuration Questions
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Show all available config commands
|
# Show all available config commands
|
||||||
provisioning config --help
|
provisioning config --help
|
||||||
|
|
||||||
@ -994,7 +994,7 @@ provisioning config services list
|
|||||||
|
|
||||||
### Test Configuration
|
### Test Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate without deploying
|
# Validate without deploying
|
||||||
nickel typecheck workspace_librecloud/config/config.ncl
|
nickel typecheck workspace_librecloud/config/config.ncl
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ quality, and efficiency.
|
|||||||
|
|
||||||
**1. Clone and Navigate**:
|
**1. Clone and Navigate**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clone repository
|
# Clone repository
|
||||||
git clone https://github.com/company/provisioning-system.git
|
git clone https://github.com/company/provisioning-system.git
|
||||||
cd provisioning-system
|
cd provisioning-system
|
||||||
@ -53,7 +53,7 @@ cd workspace/tools
|
|||||||
|
|
||||||
**2. Initialize Workspace**:
|
**2. Initialize Workspace**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize development workspace
|
# Initialize development workspace
|
||||||
nu workspace.nu init --user-name $USER --infra-name dev-env
|
nu workspace.nu init --user-name $USER --infra-name dev-env
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ nu workspace.nu health --detailed --fix-issues
|
|||||||
|
|
||||||
**3. Configure Development Environment**:
|
**3. Configure Development Environment**:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create user configuration
|
# Create user configuration
|
||||||
cp workspace/config/local-overrides.toml.example workspace/config/$USER.toml
|
cp workspace/config/local-overrides.toml.example workspace/config/$USER.toml
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ $EDITOR workspace/config/$USER.toml
|
|||||||
|
|
||||||
**4. Set Up Build System**:
|
**4. Set Up Build System**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Navigate to build tools
|
# Navigate to build tools
|
||||||
cd src/tools
|
cd src/tools
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ make dev-build
|
|||||||
|
|
||||||
**Required Tools**:
|
**Required Tools**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Nushell
|
# Install Nushell
|
||||||
cargo install nu
|
cargo install nu
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ cargo install cargo-watch # File watching
|
|||||||
|
|
||||||
**Optional Development Tools**:
|
**Optional Development Tools**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install development enhancers
|
# Install development enhancers
|
||||||
cargo install nu_plugin_tera # Template plugin
|
cargo install nu_plugin_tera # Template plugin
|
||||||
cargo install sops # Secrets management
|
cargo install sops # Secrets management
|
||||||
@ -114,7 +114,7 @@ brew install k9s # Kubernetes management
|
|||||||
|
|
||||||
**VS Code Setup** (`.vscode/settings.json`):
|
**VS Code Setup** (`.vscode/settings.json`):
|
||||||
|
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.nu": "shellscript",
|
"*.nu": "shellscript",
|
||||||
@ -143,7 +143,7 @@ brew install k9s # Kubernetes management
|
|||||||
|
|
||||||
**1. Sync and Update**:
|
**1. Sync and Update**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Sync with upstream
|
# Sync with upstream
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ nu workspace.nu status --detailed
|
|||||||
|
|
||||||
**2. Review Current State**:
|
**2. Review Current State**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check current infrastructure
|
# Check current infrastructure
|
||||||
provisioning show servers
|
provisioning show servers
|
||||||
provisioning show settings
|
provisioning show settings
|
||||||
@ -170,7 +170,7 @@ nu workspace.nu status
|
|||||||
|
|
||||||
**1. Feature Development**:
|
**1. Feature Development**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create feature branch
|
# Create feature branch
|
||||||
git checkout -b feature/new-provider-support
|
git checkout -b feature/new-provider-support
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ $EDITOR workspace/extensions/providers/new-provider/nulib/provider.nu
|
|||||||
|
|
||||||
**2. Incremental Testing**:
|
**2. Incremental Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test syntax during development
|
# Test syntax during development
|
||||||
nu --check workspace/extensions/providers/new-provider/nulib/provider.nu
|
nu --check workspace/extensions/providers/new-provider/nulib/provider.nu
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ nu workspace.nu tools test-extension providers/new-provider
|
|||||||
|
|
||||||
**3. Build and Validate**:
|
**3. Build and Validate**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Quick development build
|
# Quick development build
|
||||||
cd src/tools
|
cd src/tools
|
||||||
make dev-build
|
make dev-build
|
||||||
@ -213,7 +213,7 @@ make test-dist
|
|||||||
|
|
||||||
**Unit Testing**:
|
**Unit Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Add test examples to functions
|
# Add test examples to functions
|
||||||
def create-server [name: string] -> record {
|
def create-server [name: string] -> record {
|
||||||
# @test: "test-server" -> {name: "test-server", status: "created"}
|
# @test: "test-server" -> {name: "test-server", status: "created"}
|
||||||
@ -223,7 +223,7 @@ def create-server [name: string] -> record {
|
|||||||
|
|
||||||
**Integration Testing**:
|
**Integration Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test with real infrastructure
|
# Test with real infrastructure
|
||||||
nu workspace/extensions/providers/new-provider/nulib/provider.nu
|
nu workspace/extensions/providers/new-provider/nulib/provider.nu
|
||||||
create-server test-server --dry-run
|
create-server test-server --dry-run
|
||||||
@ -236,7 +236,7 @@ PROVISIONING_WORKSPACE_USER=$USER provisioning server create test-server --check
|
|||||||
|
|
||||||
**1. Commit Progress**:
|
**1. Commit Progress**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Stage changes
|
# Stage changes
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ git push origin feature/new-provider-support
|
|||||||
|
|
||||||
**2. Workspace Maintenance**:
|
**2. Workspace Maintenance**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clean up development data
|
# Clean up development data
|
||||||
nu workspace.nu cleanup --type cache --age 1d
|
nu workspace.nu cleanup --type cache --age 1d
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ nu workspace.nu health
|
|||||||
|
|
||||||
**File Organization**:
|
**File Organization**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Extension Structure:
|
Extension Structure:
|
||||||
├── nulib/
|
├── nulib/
|
||||||
│ ├── main.nu # Main entry point
|
│ ├── main.nu # Main entry point
|
||||||
@ -293,7 +293,7 @@ Extension Structure:
|
|||||||
|
|
||||||
**Function Naming Conventions**:
|
**Function Naming Conventions**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use kebab-case for commands
|
# Use kebab-case for commands
|
||||||
def create-server [name: string] -> record { ... }
|
def create-server [name: string] -> record { ... }
|
||||||
def validate-config [config: record] -> bool { ... }
|
def validate-config [config: record] -> bool { ... }
|
||||||
@ -310,7 +310,7 @@ def list-available-zones [] -> list<string> { ... }
|
|||||||
|
|
||||||
**Error Handling Pattern**:
|
**Error Handling Pattern**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
def create-server [
|
def create-server [
|
||||||
name: string
|
name: string
|
||||||
--dry-run: bool = false
|
--dry-run: bool = false
|
||||||
@ -347,7 +347,7 @@ def create-server [
|
|||||||
|
|
||||||
**Project Organization**:
|
**Project Organization**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
src/
|
src/
|
||||||
├── lib.rs # Library root
|
├── lib.rs # Library root
|
||||||
├── main.rs # Binary entry point
|
├── main.rs # Binary entry point
|
||||||
@ -367,7 +367,7 @@ src/
|
|||||||
|
|
||||||
**Error Handling**:
|
**Error Handling**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ pub fn create_server(name: &str) -> Result<ServerInfo> {
|
|||||||
|
|
||||||
**Schema Structure**:
|
**Schema Structure**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Base schema definitions
|
# Base schema definitions
|
||||||
let ServerConfig = {
|
let ServerConfig = {
|
||||||
name | string,
|
name | string,
|
||||||
@ -446,7 +446,7 @@ InfrastructureConfig
|
|||||||
|
|
||||||
**Unit Test Pattern**:
|
**Unit Test Pattern**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Function with embedded test
|
# Function with embedded test
|
||||||
def validate-server-name [name: string] -> bool {
|
def validate-server-name [name: string] -> bool {
|
||||||
# @test: "valid-name" -> true
|
# @test: "valid-name" -> true
|
||||||
@ -482,7 +482,7 @@ def test_validate_server_name [] {
|
|||||||
|
|
||||||
**Integration Test Pattern**:
|
**Integration Test Pattern**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# tests/integration/server-lifecycle-test.nu
|
# tests/integration/server-lifecycle-test.nu
|
||||||
def test_complete_server_lifecycle [] {
|
def test_complete_server_lifecycle [] {
|
||||||
# Setup
|
# Setup
|
||||||
@ -509,7 +509,7 @@ def test_complete_server_lifecycle [] {
|
|||||||
|
|
||||||
**Unit Testing**:
|
**Unit Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -540,7 +540,7 @@ mod tests {
|
|||||||
|
|
||||||
**Integration Testing**:
|
**Integration Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod integration_tests {
|
mod integration_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -570,7 +570,7 @@ mod integration_tests {
|
|||||||
|
|
||||||
**Schema Validation Testing**:
|
**Schema Validation Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test Nickel schemas
|
# Test Nickel schemas
|
||||||
nickel check schemas/
|
nickel check schemas/
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ nickel eval schemas/server.ncl
|
|||||||
|
|
||||||
**Continuous Testing**:
|
**Continuous Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Watch for changes and run tests
|
# Watch for changes and run tests
|
||||||
cargo watch -x test -x check
|
cargo watch -x test -x check
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ nu workspace.nu tools test-all --watch
|
|||||||
|
|
||||||
**Enable Debug Mode**:
|
**Enable Debug Mode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Environment variables
|
# Environment variables
|
||||||
export PROVISIONING_DEBUG=true
|
export PROVISIONING_DEBUG=true
|
||||||
export PROVISIONING_LOG_LEVEL=debug
|
export PROVISIONING_LOG_LEVEL=debug
|
||||||
@ -617,7 +617,7 @@ export PROVISIONING_WORKSPACE_USER=$USER
|
|||||||
|
|
||||||
**Debug Techniques**:
|
**Debug Techniques**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Debug prints
|
# Debug prints
|
||||||
def debug-server-creation [name: string] {
|
def debug-server-creation [name: string] {
|
||||||
print $"🐛 Creating server: ($name)"
|
print $"🐛 Creating server: ($name)"
|
||||||
@ -658,7 +658,7 @@ def debug-interactive [] {
|
|||||||
|
|
||||||
**Error Investigation**:
|
**Error Investigation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Comprehensive error handling
|
# Comprehensive error handling
|
||||||
def safe-server-creation [name: string] {
|
def safe-server-creation [name: string] {
|
||||||
try {
|
try {
|
||||||
@ -691,7 +691,7 @@ def safe-server-creation [name: string] {
|
|||||||
|
|
||||||
**Debug Logging**:
|
**Debug Logging**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
use tracing::{debug, info, warn, error, instrument};
|
use tracing::{debug, info, warn, error, instrument};
|
||||||
|
|
||||||
#[instrument]
|
#[instrument]
|
||||||
@ -720,7 +720,7 @@ pub async fn create_server(name: &str) -> Result<ServerInfo> {
|
|||||||
|
|
||||||
**Interactive Debugging**:
|
**Interactive Debugging**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
// Use debugger breakpoints
|
// Use debugger breakpoints
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
@ -734,7 +734,7 @@ pub async fn create_server(name: &str) -> Result<ServerInfo> {
|
|||||||
|
|
||||||
**Log Monitoring**:
|
**Log Monitoring**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Follow all logs
|
# Follow all logs
|
||||||
tail -f workspace/runtime/logs/$USER/*.log
|
tail -f workspace/runtime/logs/$USER/*.log
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ jq '.level == "ERROR"' workspace/runtime/logs/$USER/structured.jsonl
|
|||||||
|
|
||||||
**Debug Log Levels**:
|
**Debug Log Levels**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Different verbosity levels
|
# Different verbosity levels
|
||||||
PROVISIONING_LOG_LEVEL=trace provisioning server create test
|
PROVISIONING_LOG_LEVEL=trace provisioning server create test
|
||||||
PROVISIONING_LOG_LEVEL=debug provisioning server create test
|
PROVISIONING_LOG_LEVEL=debug provisioning server create test
|
||||||
@ -763,7 +763,7 @@ PROVISIONING_LOG_LEVEL=info provisioning server create test
|
|||||||
|
|
||||||
**Working with Legacy Components**:
|
**Working with Legacy Components**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test integration with existing system
|
# Test integration with existing system
|
||||||
provisioning --version # Legacy system
|
provisioning --version # Legacy system
|
||||||
src/core/nulib/provisioning --version # New system
|
src/core/nulib/provisioning --version # New system
|
||||||
@ -780,7 +780,7 @@ nu workspace.nu config validate
|
|||||||
|
|
||||||
**REST API Testing**:
|
**REST API Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test orchestrator API
|
# Test orchestrator API
|
||||||
curl -X GET http://localhost:9090/health
|
curl -X GET http://localhost:9090/health
|
||||||
curl -X GET http://localhost:9090/tasks
|
curl -X GET http://localhost:9090/tasks
|
||||||
@ -798,7 +798,7 @@ curl -X GET http://localhost:9090/workflows/batch/status/workflow-id
|
|||||||
|
|
||||||
**SurrealDB Integration**:
|
**SurrealDB Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test database connectivity
|
# Test database connectivity
|
||||||
use core/nulib/lib_provisioning/database/surreal.nu
|
use core/nulib/lib_provisioning/database/surreal.nu
|
||||||
let db = (connect-database)
|
let db = (connect-database)
|
||||||
@ -814,7 +814,7 @@ assert ($status.status == "pending")
|
|||||||
|
|
||||||
**Container Integration**:
|
**Container Integration**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test with Docker
|
# Test with Docker
|
||||||
docker run --rm -v $(pwd):/work provisioning:dev provisioning --version
|
docker run --rm -v $(pwd):/work provisioning:dev provisioning --version
|
||||||
|
|
||||||
@ -841,7 +841,7 @@ make test-dist PLATFORM=kubernetes
|
|||||||
|
|
||||||
**Workflow**:
|
**Workflow**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start new feature
|
# Start new feature
|
||||||
git checkout main
|
git checkout main
|
||||||
git pull origin main
|
git pull origin main
|
||||||
@ -869,7 +869,7 @@ gh pr create --title "Add new provider support" --body "..."
|
|||||||
|
|
||||||
**Review Commands**:
|
**Review Commands**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test PR locally
|
# Test PR locally
|
||||||
gh pr checkout 123
|
gh pr checkout 123
|
||||||
cd src/tools && make ci-test
|
cd src/tools && make ci-test
|
||||||
@ -886,7 +886,7 @@ nu --check $(find . -name "*.nu")
|
|||||||
|
|
||||||
**Code Documentation**:
|
**Code Documentation**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Function documentation
|
# Function documentation
|
||||||
def create-server [
|
def create-server [
|
||||||
name: string # Server name (must be unique)
|
name: string # Server name (must be unique)
|
||||||
@ -925,7 +925,7 @@ def create-server [
|
|||||||
|
|
||||||
**Automated Quality Gates**:
|
**Automated Quality Gates**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pre-commit hooks
|
# Pre-commit hooks
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
@ -949,7 +949,7 @@ cargo audit
|
|||||||
|
|
||||||
**Performance Testing**:
|
**Performance Testing**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Benchmark builds
|
# Benchmark builds
|
||||||
make benchmark
|
make benchmark
|
||||||
|
|
||||||
@ -962,7 +962,7 @@ ab -n 1000 -c 10 http://localhost:9090/health
|
|||||||
|
|
||||||
**Resource Monitoring**:
|
**Resource Monitoring**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Monitor during development
|
# Monitor during development
|
||||||
nu workspace/tools/runtime-manager.nu monitor --duration 5m
|
nu workspace/tools/runtime-manager.nu monitor --duration 5m
|
||||||
|
|
||||||
@ -977,7 +977,7 @@ df -h
|
|||||||
|
|
||||||
**Never Hardcode**:
|
**Never Hardcode**:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Bad
|
# Bad
|
||||||
def get-api-url [] { "https://api.upcloud.com" }
|
def get-api-url [] { "https://api.upcloud.com" }
|
||||||
|
|
||||||
@ -991,7 +991,7 @@ def get-api-url [] {
|
|||||||
|
|
||||||
**Comprehensive Error Context**:
|
**Comprehensive Error Context**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def create-server [name: string] {
|
def create-server [name: string] {
|
||||||
try {
|
try {
|
||||||
validate-server-name $name
|
validate-server-name $name
|
||||||
@ -1017,7 +1017,7 @@ def create-server [name: string] {
|
|||||||
|
|
||||||
**Clean Up Resources**:
|
**Clean Up Resources**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def with-temporary-server [name: string, action: closure] {
|
def with-temporary-server [name: string, action: closure] {
|
||||||
let server = (create-server $name)
|
let server = (create-server $name)
|
||||||
|
|
||||||
@ -1038,7 +1038,7 @@ def with-temporary-server [name: string, action: closure] {
|
|||||||
|
|
||||||
**Test Isolation**:
|
**Test Isolation**:
|
||||||
|
|
||||||
```text
|
```python
|
||||||
def test-with-isolation [test_name: string, test_action: closure] {
|
def test-with-isolation [test_name: string, test_action: closure] {
|
||||||
let test_workspace = $"test-($test_name)-(date now | format date '%Y%m%d%H%M%S')"
|
let test_workspace = $"test-($test_name)-(date now | format date '%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Before proceeding, verify your system has the core dependencies installed:
|
|||||||
|
|
||||||
### Nushell
|
### Nushell
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# Check Nushell version
|
# Check Nushell version
|
||||||
nu --version
|
nu --version
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ nu --version
|
|||||||
|
|
||||||
### Nickel
|
### Nickel
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Check Nickel version
|
# Check Nickel version
|
||||||
nickel --version
|
nickel --version
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ nickel --version
|
|||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Docker version
|
# Check Docker version
|
||||||
docker --version
|
docker --version
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ docker ps
|
|||||||
|
|
||||||
### SOPS
|
### SOPS
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check SOPS version
|
# Check SOPS version
|
||||||
sops --version
|
sops --version
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ sops --version
|
|||||||
|
|
||||||
### Age
|
### Age
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Age version
|
# Check Age version
|
||||||
age --version
|
age --version
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ age --version
|
|||||||
|
|
||||||
### macOS (using Homebrew)
|
### macOS (using Homebrew)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Homebrew if not already installed
|
# Install Homebrew if not already installed
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ brew install k9s glow bat
|
|||||||
|
|
||||||
### Ubuntu/Debian
|
### Ubuntu/Debian
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update package list
|
# Update package list
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ sudo apt install -y age
|
|||||||
|
|
||||||
### Fedora/RHEL
|
### Fedora/RHEL
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Nushell
|
# Install Nushell
|
||||||
sudo dnf install -y nushell
|
sudo dnf install -y nushell
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Estimated time: 15-20 minutes
|
|||||||
|
|
||||||
## Step 1: Clone the Repository
|
## Step 1: Clone the Repository
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone https://github.com/provisioning/provisioning-platform.git
|
git clone https://github.com/provisioning/provisioning-platform.git
|
||||||
cd provisioning-platform
|
cd provisioning-platform
|
||||||
@ -30,7 +30,7 @@ The platform uses multiple Nushell plugins for enhanced functionality.
|
|||||||
|
|
||||||
### Install nu_plugin_tera (Template Rendering)
|
### Install nu_plugin_tera (Template Rendering)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install from crates.io
|
# Install from crates.io
|
||||||
cargo install nu_plugin_tera
|
cargo install nu_plugin_tera
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ nu -c "plugin add ~/.cargo/bin/nu_plugin_tera; plugin use tera"
|
|||||||
|
|
||||||
### Verify Plugin Installation
|
### Verify Plugin Installation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start Nushell
|
# Start Nushell
|
||||||
nu
|
nu
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ plugin list
|
|||||||
|
|
||||||
Make the `provisioning` command available globally:
|
Make the `provisioning` command available globally:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option 1: Symlink to /usr/local/bin (recommended)
|
# Option 1: Symlink to /usr/local/bin (recommended)
|
||||||
sudo ln -s "$(pwd)/provisioning/core/cli/provisioning" /usr/local/bin/provisioning
|
sudo ln -s "$(pwd)/provisioning/core/cli/provisioning" /usr/local/bin/provisioning
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ provisioning --version
|
|||||||
|
|
||||||
Generate keys for encrypting sensitive configuration:
|
Generate keys for encrypting sensitive configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create Age key directory
|
# Create Age key directory
|
||||||
mkdir -p ~/.config/provisioning/age
|
mkdir -p ~/.config/provisioning/age
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ chmod 644 ~/.config/provisioning/age/public_key.txt
|
|||||||
|
|
||||||
Set up basic environment variables:
|
Set up basic environment variables:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create environment file
|
# Create environment file
|
||||||
cat > ~/.provisioning/env << 'ENVEOF'
|
cat > ~/.provisioning/env << 'ENVEOF'
|
||||||
# Provisioning Environment Configuration
|
# Provisioning Environment Configuration
|
||||||
@ -110,7 +110,7 @@ echo 'source ~/.provisioning/env' >> ~/.bashrc # or ~/.zshrc
|
|||||||
|
|
||||||
Create your first workspace:
|
Create your first workspace:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Initialize a new workspace
|
# Initialize a new workspace
|
||||||
provisioning workspace init my-first-workspace
|
provisioning workspace init my-first-workspace
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ provisioning workspace list
|
|||||||
|
|
||||||
Run the installation verification:
|
Run the installation verification:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check system configuration
|
# Check system configuration
|
||||||
provisioning validate config
|
provisioning validate config
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ Expected output should show:
|
|||||||
|
|
||||||
If you plan to use platform services (orchestrator, control center, etc.):
|
If you plan to use platform services (orchestrator, control center, etc.):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build platform services
|
# Build platform services
|
||||||
cd provisioning/platform
|
cd provisioning/platform
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ ls */target/release/
|
|||||||
|
|
||||||
Use the interactive installer for a guided setup:
|
Use the interactive installer for a guided setup:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build the installer
|
# Build the installer
|
||||||
cd provisioning/platform/installer
|
cd provisioning/platform/installer
|
||||||
cargo build --release
|
cargo build --release
|
||||||
@ -194,7 +194,7 @@ cargo build --release
|
|||||||
|
|
||||||
If plugins aren't recognized:
|
If plugins aren't recognized:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Rebuild plugin registry
|
# Rebuild plugin registry
|
||||||
nu -c "plugin list; plugin use tera"
|
nu -c "plugin list; plugin use tera"
|
||||||
```
|
```
|
||||||
@ -203,7 +203,7 @@ nu -c "plugin list; plugin use tera"
|
|||||||
|
|
||||||
If you encounter permission errors:
|
If you encounter permission errors:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Ensure proper ownership
|
# Ensure proper ownership
|
||||||
sudo chown -R $USER:$USER ~/.config/provisioning
|
sudo chown -R $USER:$USER ~/.config/provisioning
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ echo $PATH | grep provisioning
|
|||||||
|
|
||||||
If encryption fails:
|
If encryption fails:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Verify keys exist
|
# Verify keys exist
|
||||||
ls -la ~/.config/provisioning/age/
|
ls -la ~/.config/provisioning/age/
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Estimated time: 10-15 minutes
|
|||||||
|
|
||||||
Create a basic infrastructure configuration:
|
Create a basic infrastructure configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Generate infrastructure template
|
# Generate infrastructure template
|
||||||
provisioning generate infra --new my-infra
|
provisioning generate infra --new my-infra
|
||||||
|
|
||||||
@ -30,14 +30,14 @@ provisioning generate infra --new my-infra
|
|||||||
|
|
||||||
Edit the generated configuration:
|
Edit the generated configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Edit with your preferred editor
|
# Edit with your preferred editor
|
||||||
$EDITOR workspace/infra/my-infra/settings.ncl
|
$EDITOR workspace/infra/my-infra/settings.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
import provisioning.settings as cfg
|
import provisioning.settings as cfg
|
||||||
|
|
||||||
# Infrastructure settings
|
# Infrastructure settings
|
||||||
@ -62,7 +62,7 @@ servers = [
|
|||||||
|
|
||||||
First, run in check mode to see what would happen:
|
First, run in check mode to see what would happen:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check mode - no actual changes
|
# Check mode - no actual changes
|
||||||
provisioning server create --infra my-infra --check
|
provisioning server create --infra my-infra --check
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ provisioning server create --infra my-infra --check
|
|||||||
|
|
||||||
If check mode looks good, create the server:
|
If check mode looks good, create the server:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create server
|
# Create server
|
||||||
provisioning server create --infra my-infra
|
provisioning server create --infra my-infra
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ provisioning server create --infra my-infra
|
|||||||
|
|
||||||
Check server status:
|
Check server status:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all servers
|
# List all servers
|
||||||
provisioning server list
|
provisioning server list
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ provisioning server ssh dev-server-01
|
|||||||
|
|
||||||
Install a task service on the server:
|
Install a task service on the server:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check mode first
|
# Check mode first
|
||||||
provisioning taskserv create kubernetes --infra my-infra --check
|
provisioning taskserv create kubernetes --infra my-infra --check
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ provisioning taskserv create kubernetes --infra my-infra --check
|
|||||||
|
|
||||||
Proceed with installation:
|
Proceed with installation:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Kubernetes
|
# Install Kubernetes
|
||||||
provisioning taskserv create kubernetes --infra my-infra --wait
|
provisioning taskserv create kubernetes --infra my-infra --wait
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ provisioning workflow monitor <task-id>
|
|||||||
|
|
||||||
Check that Kubernetes is running:
|
Check that Kubernetes is running:
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# List installed task services
|
# List installed task services
|
||||||
provisioning taskserv list --infra my-infra
|
provisioning taskserv list --infra my-infra
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ provisioning server exec dev-server-01 -- kubectl get nodes
|
|||||||
|
|
||||||
Create multiple servers at once:
|
Create multiple servers at once:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
servers = [
|
servers = [
|
||||||
{hostname = "web-01", cores = 2, memory = 4096},
|
{hostname = "web-01", cores = 2, memory = 4096},
|
||||||
{hostname = "web-02", cores = 2, memory = 4096},
|
{hostname = "web-02", cores = 2, memory = 4096},
|
||||||
@ -172,7 +172,7 @@ servers = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning server create --infra my-infra --servers web-01,web-02,db-01
|
provisioning server create --infra my-infra --servers web-01,web-02,db-01
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ provisioning server create --infra my-infra --servers web-01,web-02,db-01
|
|||||||
|
|
||||||
Install multiple services on one server:
|
Install multiple services on one server:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning taskserv create kubernetes,cilium,postgres --infra my-infra --servers web-01
|
provisioning taskserv create kubernetes,cilium,postgres --infra my-infra --servers web-01
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ provisioning taskserv create kubernetes,cilium,postgres --infra my-infra --serve
|
|||||||
|
|
||||||
Deploy a complete cluster configuration:
|
Deploy a complete cluster configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
provisioning cluster create buildkit --infra my-infra
|
provisioning cluster create buildkit --infra my-infra
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ provisioning cluster create buildkit --infra my-infra
|
|||||||
|
|
||||||
The typical deployment workflow:
|
The typical deployment workflow:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Initialize workspace
|
# 1. Initialize workspace
|
||||||
provisioning workspace init production
|
provisioning workspace init production
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ provisioning taskserv list
|
|||||||
|
|
||||||
### Server Creation Fails
|
### Server Creation Fails
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check logs
|
# Check logs
|
||||||
provisioning server logs dev-server-01
|
provisioning server logs dev-server-01
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ provisioning --debug server create --infra my-infra
|
|||||||
|
|
||||||
### Task Service Installation Fails
|
### Task Service Installation Fails
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check task service logs
|
# Check task service logs
|
||||||
provisioning taskserv logs kubernetes
|
provisioning taskserv logs kubernetes
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ provisioning taskserv create kubernetes --infra my-infra --force
|
|||||||
|
|
||||||
### SSH Connection Issues
|
### SSH Connection Issues
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Verify SSH key
|
# Verify SSH key
|
||||||
ls -la ~/.ssh/
|
ls -la ~/.ssh/
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ After completing your first deployment, verify:
|
|||||||
|
|
||||||
Check that all configuration is valid:
|
Check that all configuration is valid:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate all configuration
|
# Validate all configuration
|
||||||
provisioning validate config
|
provisioning validate config
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ provisioning validate config
|
|||||||
# ✓ All required fields present
|
# ✓ All required fields present
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check environment variables
|
# Check environment variables
|
||||||
provisioning env
|
provisioning env
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ provisioning allenv
|
|||||||
|
|
||||||
Check that servers are accessible and healthy:
|
Check that servers are accessible and healthy:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all servers
|
# List all servers
|
||||||
provisioning server list
|
provisioning server list
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ provisioning server list
|
|||||||
# └───────────────┴──────────┴───────┴────────┴──────────────┴──────────┘
|
# └───────────────┴──────────┴───────┴────────┴──────────────┴──────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check server details
|
# Check server details
|
||||||
provisioning server info dev-server-01
|
provisioning server info dev-server-01
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ provisioning server ssh dev-server-01 -- echo "SSH working"
|
|||||||
|
|
||||||
Check installed task services:
|
Check installed task services:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List task services
|
# List task services
|
||||||
provisioning taskserv list
|
provisioning taskserv list
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ provisioning taskserv list
|
|||||||
# └────────────┴─────────┴────────────────┴──────────┘
|
# └────────────┴─────────┴────────────────┴──────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check specific task service
|
# Check specific task service
|
||||||
provisioning taskserv status kubernetes
|
provisioning taskserv status kubernetes
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ provisioning taskserv logs kubernetes --tail 50
|
|||||||
|
|
||||||
If you installed Kubernetes, verify it's working:
|
If you installed Kubernetes, verify it's working:
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# Check Kubernetes nodes
|
# Check Kubernetes nodes
|
||||||
provisioning server ssh dev-server-01 -- kubectl get nodes
|
provisioning server ssh dev-server-01 -- kubectl get nodes
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ provisioning server ssh dev-server-01 -- kubectl get nodes
|
|||||||
# dev-server-01 Ready control-plane 10m v1.28.0
|
# dev-server-01 Ready control-plane 10m v1.28.0
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Kubernetes pods
|
# Check Kubernetes pods
|
||||||
provisioning server ssh dev-server-01 -- kubectl get pods -A
|
provisioning server ssh dev-server-01 -- kubectl get pods -A
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ If you installed platform services:
|
|||||||
|
|
||||||
### Orchestrator
|
### Orchestrator
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check orchestrator health
|
# Check orchestrator health
|
||||||
curl http://localhost:8080/health
|
curl http://localhost:8080/health
|
||||||
|
|
||||||
@ -117,14 +117,14 @@ curl http://localhost:8080/health
|
|||||||
# {"status":"healthy","version":"0.1.0"}
|
# {"status":"healthy","version":"0.1.0"}
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List tasks
|
# List tasks
|
||||||
curl http://localhost:8080/tasks
|
curl http://localhost:8080/tasks
|
||||||
```
|
```
|
||||||
|
|
||||||
### Control Center
|
### Control Center
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check control center health
|
# Check control center health
|
||||||
curl http://localhost:9090/health
|
curl http://localhost:9090/health
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ curl -X POST http://localhost:9090/policies/evaluate
|
|||||||
|
|
||||||
### KMS Service
|
### KMS Service
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check KMS health
|
# Check KMS health
|
||||||
curl http://localhost:8082/api/v1/kms/health
|
curl http://localhost:8082/api/v1/kms/health
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ echo "test" | provisioning kms encrypt
|
|||||||
|
|
||||||
Run comprehensive health checks:
|
Run comprehensive health checks:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check all components
|
# Check all components
|
||||||
provisioning health check
|
provisioning health check
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ provisioning health check
|
|||||||
|
|
||||||
If you used workflows:
|
If you used workflows:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all workflows
|
# List all workflows
|
||||||
provisioning workflow list
|
provisioning workflow list
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ provisioning workflow stats
|
|||||||
|
|
||||||
### DNS Resolution (If CoreDNS Installed)
|
### DNS Resolution (If CoreDNS Installed)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test DNS resolution
|
# Test DNS resolution
|
||||||
dig @localhost test.provisioning.local
|
dig @localhost test.provisioning.local
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ provisioning server ssh dev-server-01 -- systemctl status coredns
|
|||||||
|
|
||||||
### Network Connectivity
|
### Network Connectivity
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test server-to-server connectivity
|
# Test server-to-server connectivity
|
||||||
provisioning server ssh dev-server-01 -- ping -c 3 dev-server-02
|
provisioning server ssh dev-server-01 -- ping -c 3 dev-server-02
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ provisioning server ssh dev-server-01 -- sudo iptables -L
|
|||||||
|
|
||||||
### Storage and Resources
|
### Storage and Resources
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check disk usage
|
# Check disk usage
|
||||||
provisioning server ssh dev-server-01 -- df -h
|
provisioning server ssh dev-server-01 -- df -h
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ provisioning server ssh dev-server-01 -- top -bn1 | head -20
|
|||||||
|
|
||||||
### Configuration Validation Failed
|
### Configuration Validation Failed
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# View detailed error
|
# View detailed error
|
||||||
provisioning validate config --verbose
|
provisioning validate config --verbose
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ provisioning validate config --infra my-infra
|
|||||||
|
|
||||||
### Server Unreachable
|
### Server Unreachable
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check server logs
|
# Check server logs
|
||||||
provisioning server logs dev-server-01
|
provisioning server logs dev-server-01
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ provisioning --debug server ssh dev-server-01
|
|||||||
|
|
||||||
### Task Service Not Running
|
### Task Service Not Running
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check service logs
|
# Check service logs
|
||||||
provisioning taskserv logs kubernetes
|
provisioning taskserv logs kubernetes
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ provisioning taskserv restart kubernetes --infra my-infra
|
|||||||
|
|
||||||
### Platform Service Down
|
### Platform Service Down
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check service status
|
# Check service status
|
||||||
provisioning platform status orchestrator
|
provisioning platform status orchestrator
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ provisioning platform restart orchestrator
|
|||||||
|
|
||||||
### Response Time Tests
|
### Response Time Tests
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Measure server response time
|
# Measure server response time
|
||||||
time provisioning server info dev-server-01
|
time provisioning server info dev-server-01
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ time provisioning workflow submit test-workflow.ncl
|
|||||||
|
|
||||||
### Resource Usage
|
### Resource Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check platform resource usage
|
# Check platform resource usage
|
||||||
docker stats # If using Docker
|
docker stats # If using Docker
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ provisioning system resources
|
|||||||
|
|
||||||
### Encryption
|
### Encryption
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Verify encryption keys
|
# Verify encryption keys
|
||||||
ls -la ~/.config/provisioning/age/
|
ls -la ~/.config/provisioning/age/
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ echo "test" | provisioning kms encrypt | provisioning kms decrypt
|
|||||||
|
|
||||||
### Authentication (If Enabled)
|
### Authentication (If Enabled)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test login
|
# Test login
|
||||||
provisioning login --username admin
|
provisioning login --username admin
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ Choose a deployment mode based on your needs:
|
|||||||
|
|
||||||
The configuration system is managed by a standalone script that doesn't require the main installer:
|
The configuration system is managed by a standalone script that doesn't require the main installer:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Navigate to the provisioning directory
|
# Navigate to the provisioning directory
|
||||||
cd /path/to/project-provisioning
|
cd /path/to/project-provisioning
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ TypeDialog provides an interactive form-based configuration interface available
|
|||||||
|
|
||||||
#### Quick Interactive Setup (All Services at Once)
|
#### Quick Interactive Setup (All Services at Once)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run interactive setup - prompts for choices
|
# Run interactive setup - prompts for choices
|
||||||
./provisioning/scripts/setup-platform-config.sh
|
./provisioning/scripts/setup-platform-config.sh
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ TypeDialog provides an interactive form-based configuration interface available
|
|||||||
|
|
||||||
#### Configure Specific Service with TypeDialog
|
#### Configure Specific Service with TypeDialog
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Configure orchestrator in solo mode with web UI
|
# Configure orchestrator in solo mode with web UI
|
||||||
./provisioning/scripts/setup-platform-config.sh
|
./provisioning/scripts/setup-platform-config.sh
|
||||||
--service orchestrator
|
--service orchestrator
|
||||||
@ -103,7 +103,7 @@ TypeDialog provides an interactive form-based configuration interface available
|
|||||||
|
|
||||||
Quick mode automatically creates all service configurations from defaults overlaid with mode-specific tuning.
|
Quick mode automatically creates all service configurations from defaults overlaid with mode-specific tuning.
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Quick setup for solo development mode
|
# Quick setup for solo development mode
|
||||||
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode solo
|
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode solo
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ Quick mode automatically creates all service configurations from defaults overla
|
|||||||
|
|
||||||
For advanced users who prefer editing configuration files directly:
|
For advanced users who prefer editing configuration files directly:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# View schema definition
|
# View schema definition
|
||||||
cat provisioning/schemas/platform/schemas/orchestrator.ncl
|
cat provisioning/schemas/platform/schemas/orchestrator.ncl
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ nickel typecheck provisioning/config/runtime/orchestrator.solo.ncl
|
|||||||
|
|
||||||
The configuration system uses layered composition:
|
The configuration system uses layered composition:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
1. Schema (Type contract)
|
1. Schema (Type contract)
|
||||||
↓ Defines valid fields and constraints
|
↓ Defines valid fields and constraints
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ All layers are automatically composed and validated.
|
|||||||
|
|
||||||
After running the setup script, verify the configuration was created:
|
After running the setup script, verify the configuration was created:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# List generated runtime configurations
|
# List generated runtime configurations
|
||||||
ls -la provisioning/config/runtime/
|
ls -la provisioning/config/runtime/
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ After successful configuration, services can be started:
|
|||||||
|
|
||||||
### Running a Single Service
|
### Running a Single Service
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set deployment mode
|
# Set deployment mode
|
||||||
export ORCHESTRATOR_MODE=solo
|
export ORCHESTRATOR_MODE=solo
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ cargo run -p orchestrator
|
|||||||
|
|
||||||
### Running Multiple Services
|
### Running Multiple Services
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Terminal 1: Vault Service (secrets management)
|
# Terminal 1: Vault Service (secrets management)
|
||||||
export VAULT_MODE=solo
|
export VAULT_MODE=solo
|
||||||
cargo run -p vault-service
|
cargo run -p vault-service
|
||||||
@ -227,7 +227,7 @@ cargo run -p control-center
|
|||||||
|
|
||||||
### Docker-Based Deployment
|
### Docker-Based Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start all services in Docker (requires docker-compose.yml)
|
# Start all services in Docker (requires docker-compose.yml)
|
||||||
cd provisioning/platform/infrastructure/docker
|
cd provisioning/platform/infrastructure/docker
|
||||||
docker-compose -f docker-compose.solo.yml up
|
docker-compose -f docker-compose.solo.yml up
|
||||||
@ -238,7 +238,7 @@ docker-compose -f docker-compose.enterprise.yml up
|
|||||||
|
|
||||||
## Step 6: Verify Services Are Running
|
## Step 6: Verify Services Are Running
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check orchestrator status
|
# Check orchestrator status
|
||||||
curl http://localhost:9000/health
|
curl http://localhost:9000/health
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ cargo run -p orchestrator -- --log-level debug
|
|||||||
|
|
||||||
If you need to switch from solo to multiuser mode:
|
If you need to switch from solo to multiuser mode:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option 1: Re-run setup with new mode
|
# Option 1: Re-run setup with new mode
|
||||||
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode multiuser
|
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode multiuser
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ If you need to switch from solo to multiuser mode:
|
|||||||
|
|
||||||
If you need fine-grained control:
|
If you need fine-grained control:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Edit the Nickel configuration directly
|
# 1. Edit the Nickel configuration directly
|
||||||
vim provisioning/config/runtime/orchestrator.solo.ncl
|
vim provisioning/config/runtime/orchestrator.solo.ncl
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ cargo run -p orchestrator
|
|||||||
|
|
||||||
For workspace-specific customization:
|
For workspace-specific customization:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create workspace override file
|
# Create workspace override file
|
||||||
mkdir -p workspace_myworkspace/config
|
mkdir -p workspace_myworkspace/config
|
||||||
cat > workspace_myworkspace/config/platform-overrides.ncl <<'EOF'
|
cat > workspace_myworkspace/config/platform-overrides.ncl <<'EOF'
|
||||||
@ -321,7 +321,7 @@ EOF
|
|||||||
|
|
||||||
## Available Configuration Commands
|
## Available Configuration Commands
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# List all available modes
|
# List all available modes
|
||||||
./provisioning/scripts/setup-platform-config.sh --list-modes
|
./provisioning/scripts/setup-platform-config.sh --list-modes
|
||||||
# Output: solo, multiuser, cicd, enterprise
|
# Output: solo, multiuser, cicd, enterprise
|
||||||
@ -344,7 +344,7 @@ EOF
|
|||||||
|
|
||||||
### Public Definitions (Part of repository)
|
### Public Definitions (Part of repository)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/schemas/platform/
|
provisioning/schemas/platform/
|
||||||
├── schemas/ # Type contracts (Nickel)
|
├── schemas/ # Type contracts (Nickel)
|
||||||
├── defaults/ # Base configuration values
|
├── defaults/ # Base configuration values
|
||||||
@ -356,7 +356,7 @@ provisioning/schemas/platform/
|
|||||||
|
|
||||||
### Private Runtime Configs (Gitignored)
|
### Private Runtime Configs (Gitignored)
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
provisioning/config/runtime/ # User-specific deployments
|
provisioning/config/runtime/ # User-specific deployments
|
||||||
├── orchestrator.solo.ncl # Editable config
|
├── orchestrator.solo.ncl # Editable config
|
||||||
├── orchestrator.multiuser.ncl
|
├── orchestrator.multiuser.ncl
|
||||||
@ -367,7 +367,7 @@ provisioning/config/runtime/ # User-specific deployments
|
|||||||
|
|
||||||
### Examples (Reference)
|
### Examples (Reference)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/config/examples/
|
provisioning/config/examples/
|
||||||
├── orchestrator.solo.example.ncl # Solo mode reference
|
├── orchestrator.solo.example.ncl # Solo mode reference
|
||||||
└── orchestrator.enterprise.example.ncl # Enterprise mode reference
|
└── orchestrator.enterprise.example.ncl # Enterprise mode reference
|
||||||
@ -377,7 +377,7 @@ provisioning/config/examples/
|
|||||||
|
|
||||||
### Issue: Script Fails with "Nickel not found"
|
### Issue: Script Fails with "Nickel not found"
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Install Nickel
|
# Install Nickel
|
||||||
# macOS
|
# macOS
|
||||||
brew install nickel
|
brew install nickel
|
||||||
@ -392,7 +392,7 @@ nickel --version
|
|||||||
|
|
||||||
### Issue: Configuration Won't Generate TOML
|
### Issue: Configuration Won't Generate TOML
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Check Nickel syntax
|
# Check Nickel syntax
|
||||||
nickel typecheck provisioning/config/runtime/orchestrator.solo.ncl
|
nickel typecheck provisioning/config/runtime/orchestrator.solo.ncl
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ nickel export --format toml provisioning/config/runtime/orchestrator.solo.ncl
|
|||||||
|
|
||||||
### Issue: Service Can't Read Configuration
|
### Issue: Service Can't Read Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Verify TOML file exists
|
# Verify TOML file exists
|
||||||
ls -la provisioning/config/runtime/generated/orchestrator.solo.toml
|
ls -la provisioning/config/runtime/generated/orchestrator.solo.toml
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ cargo run -p orchestrator --verbose
|
|||||||
|
|
||||||
### Issue: Services Won't Start After Config Change
|
### Issue: Services Won't Start After Config Change
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# If you edited .ncl file manually, TOML must be regenerated
|
# If you edited .ncl file manually, TOML must be regenerated
|
||||||
./provisioning/scripts/setup-platform-config.sh --generate-toml
|
./provisioning/scripts/setup-platform-config.sh --generate-toml
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ Files in `provisioning/schemas/platform/` are **version-controlled** because:
|
|||||||
|
|
||||||
The setup script is safe to run multiple times:
|
The setup script is safe to run multiple times:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Safe: Updates only what's needed
|
# Safe: Updates only what's needed
|
||||||
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode enterprise
|
./provisioning/scripts/setup-platform-config.sh --quick-mode --mode enterprise
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Before starting this guide, ensure you have:
|
|||||||
Provisioning uses **declarative configuration** to manage infrastructure. Instead of manually creating resources, you define what you want in
|
Provisioning uses **declarative configuration** to manage infrastructure. Instead of manually creating resources, you define what you want in
|
||||||
configuration files, and the system makes it happen.
|
configuration files, and the system makes it happen.
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
You describe → System creates → Infrastructure exists
|
You describe → System creates → Infrastructure exists
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ You describe → System creates → Infrastructure exists
|
|||||||
|
|
||||||
Create your personal configuration:
|
Create your personal configuration:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Initialize user configuration
|
# Initialize user configuration
|
||||||
provisioning init config
|
provisioning init config
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ provisioning init config
|
|||||||
|
|
||||||
### Step 2: Verify Your Environment
|
### Step 2: Verify Your Environment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check your environment setup
|
# Check your environment setup
|
||||||
provisioning env
|
provisioning env
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ provisioning allenv
|
|||||||
|
|
||||||
You should see output like:
|
You should see output like:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
✅ Configuration loaded successfully
|
✅ Configuration loaded successfully
|
||||||
✅ All required tools available
|
✅ All required tools available
|
||||||
📁 Base path: /usr/local/provisioning
|
📁 Base path: /usr/local/provisioning
|
||||||
@ -79,7 +79,7 @@ You should see output like:
|
|||||||
|
|
||||||
### Step 3: Explore Available Resources
|
### Step 3: Explore Available Resources
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List available providers
|
# List available providers
|
||||||
provisioning list providers
|
provisioning list providers
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ Let's create a simple local infrastructure to learn the basics.
|
|||||||
|
|
||||||
### Step 1: Create a Workspace
|
### Step 1: Create a Workspace
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create a new workspace directory
|
# Create a new workspace directory
|
||||||
mkdir ~/my-first-infrastructure
|
mkdir ~/my-first-infrastructure
|
||||||
cd ~/my-first-infrastructure
|
cd ~/my-first-infrastructure
|
||||||
@ -107,7 +107,7 @@ provisioning generate infra --new local-demo
|
|||||||
|
|
||||||
This creates:
|
This creates:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
local-demo/
|
local-demo/
|
||||||
├── config/
|
├── config/
|
||||||
│ └── config.ncl # Master Nickel configuration
|
│ └── config.ncl # Master Nickel configuration
|
||||||
@ -120,14 +120,14 @@ local-demo/
|
|||||||
|
|
||||||
### Step 2: Examine the Configuration
|
### Step 2: Examine the Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# View the generated configuration
|
# View the generated configuration
|
||||||
provisioning show settings --infra local-demo
|
provisioning show settings --infra local-demo
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3: Validate the Configuration
|
### Step 3: Validate the Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate syntax and structure
|
# Validate syntax and structure
|
||||||
provisioning validate config --infra local-demo
|
provisioning validate config --infra local-demo
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ provisioning validate config --infra local-demo
|
|||||||
|
|
||||||
### Step 4: Deploy Infrastructure (Check Mode)
|
### Step 4: Deploy Infrastructure (Check Mode)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dry run - see what would be created
|
# Dry run - see what would be created
|
||||||
provisioning server create --infra local-demo --check
|
provisioning server create --infra local-demo --check
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ provisioning server create --infra local-demo --check
|
|||||||
|
|
||||||
### Step 5: Create Your Infrastructure
|
### Step 5: Create Your Infrastructure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create the actual infrastructure
|
# Create the actual infrastructure
|
||||||
provisioning server create --infra local-demo
|
provisioning server create --infra local-demo
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ provisioning server list --infra local-demo
|
|||||||
|
|
||||||
Let's install a containerized service:
|
Let's install a containerized service:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Docker/containerd
|
# Install Docker/containerd
|
||||||
provisioning taskserv create containerd --infra local-demo
|
provisioning taskserv create containerd --infra local-demo
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ provisioning taskserv list --infra local-demo
|
|||||||
|
|
||||||
For container orchestration:
|
For container orchestration:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install Kubernetes
|
# Install Kubernetes
|
||||||
provisioning taskserv create kubernetes --infra local-demo
|
provisioning taskserv create kubernetes --infra local-demo
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ provisioning taskserv create kubernetes --infra local-demo
|
|||||||
|
|
||||||
### Checking Service Status
|
### Checking Service Status
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show all services on your infrastructure
|
# Show all services on your infrastructure
|
||||||
provisioning show servers --infra local-demo
|
provisioning show servers --infra local-demo
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ provisioning show servers web-01 taskserv kubernetes --infra local-demo
|
|||||||
|
|
||||||
All commands follow this pattern:
|
All commands follow this pattern:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning [global-options] <command> [command-options] [arguments]
|
provisioning [global-options] <command> [command-options] [arguments]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ The system supports multiple environments:
|
|||||||
|
|
||||||
### Switching Environments
|
### Switching Environments
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set environment for this session
|
# Set environment for this session
|
||||||
export PROVISIONING_ENV=dev
|
export PROVISIONING_ENV=dev
|
||||||
provisioning env
|
provisioning env
|
||||||
@ -242,7 +242,7 @@ provisioning --environment dev server create
|
|||||||
|
|
||||||
Create environment configs:
|
Create environment configs:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Development environment
|
# Development environment
|
||||||
provisioning init config dev
|
provisioning init config dev
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ provisioning init config prod
|
|||||||
|
|
||||||
### Workflow 1: Development Environment
|
### Workflow 1: Development Environment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Create development workspace
|
# 1. Create development workspace
|
||||||
mkdir ~/dev-environment
|
mkdir ~/dev-environment
|
||||||
cd ~/dev-environment
|
cd ~/dev-environment
|
||||||
@ -276,7 +276,7 @@ provisioning taskserv create containerd --infra dev-setup
|
|||||||
|
|
||||||
### Workflow 2: Service Updates
|
### Workflow 2: Service Updates
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check for service updates
|
# Check for service updates
|
||||||
provisioning taskserv check-updates
|
provisioning taskserv check-updates
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ provisioning taskserv versions kubernetes
|
|||||||
|
|
||||||
### Workflow 3: Infrastructure Scaling
|
### Workflow 3: Infrastructure Scaling
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Add servers to existing infrastructure
|
# Add servers to existing infrastructure
|
||||||
# Edit settings.ncl to add more servers
|
# Edit settings.ncl to add more servers
|
||||||
|
|
||||||
@ -304,14 +304,14 @@ provisioning taskserv create containerd --infra dev-setup
|
|||||||
|
|
||||||
### Starting Interactive Shell
|
### Starting Interactive Shell
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start Nushell with provisioning loaded
|
# Start Nushell with provisioning loaded
|
||||||
provisioning nu
|
provisioning nu
|
||||||
```
|
```
|
||||||
|
|
||||||
In the interactive shell, you have access to all provisioning functions:
|
In the interactive shell, you have access to all provisioning functions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Inside Nushell session
|
# Inside Nushell session
|
||||||
use lib_provisioning *
|
use lib_provisioning *
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ help commands | where name =~ "provision"
|
|||||||
|
|
||||||
### Useful Interactive Commands
|
### Useful Interactive Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show detailed server information
|
# Show detailed server information
|
||||||
find_servers "web-*" | table
|
find_servers "web-*" | table
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ taskservs_list | where status == "running"
|
|||||||
|
|
||||||
### Configuration Hierarchy
|
### Configuration Hierarchy
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
Infrastructure settings.ncl
|
Infrastructure settings.ncl
|
||||||
↓ (overrides)
|
↓ (overrides)
|
||||||
Environment config.{env}.toml
|
Environment config.{env}.toml
|
||||||
@ -358,7 +358,7 @@ System config.defaults.toml
|
|||||||
|
|
||||||
### Customizing Your Configuration
|
### Customizing Your Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Edit user configuration
|
# Edit user configuration
|
||||||
provisioning sops ~/.provisioning/config.user.toml
|
provisioning sops ~/.provisioning/config.user.toml
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ nano ~/.provisioning/config.user.toml
|
|||||||
|
|
||||||
Example customizations:
|
Example customizations:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[debug]
|
[debug]
|
||||||
enabled = true # Enable debug mode by default
|
enabled = true # Enable debug mode by default
|
||||||
log_level = "debug" # Verbose logging
|
log_level = "debug" # Verbose logging
|
||||||
@ -384,7 +384,7 @@ format = "json" # Prefer JSON output
|
|||||||
|
|
||||||
### Checking System Status
|
### Checking System Status
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Overall system health
|
# Overall system health
|
||||||
provisioning env
|
provisioning env
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ provisioning taskserv list --infra dev-setup
|
|||||||
|
|
||||||
### Logging and Debugging
|
### Logging and Debugging
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enable debug mode for troubleshooting
|
# Enable debug mode for troubleshooting
|
||||||
provisioning --debug server create --infra dev-setup --check
|
provisioning --debug server create --infra dev-setup --check
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ provisioning show logs --infra dev-setup
|
|||||||
|
|
||||||
### Cost Monitoring
|
### Cost Monitoring
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show cost estimates
|
# Show cost estimates
|
||||||
provisioning show cost --infra dev-setup
|
provisioning show cost --infra dev-setup
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ provisioning server price --infra dev-setup
|
|||||||
|
|
||||||
### 4. Development Workflow
|
### 4. Development Workflow
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Always validate before applying
|
# 1. Always validate before applying
|
||||||
provisioning validate config --infra my-infra
|
provisioning validate config --infra my-infra
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ provisioning show servers --infra my-infra
|
|||||||
|
|
||||||
### Built-in Help System
|
### Built-in Help System
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# General help
|
# General help
|
||||||
provisioning help
|
provisioning help
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ Let's walk through a complete example of setting up a web application infrastruc
|
|||||||
|
|
||||||
### Step 1: Plan Your Infrastructure
|
### Step 1: Plan Your Infrastructure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create project workspace
|
# Create project workspace
|
||||||
mkdir ~/webapp-infrastructure
|
mkdir ~/webapp-infrastructure
|
||||||
cd ~/webapp-infrastructure
|
cd ~/webapp-infrastructure
|
||||||
@ -504,7 +504,7 @@ Edit `webapp/settings.ncl` to define:
|
|||||||
|
|
||||||
### Step 3: Deploy Base Infrastructure
|
### Step 3: Deploy Base Infrastructure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
provisioning validate config --infra webapp
|
provisioning validate config --infra webapp
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ provisioning server create --infra webapp
|
|||||||
|
|
||||||
### Step 4: Install Services
|
### Step 4: Install Services
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install container runtime on all servers
|
# Install container runtime on all servers
|
||||||
provisioning taskserv create containerd --infra webapp
|
provisioning taskserv create containerd --infra webapp
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ provisioning taskserv create postgresql --infra webapp
|
|||||||
|
|
||||||
### Step 5: Deploy Application
|
### Step 5: Deploy Application
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create application cluster
|
# Create application cluster
|
||||||
provisioning cluster create webapp --infra webapp
|
provisioning cluster create webapp --infra webapp
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ Before installation, ensure you have:
|
|||||||
|
|
||||||
### Pre-installation Checklist
|
### Pre-installation Checklist
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check your system
|
# Check your system
|
||||||
uname -a # View system information
|
uname -a # View system information
|
||||||
df -h # Check available disk space
|
df -h # Check available disk space
|
||||||
@ -57,7 +57,7 @@ This is the easiest method for most users.
|
|||||||
|
|
||||||
#### Step 1: Download the Package
|
#### Step 1: Download the Package
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Download the latest release package
|
# Download the latest release package
|
||||||
wget https://releases.example.com/provisioning-latest.tar.gz
|
wget https://releases.example.com/provisioning-latest.tar.gz
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ curl -LO https://releases.example.com/provisioning-latest.tar.gz
|
|||||||
|
|
||||||
#### Step 2: Extract and Install
|
#### Step 2: Extract and Install
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Extract the package
|
# Extract the package
|
||||||
tar xzf provisioning-latest.tar.gz
|
tar xzf provisioning-latest.tar.gz
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ For containerized environments or testing.
|
|||||||
|
|
||||||
#### Using Docker
|
#### Using Docker
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Pull the provisioning container
|
# Pull the provisioning container
|
||||||
docker pull provisioning:latest
|
docker pull provisioning:latest
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ sudo ln -sf /usr/local/provisioning/bin/provisioning /usr/local/bin/provisioning
|
|||||||
|
|
||||||
#### Using Podman
|
#### Using Podman
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Similar to Docker but with Podman
|
# Similar to Docker but with Podman
|
||||||
podman pull provisioning:latest
|
podman pull provisioning:latest
|
||||||
podman run -it --name provisioning-setup
|
podman run -it --name provisioning-setup
|
||||||
@ -127,7 +127,7 @@ For developers or custom installations.
|
|||||||
|
|
||||||
#### Installation Steps
|
#### Installation Steps
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone https://github.com/your-org/provisioning.git
|
git clone https://github.com/your-org/provisioning.git
|
||||||
cd provisioning
|
cd provisioning
|
||||||
@ -143,7 +143,7 @@ cd provisioning
|
|||||||
|
|
||||||
For advanced users who want complete control.
|
For advanced users who want complete control.
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create installation directory
|
# Create installation directory
|
||||||
sudo mkdir -p /usr/local/provisioning
|
sudo mkdir -p /usr/local/provisioning
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ The installation process sets up:
|
|||||||
|
|
||||||
#### 1. Core System Files
|
#### 1. Core System Files
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
/usr/local/provisioning/
|
/usr/local/provisioning/
|
||||||
├── core/ # Core provisioning logic
|
├── core/ # Core provisioning logic
|
||||||
├── providers/ # Cloud provider integrations
|
├── providers/ # Cloud provider integrations
|
||||||
@ -200,7 +200,7 @@ The installation process sets up:
|
|||||||
|
|
||||||
### Basic Verification
|
### Basic Verification
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check if provisioning command is available
|
# Check if provisioning command is available
|
||||||
provisioning --version
|
provisioning --version
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ provisioning allenv
|
|||||||
|
|
||||||
Expected output should show:
|
Expected output should show:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
✅ Provisioning v1.0.0 installed
|
✅ Provisioning v1.0.0 installed
|
||||||
✅ All dependencies available
|
✅ All dependencies available
|
||||||
✅ Configuration loaded successfully
|
✅ Configuration loaded successfully
|
||||||
@ -221,7 +221,7 @@ Expected output should show:
|
|||||||
|
|
||||||
### Tool Verification
|
### Tool Verification
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check individual tools
|
# Check individual tools
|
||||||
nu --version # Should show Nushell 0.109.0+
|
nu --version # Should show Nushell 0.109.0+
|
||||||
nickel version # Should show Nickel 1.5+
|
nickel version # Should show Nickel 1.5+
|
||||||
@ -232,7 +232,7 @@ k9s version # Should show K9s 0.50.6
|
|||||||
|
|
||||||
### Plugin Verification
|
### Plugin Verification
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start Nushell and check plugins
|
# Start Nushell and check plugins
|
||||||
nu -c "version | get installed_plugins"
|
nu -c "version | get installed_plugins"
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ nu -c "version | get installed_plugins"
|
|||||||
|
|
||||||
### Configuration Verification
|
### Configuration Verification
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
provisioning validate config
|
provisioning validate config
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ provisioning validate config
|
|||||||
|
|
||||||
Add to your shell profile (`~/.bashrc`, `~/.zshrc`, or `~/.profile`):
|
Add to your shell profile (`~/.bashrc`, `~/.zshrc`, or `~/.profile`):
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Add provisioning to PATH
|
# Add provisioning to PATH
|
||||||
export PATH="/usr/local/bin:$PATH"
|
export PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ export PROVISIONING="/usr/local/provisioning"
|
|||||||
|
|
||||||
### Configuration Initialization
|
### Configuration Initialization
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Initialize user configuration
|
# Initialize user configuration
|
||||||
provisioning init config
|
provisioning init config
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ provisioning init config
|
|||||||
|
|
||||||
### First-Time Setup
|
### First-Time Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Set up your first workspace
|
# Set up your first workspace
|
||||||
mkdir -p ~/provisioning-workspace
|
mkdir -p ~/provisioning-workspace
|
||||||
cd ~/provisioning-workspace
|
cd ~/provisioning-workspace
|
||||||
@ -291,7 +291,7 @@ provisioning env
|
|||||||
|
|
||||||
### Linux (Ubuntu/Debian)
|
### Linux (Ubuntu/Debian)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y curl wget tar
|
sudo apt install -y curl wget tar
|
||||||
@ -305,7 +305,7 @@ sudo ./install-provisioning
|
|||||||
|
|
||||||
### Linux (RHEL/CentOS/Fedora)
|
### Linux (RHEL/CentOS/Fedora)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
sudo dnf install -y curl wget tar
|
sudo dnf install -y curl wget tar
|
||||||
# or for older versions: sudo yum install -y curl wget tar
|
# or for older versions: sudo yum install -y curl wget tar
|
||||||
@ -315,7 +315,7 @@ sudo dnf install -y curl wget tar
|
|||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Using Homebrew (if available)
|
# Using Homebrew (if available)
|
||||||
brew install curl wget
|
brew install curl wget
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ sudo ./install-provisioning
|
|||||||
|
|
||||||
### Windows (WSL2)
|
### Windows (WSL2)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# In WSL2 terminal
|
# In WSL2 terminal
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y curl wget tar
|
sudo apt install -y curl wget tar
|
||||||
@ -344,7 +344,7 @@ wget https://releases.example.com/provisioning-latest.tar.gz
|
|||||||
|
|
||||||
Create `~/.provisioning/config.user.toml`:
|
Create `~/.provisioning/config.user.toml`:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[core]
|
[core]
|
||||||
name = "my-provisioning"
|
name = "my-provisioning"
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ format = "yaml"
|
|||||||
|
|
||||||
For developers, use enhanced debugging:
|
For developers, use enhanced debugging:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[debug]
|
[debug]
|
||||||
enabled = true
|
enabled = true
|
||||||
log_level = "debug"
|
log_level = "debug"
|
||||||
@ -381,7 +381,7 @@ enabled = false # Disable caching during development
|
|||||||
|
|
||||||
### Upgrading from Previous Version
|
### Upgrading from Previous Version
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup current installation
|
# Backup current installation
|
||||||
sudo cp -r /usr/local/provisioning /usr/local/provisioning.backup
|
sudo cp -r /usr/local/provisioning /usr/local/provisioning.backup
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ provisioning --version
|
|||||||
|
|
||||||
### Migrating Configuration
|
### Migrating Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Backup your configuration
|
# Backup your configuration
|
||||||
cp -r ~/.provisioning ~/.provisioning.backup
|
cp -r ~/.provisioning ~/.provisioning.backup
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ provisioning init config
|
|||||||
|
|
||||||
#### Permission Denied Errors
|
#### Permission Denied Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: Cannot write to /usr/local
|
# Problem: Cannot write to /usr/local
|
||||||
# Solution: Use sudo
|
# Solution: Use sudo
|
||||||
sudo ./install-provisioning
|
sudo ./install-provisioning
|
||||||
@ -427,7 +427,7 @@ export PATH="$HOME/provisioning/bin:$PATH"
|
|||||||
|
|
||||||
#### Missing Dependencies
|
#### Missing Dependencies
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: curl/wget not found
|
# Problem: curl/wget not found
|
||||||
# Ubuntu/Debian solution:
|
# Ubuntu/Debian solution:
|
||||||
sudo apt install -y curl wget tar
|
sudo apt install -y curl wget tar
|
||||||
@ -438,7 +438,7 @@ sudo dnf install -y curl wget tar
|
|||||||
|
|
||||||
#### Download Failures
|
#### Download Failures
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: Cannot download package
|
# Problem: Cannot download package
|
||||||
# Solution: Check internet connection and try alternative
|
# Solution: Check internet connection and try alternative
|
||||||
ping google.com
|
ping google.com
|
||||||
@ -452,7 +452,7 @@ wget --tries=3 https://releases.example.com/provisioning-latest.tar.gz
|
|||||||
|
|
||||||
#### Extraction Failures
|
#### Extraction Failures
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: Archive corrupted
|
# Problem: Archive corrupted
|
||||||
# Solution: Verify and re-download
|
# Solution: Verify and re-download
|
||||||
sha256sum provisioning-latest.tar.gz # Check against published hash
|
sha256sum provisioning-latest.tar.gz # Check against published hash
|
||||||
@ -464,7 +464,7 @@ wget https://releases.example.com/provisioning-latest.tar.gz
|
|||||||
|
|
||||||
#### Tool Installation Failures
|
#### Tool Installation Failures
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: Nushell installation fails
|
# Problem: Nushell installation fails
|
||||||
# Solution: Check architecture and OS compatibility
|
# Solution: Check architecture and OS compatibility
|
||||||
uname -m # Should show x86_64 or arm64
|
uname -m # Should show x86_64 or arm64
|
||||||
@ -478,7 +478,7 @@ uname -s # Should show Linux, Darwin, etc.
|
|||||||
|
|
||||||
#### Command Not Found
|
#### Command Not Found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: 'provisioning' command not found
|
# Problem: 'provisioning' command not found
|
||||||
# Check installation path
|
# Check installation path
|
||||||
ls -la /usr/local/bin/provisioning
|
ls -la /usr/local/bin/provisioning
|
||||||
@ -493,7 +493,7 @@ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
|
|||||||
|
|
||||||
#### Plugin Errors
|
#### Plugin Errors
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Problem: Plugin command not found
|
# Problem: Plugin command not found
|
||||||
# Solution: Ensure plugin is properly registered
|
# Solution: Ensure plugin is properly registered
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ exec nu
|
|||||||
|
|
||||||
#### Configuration Errors
|
#### Configuration Errors
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Problem: Configuration validation fails
|
# Problem: Configuration validation fails
|
||||||
# Solution: Initialize with template
|
# Solution: Initialize with template
|
||||||
provisioning init config
|
provisioning init config
|
||||||
|
|||||||
@ -16,7 +16,7 @@ Before running the bootstrap script, verify that your system has all required de
|
|||||||
|
|
||||||
Run these commands to verify your system meets minimum requirements:
|
Run these commands to verify your system meets minimum requirements:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check OS
|
# Check OS
|
||||||
uname -s
|
uname -s
|
||||||
# Expected: Darwin (macOS), Linux, or WSL2
|
# Expected: Darwin (macOS), Linux, or WSL2
|
||||||
@ -48,7 +48,7 @@ df -h | grep -E '^/dev|^Filesystem'
|
|||||||
|
|
||||||
Nushell is required for bootstrap and CLI operations:
|
Nushell is required for bootstrap and CLI operations:
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
command -v nu
|
command -v nu
|
||||||
# Expected output: /path/to/nu
|
# Expected output: /path/to/nu
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ nu --version
|
|||||||
|
|
||||||
**If Nushell is not installed:**
|
**If Nushell is not installed:**
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
# macOS (using Homebrew)
|
# macOS (using Homebrew)
|
||||||
brew install nushell
|
brew install nushell
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ sudo yum install nushell
|
|||||||
|
|
||||||
Nickel is required for configuration validation:
|
Nickel is required for configuration validation:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
command -v nickel
|
command -v nickel
|
||||||
# Expected output: /path/to/nickel
|
# Expected output: /path/to/nickel
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ nickel --version
|
|||||||
|
|
||||||
**If Nickel is not installed:**
|
**If Nickel is not installed:**
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Install via Cargo (requires Rust)
|
# Install via Cargo (requires Rust)
|
||||||
cargo install nickel-lang-cli
|
cargo install nickel-lang-cli
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ cargo install nickel-lang-cli
|
|||||||
|
|
||||||
Docker is required for running containerized services:
|
Docker is required for running containerized services:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
command -v docker
|
command -v docker
|
||||||
# Expected output: /path/to/docker
|
# Expected output: /path/to/docker
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ Visit [Docker installation guide](https://docs.docker.com/get-docker/) and insta
|
|||||||
|
|
||||||
Verify the provisioning CLI binary exists:
|
Verify the provisioning CLI binary exists:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
ls -la /Users/Akasha/project-provisioning/provisioning/core/cli/provisioning
|
ls -la /Users/Akasha/project-provisioning/provisioning/core/cli/provisioning
|
||||||
# Expected: -rwxr-xr-x (executable)
|
# Expected: -rwxr-xr-x (executable)
|
||||||
|
|
||||||
@ -122,13 +122,13 @@ file /Users/Akasha/project-provisioning/provisioning/core/cli/provisioning
|
|||||||
|
|
||||||
**If binary is not executable:**
|
**If binary is not executable:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
chmod +x /Users/Akasha/project-provisioning/provisioning/core/cli/provisioning
|
chmod +x /Users/Akasha/project-provisioning/provisioning/core/cli/provisioning
|
||||||
```
|
```
|
||||||
|
|
||||||
### Prerequisites Checklist
|
### Prerequisites Checklist
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[ ] OS is macOS, Linux, or WSL2
|
[ ] OS is macOS, Linux, or WSL2
|
||||||
[ ] CPU: 2+ cores available
|
[ ] CPU: 2+ cores available
|
||||||
[ ] RAM: 2 GB minimum installed
|
[ ] RAM: 2 GB minimum installed
|
||||||
@ -147,13 +147,13 @@ The bootstrap script automates 7 stages of installation and initialization. Run
|
|||||||
|
|
||||||
### Step 2.1: Navigate to Project Root
|
### Step 2.1: Navigate to Project Root
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd /Users/Akasha/project-provisioning
|
cd /Users/Akasha/project-provisioning
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2.2: Run Bootstrap Script
|
### Step 2.2: Run Bootstrap Script
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
./provisioning/bootstrap/install.sh
|
./provisioning/bootstrap/install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ cd /Users/Akasha/project-provisioning
|
|||||||
|
|
||||||
You should see output similar to this:
|
You should see output similar to this:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
╔════════════════════════════════════════════════════════════════╗
|
╔════════════════════════════════════════════════════════════════╗
|
||||||
║ PROVISIONING BOOTSTRAP (Bash) ║
|
║ PROVISIONING BOOTSTRAP (Bash) ║
|
||||||
╚════════════════════════════════════════════════════════════════╝
|
╚════════════════════════════════════════════════════════════════╝
|
||||||
@ -241,7 +241,7 @@ After bootstrap completes, verify that all components are working correctly.
|
|||||||
|
|
||||||
Bootstrap should have created workspace directories. Verify they exist:
|
Bootstrap should have created workspace directories. Verify they exist:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd /Users/Akasha/project-provisioning
|
cd /Users/Akasha/project-provisioning
|
||||||
|
|
||||||
# Check all required directories
|
# Check all required directories
|
||||||
@ -253,7 +253,7 @@ ls -la workspaces/workspace_librecloud/.clusters/
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output**:
|
**Expected Output**:
|
||||||
```text
|
```bash
|
||||||
total 0
|
total 0
|
||||||
drwxr-xr-x 2 user group 64 Jan 7 10:30 .
|
drwxr-xr-x 2 user group 64 Jan 7 10:30 .
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ drwxr-xr-x 2 user group 64 Jan 7 10:30 .
|
|||||||
|
|
||||||
Bootstrap should have exported Nickel configuration to TOML format:
|
Bootstrap should have exported Nickel configuration to TOML format:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Check generated files exist
|
# Check generated files exist
|
||||||
ls -la workspaces/workspace_librecloud/config/generated/
|
ls -la workspaces/workspace_librecloud/config/generated/
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ cat workspaces/workspace_librecloud/config/generated/platform/orchestrator.toml
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output**:
|
**Expected Output**:
|
||||||
```text
|
```bash
|
||||||
config/
|
config/
|
||||||
├── generated/
|
├── generated/
|
||||||
│ ├── workspace.toml
|
│ ├── workspace.toml
|
||||||
@ -293,7 +293,7 @@ config/
|
|||||||
|
|
||||||
Verify Nickel configuration files have valid syntax:
|
Verify Nickel configuration files have valid syntax:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
cd /Users/Akasha/project-provisioning/workspaces/workspace_librecloud
|
cd /Users/Akasha/project-provisioning/workspaces/workspace_librecloud
|
||||||
|
|
||||||
# Type-check main workspace config
|
# Type-check main workspace config
|
||||||
@ -313,7 +313,7 @@ nu workspace.nu typecheck
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output**:
|
**Expected Output**:
|
||||||
```text
|
```bash
|
||||||
✓ All files validated successfully
|
✓ All files validated successfully
|
||||||
✓ infra/wuji/main.ncl
|
✓ infra/wuji/main.ncl
|
||||||
✓ infra/sgoyol/main.ncl
|
✓ infra/sgoyol/main.ncl
|
||||||
@ -323,7 +323,7 @@ nu workspace.nu typecheck
|
|||||||
|
|
||||||
The orchestrator service manages workflows and deployments:
|
The orchestrator service manages workflows and deployments:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check if orchestrator is running (health check)
|
# Check if orchestrator is running (health check)
|
||||||
curl http://localhost:9090/health
|
curl http://localhost:9090/health
|
||||||
# Expected: {"status": "healthy"} or similar response
|
# Expected: {"status": "healthy"} or similar response
|
||||||
@ -337,7 +337,7 @@ ps aux | grep orchestrator
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output**:
|
**Expected Output**:
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
"status": "healthy",
|
"status": "healthy",
|
||||||
"uptime": "0:05:23"
|
"uptime": "0:05:23"
|
||||||
@ -348,7 +348,7 @@ ps aux | grep orchestrator
|
|||||||
|
|
||||||
Check logs and restart manually:
|
Check logs and restart manually:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd /Users/Akasha/project-provisioning/provisioning/platform/orchestrator
|
cd /Users/Akasha/project-provisioning/provisioning/platform/orchestrator
|
||||||
|
|
||||||
# Check log file
|
# Check log file
|
||||||
@ -365,7 +365,7 @@ curl http://localhost:9090/health
|
|||||||
|
|
||||||
You can install the provisioning CLI globally for easier access:
|
You can install the provisioning CLI globally for easier access:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option A: System-wide installation (requires sudo)
|
# Option A: System-wide installation (requires sudo)
|
||||||
cd /Users/Akasha/project-provisioning
|
cd /Users/Akasha/project-provisioning
|
||||||
sudo ./scripts/install-provisioning.sh
|
sudo ./scripts/install-provisioning.sh
|
||||||
@ -382,7 +382,7 @@ provisioning --version
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output**:
|
**Expected Output**:
|
||||||
```text
|
```bash
|
||||||
provisioning version 1.0.0
|
provisioning version 1.0.0
|
||||||
|
|
||||||
Usage: provisioning [OPTIONS] COMMAND
|
Usage: provisioning [OPTIONS] COMMAND
|
||||||
@ -396,7 +396,7 @@ Commands:
|
|||||||
|
|
||||||
### Installation Validation Checklist
|
### Installation Validation Checklist
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
[ ] Workspace directories created (.orchestrator, .kms, .providers, .taskservs, .clusters)
|
[ ] Workspace directories created (.orchestrator, .kms, .providers, .taskservs, .clusters)
|
||||||
[ ] Generated TOML files exist in config/generated/
|
[ ] Generated TOML files exist in config/generated/
|
||||||
[ ] Nickel type-checking passes (no errors)
|
[ ] Nickel type-checking passes (no errors)
|
||||||
@ -415,7 +415,7 @@ This section covers common issues and solutions.
|
|||||||
### Issue: "Nushell not found"
|
### Issue: "Nushell not found"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```nushell
|
||||||
./provisioning/bootstrap/install.sh: line X: nu: command not found
|
./provisioning/bootstrap/install.sh: line X: nu: command not found
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ This section covers common issues and solutions.
|
|||||||
### Issue: "Nickel configuration validation failed"
|
### Issue: "Nickel configuration validation failed"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```nickel
|
||||||
⚙️ Stage 4: Validating Configuration
|
⚙️ Stage 4: Validating Configuration
|
||||||
Error: Nickel configuration validation failed
|
Error: Nickel configuration validation failed
|
||||||
```
|
```
|
||||||
@ -441,7 +441,7 @@ Error: Nickel configuration validation failed
|
|||||||
### Issue: "Docker not installed"
|
### Issue: "Docker not installed"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```bash
|
||||||
❌ Docker is required but not installed
|
❌ Docker is required but not installed
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ Error: Nickel configuration validation failed
|
|||||||
### Issue: "Configuration export failed"
|
### Issue: "Configuration export failed"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```toml
|
||||||
⚠️ Configuration export encountered issues (may continue)
|
⚠️ Configuration export encountered issues (may continue)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ Error: Nickel configuration validation failed
|
|||||||
### Issue: "Orchestrator didn't start"
|
### Issue: "Orchestrator didn't start"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```bash
|
||||||
🚀 Stage 6: Initializing Orchestrator Service
|
🚀 Stage 6: Initializing Orchestrator Service
|
||||||
⚠️ Orchestrator may not have started (check logs)
|
⚠️ Orchestrator may not have started (check logs)
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ curl http://localhost:9090/health
|
|||||||
### Issue: "Sudo password prompt during bootstrap"
|
### Issue: "Sudo password prompt during bootstrap"
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```bash
|
||||||
Stage 3: Creating Directory Structure
|
Stage 3: Creating Directory Structure
|
||||||
[sudo] password for user:
|
[sudo] password for user:
|
||||||
```
|
```
|
||||||
@ -505,12 +505,12 @@ Stage 3: Creating Directory Structure
|
|||||||
### Issue: "Permission denied" on binary
|
### Issue: "Permission denied" on binary
|
||||||
|
|
||||||
**Symptoms**:
|
**Symptoms**:
|
||||||
```text
|
```bash
|
||||||
bash: ./provisioning/bootstrap/install.sh: Permission denied
|
bash: ./provisioning/bootstrap/install.sh: Permission denied
|
||||||
```
|
```
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```bash
|
||||||
# Make script executable
|
# Make script executable
|
||||||
chmod +x /Users/Akasha/project-provisioning/provisioning/bootstrap/install.sh
|
chmod +x /Users/Akasha/project-provisioning/provisioning/bootstrap/install.sh
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ After successful installation validation, you can:
|
|||||||
|
|
||||||
To deploy infrastructure to UpCloud:
|
To deploy infrastructure to UpCloud:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Read workspace deployment guide
|
# Read workspace deployment guide
|
||||||
cat workspaces/workspace_librecloud/docs/deployment-guide.md
|
cat workspaces/workspace_librecloud/docs/deployment-guide.md
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ cat docs/deployment-guide.md
|
|||||||
|
|
||||||
To create a new workspace for different infrastructure:
|
To create a new workspace for different infrastructure:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning workspace init my_workspace --template minimal
|
provisioning workspace init my_workspace --template minimal
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ provisioning workspace init my_workspace --template minimal
|
|||||||
|
|
||||||
Discover what's available to deploy:
|
Discover what's available to deploy:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List available task services
|
# List available task services
|
||||||
provisioning mod discover taskservs
|
provisioning mod discover taskservs
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ provisioning mod discover clusters
|
|||||||
|
|
||||||
After completing all steps, verify with this final checklist:
|
After completing all steps, verify with this final checklist:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Prerequisites Verified:
|
Prerequisites Verified:
|
||||||
[ ] OS is macOS, Linux, or WSL2
|
[ ] OS is macOS, Linux, or WSL2
|
||||||
[ ] CPU: 2+ cores
|
[ ] CPU: 2+ cores
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Native Nushell plugins for high-performance operations. **10-50x faster than HTT
|
|||||||
|
|
||||||
### Authentication Plugin (nu_plugin_auth)
|
### Authentication Plugin (nu_plugin_auth)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Login (password prompted securely)
|
# Login (password prompted securely)
|
||||||
auth login admin
|
auth login admin
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ auth mfa verify --code ABCD-EFGH-IJKL # Backup code
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cd provisioning/core/plugins/nushell-plugins
|
cd provisioning/core/plugins/nushell-plugins
|
||||||
cargo build --release -p nu_plugin_auth
|
cargo build --release -p nu_plugin_auth
|
||||||
plugin add target/release/nu_plugin_auth
|
plugin add target/release/nu_plugin_auth
|
||||||
@ -64,7 +64,7 @@ plugin add target/release/nu_plugin_auth
|
|||||||
|
|
||||||
**Performance**: 10x faster encryption (~5 ms vs ~50 ms HTTP)
|
**Performance**: 10x faster encryption (~5 ms vs ~50 ms HTTP)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Encrypt with auto-detected backend
|
# Encrypt with auto-detected backend
|
||||||
kms encrypt "secret data"
|
kms encrypt "secret data"
|
||||||
# vault:v1:abc123...
|
# vault:v1:abc123...
|
||||||
@ -102,7 +102,7 @@ kms status
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cargo build --release -p nu_plugin_kms
|
cargo build --release -p nu_plugin_kms
|
||||||
plugin add target/release/nu_plugin_kms
|
plugin add target/release/nu_plugin_kms
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ export RUSTYVAULT_TOKEN="hvs.xxxxx"
|
|||||||
|
|
||||||
**Performance**: 30-50x faster queries (~1 ms vs ~30-50 ms HTTP)
|
**Performance**: 30-50x faster queries (~1 ms vs ~30-50 ms HTTP)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Get orchestrator status (direct file access, ~1 ms)
|
# Get orchestrator status (direct file access, ~1 ms)
|
||||||
orch status
|
orch status
|
||||||
# { active_tasks: 5, completed_tasks: 120, health: "healthy" }
|
# { active_tasks: 5, completed_tasks: 120, health: "healthy" }
|
||||||
@ -132,7 +132,7 @@ orch tasks --status failed --limit 10
|
|||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
cargo build --release -p nu_plugin_orchestrator
|
cargo build --release -p nu_plugin_orchestrator
|
||||||
plugin add target/release/nu_plugin_orchestrator
|
plugin add target/release/nu_plugin_orchestrator
|
||||||
```
|
```
|
||||||
@ -154,7 +154,7 @@ plugin add target/release/nu_plugin_orchestrator
|
|||||||
|
|
||||||
### Infrastructure Shortcuts
|
### Infrastructure Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Server shortcuts
|
# Server shortcuts
|
||||||
provisioning s # server (same as 'provisioning server')
|
provisioning s # server (same as 'provisioning server')
|
||||||
provisioning s create # Create servers
|
provisioning s create # Create servers
|
||||||
@ -186,7 +186,7 @@ provisioning i validate
|
|||||||
|
|
||||||
### Orchestration Shortcuts
|
### Orchestration Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Workflow shortcuts
|
# Workflow shortcuts
|
||||||
provisioning wf # workflow (same as 'provisioning workflow')
|
provisioning wf # workflow (same as 'provisioning workflow')
|
||||||
provisioning flow # workflow (alias)
|
provisioning flow # workflow (alias)
|
||||||
@ -217,7 +217,7 @@ provisioning orch logs
|
|||||||
|
|
||||||
### Development Shortcuts
|
### Development Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Module shortcuts
|
# Module shortcuts
|
||||||
provisioning mod # module (same as 'provisioning module')
|
provisioning mod # module (same as 'provisioning module')
|
||||||
provisioning mod discover taskserv
|
provisioning mod discover taskserv
|
||||||
@ -251,7 +251,7 @@ provisioning pack clean
|
|||||||
|
|
||||||
### Workspace Shortcuts
|
### Workspace Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Workspace shortcuts
|
# Workspace shortcuts
|
||||||
provisioning ws # workspace (same as 'provisioning workspace')
|
provisioning ws # workspace (same as 'provisioning workspace')
|
||||||
provisioning ws init
|
provisioning ws init
|
||||||
@ -275,7 +275,7 @@ provisioning tpl validate <name>
|
|||||||
|
|
||||||
### Configuration Shortcuts
|
### Configuration Shortcuts
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Environment shortcuts
|
# Environment shortcuts
|
||||||
provisioning e # env (same as 'provisioning env')
|
provisioning e # env (same as 'provisioning env')
|
||||||
provisioning val # validate (same as 'provisioning validate')
|
provisioning val # validate (same as 'provisioning validate')
|
||||||
@ -296,7 +296,7 @@ provisioning allenv # Show all config and environment
|
|||||||
|
|
||||||
### Utility Shortcuts
|
### Utility Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List shortcuts
|
# List shortcuts
|
||||||
provisioning l # list (same as 'provisioning list')
|
provisioning l # list (same as 'provisioning list')
|
||||||
provisioning ls # list (alias)
|
provisioning ls # list (alias)
|
||||||
@ -334,7 +334,7 @@ provisioning plugin test nu_plugin_kms
|
|||||||
|
|
||||||
### Generation Shortcuts
|
### Generation Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate shortcuts
|
# Generate shortcuts
|
||||||
provisioning g # generate (same as 'provisioning generate')
|
provisioning g # generate (same as 'provisioning generate')
|
||||||
provisioning gen # generate (alias)
|
provisioning gen # generate (alias)
|
||||||
@ -347,7 +347,7 @@ provisioning g new <type> <name>
|
|||||||
|
|
||||||
### Action Shortcuts
|
### Action Shortcuts
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Common actions
|
# Common actions
|
||||||
provisioning c # create (same as 'provisioning create')
|
provisioning c # create (same as 'provisioning create')
|
||||||
provisioning d # delete (same as 'provisioning delete')
|
provisioning d # delete (same as 'provisioning delete')
|
||||||
@ -369,7 +369,7 @@ provisioning csts # create-server-task (alias)
|
|||||||
|
|
||||||
### Server Management
|
### Server Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create servers
|
# Create servers
|
||||||
provisioning server create
|
provisioning server create
|
||||||
provisioning server create --check # Dry-run mode
|
provisioning server create --check # Dry-run mode
|
||||||
@ -396,7 +396,7 @@ provisioning server price --provider upcloud
|
|||||||
|
|
||||||
### Taskserv Management
|
### Taskserv Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create taskserv
|
# Create taskserv
|
||||||
provisioning taskserv create kubernetes
|
provisioning taskserv create kubernetes
|
||||||
provisioning taskserv create kubernetes --check
|
provisioning taskserv create kubernetes --check
|
||||||
@ -421,7 +421,7 @@ provisioning taskserv check-updates --taskserv kubernetes
|
|||||||
|
|
||||||
### Cluster Management
|
### Cluster Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create cluster
|
# Create cluster
|
||||||
provisioning cluster create buildkit
|
provisioning cluster create buildkit
|
||||||
provisioning cluster create buildkit --check
|
provisioning cluster create buildkit --check
|
||||||
@ -442,7 +442,7 @@ provisioning cluster list --infra wuji
|
|||||||
|
|
||||||
### Workflow Management
|
### Workflow Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Submit server creation workflow
|
# Submit server creation workflow
|
||||||
nu -c "use core/nulib/workflows/server_create.nu *; server_create_workflow 'wuji' '' [] --check"
|
nu -c "use core/nulib/workflows/server_create.nu *; server_create_workflow 'wuji' '' [] --check"
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ nu -c "use core/nulib/workflows/management.nu *; workflow status <task_id>"
|
|||||||
|
|
||||||
### Batch Operations
|
### Batch Operations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Submit batch workflow from Nickel
|
# Submit batch workflow from Nickel
|
||||||
provisioning batch submit workflows/example_batch.ncl
|
provisioning batch submit workflows/example_batch.ncl
|
||||||
nu -c "use core/nulib/workflows/batch.nu *; batch submit workflows/example_batch.ncl"
|
nu -c "use core/nulib/workflows/batch.nu *; batch submit workflows/example_batch.ncl"
|
||||||
@ -507,7 +507,7 @@ nu -c "use core/nulib/workflows/batch.nu *; batch stats"
|
|||||||
|
|
||||||
### Orchestrator Management
|
### Orchestrator Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Start orchestrator in background
|
# Start orchestrator in background
|
||||||
cd provisioning/platform/orchestrator
|
cd provisioning/platform/orchestrator
|
||||||
./scripts/start-orchestrator.nu --background
|
./scripts/start-orchestrator.nu --background
|
||||||
@ -531,7 +531,7 @@ provisioning orchestrator logs
|
|||||||
|
|
||||||
### Environment and Validation
|
### Environment and Validation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show environment variables
|
# Show environment variables
|
||||||
provisioning env
|
provisioning env
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ provisioning setup
|
|||||||
|
|
||||||
### Configuration Files
|
### Configuration Files
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# System defaults
|
# System defaults
|
||||||
less provisioning/config/config.defaults.toml
|
less provisioning/config/config.defaults.toml
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ vim workspace/infra/<name>/config.toml
|
|||||||
|
|
||||||
### HTTP Configuration
|
### HTTP Configuration
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Configure HTTP client behavior
|
# Configure HTTP client behavior
|
||||||
# In workspace/config/local-overrides.toml:
|
# In workspace/config/local-overrides.toml:
|
||||||
[http]
|
[http]
|
||||||
@ -579,7 +579,7 @@ use_curl = true # Use curl instead of ureq
|
|||||||
|
|
||||||
### Workspace Management
|
### Workspace Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all workspaces
|
# List all workspaces
|
||||||
provisioning workspace list
|
provisioning workspace list
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ provisioning workspace migrate
|
|||||||
|
|
||||||
### User Preferences
|
### User Preferences
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View user preferences
|
# View user preferences
|
||||||
provisioning workspace preferences
|
provisioning workspace preferences
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ provisioning workspace get-preference editor
|
|||||||
|
|
||||||
### Authentication (via CLI)
|
### Authentication (via CLI)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Login
|
# Login
|
||||||
provisioning login admin
|
provisioning login admin
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ provisioning auth sessions
|
|||||||
|
|
||||||
### Multi-Factor Authentication (MFA)
|
### Multi-Factor Authentication (MFA)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Enroll in TOTP (Google Authenticator, Authy)
|
# Enroll in TOTP (Google Authenticator, Authy)
|
||||||
provisioning mfa totp enroll
|
provisioning mfa totp enroll
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ provisioning mfa devices
|
|||||||
|
|
||||||
### Secrets Management
|
### Secrets Management
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate AWS STS credentials (15 min-12h TTL)
|
# Generate AWS STS credentials (15 min-12h TTL)
|
||||||
provisioning secrets generate aws --ttl 1hr
|
provisioning secrets generate aws --ttl 1hr
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ provisioning secrets cleanup
|
|||||||
|
|
||||||
### SSH Temporal Keys
|
### SSH Temporal Keys
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Connect to server with temporal key
|
# Connect to server with temporal key
|
||||||
provisioning ssh connect server01 --ttl 1hr
|
provisioning ssh connect server01 --ttl 1hr
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ provisioning ssh revoke <key_id>
|
|||||||
|
|
||||||
### KMS Operations (via CLI)
|
### KMS Operations (via CLI)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Encrypt configuration file
|
# Encrypt configuration file
|
||||||
provisioning kms encrypt secure.yaml
|
provisioning kms encrypt secure.yaml
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ provisioning config decrypt workspace/infra/production/
|
|||||||
|
|
||||||
### Break-Glass Emergency Access
|
### Break-Glass Emergency Access
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Request emergency access
|
# Request emergency access
|
||||||
provisioning break-glass request "Production database outage"
|
provisioning break-glass request "Production database outage"
|
||||||
|
|
||||||
@ -742,7 +742,7 @@ provisioning break-glass revoke <session_id>
|
|||||||
|
|
||||||
### Compliance and Audit
|
### Compliance and Audit
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Generate compliance report
|
# Generate compliance report
|
||||||
provisioning compliance report
|
provisioning compliance report
|
||||||
provisioning compliance report --standard gdpr
|
provisioning compliance report --standard gdpr
|
||||||
@ -770,7 +770,7 @@ provisioning audit export --format json --output audit-logs.json
|
|||||||
|
|
||||||
### Complete Deployment from Scratch
|
### Complete Deployment from Scratch
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Initialize workspace
|
# 1. Initialize workspace
|
||||||
provisioning workspace init --name production
|
provisioning workspace init --name production
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ provisioning server ssh k8s-master-01
|
|||||||
|
|
||||||
### Multi-Environment Deployment
|
### Multi-Environment Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Deploy to dev
|
# Deploy to dev
|
||||||
provisioning server create --infra dev --check
|
provisioning server create --infra dev --check
|
||||||
provisioning server create --infra dev
|
provisioning server create --infra dev
|
||||||
@ -823,7 +823,7 @@ provisioning taskserv create kubernetes --infra production
|
|||||||
|
|
||||||
### Update Infrastructure
|
### Update Infrastructure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Check for updates
|
# 1. Check for updates
|
||||||
provisioning taskserv check-updates
|
provisioning taskserv check-updates
|
||||||
|
|
||||||
@ -839,7 +839,7 @@ provisioning taskserv list --infra production | where name == kubernetes
|
|||||||
|
|
||||||
### Encrypted Secrets Deployment
|
### Encrypted Secrets Deployment
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Authenticate
|
# 1. Authenticate
|
||||||
auth login admin
|
auth login admin
|
||||||
auth mfa verify --code 123456
|
auth mfa verify --code 123456
|
||||||
@ -862,7 +862,7 @@ orch tasks --status completed
|
|||||||
|
|
||||||
Enable verbose logging with `--debug` or `-x` flag:
|
Enable verbose logging with `--debug` or `-x` flag:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Server creation with debug output
|
# Server creation with debug output
|
||||||
provisioning server create --debug
|
provisioning server create --debug
|
||||||
provisioning server create -x
|
provisioning server create -x
|
||||||
@ -878,7 +878,7 @@ provisioning --debug taskserv create kubernetes
|
|||||||
|
|
||||||
Preview changes without applying them with `--check` or `-c` flag:
|
Preview changes without applying them with `--check` or `-c` flag:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check what servers would be created
|
# Check what servers would be created
|
||||||
provisioning server create --check
|
provisioning server create --check
|
||||||
provisioning server create -c
|
provisioning server create -c
|
||||||
@ -897,7 +897,7 @@ provisioning server create --check --debug
|
|||||||
|
|
||||||
Skip confirmation prompts with `--yes` or `-y` flag:
|
Skip confirmation prompts with `--yes` or `-y` flag:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Auto-confirm server creation
|
# Auto-confirm server creation
|
||||||
provisioning server create --yes
|
provisioning server create --yes
|
||||||
provisioning server create -y
|
provisioning server create -y
|
||||||
@ -910,7 +910,7 @@ provisioning server delete --yes
|
|||||||
|
|
||||||
Wait for operations to complete with `--wait` or `-w` flag:
|
Wait for operations to complete with `--wait` or `-w` flag:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Wait for server creation to complete
|
# Wait for server creation to complete
|
||||||
provisioning server create --wait
|
provisioning server create --wait
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ provisioning taskserv create kubernetes --wait
|
|||||||
|
|
||||||
Specify target infrastructure with `--infra` or `-i` flag:
|
Specify target infrastructure with `--infra` or `-i` flag:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create servers in specific infrastructure
|
# Create servers in specific infrastructure
|
||||||
provisioning server create --infra production
|
provisioning server create --infra production
|
||||||
provisioning server create -i production
|
provisioning server create -i production
|
||||||
@ -937,7 +937,7 @@ provisioning server list --infra production
|
|||||||
|
|
||||||
### JSON Output
|
### JSON Output
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Output as JSON
|
# Output as JSON
|
||||||
provisioning server list --out json
|
provisioning server list --out json
|
||||||
provisioning taskserv list --out json
|
provisioning taskserv list --out json
|
||||||
@ -948,7 +948,7 @@ provisioning server list --out json | jq '.[] | select(.status == "running")'
|
|||||||
|
|
||||||
### YAML Output
|
### YAML Output
|
||||||
|
|
||||||
```text
|
```yaml
|
||||||
# Output as YAML
|
# Output as YAML
|
||||||
provisioning server list --out yaml
|
provisioning server list --out yaml
|
||||||
provisioning taskserv list --out yaml
|
provisioning taskserv list --out yaml
|
||||||
@ -959,7 +959,7 @@ provisioning server list --out yaml | yq '.[] | select(.status == "running")'
|
|||||||
|
|
||||||
### Table Output (Default)
|
### Table Output (Default)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Output as table (default)
|
# Output as table (default)
|
||||||
provisioning server list
|
provisioning server list
|
||||||
provisioning server list --out table
|
provisioning server list --out table
|
||||||
@ -970,7 +970,7 @@ provisioning server list | table
|
|||||||
|
|
||||||
### Text Output
|
### Text Output
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Output as plain text
|
# Output as plain text
|
||||||
provisioning server list --out text
|
provisioning server list --out text
|
||||||
```
|
```
|
||||||
@ -981,7 +981,7 @@ provisioning server list --out text
|
|||||||
|
|
||||||
### Use Plugins for Frequent Operations
|
### Use Plugins for Frequent Operations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# ❌ Slow: HTTP API (50 ms per call)
|
# ❌ Slow: HTTP API (50 ms per call)
|
||||||
for i in 1..100 { http post http://localhost:9998/encrypt { data: "secret" } }
|
for i in 1..100 { http post http://localhost:9998/encrypt { data: "secret" } }
|
||||||
|
|
||||||
@ -991,14 +991,14 @@ for i in 1..100 { kms encrypt "secret" }
|
|||||||
|
|
||||||
### Batch Operations
|
### Batch Operations
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Use batch workflows for multiple operations
|
# Use batch workflows for multiple operations
|
||||||
provisioning batch submit workflows/multi-cloud-deploy.ncl
|
provisioning batch submit workflows/multi-cloud-deploy.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
### Check Mode for Testing
|
### Check Mode for Testing
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Always test with --check first
|
# Always test with --check first
|
||||||
provisioning server create --check
|
provisioning server create --check
|
||||||
provisioning server create # Only after verification
|
provisioning server create # Only after verification
|
||||||
@ -1010,7 +1010,7 @@ provisioning server create # Only after verification
|
|||||||
|
|
||||||
### Command-Specific Help
|
### Command-Specific Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show help for specific command
|
# Show help for specific command
|
||||||
provisioning help server
|
provisioning help server
|
||||||
provisioning help taskserv
|
provisioning help taskserv
|
||||||
@ -1028,7 +1028,7 @@ provisioning help config
|
|||||||
|
|
||||||
### Bi-Directional Help
|
### Bi-Directional Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# All these work identically:
|
# All these work identically:
|
||||||
provisioning help workspace
|
provisioning help workspace
|
||||||
provisioning workspace help
|
provisioning workspace help
|
||||||
@ -1038,7 +1038,7 @@ provisioning help ws
|
|||||||
|
|
||||||
### General Help
|
### General Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show all commands
|
# Show all commands
|
||||||
provisioning help
|
provisioning help
|
||||||
provisioning --help
|
provisioning --help
|
||||||
@ -1065,7 +1065,7 @@ provisioning --version
|
|||||||
|
|
||||||
## Plugin Installation Quick Reference
|
## Plugin Installation Quick Reference
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Build all plugins (one-time setup)
|
# Build all plugins (one-time setup)
|
||||||
cd provisioning/core/plugins/nushell-plugins
|
cd provisioning/core/plugins/nushell-plugins
|
||||||
cargo build --release --all
|
cargo build --release --all
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Please see the complete quick start guide here:
|
|||||||
|
|
||||||
## Quick Commands
|
## Quick Commands
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check system status
|
# Check system status
|
||||||
provisioning status
|
provisioning status
|
||||||
|
|
||||||
|
|||||||
@ -70,12 +70,12 @@ This guide provides detailed information about each setup profile and when to us
|
|||||||
|
|
||||||
#### Step 1: Run Setup
|
#### Step 1: Run Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning setup profile --profile developer
|
provisioning setup profile --profile developer
|
||||||
```
|
```
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
```text
|
```bash
|
||||||
╔═══════════════════════════════════════════════════════╗
|
╔═══════════════════════════════════════════════════════╗
|
||||||
║ PROVISIONING SYSTEM SETUP - DEVELOPER PROFILE ║
|
║ PROVISIONING SYSTEM SETUP - DEVELOPER PROFILE ║
|
||||||
╚═══════════════════════════════════════════════════════╝
|
╚═══════════════════════════════════════════════════════╝
|
||||||
@ -108,7 +108,7 @@ System automatically detects:
|
|||||||
Creates three Nickel configs:
|
Creates three Nickel configs:
|
||||||
|
|
||||||
**system.ncl** - System info (read-only):
|
**system.ncl** - System info (read-only):
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
version = "1.0.0",
|
version = "1.0.0",
|
||||||
config_base_path = "/Users/user/Library/Application Support/provisioning",
|
config_base_path = "/Users/user/Library/Application Support/provisioning",
|
||||||
@ -124,7 +124,7 @@ Creates three Nickel configs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**platform/deployment.ncl** - Deployment config (can edit):
|
**platform/deployment.ncl** - Deployment config (can edit):
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
deployment = {
|
deployment = {
|
||||||
mode = 'docker_compose,
|
mode = 'docker_compose,
|
||||||
@ -149,7 +149,7 @@ Creates three Nickel configs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**user_preferences.ncl** - User settings (can edit):
|
**user_preferences.ncl** - User settings (can edit):
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
output_format = 'yaml,
|
output_format = 'yaml,
|
||||||
use_colors = true,
|
use_colors = true,
|
||||||
@ -163,7 +163,7 @@ Creates three Nickel configs:
|
|||||||
#### Step 4: Validation
|
#### Step 4: Validation
|
||||||
|
|
||||||
Each config is validated:
|
Each config is validated:
|
||||||
```text
|
```toml
|
||||||
✓ Validating system.ncl
|
✓ Validating system.ncl
|
||||||
✓ Validating platform/deployment.ncl
|
✓ Validating platform/deployment.ncl
|
||||||
✓ Validating user_preferences.ncl
|
✓ Validating user_preferences.ncl
|
||||||
@ -173,7 +173,7 @@ Each config is validated:
|
|||||||
#### Step 5: Service Startup
|
#### Step 5: Service Startup
|
||||||
|
|
||||||
Docker Compose starts:
|
Docker Compose starts:
|
||||||
```text
|
```bash
|
||||||
✓ Starting Docker Compose services...
|
✓ Starting Docker Compose services...
|
||||||
✓ Starting orchestrator... [port 9090]
|
✓ Starting orchestrator... [port 9090]
|
||||||
✓ Starting control-center... [port 3000]
|
✓ Starting control-center... [port 3000]
|
||||||
@ -183,7 +183,7 @@ Docker Compose starts:
|
|||||||
#### Step 6: Verification
|
#### Step 6: Verification
|
||||||
|
|
||||||
Health checks verify services:
|
Health checks verify services:
|
||||||
```text
|
```bash
|
||||||
✓ Orchestrator health: HEALTHY
|
✓ Orchestrator health: HEALTHY
|
||||||
✓ Control Center health: HEALTHY
|
✓ Control Center health: HEALTHY
|
||||||
✓ KMS health: HEALTHY
|
✓ KMS health: HEALTHY
|
||||||
@ -194,32 +194,32 @@ Setup complete in 3 minutes 47 seconds!
|
|||||||
### After Setup: Common Tasks
|
### After Setup: Common Tasks
|
||||||
|
|
||||||
**Verify everything works**:
|
**Verify everything works**:
|
||||||
```text
|
```bash
|
||||||
curl http://localhost:9090/health
|
curl http://localhost:9090/health
|
||||||
curl http://localhost:3000/health
|
curl http://localhost:3000/health
|
||||||
curl http://localhost:3001/health
|
curl http://localhost:3001/health
|
||||||
```
|
```
|
||||||
|
|
||||||
**View your configuration**:
|
**View your configuration**:
|
||||||
```text
|
```toml
|
||||||
cat ~/Library/Application\ Support/provisioning/system.ncl
|
cat ~/Library/Application\ Support/provisioning/system.ncl
|
||||||
cat ~/Library/Application\ Support/provisioning/platform/deployment.ncl
|
cat ~/Library/Application\ Support/provisioning/platform/deployment.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
**Create a workspace**:
|
**Create a workspace**:
|
||||||
```text
|
```bash
|
||||||
provisioning workspace create myapp
|
provisioning workspace create myapp
|
||||||
```
|
```
|
||||||
|
|
||||||
**View logs**:
|
**View logs**:
|
||||||
```text
|
```bash
|
||||||
docker-compose logs orchestrator
|
docker-compose logs orchestrator
|
||||||
docker-compose logs control-center
|
docker-compose logs control-center
|
||||||
docker-compose logs kms
|
docker-compose logs kms
|
||||||
```
|
```
|
||||||
|
|
||||||
**Stop services**:
|
**Stop services**:
|
||||||
```text
|
```bash
|
||||||
docker-compose down
|
docker-compose down
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ docker-compose down
|
|||||||
|
|
||||||
#### Step 1: Run Setup
|
#### Step 1: Run Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning setup profile --profile production --interactive
|
provisioning setup profile --profile production --interactive
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ Same as Developer profile - auto-detects OS, CPU, memory, etc.
|
|||||||
|
|
||||||
The wizard asks 10-15 questions:
|
The wizard asks 10-15 questions:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
1. Deployment Mode?
|
1. Deployment Mode?
|
||||||
a) Kubernetes (recommended for HA)
|
a) Kubernetes (recommended for HA)
|
||||||
b) SSH (manual server management)
|
b) SSH (manual server management)
|
||||||
@ -366,7 +366,7 @@ The wizard asks 10-15 questions:
|
|||||||
Creates extensive Nickel configs:
|
Creates extensive Nickel configs:
|
||||||
|
|
||||||
**platform/deployment.ncl**:
|
**platform/deployment.ncl**:
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
deployment = {
|
deployment = {
|
||||||
mode = 'kubernetes,
|
mode = 'kubernetes,
|
||||||
@ -393,7 +393,7 @@ Creates extensive Nickel configs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**providers/upcloud.ncl**:
|
**providers/upcloud.ncl**:
|
||||||
```text
|
```json
|
||||||
{
|
{
|
||||||
provider = 'upcloud,
|
provider = 'upcloud,
|
||||||
api_key_ref = "rustyvault://secrets/upcloud/api-key",
|
api_key_ref = "rustyvault://secrets/upcloud/api-key",
|
||||||
@ -405,7 +405,7 @@ Creates extensive Nickel configs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**cedar-policies/default.cedar**:
|
**cedar-policies/default.cedar**:
|
||||||
```text
|
```bash
|
||||||
permit(
|
permit(
|
||||||
principal == User::"john@company.com",
|
principal == User::"john@company.com",
|
||||||
action == Action::"Deploy",
|
action == Action::"Deploy",
|
||||||
@ -429,7 +429,7 @@ forbid(
|
|||||||
#### Step 5: Validation
|
#### Step 5: Validation
|
||||||
|
|
||||||
All configs validated:
|
All configs validated:
|
||||||
```text
|
```toml
|
||||||
✓ Validating system.ncl
|
✓ Validating system.ncl
|
||||||
✓ Validating platform/deployment.ncl
|
✓ Validating platform/deployment.ncl
|
||||||
✓ Validating providers/upcloud.ncl
|
✓ Validating providers/upcloud.ncl
|
||||||
@ -439,7 +439,7 @@ All configs validated:
|
|||||||
|
|
||||||
#### Step 6: Summary & Confirmation
|
#### Step 6: Summary & Confirmation
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Setup Summary
|
Setup Summary
|
||||||
─────────────────────────────────────────
|
─────────────────────────────────────────
|
||||||
Profile: Production
|
Profile: Production
|
||||||
@ -457,7 +457,7 @@ Do you want to proceed? (y/n): y
|
|||||||
|
|
||||||
#### Step 7: Infrastructure Creation (Optional)
|
#### Step 7: Infrastructure Creation (Optional)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Creating UpCloud infrastructure...
|
Creating UpCloud infrastructure...
|
||||||
Creating 3 master nodes... [networking configured]
|
Creating 3 master nodes... [networking configured]
|
||||||
Creating 5 worker nodes... [networking configured]
|
Creating 5 worker nodes... [networking configured]
|
||||||
@ -478,28 +478,28 @@ Deploy services:
|
|||||||
### After Setup: Common Tasks
|
### After Setup: Common Tasks
|
||||||
|
|
||||||
**View Kubernetes cluster**:
|
**View Kubernetes cluster**:
|
||||||
```text
|
```yaml
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
kubectl get pods --all-namespaces
|
kubectl get pods --all-namespaces
|
||||||
```
|
```
|
||||||
|
|
||||||
**Check Cedar authorization**:
|
**Check Cedar authorization**:
|
||||||
```text
|
```bash
|
||||||
cat ~/.config/provisioning/cedar-policies/default.cedar
|
cat ~/.config/provisioning/cedar-policies/default.cedar
|
||||||
```
|
```
|
||||||
|
|
||||||
**View infrastructure definition**:
|
**View infrastructure definition**:
|
||||||
```text
|
```bash
|
||||||
cat workspace-production-infrastructure/infrastructure.ncl
|
cat workspace-production-infrastructure/infrastructure.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
**Deploy an application**:
|
**Deploy an application**:
|
||||||
```text
|
```bash
|
||||||
provisioning app deploy myapp --workspace production-infrastructure
|
provisioning app deploy myapp --workspace production-infrastructure
|
||||||
```
|
```
|
||||||
|
|
||||||
**Monitor cluster**:
|
**Monitor cluster**:
|
||||||
```text
|
```bash
|
||||||
# Access Grafana
|
# Access Grafana
|
||||||
open http://localhost:3000
|
open http://localhost:3000
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ open http://localhost:9090
|
|||||||
|
|
||||||
#### Example: GitHub Actions
|
#### Example: GitHub Actions
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
name: Integration Tests
|
name: Integration Tests
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
@ -598,27 +598,27 @@ jobs:
|
|||||||
#### What Happens
|
#### What Happens
|
||||||
|
|
||||||
**Step 1: Minimal Detection**
|
**Step 1: Minimal Detection**
|
||||||
```text
|
```bash
|
||||||
✓ Detected: CI environment
|
✓ Detected: CI environment
|
||||||
✓ Profile: CICD
|
✓ Profile: CICD
|
||||||
```
|
```
|
||||||
|
|
||||||
**Step 2: Ephemeral Config Creation**
|
**Step 2: Ephemeral Config Creation**
|
||||||
```text
|
```toml
|
||||||
✓ Created: /tmp/provisioning-ci-abc123def456/
|
✓ Created: /tmp/provisioning-ci-abc123def456/
|
||||||
✓ Created: /tmp/provisioning-ci-abc123def456/system.ncl
|
✓ Created: /tmp/provisioning-ci-abc123def456/system.ncl
|
||||||
✓ Created: /tmp/provisioning-ci-abc123def456/platform/deployment.ncl
|
✓ Created: /tmp/provisioning-ci-abc123def456/platform/deployment.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
**Step 3: Validation**
|
**Step 3: Validation**
|
||||||
```text
|
```bash
|
||||||
✓ Validating system.ncl
|
✓ Validating system.ncl
|
||||||
✓ Validating platform/deployment.ncl
|
✓ Validating platform/deployment.ncl
|
||||||
✓ All configurations validated: PASSED
|
✓ All configurations validated: PASSED
|
||||||
```
|
```
|
||||||
|
|
||||||
**Step 4: Services Start**
|
**Step 4: Services Start**
|
||||||
```text
|
```bash
|
||||||
✓ Starting Docker Compose services
|
✓ Starting Docker Compose services
|
||||||
✓ Orchestrator running [port 9090]
|
✓ Orchestrator running [port 9090]
|
||||||
✓ Control Center running [port 3000]
|
✓ Control Center running [port 3000]
|
||||||
@ -627,7 +627,7 @@ jobs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Step 5: Tests Execute**
|
**Step 5: Tests Execute**
|
||||||
```text
|
```bash
|
||||||
$ curl http://localhost:9090/health
|
$ curl http://localhost:9090/health
|
||||||
{"status": "healthy", "uptime": "2s"}
|
{"status": "healthy", "uptime": "2s"}
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ All tests passed!
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Step 6: Automatic Cleanup**
|
**Step 6: Automatic Cleanup**
|
||||||
```text
|
```bash
|
||||||
✓ Cleanup triggered (job exit)
|
✓ Cleanup triggered (job exit)
|
||||||
✓ Stopping Docker Compose
|
✓ Stopping Docker Compose
|
||||||
✓ Removing temporary directory: /tmp/provisioning-ci-abc123def456/
|
✓ Removing temporary directory: /tmp/provisioning-ci-abc123def456/
|
||||||
@ -650,7 +650,7 @@ All tests passed!
|
|||||||
|
|
||||||
Use environment variables to customize:
|
Use environment variables to customize:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Provider (local or cloud)
|
# Provider (local or cloud)
|
||||||
export PROVISIONING_PROVIDER=local|upcloud|aws|hetzner
|
export PROVISIONING_PROVIDER=local|upcloud|aws|hetzner
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ export PROVISIONING_CONFIG=/tmp/custom-config.ncl
|
|||||||
### CI/CD Best Practices
|
### CI/CD Best Practices
|
||||||
|
|
||||||
**1. Use matrix builds for testing**:
|
**1. Use matrix builds for testing**:
|
||||||
```text
|
```bash
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
profile: [developer, production]
|
profile: [developer, production]
|
||||||
@ -678,7 +678,7 @@ strategy:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**2. Cache Nickel compilation**:
|
**2. Cache Nickel compilation**:
|
||||||
```text
|
```nickel
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/nickel
|
path: ~/.cache/nickel
|
||||||
@ -686,7 +686,7 @@ strategy:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**3. Separate test stages**:
|
**3. Separate test stages**:
|
||||||
```text
|
```bash
|
||||||
- name: Setup (CI/CD Profile)
|
- name: Setup (CI/CD Profile)
|
||||||
- name: Test Unit
|
- name: Test Unit
|
||||||
- name: Test Integration
|
- name: Test Integration
|
||||||
@ -694,7 +694,7 @@ strategy:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**4. Publish test results**:
|
**4. Publish test results**:
|
||||||
```text
|
```bash
|
||||||
- name: Publish Test Results
|
- name: Publish Test Results
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@ -730,7 +730,7 @@ strategy:
|
|||||||
|
|
||||||
### Migration Path
|
### Migration Path
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
Developer → Production
|
Developer → Production
|
||||||
(ready for team)
|
(ready for team)
|
||||||
↓
|
↓
|
||||||
@ -747,7 +747,7 @@ You can run Developer locally and CI/CD in your pipeline simultaneously.
|
|||||||
|
|
||||||
If you started with Developer and want to move to Production:
|
If you started with Developer and want to move to Production:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup your current setup
|
# Backup your current setup
|
||||||
tar czf provisioning-backup.tar.gz ~/.config/provisioning/
|
tar czf provisioning-backup.tar.gz ~/.config/provisioning/
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ tar xzf provisioning-backup.tar.gz
|
|||||||
|
|
||||||
All profiles' Nickel configs can be edited after setup:
|
All profiles' Nickel configs can be edited after setup:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Edit deployment config
|
# Edit deployment config
|
||||||
vim ~/.config/provisioning/platform/deployment.ncl
|
vim ~/.config/provisioning/platform/deployment.ncl
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ docker-compose restart # or kubectl apply -f
|
|||||||
### Developer Profile
|
### Developer Profile
|
||||||
|
|
||||||
**Problem**: Docker not running
|
**Problem**: Docker not running
|
||||||
```text
|
```bash
|
||||||
# Solution: Start Docker
|
# Solution: Start Docker
|
||||||
docker daemon &
|
docker daemon &
|
||||||
# or
|
# or
|
||||||
@ -789,7 +789,7 @@ sudo systemctl start docker
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Problem**: Ports 9090/3000/3001 already in use
|
**Problem**: Ports 9090/3000/3001 already in use
|
||||||
```text
|
```bash
|
||||||
# Solution: Kill conflicting process
|
# Solution: Kill conflicting process
|
||||||
lsof -i :9090 | grep LISTEN | awk '{print $2}' | xargs kill -9
|
lsof -i :9090 | grep LISTEN | awk '{print $2}' | xargs kill -9
|
||||||
```
|
```
|
||||||
@ -797,14 +797,14 @@ lsof -i :9090 | grep LISTEN | awk '{print $2}' | xargs kill -9
|
|||||||
### Production Profile
|
### Production Profile
|
||||||
|
|
||||||
**Problem**: Kubernetes not installed
|
**Problem**: Kubernetes not installed
|
||||||
```text
|
```yaml
|
||||||
# Solution: Install kubectl
|
# Solution: Install kubectl
|
||||||
brew install kubectl # macOS
|
brew install kubectl # macOS
|
||||||
sudo apt-get install kubectl # Linux
|
sudo apt-get install kubectl # Linux
|
||||||
```
|
```
|
||||||
|
|
||||||
**Problem**: Cloud credentials rejected
|
**Problem**: Cloud credentials rejected
|
||||||
```text
|
```bash
|
||||||
# Solution: Verify credentials
|
# Solution: Verify credentials
|
||||||
upcloud auth status # or aws sts get-caller-identity
|
upcloud auth status # or aws sts get-caller-identity
|
||||||
# Re-run setup with correct credentials
|
# Re-run setup with correct credentials
|
||||||
@ -813,13 +813,13 @@ upcloud auth status # or aws sts get-caller-identity
|
|||||||
### CI/CD Profile
|
### CI/CD Profile
|
||||||
|
|
||||||
**Problem**: Services not accessible from test
|
**Problem**: Services not accessible from test
|
||||||
```text
|
```bash
|
||||||
# Solution: Use service DNS
|
# Solution: Use service DNS
|
||||||
curl http://orchestrator:9090/health # instead of localhost
|
curl http://orchestrator:9090/health # instead of localhost
|
||||||
```
|
```
|
||||||
|
|
||||||
**Problem**: Cleanup not working
|
**Problem**: Cleanup not working
|
||||||
```text
|
```bash
|
||||||
# Solution: Manual cleanup
|
# Solution: Manual cleanup
|
||||||
docker system prune -f
|
docker system prune -f
|
||||||
rm -rf /tmp/provisioning-ci-*/
|
rm -rf /tmp/provisioning-ci-*/
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Step 1: Check Prerequisites (30 seconds)
|
## Step 1: Check Prerequisites (30 seconds)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Nushell
|
# Check Nushell
|
||||||
nu --version # Should be 0.109.0+
|
nu --version # Should be 0.109.0+
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ systemctl --version
|
|||||||
|
|
||||||
## Step 2: Install Provisioning (1 minute)
|
## Step 2: Install Provisioning (1 minute)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Option A: Using installer script
|
# Option A: Using installer script
|
||||||
curl -sSL https://install.provisioning.dev | bash
|
curl -sSL https://install.provisioning.dev | bash
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ cd provisioning
|
|||||||
|
|
||||||
## Step 3: Initialize System (2 minutes)
|
## Step 3: Initialize System (2 minutes)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run interactive setup
|
# Run interactive setup
|
||||||
provisioning setup system --interactive
|
provisioning setup system --interactive
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ provisioning setup system --interactive
|
|||||||
|
|
||||||
## Step 4: Create Your First Workspace (1 minute)
|
## Step 4: Create Your First Workspace (1 minute)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create workspace
|
# Create workspace
|
||||||
provisioning setup workspace myapp
|
provisioning setup workspace myapp
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ provisioning workspace list
|
|||||||
|
|
||||||
## Step 5: Deploy Your First Server (1 minute)
|
## Step 5: Deploy Your First Server (1 minute)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Activate workspace
|
# Activate workspace
|
||||||
provisioning workspace activate myapp
|
provisioning workspace activate myapp
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ provisioning server create --yes
|
|||||||
|
|
||||||
## Verify Everything Works
|
## Verify Everything Works
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check health
|
# Check health
|
||||||
provisioning platform health
|
provisioning platform health
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ provisioning server ssh <server-name>
|
|||||||
|
|
||||||
## Common Commands Cheat Sheet
|
## Common Commands Cheat Sheet
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Workspace management
|
# Workspace management
|
||||||
provisioning workspace list # List all workspaces
|
provisioning workspace list # List all workspaces
|
||||||
provisioning workspace activate prod # Switch workspace
|
provisioning workspace activate prod # Switch workspace
|
||||||
@ -106,7 +106,7 @@ provisioning platform health # Check platform health
|
|||||||
|
|
||||||
**Setup wizard won't start**
|
**Setup wizard won't start**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Check Nushell
|
# Check Nushell
|
||||||
nu --version
|
nu --version
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ chmod +x $(which provisioning)
|
|||||||
|
|
||||||
**Configuration error**
|
**Configuration error**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
provisioning setup validate --verbose
|
provisioning setup validate --verbose
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ provisioning info paths
|
|||||||
|
|
||||||
**Deployment fails**
|
**Deployment fails**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Dry-run to see what would happen
|
# Dry-run to see what would happen
|
||||||
provisioning server create --check
|
provisioning server create --check
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ After basic setup:
|
|||||||
|
|
||||||
## Need Help
|
## Need Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Get help
|
# Get help
|
||||||
provisioning help
|
provisioning help
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
### 30-Second Setup
|
### 30-Second Setup
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Install provisioning
|
# Install provisioning
|
||||||
curl -sSL https://install.provisioning.dev | bash
|
curl -sSL https://install.provisioning.dev | bash
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ provisioning server create
|
|||||||
|
|
||||||
## Directory Structure
|
## Directory Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/
|
provisioning/
|
||||||
├── system.toml # System info (immutable)
|
├── system.toml # System info (immutable)
|
||||||
├── user_preferences.toml # User settings (editable)
|
├── user_preferences.toml # User settings (editable)
|
||||||
@ -54,7 +54,7 @@ provisioning/
|
|||||||
|
|
||||||
Run the interactive setup wizard:
|
Run the interactive setup wizard:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning setup system --interactive
|
provisioning setup system --interactive
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ The wizard guides you through:
|
|||||||
|
|
||||||
Create and manage multiple isolated environments:
|
Create and manage multiple isolated environments:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create workspace
|
# Create workspace
|
||||||
provisioning setup workspace dev
|
provisioning setup workspace dev
|
||||||
provisioning setup workspace prod
|
provisioning setup workspace prod
|
||||||
@ -109,7 +109,7 @@ provisioning workspace activate prod
|
|||||||
|
|
||||||
Update any setting:
|
Update any setting:
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Update platform configuration
|
# Update platform configuration
|
||||||
provisioning setup platform --config new-config.toml
|
provisioning setup platform --config new-config.toml
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ provisioning setup validate
|
|||||||
|
|
||||||
## Backup & Restore
|
## Backup & Restore
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Backup current configuration
|
# Backup current configuration
|
||||||
provisioning setup backup --path ./backup.tar.gz
|
provisioning setup backup --path ./backup.tar.gz
|
||||||
|
|
||||||
@ -137,25 +137,25 @@ provisioning setup migrate --from-existing
|
|||||||
|
|
||||||
### "Command not found: provisioning"
|
### "Command not found: provisioning"
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
export PATH="/usr/local/bin:$PATH"
|
export PATH="/usr/local/bin:$PATH"
|
||||||
```
|
```
|
||||||
|
|
||||||
### "Nushell not found"
|
### "Nushell not found"
|
||||||
|
|
||||||
```text
|
```nushell
|
||||||
curl -sSL https://raw.githubusercontent.com/nushell/nushell/main/install.sh | bash
|
curl -sSL https://raw.githubusercontent.com/nushell/nushell/main/install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
### "Cannot write to directory"
|
### "Cannot write to directory"
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
chmod 755 ~/Library/Application\ Support/provisioning/
|
chmod 755 ~/Library/Application\ Support/provisioning/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Check required tools
|
### Check required tools
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning setup validate --check-tools
|
provisioning setup validate --check-tools
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ A: Yes, via GitOps - configurations in Git, secrets in secure storage.
|
|||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# General help
|
# General help
|
||||||
provisioning help
|
provisioning help
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ All profiles use **Nickel-first architecture**: configuration source of truth is
|
|||||||
|
|
||||||
### Developer Profile (Recommended for First Time)
|
### Developer Profile (Recommended for First Time)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Run unified setup
|
# Run unified setup
|
||||||
provisioning setup profile --profile developer
|
provisioning setup profile --profile developer
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ curl http://localhost:3001/health
|
|||||||
```
|
```
|
||||||
|
|
||||||
Expected output:
|
Expected output:
|
||||||
```text
|
```bash
|
||||||
╔═════════════════════════════════════════════════════╗
|
╔═════════════════════════════════════════════════════╗
|
||||||
║ PROVISIONING SETUP - DEVELOPER PROFILE ║
|
║ PROVISIONING SETUP - DEVELOPER PROFILE ║
|
||||||
╚═════════════════════════════════════════════════════╝
|
╚═════════════════════════════════════════════════════╝
|
||||||
@ -62,7 +62,7 @@ Setup complete in ~4 minutes!
|
|||||||
|
|
||||||
### Production Profile (HA, Security, Team Ready)
|
### Production Profile (HA, Security, Team Ready)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Interactive setup for production
|
# Interactive setup for production
|
||||||
provisioning setup profile --profile production --interactive
|
provisioning setup profile --profile production --interactive
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ nickel typecheck ~/.config/provisioning/platform/deployment.ncl
|
|||||||
```
|
```
|
||||||
|
|
||||||
Expected config structure:
|
Expected config structure:
|
||||||
```text
|
```toml
|
||||||
~/.config/provisioning/
|
~/.config/provisioning/
|
||||||
├── system.ncl # System detection + capabilities
|
├── system.ncl # System detection + capabilities
|
||||||
├── user_preferences.ncl # User settings (MFA, audit, etc.)
|
├── user_preferences.ncl # User settings (MFA, audit, etc.)
|
||||||
@ -102,7 +102,7 @@ Expected config structure:
|
|||||||
|
|
||||||
### CI/CD Profile (Automated, Ephemeral)
|
### CI/CD Profile (Automated, Ephemeral)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Fully automated setup for pipelines
|
# Fully automated setup for pipelines
|
||||||
export PROVISIONING_PROVIDER=local
|
export PROVISIONING_PROVIDER=local
|
||||||
export PROVISIONING_WORKSPACE=ci-test-${CI_JOB_ID}
|
export PROVISIONING_WORKSPACE=ci-test-${CI_JOB_ID}
|
||||||
@ -126,7 +126,7 @@ provisioning setup profile --profile cicd
|
|||||||
|
|
||||||
### Linux (XDG Base Directory)
|
### Linux (XDG Base Directory)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Primary location
|
# Primary location
|
||||||
~/.config/provisioning/
|
~/.config/provisioning/
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ $XDG_CONFIG_HOME/provisioning/
|
|||||||
|
|
||||||
### macOS (Application Support)
|
### macOS (Application Support)
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Platform-specific location
|
# Platform-specific location
|
||||||
~/Library/Application Support/provisioning/
|
~/Library/Application Support/provisioning/
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ Provisioning detects:
|
|||||||
- **Memory**: Total system RAM in GB
|
- **Memory**: Total system RAM in GB
|
||||||
- **Disk Space**: Total available disk
|
- **Disk Space**: Total available disk
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# View detected system
|
# View detected system
|
||||||
provisioning setup detect --verbose
|
provisioning setup detect --verbose
|
||||||
```
|
```
|
||||||
@ -193,7 +193,7 @@ You choose between:
|
|||||||
|
|
||||||
Setup creates Nickel configs using composition:
|
Setup creates Nickel configs using composition:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Example: system.ncl is composed from:
|
# Example: system.ncl is composed from:
|
||||||
let helpers = import "../../schemas/platform/common/helpers.ncl"
|
let helpers = import "../../schemas/platform/common/helpers.ncl"
|
||||||
let defaults = import "../../schemas/platform/defaults/system-defaults.ncl"
|
let defaults = import "../../schemas/platform/defaults/system-defaults.ncl"
|
||||||
@ -213,7 +213,7 @@ Result: **Type-safe config**, guaranteed valid structure and values.
|
|||||||
|
|
||||||
All configs are validated:
|
All configs are validated:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Done automatically during setup
|
# Done automatically during setup
|
||||||
nickel typecheck ~/.config/provisioning/system.ncl
|
nickel typecheck ~/.config/provisioning/system.ncl
|
||||||
nickel typecheck ~/.config/provisioning/platform/deployment.ncl
|
nickel typecheck ~/.config/provisioning/platform/deployment.ncl
|
||||||
@ -225,19 +225,19 @@ nickel typecheck ~/.config/provisioning/**/*.ncl
|
|||||||
### Step 5: Service Bootstrap (Profile-Dependent)
|
### Step 5: Service Bootstrap (Profile-Dependent)
|
||||||
|
|
||||||
**Developer**: Starts Docker Compose services locally
|
**Developer**: Starts Docker Compose services locally
|
||||||
```text
|
```bash
|
||||||
docker-compose up -d orchestrator control-center kms
|
docker-compose up -d orchestrator control-center kms
|
||||||
```
|
```
|
||||||
|
|
||||||
**Production**: Outputs Kubernetes manifests (doesn't auto-start, you review first)
|
**Production**: Outputs Kubernetes manifests (doesn't auto-start, you review first)
|
||||||
```text
|
```yaml
|
||||||
cat ~/.config/provisioning/platform/deployment.ncl
|
cat ~/.config/provisioning/platform/deployment.ncl
|
||||||
# Review, then deploy to your cluster
|
# Review, then deploy to your cluster
|
||||||
kubectl apply -f generated-from-deployment.ncl
|
kubectl apply -f generated-from-deployment.ncl
|
||||||
```
|
```
|
||||||
|
|
||||||
**CI/CD**: Starts ephemeral Docker Compose in `/tmp`
|
**CI/CD**: Starts ephemeral Docker Compose in `/tmp`
|
||||||
```text
|
```bash
|
||||||
# Automatic cleanup on job exit
|
# Automatic cleanup on job exit
|
||||||
docker-compose -f /tmp/provisioning-ci-${JOB_ID}/compose.yml up
|
docker-compose -f /tmp/provisioning-ci-${JOB_ID}/compose.yml up
|
||||||
# Tests run, cleanup automatic on script exit
|
# Tests run, cleanup automatic on script exit
|
||||||
@ -266,7 +266,7 @@ docker-compose -f /tmp/provisioning-ci-${JOB_ID}/compose.yml up
|
|||||||
**Time**: 3-4 minutes
|
**Time**: 3-4 minutes
|
||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
```text
|
```bash
|
||||||
provisioning setup profile --profile developer
|
provisioning setup profile --profile developer
|
||||||
|
|
||||||
# Output:
|
# Output:
|
||||||
@ -303,7 +303,7 @@ provisioning setup profile --profile developer
|
|||||||
**Time**: 10-15 minutes (interactive, many questions)
|
**Time**: 10-15 minutes (interactive, many questions)
|
||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
```text
|
```bash
|
||||||
provisioning setup profile --profile production --interactive
|
provisioning setup profile --profile production --interactive
|
||||||
|
|
||||||
# Prompts:
|
# Prompts:
|
||||||
@ -347,7 +347,7 @@ provisioning setup profile --profile production --interactive
|
|||||||
**Time**: Less than 2 minutes
|
**Time**: Less than 2 minutes
|
||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
```text
|
```bash
|
||||||
# In GitHub Actions:
|
# In GitHub Actions:
|
||||||
- name: Setup Provisioning
|
- name: Setup Provisioning
|
||||||
run: |
|
run: |
|
||||||
@ -369,7 +369,7 @@ provisioning setup profile --profile production --interactive
|
|||||||
### After Setup, Verify Everything Works
|
### After Setup, Verify Everything Works
|
||||||
|
|
||||||
**Developer Profile**:
|
**Developer Profile**:
|
||||||
```text
|
```bash
|
||||||
# Check configs exist
|
# Check configs exist
|
||||||
ls -la ~/.config/provisioning/
|
ls -la ~/.config/provisioning/
|
||||||
ls -la ~/.config/provisioning/platform/
|
ls -la ~/.config/provisioning/platform/
|
||||||
@ -387,7 +387,7 @@ curl http://localhost:3001/health
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Production Profile**:
|
**Production Profile**:
|
||||||
```text
|
```bash
|
||||||
# Check Nickel configs
|
# Check Nickel configs
|
||||||
nickel typecheck ~/.config/provisioning/system.ncl
|
nickel typecheck ~/.config/provisioning/system.ncl
|
||||||
nickel typecheck ~/.config/provisioning/platform/deployment.ncl
|
nickel typecheck ~/.config/provisioning/platform/deployment.ncl
|
||||||
@ -404,7 +404,7 @@ cat ~/.config/provisioning/cedar-policies/default.cedar
|
|||||||
```
|
```
|
||||||
|
|
||||||
**CI/CD Profile**:
|
**CI/CD Profile**:
|
||||||
```text
|
```bash
|
||||||
# Check temp configs exist
|
# Check temp configs exist
|
||||||
ls -la /tmp/provisioning-ci-*/
|
ls -la /tmp/provisioning-ci-*/
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ docker ps | grep provisioning
|
|||||||
**Cause**: Nickel binary not installed
|
**Cause**: Nickel binary not installed
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```nickel
|
||||||
# macOS
|
# macOS
|
||||||
brew install nickel
|
brew install nickel
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ nickel --version # Should be 1.5.0+
|
|||||||
**Cause**: Nickel typecheck error in generated config
|
**Cause**: Nickel typecheck error in generated config
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```nickel
|
||||||
# See detailed error
|
# See detailed error
|
||||||
nickel typecheck ~/.config/provisioning/platform/deployment.ncl --color always
|
nickel typecheck ~/.config/provisioning/platform/deployment.ncl --color always
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ provisioning setup profile --profile developer --verbose
|
|||||||
**Cause**: Docker not installed or not running
|
**Cause**: Docker not installed or not running
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```bash
|
||||||
# Check Docker
|
# Check Docker
|
||||||
docker --version
|
docker --version
|
||||||
docker ps
|
docker ps
|
||||||
@ -487,7 +487,7 @@ provisioning setup profile --profile developer
|
|||||||
**Cause**: Port already in use, Docker not running, or resource constraints
|
**Cause**: Port already in use, Docker not running, or resource constraints
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```bash
|
||||||
# Check what's using ports 9090, 3000, 3001
|
# Check what's using ports 9090, 3000, 3001
|
||||||
lsof -i :9090
|
lsof -i :9090
|
||||||
lsof -i :3000
|
lsof -i :3000
|
||||||
@ -509,7 +509,7 @@ docker system prune # Free up space if needed
|
|||||||
**Cause**: Directory created with wrong permissions
|
**Cause**: Directory created with wrong permissions
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```bash
|
||||||
# Fix permissions (macOS)
|
# Fix permissions (macOS)
|
||||||
chmod 700 ~/Library/Application\ Support/provisioning/
|
chmod 700 ~/Library/Application\ Support/provisioning/
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ provisioning setup profile --profile developer
|
|||||||
**Cause**: Services reading from old location or wrong environment variable
|
**Cause**: Services reading from old location or wrong environment variable
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
```text
|
```bash
|
||||||
# Verify service sees new location
|
# Verify service sees new location
|
||||||
echo $PROVISIONING_CONFIG
|
echo $PROVISIONING_CONFIG
|
||||||
# Should be: ~/.config/provisioning/platform/deployment.ncl
|
# Should be: ~/.config/provisioning/platform/deployment.ncl
|
||||||
@ -547,7 +547,7 @@ provisioning service status --verbose
|
|||||||
|
|
||||||
After initial setup, you can customize configs per workspace:
|
After initial setup, you can customize configs per workspace:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create workspace-specific override
|
# Create workspace-specific override
|
||||||
mkdir -p workspace-myproject/config
|
mkdir -p workspace-myproject/config
|
||||||
cat > workspace-myproject/config/platform-overrides.ncl <<'EOF'
|
cat > workspace-myproject/config/platform-overrides.ncl <<'EOF'
|
||||||
@ -631,7 +631,7 @@ Result: Minimal, validated, reproducible config.
|
|||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Help for setup
|
# Help for setup
|
||||||
provisioning setup --help
|
provisioning setup --help
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ This guide covers:
|
|||||||
|
|
||||||
The provisioning system uses a **3-layer architecture** for configuration inheritance:
|
The provisioning system uses a **3-layer architecture** for configuration inheritance:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
┌─────────────────────────────────────┐
|
┌─────────────────────────────────────┐
|
||||||
│ Infrastructure Layer (Priority 300)│ ← Highest priority
|
│ Infrastructure Layer (Priority 300)│ ← Highest priority
|
||||||
│ workspace/infra/{name}/ │
|
│ workspace/infra/{name}/ │
|
||||||
@ -52,14 +52,14 @@ Higher numbers override lower numbers.
|
|||||||
|
|
||||||
### View Layer Resolution
|
### View Layer Resolution
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Explain layer concept
|
# Explain layer concept
|
||||||
provisioning lyr explain
|
provisioning lyr explain
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📚 LAYER SYSTEM EXPLAINED
|
📚 LAYER SYSTEM EXPLAINED
|
||||||
|
|
||||||
The layer system provides configuration inheritance across 3 levels:
|
The layer system provides configuration inheritance across 3 levels:
|
||||||
@ -89,14 +89,14 @@ Resolution: Infrastructure → Workspace → Core
|
|||||||
Higher priority layers override lower ones.
|
Higher priority layers override lower ones.
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show layer resolution for your project
|
# Show layer resolution for your project
|
||||||
provisioning lyr show my-production
|
provisioning lyr show my-production
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📊 Layer Resolution for my-production:
|
📊 Layer Resolution for my-production:
|
||||||
|
|
||||||
LAYER PRIORITY SOURCE FILES
|
LAYER PRIORITY SOURCE FILES
|
||||||
@ -121,14 +121,14 @@ Status: ✅ All layers resolved successfully
|
|||||||
|
|
||||||
### Test Layer Resolution
|
### Test Layer Resolution
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Test how a specific module resolves
|
# Test how a specific module resolves
|
||||||
provisioning lyr test kubernetes my-production
|
provisioning lyr test kubernetes my-production
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
🔍 Layer Resolution Test: kubernetes → my-production
|
🔍 Layer Resolution Test: kubernetes → my-production
|
||||||
|
|
||||||
Resolving kubernetes configuration...
|
Resolving kubernetes configuration...
|
||||||
@ -171,14 +171,14 @@ Resolution: ✅ Success
|
|||||||
|
|
||||||
### List Available Templates
|
### List Available Templates
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List all templates
|
# List all templates
|
||||||
provisioning tpl list
|
provisioning tpl list
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📋 Available Templates:
|
📋 Available Templates:
|
||||||
|
|
||||||
TASKSERVS:
|
TASKSERVS:
|
||||||
@ -203,7 +203,7 @@ CLUSTERS:
|
|||||||
Total: 13 templates
|
Total: 13 templates
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List templates by type
|
# List templates by type
|
||||||
provisioning tpl list --type taskservs
|
provisioning tpl list --type taskservs
|
||||||
provisioning tpl list --type providers
|
provisioning tpl list --type providers
|
||||||
@ -212,14 +212,14 @@ provisioning tpl list --type clusters
|
|||||||
|
|
||||||
### View Template Details
|
### View Template Details
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show template details
|
# Show template details
|
||||||
provisioning tpl show production-kubernetes
|
provisioning tpl show production-kubernetes
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📄 Template: production-kubernetes
|
📄 Template: production-kubernetes
|
||||||
|
|
||||||
Description: Production-ready Kubernetes configuration with
|
Description: Production-ready Kubernetes configuration with
|
||||||
@ -250,14 +250,14 @@ Example Usage:
|
|||||||
|
|
||||||
### Apply Template
|
### Apply Template
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Apply template to your infrastructure
|
# Apply template to your infrastructure
|
||||||
provisioning tpl apply production-kubernetes my-production
|
provisioning tpl apply production-kubernetes my-production
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
🚀 Applying template: production-kubernetes → my-production
|
🚀 Applying template: production-kubernetes → my-production
|
||||||
|
|
||||||
Checking compatibility... ⏳
|
Checking compatibility... ⏳
|
||||||
@ -282,14 +282,14 @@ Next steps:
|
|||||||
|
|
||||||
### Validate Template Usage
|
### Validate Template Usage
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Validate template was applied correctly
|
# Validate template was applied correctly
|
||||||
provisioning tpl validate my-production
|
provisioning tpl validate my-production
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
✅ Template Validation: my-production
|
✅ Template Validation: my-production
|
||||||
|
|
||||||
Templates Applied:
|
Templates Applied:
|
||||||
@ -314,7 +314,7 @@ Status: ✅ Valid
|
|||||||
|
|
||||||
### Step 1: Create Template Structure
|
### Step 1: Create Template Structure
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Create custom template directory
|
# Create custom template directory
|
||||||
mkdir -p provisioning/workspace/templates/my-custom-template
|
mkdir -p provisioning/workspace/templates/my-custom-template
|
||||||
```
|
```
|
||||||
@ -323,7 +323,7 @@ mkdir -p provisioning/workspace/templates/my-custom-template
|
|||||||
|
|
||||||
**File: `provisioning/workspace/templates/my-custom-template/main.ncl`**
|
**File: `provisioning/workspace/templates/my-custom-template/main.ncl`**
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Custom Kubernetes template with specific settings
|
# Custom Kubernetes template with specific settings
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
# Version
|
# Version
|
||||||
@ -389,7 +389,7 @@ kubernetes_config
|
|||||||
|
|
||||||
**File: `provisioning/workspace/templates/my-custom-template/metadata.toml`**
|
**File: `provisioning/workspace/templates/my-custom-template/metadata.toml`**
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
[template]
|
[template]
|
||||||
name = "my-custom-template"
|
name = "my-custom-template"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -409,7 +409,7 @@ features = ["security", "monitoring", "high-availability"]
|
|||||||
|
|
||||||
### Step 4: Test Custom Template
|
### Step 4: Test Custom Template
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List templates (should include your custom template)
|
# List templates (should include your custom template)
|
||||||
provisioning tpl list
|
provisioning tpl list
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ provisioning tpl apply my-custom-template my-test
|
|||||||
|
|
||||||
**Core Layer** (`provisioning/extensions/taskservs/postgres/main.ncl`):
|
**Core Layer** (`provisioning/extensions/taskservs/postgres/main.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
version = "15.5",
|
version = "15.5",
|
||||||
port = 5432,
|
port = 5432,
|
||||||
@ -437,7 +437,7 @@ postgres_config
|
|||||||
|
|
||||||
**Infrastructure Layer** (`workspace/infra/my-production/taskservs/postgres.ncl`):
|
**Infrastructure Layer** (`workspace/infra/my-production/taskservs/postgres.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
max_connections = 500, # Override only max_connections
|
max_connections = 500, # Override only max_connections
|
||||||
} in
|
} in
|
||||||
@ -446,7 +446,7 @@ postgres_config
|
|||||||
|
|
||||||
**Result** (after layer resolution):
|
**Result** (after layer resolution):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
version = "15.5", # From Core
|
version = "15.5", # From Core
|
||||||
port = 5432, # From Core
|
port = 5432, # From Core
|
||||||
@ -459,7 +459,7 @@ postgres_config
|
|||||||
|
|
||||||
**Workspace Layer** (`provisioning/workspace/templates/production-postgres.ncl`):
|
**Workspace Layer** (`provisioning/workspace/templates/production-postgres.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
replication = {
|
replication = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -472,7 +472,7 @@ postgres_config
|
|||||||
|
|
||||||
**Infrastructure Layer** (`workspace/infra/my-production/taskservs/postgres.ncl`):
|
**Infrastructure Layer** (`workspace/infra/my-production/taskservs/postgres.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
replication = {
|
replication = {
|
||||||
sync_mode = "sync", # Override sync mode
|
sync_mode = "sync", # Override sync mode
|
||||||
@ -484,7 +484,7 @@ postgres_config
|
|||||||
|
|
||||||
**Result**:
|
**Result**:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let postgres_config = {
|
let postgres_config = {
|
||||||
version = "15.5", # From Core
|
version = "15.5", # From Core
|
||||||
port = 5432, # From Core
|
port = 5432, # From Core
|
||||||
@ -503,7 +503,7 @@ postgres_config
|
|||||||
|
|
||||||
**Workspace Layer** (`provisioning/workspace/templates/base-kubernetes.ncl`):
|
**Workspace Layer** (`provisioning/workspace/templates/base-kubernetes.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
version = "1.30.0",
|
version = "1.30.0",
|
||||||
control_plane_count = 3,
|
control_plane_count = 3,
|
||||||
@ -518,7 +518,7 @@ kubernetes_config
|
|||||||
|
|
||||||
**Development Infrastructure** (`workspace/infra/my-dev/taskservs/kubernetes.ncl`):
|
**Development Infrastructure** (`workspace/infra/my-dev/taskservs/kubernetes.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
control_plane_count = 1, # Smaller for dev
|
control_plane_count = 1, # Smaller for dev
|
||||||
worker_count = 2,
|
worker_count = 2,
|
||||||
@ -532,7 +532,7 @@ kubernetes_config
|
|||||||
|
|
||||||
**Production Infrastructure** (`workspace/infra/my-prod/taskservs/kubernetes.ncl`):
|
**Production Infrastructure** (`workspace/infra/my-prod/taskservs/kubernetes.ncl`):
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
control_plane_count = 5, # Larger for prod
|
control_plane_count = 5, # Larger for prod
|
||||||
worker_count = 10,
|
worker_count = 10,
|
||||||
@ -550,7 +550,7 @@ kubernetes_config
|
|||||||
|
|
||||||
Create different configurations for each environment:
|
Create different configurations for each environment:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Create environments
|
# Create environments
|
||||||
provisioning ws init my-app-dev
|
provisioning ws init my-app-dev
|
||||||
provisioning ws init my-app-staging
|
provisioning ws init my-app-staging
|
||||||
@ -573,7 +573,7 @@ Create reusable configuration fragments:
|
|||||||
|
|
||||||
**File: `provisioning/workspace/templates/shared/security-policies.ncl`**
|
**File: `provisioning/workspace/templates/shared/security-policies.ncl`**
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let security_policies = {
|
let security_policies = {
|
||||||
pod_security = {
|
pod_security = {
|
||||||
enforce = "restricted",
|
enforce = "restricted",
|
||||||
@ -603,7 +603,7 @@ security_policies
|
|||||||
|
|
||||||
Import in your infrastructure:
|
Import in your infrastructure:
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let security_policies = (import "../../../provisioning/workspace/templates/shared/security-policies.ncl") in
|
let security_policies = (import "../../../provisioning/workspace/templates/shared/security-policies.ncl") in
|
||||||
|
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
@ -618,7 +618,7 @@ kubernetes_config
|
|||||||
|
|
||||||
Use Nickel features for dynamic configuration:
|
Use Nickel features for dynamic configuration:
|
||||||
|
|
||||||
```text
|
```nickel
|
||||||
# Calculate resources based on server count
|
# Calculate resources based on server count
|
||||||
let server_count = 5 in
|
let server_count = 5 in
|
||||||
let replicas_per_server = 2 in
|
let replicas_per_server = 2 in
|
||||||
@ -634,7 +634,7 @@ postgres_config
|
|||||||
|
|
||||||
### Pattern 4: Conditional Configuration
|
### Pattern 4: Conditional Configuration
|
||||||
|
|
||||||
```text
|
```javascript
|
||||||
let environment = "production" in # or "development"
|
let environment = "production" in # or "development"
|
||||||
|
|
||||||
let kubernetes_config = {
|
let kubernetes_config = {
|
||||||
@ -651,14 +651,14 @@ kubernetes_config
|
|||||||
|
|
||||||
## Layer Statistics
|
## Layer Statistics
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Show layer system statistics
|
# Show layer system statistics
|
||||||
provisioning lyr stats
|
provisioning lyr stats
|
||||||
```
|
```
|
||||||
|
|
||||||
**Expected Output:**
|
**Expected Output:**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
📊 Layer System Statistics:
|
📊 Layer System Statistics:
|
||||||
|
|
||||||
Infrastructure Layer:
|
Infrastructure Layer:
|
||||||
@ -686,7 +686,7 @@ Resolution Performance:
|
|||||||
|
|
||||||
### Complete Customization Example
|
### Complete Customization Example
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# 1. Create new infrastructure
|
# 1. Create new infrastructure
|
||||||
provisioning ws init my-custom-app
|
provisioning ws init my-custom-app
|
||||||
|
|
||||||
@ -728,7 +728,7 @@ provisioning t create kubernetes --infra my-custom-app
|
|||||||
|
|
||||||
### 2. Template Organization
|
### 2. Template Organization
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
provisioning/workspace/templates/
|
provisioning/workspace/templates/
|
||||||
├── shared/ # Shared configuration fragments
|
├── shared/ # Shared configuration fragments
|
||||||
│ ├── security-policies.ncl
|
│ ├── security-policies.ncl
|
||||||
@ -749,7 +749,7 @@ Document your customizations:
|
|||||||
|
|
||||||
**File: `workspace/infra/my-production/README.md`**
|
**File: `workspace/infra/my-production/README.md`**
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# My Production Infrastructure
|
# My Production Infrastructure
|
||||||
|
|
||||||
## Customizations
|
## Customizations
|
||||||
@ -769,7 +769,7 @@ Document your customizations:
|
|||||||
|
|
||||||
Keep templates and configurations in version control:
|
Keep templates and configurations in version control:
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
cd provisioning/workspace/templates/
|
cd provisioning/workspace/templates/
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Add production Kubernetes template with enhanced security"
|
git commit -m "Add production Kubernetes template with enhanced security"
|
||||||
@ -783,7 +783,7 @@ git commit -m "Configure production environment for my-production"
|
|||||||
|
|
||||||
### Issue: Configuration not applied
|
### Issue: Configuration not applied
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Check layer resolution
|
# Check layer resolution
|
||||||
provisioning lyr show my-production
|
provisioning lyr show my-production
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ provisioning lyr test kubernetes my-production
|
|||||||
|
|
||||||
### Issue: Conflicting configurations
|
### Issue: Conflicting configurations
|
||||||
|
|
||||||
```text
|
```toml
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
provisioning val config --infra my-production
|
provisioning val config --infra my-production
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ provisioning show config kubernetes --infra my-production
|
|||||||
|
|
||||||
### Issue: Template not found
|
### Issue: Template not found
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# List available templates
|
# List available templates
|
||||||
provisioning tpl list
|
provisioning tpl list
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ provisioning tpl refresh
|
|||||||
|
|
||||||
## Quick Reference
|
## Quick Reference
|
||||||
|
|
||||||
```text
|
```bash
|
||||||
# Layer system
|
# Layer system
|
||||||
provisioning lyr explain # Explain layers
|
provisioning lyr explain # Explain layers
|
||||||
provisioning lyr show <project> # Show layer resolution
|
provisioning lyr show <project> # Show layer resolution
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user