veda/platform/scripts/install-all.sh

63 lines
1.9 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
# Get the directory where the script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMPONENTS_DIR="$(cd "${SCRIPT_DIR}/../components" && pwd)"
# Function to check prerequisites
check_prerequisites() {
echo "Checking prerequisites..."
command -v kubectl >/dev/null 2>&1 || { echo "kubectl is required but not installed"; exit 1; }
command -v helm >/dev/null 2>&1 || { echo "helm is required but not installed"; exit 1; }
# Check if we can connect to the cluster
kubectl cluster-info >/dev/null 2>&1 || { echo "Cannot connect to Kubernetes cluster"; exit 1; }
}
# Function to install a component
install_component() {
local component_dir=$1
local component_name=$(basename "${component_dir}")
echo
echo "================================================================"
echo "Installing component: ${component_name}"
echo "================================================================"
if [[ -f "${component_dir}/install.sh" ]]; then
bash "${component_dir}/install.sh"
else
echo "No install.sh found for ${component_name}, skipping..."
fi
}
# Main installation process
main() {
echo "Starting platform installation..."
echo
# Check prerequisites
check_prerequisites
# Get all component directories in order
components=($(find "${COMPONENTS_DIR}" -maxdepth 1 -mindepth 1 -type d | sort))
# Install each component
for component in "${components[@]}"; do
install_component "${component}"
done
echo
echo "================================================================"
echo "Platform installation complete!"
echo "================================================================"
echo
echo "To validate the installation, run:"
echo " ./validate.sh"
}
# Run main function
main "$@"