# Infrastructure Setup Quick Reference\n\n**Complete guide to provisioning infrastructure with Nickel + ConfigLoader + TypeDialog**\n\n---\n\n## Quick Start\n\n### 1. Generate Infrastructure Configs (Solo Mode)\n\n```\ncd project-provisioning\n\n# Generate solo deployment (Docker Compose, Nginx, Prometheus, OCI Registry)\nnickel export --format json provisioning/schemas/infrastructure/examples-solo-deployment.ncl > /tmp/solo-infra.json\n\n# Verify JSON structure\njq . /tmp/solo-infra.json\n```\n\n### 2. Validate Generated Configs\n\n```\n# Solo deployment validation\nbash provisioning/platform/scripts/validate-infrastructure.nu --config-dir provisioning/platform/infrastructure\n\n# Output shows validation status for Docker, K8s, Nginx, Prometheus\n```\n\n### 3. Compare Solo vs Enterprise\n\n```\n# Export both examples\nnickel export --format json provisioning/schemas/infrastructure/examples-solo-deployment.ncl > /tmp/solo.json\nnickel export --format json provisioning/schemas/infrastructure/examples-enterprise-deployment.ncl > /tmp/enterprise.json\n\n# Compare orchestrator resources\necho "=== Solo Resources ===" && jq '.docker_compose_services.orchestrator.deploy.resources.limits' /tmp/solo.json\necho "=== Enterprise Resources ===" && jq '.docker_compose_services.orchestrator.deploy.resources.limits' /tmp/enterprise.json\n\n# Compare prometheus monitoring\necho "=== Solo Prometheus Jobs ===" && jq '.prometheus_config.scrape_configs | length' /tmp/solo.json\necho "=== Enterprise Prometheus Jobs ===" && jq '.prometheus_config.scrape_configs | length' /tmp/enterprise.json\n```\n\n---\n\n## Infrastructure Components\n\n### Available Schemas (6)\n\n| Schema | Purpose | Mode Presets |\n| -------- | --------- | -------------- |\n| `docker-compose.ncl` | Container orchestration | solo, multiuser, enterprise |\n| `kubernetes.ncl` | K8s manifest generation | solo, enterprise |\n| `nginx.ncl` | Reverse proxy & load balancer | solo, enterprise |\n| `prometheus.ncl` | Metrics & monitoring | solo, multiuser, enterprise |\n| `systemd.ncl` | System service units | solo, enterprise |\n| `oci-registry.ncl` | Container registry (Zot/Harbor) | solo, multiuser, enterprise |\n\n### Configuration Examples (2)\n\n| Example | Type | Services | CPU | Memory |\n| --------- | ------ | ---------- | ----- | -------- |\n| `examples-solo-deployment.ncl` | Dev/Testing | 5 | 1.0 | 1024M |\n| `examples-enterprise-deployment.ncl` | Production | 6 | 4.0 | 4096M |\n\n### Automation Scripts (3)\n\n| Script | Purpose | Usage |\n| -------- | --------- | ------- |\n| `generate-infrastructure-configs.nu` | Generate all configs | `--mode solo --format yaml` |\n| `validate-infrastructure.nu` | Validate configs | `--config-dir /path` |\n| `setup-with-forms.sh` | Interactive setup | Auto-detects TypeDialog |\n\n---\n\n## Workflow: Platform Config + Infrastructure Config\n\n### Two-Tier Configuration System\n\n**Platform Config Layer** (Service-Internal):\n```\nOrchestrator port, database host, logging level\n    ↓\nConfigLoader (Rust)\n    ↓\nService reads TOML from runtime/generated/\n```\n\n**Infrastructure Config Layer** (Deployment-External):\n```\nDocker Compose services, Nginx routing, Prometheus scrape jobs\n    ↓\nnickel export → YAML/JSON\n    ↓\nDocker/Kubernetes/Nginx deploys infrastructure\n```\n\n### Complete Deployment Workflow\n\n```\n1. Choose platform config mode\n   provisioning/platform/config/examples/orchestrator.solo.example.ncl\n                                        ↓\n2. Generate platform config TOML\n   nickel export --format toml → runtime/generated/orchestrator.solo.toml\n                                        ↓\n3. Choose infrastructure mode\n   provisioning/schemas/infrastructure/examples-solo-deployment.ncl\n                                        ↓\n4. Generate infrastructure JSON/YAML\n   nickel export --format json → docker-compose-solo.json\n                                        ↓\n5. Deploy infrastructure\n   docker-compose -f docker-compose-solo.yaml up\n                                        ↓\n6. Services start with configs\n   ConfigLoader reads platform config TOML\n   Docker/Nginx read infrastructure configs\n```\n\n---\n\n## Resource Allocation Reference\n\n### Solo Mode (Development)\n\n```\nOrchestrator:      1.0 CPU, 1024M RAM (1 replica)\nControl Center:    0.5 CPU,  512M RAM\nCoreDNS:           0.25 CPU, 256M RAM\nKMS:               0.5 CPU,  512M RAM\nOCI Registry:      0.5 CPU,  512M RAM (Zot - filesystem)\n─────────────────────────────────────\nTotal:             2.75 CPU, 2624M RAM\nUse Case:          Development, testing, PoCs\n```\n\n### Enterprise Mode (Production)\n\n```\nOrchestrator:      4.0 CPU, 4096M RAM (3 replicas)\nControl Center:    2.0 CPU, 2048M RAM (HA)\nCoreDNS:           1.0 CPU, 1024M RAM\nKMS:               2.0 CPU, 2048M RAM\nOCI Registry:      2.0 CPU, 2048M RAM (Harbor - S3)\n─────────────────────────────────────\nTotal:            11.0 CPU, 10240M RAM (+ replicas)\nUse Case:          Production deployments, high availability\n```\n\n---\n\n## Common Tasks\n\n### Generate Solo Infrastructure\n\n```\nnickel export --format json provisioning/schemas/infrastructure/examples-solo-deployment.ncl\n```\n\n### Generate Enterprise Infrastructure\n\n```\nnickel export --format json provisioning/schemas/infrastructure/examples-enterprise-deployment.ncl\n```\n\n### Validate JSON Structure\n\n```\njq '.docker_compose_services | keys' /tmp/infra.json\njq '.prometheus_config.scrape_configs | length' /tmp/infra.json\njq '.oci_registry_config.backend' /tmp/infra.json\n```\n\n### Check Resource Limits\n\n```\n# All services in solo mode\njq '.docker_compose_services[] | {name: .name, cpu: .deploy.resources.limits.cpus, memory: .deploy.resources.limits.memory}' /tmp/solo.json\n\n# Just orchestrator\njq '.docker_compose_services.orchestrator.deploy.resources.limits' /tmp/solo.json\n```\n\n### Compare Modes\n\n```\n# Services count\njq '.docker_compose_services | length' /tmp/solo.json      # 5 services\njq '.docker_compose_services | length' /tmp/enterprise.json # 6 services\n\n# Prometheus jobs\njq '.prometheus_config.scrape_configs | length' /tmp/solo.json      # 4 jobs\njq '.prometheus_config.scrape_configs | length' /tmp/enterprise.json # 7 jobs\n\n# Registry backend\njq -r '.oci_registry_config.backend' /tmp/solo.json      # Zot\njq -r '.oci_registry_config.backend' /tmp/enterprise.json # Harbor\n```\n\n---\n\n## Validation Commands\n\n### Type Check Schemas\n\n```\nnickel typecheck provisioning/schemas/infrastructure/docker-compose.ncl\nnickel typecheck provisioning/schemas/infrastructure/kubernetes.ncl\nnickel typecheck provisioning/schemas/infrastructure/nginx.ncl\nnickel typecheck provisioning/schemas/infrastructure/prometheus.ncl\nnickel typecheck provisioning/schemas/infrastructure/systemd.ncl\nnickel typecheck provisioning/schemas/infrastructure/oci-registry.ncl\n```\n\n### Validate Examples\n\n```\nnickel typecheck provisioning/schemas/infrastructure/examples-solo-deployment.ncl\nnickel typecheck provisioning/schemas/infrastructure/examples-enterprise-deployment.ncl\n```\n\n### Test Export\n\n```\nnickel export --format json provisioning/schemas/infrastructure/examples-solo-deployment.ncl | jq .\n```\n\n---\n\n## Platform Config Examples\n\n### Solo Platform Config\n\n```\nnickel export --format toml provisioning/platform/config/examples/orchestrator.solo.example.ncl\n# Output: TOML with [database], [logging], [monitoring], [workspace] sections\n```\n\n### Enterprise Platform Config\n\n```\nnickel export --format toml provisioning/platform/config/examples/orchestrator.enterprise.example.ncl\n# Output: TOML with HA, S3, Redis, tracing configuration\n```\n\n---\n\n## Configuration Files Reference\n\n### Platform Configs (services internally)\n\n```\nprovisioning/platform/config/\n├── runtime/generated/*.toml          # Auto-generated by ConfigLoader\n├── examples/                         # Reference implementations\n│   ├── orchestrator.solo.example.ncl\n│   ├── orchestrator.multiuser.example.ncl\n│   └── orchestrator.enterprise.example.ncl\n└── README.md\n```\n\n### Infrastructure Schemas\n\n```\nprovisioning/schemas/infrastructure/\n├── docker-compose.ncl                # 232 lines\n├── kubernetes.ncl                    # 376 lines\n├── nginx.ncl                         # 233 lines\n├── prometheus.ncl                    # 280 lines\n├── systemd.ncl                       # 235 lines\n├── oci-registry.ncl                  # 221 lines\n├── examples-solo-deployment.ncl      # 27 lines\n├── examples-enterprise-deployment.ncl # 27 lines\n└── README.md\n```\n\n### TypeDialog Integration\n\n```\nprovisioning/platform/.typedialog/provisioning/platform/\n├── forms/                            # Ready for auto-generated forms\n├── templates/service-form.template.j2\n├── schemas/ → ../../schemas          # Symlink\n├── constraints/constraints.toml       # Validation rules\n└── README.md\n```\n\n### Automation Scripts\n\n```\nprovisioning/platform/scripts/\n├── generate-infrastructure-configs.nu  # Generate all configs\n├── validate-infrastructure.nu          # Validate with tools\n└── setup-with-forms.sh                # Interactive wizard\n```\n\n---\n\n## Integration Status\n\n| Component | Status | Details |\n| ----------- | -------- | --------- |\n| **Infrastructure Schemas** | ✅ Complete | 6 schemas, 1,577 lines, all validated |\n| **Deployment Examples** | ✅ Complete | 2 examples (solo + enterprise), tested |\n| **Generation Scripts** | ✅ Complete | Auto-generate configs for all modes |\n| **Validation Scripts** | ✅ Complete | Validate Docker, K8s, Nginx, Prometheus |\n| **Platform Config** | ✅ Complete | 36 TOML files in runtime/generated/ |\n| **TypeDialog Forms** | ✅ Ready | Forms + bash wrappers created, awaiting binary |\n| **Setup Wizard** | ✅ Active | Basic prompts as fallback |\n| **Documentation** | ✅ Complete | All guides updated with examples |\n\n---\n\n## Next Steps\n\n### Now Available\n- Generate infrastructure configs for solo/enterprise modes\n- Validate generated configs with format-specific tools\n- Use interactive setup wizard with basic Nushell prompts\n- TypeDialog forms created and ready (awaiting binary install)\n- Deploy with Docker/Kubernetes using generated configs\n\n### When TypeDialog Binary Becomes Available\n- Install TypeDialog binary\n- TypeDialog forms already created (setup, auth, MFA)\n- Bash wrappers handle TTY input (no Nushell stack issues)\n- Full nickel-roundtrip workflow will be enabled\n\n---\n\n## Key Files\n\n**Schemas**:\n- `provisioning/schemas/infrastructure/` - All infrastructure schemas\n\n**Examples**:\n- `provisioning/schemas/infrastructure/examples-solo-deployment.ncl`\n- `provisioning/schemas/infrastructure/examples-enterprise-deployment.ncl`\n\n**Platform Configs**:\n- `provisioning/platform/config/examples/` - Platform config examples\n- `provisioning/platform/config/runtime/generated/` - Generated TOML files\n\n**Scripts**:\n- `provisioning/platform/scripts/generate-infrastructure-configs.nu`\n- `provisioning/platform/scripts/validate-infrastructure.nu`\n- `provisioning/platform/scripts/setup-with-forms.sh`\n\n**Documentation**:\n- `provisioning/docs/src/guides/infrastructure-setup.md` - This guide\n- `provisioning/schemas/infrastructure/README.md` - Infrastructure schema reference\n- `provisioning/platform/config/examples/README.md` - Platform config guide\n- `provisioning/platform/.typedialog/README.md` - TypeDialog integration guide\n\n---\n\n**Version**: 1.0.0\n**Last Updated**: 2025-01-06\n**Status**: Production Ready
