#!/bin/bash set -e set -o pipefail # Parse arguments SKIP_SCAFFOLD=false SKIP_CLUSTER=false SKIP_SERVICES=false while [[ $# -gt 0 ]]; do case $1 in --skip-cluster) SKIP_CLUSTER=true shift ;; --skip-services) SKIP_SERVICES=true shift ;; -h|--help) echo "Usage: $0 [component-options]" echo "" echo "Complete Wild Cloud setup - runs all components in sequence." echo "" echo "Component Control Options:" echo " --skip-scaffold Skip scaffold setup (cloud initialization)" echo " --skip-docs Skip cloud documentation setup" echo " --skip-cluster Skip cluster setup" echo " --skip-services Skip services setup" echo " -h, --help Show this help message" echo "" echo "This script runs:" echo " 1. wild-setup-scaffold # Cloud initialization and basic config" echo " 2. wild-setup-cluster # Cluster infrastructure" echo " 3. wild-setup-services # Cluster services" echo "" echo "You can also run these components individually:" echo " - wild-setup-scaffold [--update]" echo " - wild-setup-cluster [--skip-installer] [--skip-hardware] [--skip-configs]" echo " - wild-setup-services [--skip-install]" echo "" echo "For detailed options for each component, use:" echo " wild-setup-scaffold --help" echo " wild-setup-cluster --help" echo " wild-setup-services --help" exit 0 ;; -*) echo "Unknown option $1" echo "Usage: $0 [component-options]" echo "Use --help for full usage information" exit 1 ;; *) echo "Unexpected argument: $1" echo "Usage: $0 [component-options]" echo "Use --help for full usage information" exit 1 ;; esac done # Initialize Wild Cloud environment if [ -z "${WC_ROOT}" ]; then print "WC_ROOT is not set." exit 1 else source "${WC_ROOT}/scripts/common.sh" init_wild_env fi print_header "Wild Cloud Setup" # ============================================================================= # CLUSTER SETUP # ============================================================================= if [ "${SKIP_CLUSTER}" = false ]; then if wild-setup-cluster; then print_success "Cluster setup completed" else print_error "Cluster setup failed" exit 1 fi echo "" else print_info "Skipping Cluster Setup" fi # ============================================================================= # SERVICES SETUP # ============================================================================= if [ "${SKIP_SERVICES}" = false ]; then if wild-setup-services; then print_success "Services setup completed" else print_error "Services setup failed" exit 1 fi echo "" else print_info "Skipping cluster services setup" fi # ============================================================================= # FINAL SUMMARY # ============================================================================= print_header "Wild Cloud Setup Finished!" echo "" if [ "${SKIP_SERVICES}" = false ] && command -v kubectl >/dev/null 2>&1; then if [ -f "${WC_HOME}/config.yaml" ]; then INTERNAL_DOMAIN=$(wild-config cloud.internalDomain 2>/dev/null || echo "your-internal-domain") print_info "Your Wild Cloud is ready!" echo " Dashboard: https://dashboard.${INTERNAL_DOMAIN}" echo " Get token: ./bin/dashboard-token" fi else print_info "Complete the remaining setup steps to finalize your Wild Cloud deployment" fi print_success "Wild Cloud setup completed!"