feat(installer): add main function and complete install.sh

Appends the main() entry point that wires together all installer phases:
arg parsing, config loading, rerun detection, prerequisites, auto-detect,
interactive prompts, config merge/validate, password generation, file
generation, docker pull/up, health verification, and output printing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-13 16:33:15 +02:00
parent b01f6e5109
commit 7f15177310

View File

@@ -636,7 +636,7 @@ generate_compose_file() {
cat >> "$f" << 'EOF' cat >> "$f" << 'EOF'
# Cameleer SaaS Platform # Cameleer SaaS Platform
# Generated by Cameleer installer <20> do not edit manually # Generated by Cameleer installer <20> do not edit manually
services: services:
traefik: traefik:
@@ -950,7 +950,7 @@ verify_health() {
echo "" echo ""
if [ $failed -ne 0 ]; then if [ $failed -ne 0 ]; then
log_error "Installation verification failed. Stack is running <20> check logs." log_error "Installation verification failed. Stack is running <20> check logs."
exit 1 exit 1
fi fi
log_success "All services healthy." log_success "All services healthy."
@@ -1031,7 +1031,7 @@ generate_install_doc() {
[ "$TLS_MODE" = "custom" ] && tls_desc="Custom certificate" [ "$TLS_MODE" = "custom" ] && tls_desc="Custom certificate"
cat > "$f" << EOF cat > "$f" << EOF
# Cameleer SaaS <20> Installation Documentation # Cameleer SaaS <20> Installation Documentation
## Installation Summary ## Installation Summary
@@ -1296,3 +1296,77 @@ handle_rerun() {
;; ;;
esac 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 "$@"