# Provisioning System - Standalone Infrastructure Automation # Modern justfile for infrastructure provisioning and automation # ============================================================ # Import provisioning module justfiles import 'justfiles/build.just' import 'justfiles/package.just' import 'justfiles/release.just' import 'justfiles/dev.just' import 'justfiles/platform.just' import 'justfiles/installer.just' # ============================================================================ # Provisioning Configuration # ============================================================================ # Project metadata provisioning_name := "provisioning" version := `git describe --tags --always --dirty 2>/dev/null || echo "dev-$(date +%Y%m%d)"` build_time := `date -u +"%Y-%m-%dT%H:%M:%SZ"` git_commit := `git rev-parse HEAD 2>/dev/null || echo "unknown"` # Directories provisioning_root := justfile_directory() project_root := provisioning_root / ".." tools_dir := provisioning_root / "tools" build_dir := project_root / "target" dist_dir := project_root / "dist" packages_dir := project_root / "packages" # Build configuration rust_target := "x86_64-unknown-linux-gnu" build_mode := "release" platforms := "linux-amd64,macos-amd64,windows-amd64" variants := "complete,minimal" # Tools nu := "nu" cargo := "cargo" docker := "docker" # Flags verbose := "false" dry_run := "false" parallel := "true" # ============================================================================ # Default Recipe - Show Help # ============================================================================ # Show concise provisioning overview @default: echo "๐Ÿ—๏ธ PROVISIONING SYSTEM - INFRASTRUCTURE AUTOMATION" echo "===================================================" echo "" echo "๐Ÿš€ QUICK START" echo " just all - Complete pipeline (build + package + test)" echo " just quick - Fast development build" echo " just ci - Full CI/CD pipeline" echo "" echo "๐Ÿ“ฆ KEY MODULES" echo " ๐Ÿ—๏ธ build - Platform binaries & core libraries (just build-help)" echo " ๐Ÿ“ฆ package - Distribution packaging & containers (just package-help)" echo " ๐Ÿš€ release - Release management & artifacts (just release-help)" echo " ๐Ÿ”ง dev - Development workflows & testing (just dev-help)" echo " โšก platform - Platform services & orchestration (just platform-help)" echo " ๐Ÿ“ฆ installer - Interactive installer & config mgmt (just installer-help)" echo "" echo "๐Ÿ” DETAILED HELP" echo " just help - Show this overview" echo " just help-full - Show comprehensive help" echo " just --list - List all available recipes" echo "" echo "๐Ÿ’ก VERSION: {{version}} | Build: {{build_mode}} | Target: {{rust_target}}" # ============================================================================ # Meta Recipes # ============================================================================ # Show concise provisioning overview (alias for default) @help: just --justfile {{justfile()}} default # Show comprehensive provisioning help @help-full: echo "๐Ÿ—๏ธ PROVISIONING SYSTEM - COMPREHENSIVE HELP" echo "=============================================" echo "" echo "STANDALONE INFRASTRUCTURE AUTOMATION TOOLKIT" echo "This system can be used independently or as part of a larger project ecosystem" echo "for cloud-native deployments across multiple providers (UpCloud, AWS, Local)." echo "" echo "๐Ÿ“ฆ BUILD MODULE (build.just) - DETAILED" echo " Complete build system for platform binaries and core libraries" echo " โ€ข build-all - Build all components (platform + core + KCL)" echo " โ€ข build-platform - Build platform binaries for all targets" echo " โ€ข build-core - Bundle core Nushell libraries" echo " โ€ข validate-kcl - Validate and compile KCL schemas" echo " โ€ข build-cross - Cross-compile for multiple platforms" echo " โ€ข build-debug - Debug build with symbols" echo " โ€ข build-wasm - WebAssembly target build" echo " โ€ข build-libs - Library components only" echo "" echo "๐Ÿ“ฆ PACKAGE MODULE (package.just) - DETAILED" echo " Distribution packaging and container management" echo " โ€ข package-all - Create all distribution packages" echo " โ€ข package-binaries - Package binaries for distribution" echo " โ€ข package-containers - Build container images" echo " โ€ข create-archives - Create distribution archives" echo " โ€ข create-installers - Create installation packages" echo " โ€ข package-minimal - Minimal distribution package" echo " โ€ข package-complete - Complete distribution with docs" echo "" echo "๐Ÿš€ RELEASE MODULE (release.just) - DETAILED" echo " Release management and artifact distribution" echo " โ€ข release - Create complete release (VERSION required)" echo " โ€ข release-draft - Create draft release" echo " โ€ข upload-artifacts - Upload release artifacts" echo " โ€ข notify-release - Send release notifications" echo " โ€ข publish-registry - Publish to package registries" echo " โ€ข tag-release - Git tag with version" echo "" echo "๐Ÿ”ง DEVELOPMENT MODULE (dev.just) - DETAILED" echo " Development workflows and testing utilities" echo " โ€ข dev-build - Quick development build" echo " โ€ข test-build - Test build system" echo " โ€ข test-dist - Test generated distributions" echo " โ€ข validate-all - Validate all components" echo " โ€ข benchmark - Run build benchmarks" echo " โ€ข watch-build - Watch and rebuild on changes" echo " โ€ข format-code - Format all source code" echo " โ€ข lint-check - Run linting checks" echo "" echo "โšก PLATFORM MODULE (platform.just) - DETAILED" echo " Platform services and orchestration" echo " โ€ข orchestrator - Rust orchestrator management" echo " โ€ข control-center - Web control center" echo " โ€ข mcp-server - Model Context Protocol server" echo " โ€ข api-gateway - REST API gateway" echo " โ€ข platform-status - All platform services status" echo "" echo "๐Ÿ“ฆ INSTALLER MODULE (installer.just) - DETAILED" echo " Interactive installer and configuration management" echo " โ€ข installer-build - Build installer binary" echo " โ€ข installer-run - Run interactive TUI installer" echo " โ€ข installer-headless - Run in headless mode" echo " โ€ข installer-unattended - Run in unattended mode" echo " โ€ข config-review - Review installer configuration" echo " โ€ข config-validate - Validate config file" echo " โ€ข install - Install provisioning platform" echo " โ€ข update - Update existing installation" echo " โ€ข installer-help - Complete installer module help" echo "" echo "โšก QUICK WORKFLOWS" echo " just all - Complete build, package, and test pipeline" echo " just quick - Fast development build" echo " just ci - CI/CD pipeline (build + test + package)" echo " just init - Initialize provisioning environment" echo " just status - Show current provisioning status" echo "" echo "๐Ÿ” SYSTEM MANAGEMENT" echo " just check-tools - Validate required tools (nu, cargo, docker, git, kcl)" echo " just clean - Clean all build artifacts" echo " just create-dirs - Create necessary directories" echo " just show-dirs - Show directory structure" echo " just info - Show detailed system information" echo " just validate-system - Complete system validation" echo "" echo "๐Ÿ“Š CURRENT CONFIGURATION" echo " System Name: {{provisioning_name}}" echo " Version: {{version}}" echo " Git Commit: {{git_commit}}" echo " Build Mode: {{build_mode}}" echo " Platforms: {{platforms}}" echo " Target: {{rust_target}}" echo " Variants: {{variants}}" echo " Root: {{provisioning_root}}" echo "" echo "๐Ÿ’ก PRACTICAL EXAMPLES" echo " # Complete development workflow" echo " just init && just all" echo "" echo " # Quick development iteration" echo " just dev-build && just test-dist" echo "" echo " # Release workflow" echo " just ci && just release VERSION=2.1.0" echo "" echo " # Platform services" echo " just orchestrator start && just api-gateway" echo "" echo " # Module-specific operations" echo " just build-platform && just package-containers" # Complete build, package, and test pipeline @all: clean build-all package-all test-dist echo "โœ… Complete provisioning pipeline finished successfully" # Quick development workflow @quick: dev-build echo "โšก Quick provisioning development build completed" # CI/CD pipeline @ci: clean build-all test-dist package-all echo "๐Ÿš€ Provisioning CI/CD pipeline completed successfully" # Show current provisioning status @status: echo "๐Ÿ“Š PROVISIONING SYSTEM STATUS" echo "=============================" echo "Name: {{provisioning_name}}" echo "Version: {{version}}" echo "Git Commit: {{git_commit}}" echo "Build Time: {{build_time}}" echo "" echo "Directories:" echo " Provisioning: {{provisioning_root}}" echo " Project Root: {{project_root}}" echo " Tools: {{tools_dir}}" echo " Build: {{build_dir}}" echo " Distribution: {{dist_dir}}" echo " Packages: {{packages_dir}}" # ============================================================================ # Environment Validation # ============================================================================ # Validate that all required tools are available @check-tools: #!/usr/bin/env bash echo "๐Ÿ” Checking required tools..." check_tool() { if command -v "$1" >/dev/null 2>&1; then echo "โœ… $1: $(command -v "$1")" else echo "โŒ $1: not found" exit 1 fi } check_tool nu check_tool cargo check_tool docker check_tool git check_tool kcl echo "โœ… All required tools are available" # Initialize provisioning environment @init: check-tools echo "๐Ÿš€ Initializing provisioning environment..." mkdir -p "{{build_dir}}" "{{dist_dir}}" "{{packages_dir}}" echo "โœ… Provisioning environment initialized" # ============================================================================ # Directory Operations # ============================================================================ # Create necessary directories @create-dirs: mkdir -p "{{build_dir}}" "{{dist_dir}}" "{{packages_dir}}" mkdir -p "{{dist_dir}}/platform" "{{dist_dir}}/core" "{{dist_dir}}/kcl" # Clean all build artifacts @clean: echo "๐Ÿงน Cleaning provisioning build artifacts..." {{nu}} {{tools_dir}}/build/clean-build.nu \ --scope all \ --force \ --verbose={{verbose}} rm -rf {{dist_dir}} {{packages_dir}} {{build_dir}} mkdir -p {{dist_dir}} {{packages_dir}} {{build_dir}} echo "โœ… All provisioning build artifacts cleaned" # Show directory structure @show-dirs: tree -d -L 3 "{{provisioning_root}}" || ls -la "{{provisioning_root}}" # ============================================================================ # Integration Points # ============================================================================ # Export provisioning configuration for external use @export-config: echo "๐Ÿ“ค Exporting provisioning configuration..." echo "PROVISIONING_VERSION={{version}}" echo "PROVISIONING_BUILD_MODE={{build_mode}}" echo "PROVISIONING_PLATFORMS={{platforms}}" echo "PROVISIONING_ROOT={{provisioning_root}}" echo "PROVISIONING_TOOLS={{tools_dir}}" # Validate provisioning system integrity @validate-system: echo "๐Ÿ” Validating provisioning system..." just check-tools just validate-all echo "โœ… Provisioning system validation completed" # Show system information @info: #!/usr/bin/env bash echo "๐Ÿ” PROVISIONING SYSTEM INFORMATION" echo "==================================" echo "Operating System:" echo " OS: $(uname -s -r)" echo " Architecture: $(uname -m)" echo " User: $(whoami)" echo " Working Dir: {{provisioning_root}}" echo "" echo "Tool Versions:" tools=("nu" "cargo" "rustc" "docker" "git" "kcl") for tool in "${tools[@]}"; do if command -v "$tool" >/dev/null 2>&1; then version=$($tool --version 2>/dev/null | head -1 | cut -d' ' -f2- || echo "unknown") echo " $tool: $version" else echo " $tool: not found" fi done