From 6eabd0cf2eb25eebd27f73fd920720028b78da58 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Mon, 13 Apr 2026 16:25:16 +0200 Subject: [PATCH] feat(installer): add interactive prompts for simple and expert modes --- installer/install.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/installer/install.sh b/installer/install.sh index 6089102..2b70bae 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -375,3 +375,101 @@ detect_existing_install() { load_config_file "$dir/cameleer.conf" fi } + +# --- Interactive prompts --- + +select_mode() { + if [ -n "$MODE" ]; then return; fi + echo "" + echo " Installation mode:" + echo " [1] Simple — 6 questions, sensible defaults (recommended)" + echo " [2] Expert — configure everything" + echo "" + local choice + read -rp " Select mode [1]: " choice + case "${choice:-1}" in + 2) MODE="expert" ;; + *) MODE="simple" ;; + esac +} + +run_simple_prompts() { + echo "" + echo -e "${BOLD}--- Simple Installation ---${NC}" + echo "" + + prompt INSTALL_DIR "Install directory" "${INSTALL_DIR:-$DEFAULT_INSTALL_DIR}" + prompt PUBLIC_HOST "Public hostname" "${PUBLIC_HOST:-localhost}" + prompt ADMIN_USER "Admin username" "${ADMIN_USER:-$DEFAULT_ADMIN_USER}" + + if prompt_yesno "Auto-generate admin password?" "y"; then + ADMIN_PASS="" + else + prompt_password ADMIN_PASS "Admin password" "" + fi + + echo "" + if prompt_yesno "Use custom TLS certificates? (no = self-signed)"; then + TLS_MODE="custom" + prompt CERT_FILE "Path to certificate file (PEM)" "" + prompt KEY_FILE "Path to private key file (PEM)" "" + if prompt_yesno "Include CA bundle?"; then + prompt CA_FILE "Path to CA bundle (PEM)" "" + fi + else + TLS_MODE="self-signed" + fi + + echo "" + prompt MONITORING_NETWORK "Monitoring network name (empty = skip)" "" +} + +run_expert_prompts() { + echo "" + echo -e "${BOLD}--- Expert Installation ---${NC}" + + run_simple_prompts + + echo "" + echo -e "${BOLD} Credentials:${NC}" + if prompt_yesno "Auto-generate database passwords?" "y"; then + POSTGRES_PASSWORD="" + CLICKHOUSE_PASSWORD="" + else + prompt_password POSTGRES_PASSWORD "PostgreSQL password" "" + prompt_password CLICKHOUSE_PASSWORD "ClickHouse password" "" + fi + + echo "" + if prompt_yesno "Enable vendor account?"; then + VENDOR_ENABLED="true" + prompt VENDOR_USER "Vendor username" "${VENDOR_USER:-$DEFAULT_VENDOR_USER}" + if prompt_yesno "Auto-generate vendor password?" "y"; then + VENDOR_PASS="" + else + prompt_password VENDOR_PASS "Vendor password" "" + fi + else + VENDOR_ENABLED="false" + fi + + echo "" + echo -e "${BOLD} Networking:${NC}" + prompt HTTP_PORT "HTTP port" "${HTTP_PORT:-$DEFAULT_HTTP_PORT}" + prompt HTTPS_PORT "HTTPS port" "${HTTPS_PORT:-$DEFAULT_HTTPS_PORT}" + prompt LOGTO_CONSOLE_PORT "Logto admin console port" "${LOGTO_CONSOLE_PORT:-$DEFAULT_LOGTO_CONSOLE_PORT}" + + echo "" + echo -e "${BOLD} Docker:${NC}" + prompt VERSION "Image version/tag" "${VERSION:-$CAMELEER_DEFAULT_VERSION}" + prompt COMPOSE_PROJECT "Compose project name" "${COMPOSE_PROJECT:-$DEFAULT_COMPOSE_PROJECT}" + prompt DOCKER_SOCKET "Docker socket path" "${DOCKER_SOCKET:-$DEFAULT_DOCKER_SOCKET}" + + echo "" + echo -e "${BOLD} Logto:${NC}" + if prompt_yesno "Expose Logto admin console externally?" "y"; then + LOGTO_CONSOLE_EXPOSED="true" + else + LOGTO_CONSOLE_EXPOSED="false" + fi +}