diff --git a/scripts/03_generate_secrets.sh b/scripts/03_generate_secrets.sh index 524a262..36ee72b 100755 --- a/scripts/03_generate_secrets.sh +++ b/scripts/03_generate_secrets.sh @@ -78,7 +78,6 @@ else fi # Install Caddy -log_info "Installing Caddy..." curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --yes --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list apt install -y caddy @@ -115,6 +114,7 @@ while true; do done # Prompt for user email +echo "" echo "Please enter your email address. This email will be used for:" echo " - Login to Flowise" echo " - Login to Supabase" @@ -153,6 +153,7 @@ else fi # Prompt for OpenAI API key (optional) +echo "" echo "OpenAI API Key (optional). This key will be used for:" echo " - Supabase: AI services to help with writing SQL queries, statements, and policies" echo " - Crawl4AI: Default LLM configuration for web crawling capabilities" @@ -173,6 +174,7 @@ else fi # Ask if user wants to import ready-made workflow for n8n +echo "" echo "Do you want to import 300 ready-made workflows for n8n? This process may take about 30 minutes to complete." if [[ -n "${existing_env_vars[RUN_N8N_IMPORT]}" ]]; then RUN_N8N_IMPORT="${existing_env_vars[RUN_N8N_IMPORT]}" @@ -210,7 +212,6 @@ if [[ -n "${existing_env_vars[N8N_WORKER_COUNT]}" ]]; then read -p "Update n8n workers to $N8N_WORKER_COUNT_TEMP? (y/N): " confirm_change if [[ "$confirm_change" =~ ^[Yy]$ ]]; then N8N_WORKER_COUNT="$N8N_WORKER_COUNT_TEMP" - log_info "N8N_WORKER_COUNT set to $N8N_WORKER_COUNT." else N8N_WORKER_COUNT="$N8N_WORKER_COUNT_CURRENT" log_info "Change declined. Keeping N8N_WORKER_COUNT at $N8N_WORKER_COUNT." @@ -453,14 +454,12 @@ fi # Generate the actual JWT tokens using the JWT_SECRET_TO_USE, if not already set if [[ -z "${generated_values[ANON_KEY]}" ]]; then - log_info "Generating ANON_KEY..." generated_values["ANON_KEY"]=$(create_jwt "anon" "$JWT_SECRET_TO_USE") else log_info "Using existing ANON_KEY." fi if [[ -z "${generated_values[SERVICE_ROLE_KEY]}" ]]; then - log_info "Generating SERVICE_ROLE_KEY..." generated_values["SERVICE_ROLE_KEY"]=$(create_jwt "service_role" "$JWT_SECRET_TO_USE") else log_info "Using existing SERVICE_ROLE_KEY." @@ -548,7 +547,6 @@ for key in "${!generated_values[@]}"; do done # Hash passwords using caddy with bcrypt -log_info "Hashing passwords with caddy using bcrypt..." PROMETHEUS_PLAIN_PASS="${generated_values["PROMETHEUS_PASSWORD"]}" SEARXNG_PLAIN_PASS="${generated_values["SEARXNG_PASSWORD"]}" @@ -589,7 +587,6 @@ else fi # Uninstall caddy -log_info "Uninstalling caddy..." apt remove -y caddy exit 0 \ No newline at end of file diff --git a/scripts/04_wizard.sh b/scripts/04_wizard.sh index 8721ec7..0372bda 100755 --- a/scripts/04_wizard.sh +++ b/scripts/04_wizard.sh @@ -7,6 +7,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" ENV_FILE="$PROJECT_ROOT/.env" + +# Source the utilities file +source "$(dirname "$0")/utils.sh" + # UTILS_SCRIPT="$SCRIPT_DIR/utils.sh" # Uncomment if utils.sh contains relevant functions # if [ -f "$UTILS_SCRIPT" ]; then @@ -16,12 +20,10 @@ ENV_FILE="$PROJECT_ROOT/.env" # Function to check if whiptail is installed check_whiptail() { if ! command -v whiptail &> /dev/null; then - echo "--------------------------------------------------------------------" - echo "ERROR: 'whiptail' is not installed." - echo "This tool is required for the interactive service selection." - echo "On Debian/Ubuntu, you can install it using: sudo apt-get install whiptail" - echo "Please install whiptail and try again." - echo "--------------------------------------------------------------------" + log_error "'whiptail' is not installed." + log_info "This tool is required for the interactive service selection." + log_info "On Debian/Ubuntu, you can install it using: sudo apt-get install whiptail" + log_info "Please install whiptail and try again." exit 1 fi } @@ -107,10 +109,8 @@ fi # Exit if user pressed Cancel or Esc exitstatus=$? if [ $exitstatus -ne 0 ]; then - echo "--------------------------------------------------------------------" - echo "INFO: Service selection cancelled by user. Exiting wizard." - echo "No changes made to service profiles. Default services will be used." - echo "--------------------------------------------------------------------" + log_info "Service selection cancelled by user. Exiting wizard." + log_info "No changes made to service profiles. Default services will be used." # Set COMPOSE_PROFILES to empty to ensure only core services run if [ ! -f "$ENV_FILE" ]; then touch "$ENV_FILE" @@ -181,21 +181,20 @@ if [ $ollama_selected -eq 1 ]; then if [ $ollama_exitstatus -eq 0 ] && [ -n "$CHOSEN_OLLAMA_PROFILE" ]; then selected_profiles+=("$CHOSEN_OLLAMA_PROFILE") ollama_profile="$CHOSEN_OLLAMA_PROFILE" # Store for user message - echo "INFO: Ollama hardware profile selected: $CHOSEN_OLLAMA_PROFILE" + log_info "Ollama hardware profile selected: $CHOSEN_OLLAMA_PROFILE" else - echo "INFO: Ollama hardware profile selection cancelled or no choice made. Ollama will not be configured with a specific hardware profile." + log_info "Ollama hardware profile selection cancelled or no choice made. Ollama will not be configured with a specific hardware profile." # ollama_selected remains 1, but no specific profile is added. # This means "ollama" won't be in COMPOSE_PROFILES unless a hardware profile is chosen. ollama_selected=0 # Mark as not fully selected if profile choice is cancelled fi fi -echo "--------------------------------------------------------------------" if [ ${#selected_profiles[@]} -eq 0 ]; then - echo "INFO: No optional services selected." + log_info "No optional services selected." COMPOSE_PROFILES_VALUE="" else - echo "INFO: You have selected the following service profiles to be deployed:" + log_info "You have selected the following service profiles to be deployed:" # Join the array into a comma-separated string COMPOSE_PROFILES_VALUE=$(IFS=,; echo "${selected_profiles[*]}") for profile in "${selected_profiles[@]}"; do @@ -211,12 +210,11 @@ else fi done fi -echo "--------------------------------------------------------------------" # Update or add COMPOSE_PROFILES in .env file # Ensure .env file exists (it should have been created by 03_generate_secrets.sh or exist from previous run) if [ ! -f "$ENV_FILE" ]; then - echo "WARNING: '.env' file not found at $ENV_FILE. Creating it." + log_warning "'.env' file not found at $ENV_FILE. Creating it." touch "$ENV_FILE" fi @@ -228,13 +226,12 @@ fi # Add the new COMPOSE_PROFILES line echo "COMPOSE_PROFILES=${COMPOSE_PROFILES_VALUE}" >> "$ENV_FILE" -echo "INFO: COMPOSE_PROFILES has been set in '$ENV_FILE'." +log_info "COMPOSE_PROFILES has been set in '$ENV_FILE'." if [ -z "$COMPOSE_PROFILES_VALUE" ]; then - echo "Only core services (Caddy, Postgres, Redis) will be started." + log_info "Only core services (Caddy, Postgres, Redis) will be started." else - echo "The following Docker Compose profiles will be active: ${COMPOSE_PROFILES_VALUE}" + log_info "The following Docker Compose profiles will be active: ${COMPOSE_PROFILES_VALUE}" fi -echo "--------------------------------------------------------------------" # Make the script executable (though install.sh calls it with bash) chmod +x "$SCRIPT_DIR/04_wizard.sh" diff --git a/scripts/apply_update.sh b/scripts/apply_update.sh index 64de275..d2b3ff3 100755 --- a/scripts/apply_update.sh +++ b/scripts/apply_update.sh @@ -7,7 +7,6 @@ source "$(dirname "$0")/utils.sh" # Set the compose command explicitly to use docker compose subcommand COMPOSE_CMD="docker compose" -log_info "Using $COMPOSE_CMD as compose command for update application" # Navigate to the directory where this script is located SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" @@ -56,9 +55,6 @@ SUPABASE_COMPOSE_FILE_PATH="$SUPABASE_DOCKER_DIR/docker-compose.yml" # Check if Supabase directory and its docker-compose.yml exist if [ -d "$SUPABASE_DOCKER_DIR" ] && [ -f "$SUPABASE_COMPOSE_FILE_PATH" ]; then COMPOSE_FILES_FOR_PULL+=("-f" "$SUPABASE_COMPOSE_FILE_PATH") - log_info "Supabase docker-compose.yml found, will be included for pull if Supabase is selected." -else - log_info "Supabase docker-compose.yml not found or directory does not exist, skipping for pull consideration." fi # Use the project name "localai" for consistency. diff --git a/scripts/install.sh b/scripts/install.sh index 252ee6a..830b027 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -81,27 +81,27 @@ fi # Run installation steps sequentially using their full paths -log_info "Step 1: System Preparation..." +log_info "========== STEP 1: System Preparation ==========" bash "$SCRIPT_DIR/01_system_preparation.sh" || { log_error "System Preparation failed"; exit 1; } log_success "System preparation complete!" -log_info "Step 2: Installing Docker..." +log_info "========== STEP 2: Installing Docker ==========" bash "$SCRIPT_DIR/02_install_docker.sh" || { log_error "Docker Installation failed"; exit 1; } log_success "Docker installation complete!" -log_info "Step 3: Generating Secrets and Configuration..." +log_info "========== STEP 3: Generating Secrets and Configuration ==========" bash "$SCRIPT_DIR/03_generate_secrets.sh" || { log_error "Secret/Config Generation failed"; exit 1; } log_success "Secret/Config Generation complete!" -log_info "Step 4: Running Service Selection Wizard..." +log_info "========== STEP 4: Running Service Selection Wizard ==========" bash "$SCRIPT_DIR/04_wizard.sh" || { log_error "Service Selection Wizard failed"; exit 1; } log_success "Service Selection Wizard complete!" -log_info "Step 5: Running Services..." +log_info "========== STEP 5: Running Services ==========" bash "$SCRIPT_DIR/05_run_services.sh" || { log_error "Running Services failed"; exit 1; } log_success "Running Services complete!" -log_info "Step 6: Generating Final Report..." +log_info "========== STEP 6: Generating Final Report ==========" # --- Installation Summary --- log_info "Installation Summary. The following steps were performed by the scripts:" log_success "- System updated and basic utilities installed" @@ -115,6 +115,4 @@ log_success "- Services launched via Docker Compose" bash "$SCRIPT_DIR/06_final_report.sh" || { log_error "Final Report Generation failed"; exit 1; } log_success "Final Report Generation complete!" -log_message "SUCCESS" "Installation process completed!" - exit 0 \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index 8f3023c..2904c4b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -43,7 +43,6 @@ else fi # Execute the rest of the update process using the (potentially updated) apply_update.sh -log_info "Handing over to apply_update.sh..." bash "$APPLY_UPDATE_SCRIPT" # The final success message will now come from apply_update.sh