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:
@@ -636,7 +636,7 @@ generate_compose_file() {
|
||||
|
||||
cat >> "$f" << 'EOF'
|
||||
# Cameleer SaaS Platform
|
||||
# Generated by Cameleer installer <20> do not edit manually
|
||||
# Generated by Cameleer installer <20> 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 <20> check logs."
|
||||
log_error "Installation verification failed. Stack is running <20> 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 <20> Installation Documentation
|
||||
# Cameleer SaaS <20> 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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user