diff --git a/ct/clickhouse.sh b/ct/clickhouse.sh index 6fb68b54..05a2ed8f 100644 --- a/ct/clickhouse.sh +++ b/ct/clickhouse.sh @@ -32,10 +32,7 @@ function update_script() { setup_clickhouse if [[ -f /opt/clickstack/.env ]]; then - CURRENT_HDX_VERSION=$(cat ~/.clickstack 2>/dev/null || echo "none") - LATEST_HDX_VERSION=$(curl -fsSL "https://api.github.com/repos/hyperdxio/hyperdx/releases" | grep -oP '"tag_name": "@hyperdx/app@\K[^"]+' | head -1) - - if [[ "$CURRENT_HDX_VERSION" != "$LATEST_HDX_VERSION" ]]; then + if check_for_gh_release "clickstack" "hyperdxio/hyperdx"; then msg_info "Stopping ClickStack Services" systemctl stop clickstack-app clickstack-api msg_ok "Stopped ClickStack Services" @@ -44,10 +41,7 @@ function update_script() { cp /opt/clickstack/.env /opt/clickstack.env.bak msg_ok "Backed up Data" - msg_info "Updating HyperDX" - rm -rf /opt/clickstack - $STD git clone --depth 1 --branch "@hyperdx/app@${LATEST_HDX_VERSION}" https://github.com/hyperdxio/hyperdx.git /opt/clickstack - msg_ok "Updated HyperDX Source" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "clickstack" "hyperdxio/hyperdx" "tarball" "latest" "/opt/clickstack" cd /opt/clickstack $STD corepack enable @@ -69,11 +63,7 @@ function update_script() { msg_info "Starting ClickStack Services" systemctl start clickstack-api clickstack-app msg_ok "Started ClickStack Services" - - echo "${LATEST_HDX_VERSION}" >~/.clickstack - msg_ok "Updated HyperDX to v${LATEST_HDX_VERSION}" - else - msg_ok "HyperDX is already up to date (v${CURRENT_HDX_VERSION})" + msg_ok "Updated successfully!" fi if check_for_gh_release "otelcol" "open-telemetry/opentelemetry-collector-releases"; then diff --git a/install/clickhouse-install.sh b/install/clickhouse-install.sh index d418e0b1..0564f452 100644 --- a/install/clickhouse-install.sh +++ b/install/clickhouse-install.sh @@ -28,7 +28,6 @@ if [[ "${CLICKSTACK:-}" == "yes" ]]; then msg_info "Installing Dependencies" $STD apt install -y \ build-essential \ - git \ python3 msg_ok "Installed Dependencies" @@ -196,11 +195,7 @@ service: EOF msg_ok "Configured OTel Collector" - msg_info "Cloning HyperDX" - HDX_VERSION=$(curl -fsSL "https://api.github.com/repos/hyperdxio/hyperdx/releases" | grep -oP '"tag_name": "@hyperdx/app@\K[^"]+' | head -1) - $STD git clone --depth 1 --branch "@hyperdx/app@${HDX_VERSION}" https://github.com/hyperdxio/hyperdx.git /opt/clickstack - echo "${HDX_VERSION}" >~/.clickstack - msg_ok "Cloned HyperDX v${HDX_VERSION}" + fetch_and_deploy_gh_release "clickstack" "hyperdxio/hyperdx" "tarball" "latest" "/opt/clickstack" msg_info "Enabling Corepack" cd /opt/clickstack