diff --git a/installer/install.sh b/installer/install.sh index 09c511b..93bd505 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -636,7 +636,7 @@ generate_compose_file() { cat >> "$f" << 'EOF' # Cameleer SaaS Platform -# Generated by Cameleer installer — do not edit manually +# Generated by Cameleer installer � do not edit manually services: traefik: @@ -950,7 +950,7 @@ verify_health() { echo "" if [ $failed -ne 0 ]; then - log_error "Installation verification failed. Stack is running — check logs." + log_error "Installation verification failed. Stack is running � check logs." exit 1 fi log_success "All services healthy." @@ -1031,7 +1031,7 @@ generate_install_doc() { [ "$TLS_MODE" = "custom" ] && tls_desc="Custom certificate" cat > "$f" << EOF -# Cameleer SaaS — Installation Documentation +# Cameleer SaaS � Installation Documentation ## Installation Summary @@ -1296,3 +1296,77 @@ handle_rerun() { ;; esac } + +# --- Main --- + +main() { + parse_args "$@" + + print_banner + + # Load config sources (CLI already loaded via parse_args) + if [ -n "$CONFIG_FILE_PATH" ]; then + load_config_file "$CONFIG_FILE_PATH" + fi + load_env_overrides + + # Check for existing installation + detect_existing_install + if [ "$IS_RERUN" = true ]; then + show_rerun_menu + handle_rerun + fi + + # Prerequisites + check_prerequisites + + # Auto-detect defaults + auto_detect + + # Interactive prompts (unless silent) + if [ "$MODE" != "silent" ]; then + select_mode + if [ "$MODE" = "expert" ]; then + run_expert_prompts + else + run_simple_prompts + fi + fi + + # Merge remaining defaults and validate + merge_config + validate_config + + # Generate passwords for any empty values + generate_passwords + + # Create install directory + mkdir -p "$INSTALL_DIR" + + # Copy custom certs if provided + if [ "$TLS_MODE" = "custom" ]; then + copy_certs + fi + + # Generate configuration files + generate_env_file + generate_compose_file + write_config_file + + # Pull and start + docker_compose_pull + docker_compose_up + + # Verify health + verify_health + + # Generate output files + generate_credentials_file + generate_install_doc + + # Print results + print_credentials + print_summary +} + +main "$@"