diff --git a/scripts/download-oss.ps1 b/scripts/download-oss.ps1 new file mode 100644 index 000000000..9a4425877 --- /dev/null +++ b/scripts/download-oss.ps1 @@ -0,0 +1,150 @@ +#!/usr/bin/env pwsh + +# Install latest Parseable OSS release. + +<# only supports windows, +# `SUPPORTED_OS` array contains the supported linux and darwin for filtering only +# `SUPPORTED_ARCH` array contains the supported architectures but only x86_64/amd64 are +# available for now. both amd64 and x86_64 are there cause windows does report either +# of them when querying for the architecture. +#> +[System.String[]]$SUPPORTED_ARCH = @("x86_64", "arm64", "amd64") + +# Progress bar in powershell slows down downloads a lot, disable it +# https://stackoverflow.com/questions/28682642/powershell-why-is-using-invoke-webrequest-much-slower-than-a-browser-download +$ProgressPreference = 'SilentlyContinue' + +# util functions +function Get-Env { + param([String] $Key) + + $RegisterKey = Get-Item -Path 'HKCU:' + $EnvRegisterKey = $RegisterKey.OpenSubKey('Environment') + $EnvRegisterKey.GetValue($Key, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) +} + +# These three environment functions are roughly copied from https://github.com/prefix-dev/pixi/pull/692 +# They are used instead of `SetEnvironmentVariable` because of unwanted variable expansions. +function Publish-Env { + if (-not ("Win32.NativeMethods" -as [Type])) { + <# dllimport should not be needed but still#> + Add-Type -Namespace Win32 -Name NativeMethods -MemberDefinition @" +[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] +public static extern IntPtr SendMessageTimeout( + IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, + uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); +"@ + } + $HWND_BROADCAST = [IntPtr] 0xffff + $WM_SETTINGCHANGE = 0x1a + $result = [UIntPtr]::Zero + [Win32.NativeMethods]::SendMessageTimeout($HWND_BROADCAST, + $WM_SETTINGCHANGE, + [UIntPtr]::Zero, + "Environment", + 2, + 5000, + [ref] $result + ) | Out-Null +} +function Write-Env { + param([String]$Key, [String]$Value) + + [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' + + + [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment', $true) + if ($null -eq $Value) { + $EnvRegisterKey.DeleteValue($Key) + } + else { + $RegistryValueKind = if ($Value.Contains('%')) { + [Microsoft.Win32.RegistryValueKind]::ExpandString + } + elseif ($EnvRegisterKey.GetValue($Key)) { + $EnvRegisterKey.GetValueKind($Key) + } + else { + [Microsoft.Win32.RegistryValueKind]::String + } + $EnvRegisterKey.SetValue($Key, $Value, $RegistryValueKind) + } + + Publish-Env +} + +function Get-Env { + param([String] $Key) + + [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' + [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment') + $EnvRegisterKey.GetValue($Key, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) +} + +# Get the system's CPU architecture and operating system +[String]$CPU_ARCH = "x86_64" +[String]$OS = "windows" +[String]$INSTALLDIR = "${HOME}\.parseable\bin" +[String]$BIN = "${INSTALLDIR}\parseable.exe" + +function Install-Parseable { + Write-Output "`n=========================`n" + Write-Output "OS: $OS" + Write-Output "CPU arch: $CPU_ARCH" + + # Check if the CPU architecture is supported + if ($SUPPORTED_ARCH -notcontains $CPU_ARCH) { + Write-Error "Unsupported CPU architecture ($CPU_ARCH)." + exit 1 + } + + Write-Output "Checking for existing installation..." + if (Test-Path $BIN) { + Write-Error "Parseable is already installed. Run 'parseable --version' to check the version." + Write-Error "Consider removing the existing installation" + exit 1 + } + + Write-Output "No existing installation found" + + Write-Output "Fetching latest release..." + # Get the latest release information using GitHub API + $release = Invoke-RestMethod -Uri "https://api.github.com/repos/parseablehq/parseable/releases/latest" + # Write-Host ($release | Format-List | Out-String) # Write-Host formats the object while printing + + $installation_found_flag = 0 + $required_installation = "Parseable_OSS_" + $CPU_ARCH + "-" + "pc" + "-" + $OS + "-msvc.exe" + # Loop through assets and select one based on `name` + foreach($asset in $release.assets) { + if ($asset.name -contains $required_installation) { + $installation_found_flag = 1 + $download_url = $asset.browser_download_url + # Create installdir since we were able to find the required installation + mkdir -Force $INSTALLDIR + } + } + + Write-Output "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH`n`n" + # Download the binary using Invoke-WebRequest + if ($installation_found_flag) { + Invoke-WebRequest -Uri $download_url -OutFile $BIN + } else { + Write-Output "Unable to find correct installation. Exiting" + exit + } + + + Write-Output "Adding Parseable to PATH..." + # Only try adding to path if there isn't already a bun.exe in the path + $Path = (Get-Env -Key "Path") -split ';' + if ($Path -notcontains $INSTALLDIR) { + $Path += $INSTALLDIR + Write-Env -Key 'Path' -Value ($Path -join ';') + $env:PATH = $Path; + } +} + +Install-Parseable + +Write-Output "Parseable was downloaded successfully! at $INSTALLDIR" +Write-Output "To get started, restart your terminal/editor, then type `"parseable`"`n" diff --git a/scripts/download-oss.sh b/scripts/download-oss.sh new file mode 100755 index 000000000..058e60048 --- /dev/null +++ b/scripts/download-oss.sh @@ -0,0 +1,193 @@ +#!/bin/sh + +# Install latest Parseable OSS release. + +DOWNLOAD_BASE_URL="https://github.com/parseablehq/parseable/releases/download" +INSTALL_DIR="${HOME}/.parseable" +BIN_DIR="${INSTALL_DIR}/bin" +BIN_NAME="${BIN_DIR}/parseable" + +# Get the system's CPU architecture and operating system. +CPU_ARCH=$(uname -m) +OS=$(uname -s | tr '[:upper:]' '[:lower:]') + +printf '\n=========================\n' +printf 'Detected CPU architecture: %s\n' "$CPU_ARCH" +printf 'Detected operating system: %s\n' "$OS" + +# Select one downloader and use it for both the release lookup and the binary. +if command -v curl >/dev/null 2>&1; then + DOWNLOADER="curl" +elif command -v wget >/dev/null 2>&1; then + DOWNLOADER="wget" +else + printf 'Error: Neither curl nor wget was found. Please install either curl or wget.\n' >&2 + exit 1 +fi + +# Match the platform names used by the release assets. Linux commonly reports +# ARM64 as "aarch64", while macOS reports it as "arm64". +case "${OS}_${CPU_ARCH}" in + darwin_arm64) + PARSEABLE_PREFIX="Parseable_OSS_aarch64-apple-darwin" + ;; + linux_arm64|linux_aarch64) + PARSEABLE_PREFIX="Parseable_OSS_aarch64-unknown-linux-gnu" + ;; + linux_x86_64|linux_amd64) + PARSEABLE_PREFIX="Parseable_OSS_x86_64-unknown-linux-gnu" + ;; + *) + printf 'Error: unsupported platform %s/%s.\n' "$OS" "$CPU_ARCH" >&2 + exit 1 + ;; +esac + +# Parseable's Linux release binaries require glibc. +if [ "$OS" = "linux" ]; then + MUSL_FOUND="false" + if command -v ldd >/dev/null 2>&1 && ldd --version 2>&1 | grep -qi musl; then + MUSL_FOUND="true" + else + for MUSL_LOADER in /lib/ld-musl-*.so.1; do + if [ -e "$MUSL_LOADER" ]; then + MUSL_FOUND="true" + break + fi + done + fi + if [ "$MUSL_FOUND" = "true" ]; then + printf 'Error: Alpine Linux and other musl-based systems are not supported by the available release binaries.\n' >&2 + exit 1 + fi +fi + +# Get the latest release tag from the GitHub API. +fetch_release() { + case "$DOWNLOADER" in + curl) + curl -fsSL "https://api.github.com/repos/parseablehq/parseable/releases/latest" + ;; + wget) + wget -q -O - "https://api.github.com/repos/parseablehq/parseable/releases/latest" + ;; + esac +} +if ! release=$(fetch_release); then + printf 'Error: Could not fetch the latest release information.\n' >&2 + exit 1 +fi +release_tag=$(printf '%s\n' "$release" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1) +if [ -z "$release_tag" ]; then + printf 'Error: Could not determine the latest release version.\n' >&2 + exit 1 +fi + +printf 'Latest Parseable version: %s\n' "$release_tag" + +download_url="${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX}" + +if [ -d "$INSTALL_DIR" ]; then + printf "A previous version of Parseable already exists. Run 'parseable --version' to check the version,\n" + printf 'or remove %s before installing a new version.\n' "$INSTALL_DIR" + exit 1 +fi +mkdir -p "$BIN_DIR" || { + printf 'Error: Could not create installation directory %s.\n' "$BIN_DIR" >&2 + rmdir "$BIN_DIR" "$INSTALL_DIR" 2>/dev/null || : + exit 1 +} + +TEMP_BIN="${BIN_NAME}.tmp" +# Remove files and empty directories created by an incomplete installation. +cleanup_install() { + rm -f "$TEMP_BIN" "$BIN_NAME" + rmdir "$BIN_DIR" "$INSTALL_DIR" 2>/dev/null || : +} +trap 'cleanup_install' 0 +trap 'cleanup_install; exit 1' 1 2 15 + +printf 'Downloading Parseable version %s, for OS: %s, CPU architecture: %s\n' "$release_tag" "$OS" "$CPU_ARCH" +printf 'Download URL: %s\n\n' "$download_url" + +# Download the selected release asset to the temporary installation path. +download_binary() { + case "$DOWNLOADER" in + curl) + curl -fL -o "$TEMP_BIN" "$download_url" + ;; + wget) + wget -q -O "$TEMP_BIN" "$download_url" + ;; + esac +} +if ! download_binary; then + printf 'Error: download failed.\n' >&2 + exit 1 +fi + +chmod +x "$TEMP_BIN" || { + printf 'Error: Could not make the downloaded binary executable.\n' >&2 + exit 1 +} +mv "$TEMP_BIN" "$BIN_NAME" || { + printf 'Error: Could not finish installing %s.\n' "$BIN_NAME" >&2 + exit 1 +} +trap - 0 1 2 15 + +printf 'Parseable Server was successfully installed at: %s\n' "$BIN_NAME" + +# Use the user's login shell to select its startup file. Do not source that file +# here: this installer may be running under a different shell via `... | sh`. +SHELL_NAME=${SHELL##*/} +case "$SHELL_NAME" in + zsh) + RC_FILE_PATH="${ZDOTDIR:-$HOME}/.zshrc" + ;; + bash) + RC_FILE_PATH="${HOME}/.bash_profile" + for BASH_PROFILE in .bash_profile .bash_login .profile; do + if [ -f "${HOME}/${BASH_PROFILE}" ]; then + RC_FILE_PATH="${HOME}/${BASH_PROFILE}" + break + fi + done + ;; + sh|dash|ksh) + RC_FILE_PATH="${HOME}/.profile" + ;; + *) + RC_FILE_PATH="" + ;; +esac + +PATH_STR="export PATH=\"${BIN_DIR}:\$PATH\"" +# Add the PATH export to a shell profile unless it is already present. +append_path() { + PROFILE_PATH=$1 + if grep -Fqx "$PATH_STR" "$PROFILE_PATH" 2>/dev/null; then + printf 'Parseable is already configured in %s.\n' "$PROFILE_PATH" + elif { + if [ -s "$PROFILE_PATH" ] && ! tail -c 1 "$PROFILE_PATH" | grep -q '^$'; then + printf '\n' + fi + printf '%s\n' "$PATH_STR" + } >> "$PROFILE_PATH"; then + printf 'Added Parseable to PATH in %s.\n' "$PROFILE_PATH" + else + printf 'Warning: Could not update %s.\n' "$PROFILE_PATH" >&2 + fi +} + +if [ "$SHELL_NAME" = "bash" ]; then + append_path "${HOME}/.bashrc" + if [ "$RC_FILE_PATH" != "${HOME}/.bashrc" ]; then + append_path "$RC_FILE_PATH" + fi +elif [ -n "$RC_FILE_PATH" ]; then + append_path "$RC_FILE_PATH" +else + printf 'No supported shell profile was detected.\n' +fi +printf 'To use Parseable in the current shell, run:\n %s\n' "$PATH_STR" diff --git a/scripts/download.ps1 b/scripts/download.ps1 index 6ce086d16..b7cc9c5fb 100644 --- a/scripts/download.ps1 +++ b/scripts/download.ps1 @@ -1,148 +1,131 @@ -#!/usr/bin/env pwsh - -<# only supports windows, -# `SUPPORTED_OS` array contains the supported linux and darwin for filtering only -# `SUPPORTED_ARCH` array contains the supported architectures but only x86_64/amd64 are -# available for now. both amd64 and x86_64 are there cause windows does report either -# of them when querying for the architecture. -#> -[System.String[]]$SUPPORTED_ARCH = @("x86_64", "arm64", "amd64") - -# Progress bar in powershell slows down downloads a lot, disable it -# https://stackoverflow.com/questions/28682642/powershell-why-is-using-invoke-webrequest-much-slower-than-a-browser-download -$ProgressPreference = 'SilentlyContinue' - -# util functions -function Get-Env { - param([String] $Key) - - $RegisterKey = Get-Item -Path 'HKCU:' - $EnvRegisterKey = $RegisterKey.OpenSubKey('Environment') - $EnvRegisterKey.GetValue($Key, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) -} - -# These three environment functions are roughly copied from https://github.com/prefix-dev/pixi/pull/692 -# They are used instead of `SetEnvironmentVariable` because of unwanted variable expansions. -function Publish-Env { - if (-not ("Win32.NativeMethods" -as [Type])) { - <# dllimport should not be needed but still#> - Add-Type -Namespace Win32 -Name NativeMethods -MemberDefinition @" -[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] -public static extern IntPtr SendMessageTimeout( - IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, - uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); -"@ - } - $HWND_BROADCAST = [IntPtr] 0xffff - $WM_SETTINGCHANGE = 0x1a - $result = [UIntPtr]::Zero - [Win32.NativeMethods]::SendMessageTimeout($HWND_BROADCAST, - $WM_SETTINGCHANGE, - [UIntPtr]::Zero, - "Environment", - 2, - 5000, - [ref] $result - ) | Out-Null -} -function Write-Env { - param([String]$Key, [String]$Value) - - [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' - - - [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment', $true) - if ($null -eq $Value) { - $EnvRegisterKey.DeleteValue($Key) - } - else { - $RegistryValueKind = if ($Value.Contains('%')) { - [Microsoft.Win32.RegistryValueKind]::ExpandString - } - elseif ($EnvRegisterKey.GetValue($Key)) { - $EnvRegisterKey.GetValueKind($Key) - } - else { - [Microsoft.Win32.RegistryValueKind]::String - } - $EnvRegisterKey.SetValue($Key, $Value, $RegistryValueKind) - } - - Publish-Env -} - -function Get-Env { - param([String] $Key) - - [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' - [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment') - $EnvRegisterKey.GetValue($Key, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) -} - -# Get the system's CPU architecture and operating system -[String]$CPU_ARCH = "x86_64" -[String]$OS = "windows" -[String]$INSTALLDIR = "${HOME}\.parseable\bin" -[String]$BIN = "${INSTALLDIR}\parseable.exe" - -function Install-Parseable { - Write-Output "`n=========================`n" - Write-Output "OS: $OS" - Write-Output "CPU arch: $CPU_ARCH" - - # Check if the CPU architecture is supported - if ($SUPPORTED_ARCH -notcontains $CPU_ARCH) { - Write-Error "Unsupported CPU architecture ($CPU_ARCH)." - exit 1 - } - - Write-Output "Checking for existing installation..." - if (Test-Path $BIN) { - Write-Error "Parseable is already installed. Run 'parseable --version' to check the version." - Write-Error "Consider removing the existing installation" - exit 1 - } - - Write-Output "No existing installation found" - - Write-Output "Fetching latest release..." - # Get the latest release information using GitHub API - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/parseablehq/parseable/releases/latest" - # Write-Host ($release | Format-List | Out-String) # Write-Host formats the object while printing - - $installation_found_flag = 0 - $required_installation = "Parseable_OSS_" + $CPU_ARCH + "-" + "pc" + "-" + $OS + "-msvc.exe" - # Loop through assets and select one based on `name` - foreach($asset in $release.assets) { - if ($asset.name -contains $required_installation) { - $installation_found_flag = 1 - $download_url = $asset.browser_download_url - # Create installdir since we were able to find the required installation - mkdir -Force $INSTALLDIR - } - } - - Write-Output "Downloading Parseable version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH`n`n" - # Download the binary using Invoke-WebRequest - if ($installation_found_flag) { - Invoke-WebRequest -Uri $download_url -OutFile $BIN - } else { - Write-Output "Unable to find correct installation. Exiting" - exit - } - - - Write-Output "Adding Parseable to PATH..." - # Only try adding to path if there isn't already a bun.exe in the path - $Path = (Get-Env -Key "Path") -split ';' - if ($Path -notcontains $INSTALLDIR) { - $Path += $INSTALLDIR - Write-Env -Key 'Path' -Value ($Path -join ';') - $env:PATH = $Path; - } -} - -Install-Parseable - -Write-Output "Parseable was downloaded successfully! at $INSTALLDIR" -Write-Output "To get started, restart your terminal/editor, then type `"parseable`"`n" \ No newline at end of file +#!/usr/bin/env pwsh + +# Installs Parseable Enterprise for Windows x86_64. +[System.String[]]$SUPPORTED_ARCH = @("x86_64", "amd64") + +# PowerShell's progress bar significantly slows Invoke-WebRequest. +$ProgressPreference = 'SilentlyContinue' + +function Get-Env { + param([String] $Key) + + [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' + [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment') + $EnvRegisterKey.GetValue($Key, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) +} + +function Publish-Env { + if (-not ("Win32.NativeMethods" -as [Type])) { + Add-Type -Namespace Win32 -Name NativeMethods -MemberDefinition @" +[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] +public static extern IntPtr SendMessageTimeout( + IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, + uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); +"@ + } + $HWND_BROADCAST = [IntPtr] 0xffff + $WM_SETTINGCHANGE = 0x1a + $result = [UIntPtr]::Zero + [Win32.NativeMethods]::SendMessageTimeout( + $HWND_BROADCAST, + $WM_SETTINGCHANGE, + [UIntPtr]::Zero, + "Environment", + 2, + 5000, + [ref] $result + ) | Out-Null +} + +function Write-Env { + param([String]$Key, [String]$Value) + + [Microsoft.Win32.RegistryKey]$RegisterKey = Get-Item -Path 'HKCU:' + [Microsoft.Win32.RegistryKey]$EnvRegisterKey = $RegisterKey.OpenSubKey('Environment', $true) + if ($null -eq $Value) { + $EnvRegisterKey.DeleteValue($Key) + } + else { + $RegistryValueKind = if ($Value.Contains('%')) { + [Microsoft.Win32.RegistryValueKind]::ExpandString + } + elseif ($EnvRegisterKey.GetValue($Key)) { + $EnvRegisterKey.GetValueKind($Key) + } + else { + [Microsoft.Win32.RegistryValueKind]::String + } + $EnvRegisterKey.SetValue($Key, $Value, $RegistryValueKind) + } + + Publish-Env +} + +[String]$CPU_ARCH = "x86_64" +[String]$OS = "windows" +[String]$INSTALLDIR = "${HOME}\.parseable\bin" +[String]$BIN = "${INSTALLDIR}\parseable-enterprise.exe" +[String]$DOWNLOAD_BASE_URL = "https://cdn.parseable.com/parseablepublicrelease/parseable-enterprise" +[String]$PARSEABLE_FILENAME = "Parseable_Enterprise_x86_64-pc-windows-msvc.exe" + +function Install-Parseable { + Write-Output "`n=========================`n" + Write-Output "OS: $OS" + Write-Output "CPU arch: $CPU_ARCH" + + if ($SUPPORTED_ARCH -notcontains $CPU_ARCH) { + Write-Error "Unsupported CPU architecture ($CPU_ARCH)." + exit 1 + } + + Write-Output "Checking for existing installation..." + if (Test-Path $BIN) { + Write-Error "Parseable Enterprise is already installed. Run 'parseable-enterprise --version' to check the version." + Write-Error "Remove the existing installation before installing a new version." + exit 1 + } + + Write-Output "Fetching latest release..." + try { + # Enterprise releases use the latest Parseable OSS release tag as their version. + $release = Invoke-RestMethod -Uri "https://api.github.com/repos/parseablehq/parseable/releases/latest" + } + catch { + Write-Error "Could not fetch the latest release information: $_" + exit 1 + } + + [String]$release_tag = $release.tag_name + if ([String]::IsNullOrWhiteSpace($release_tag)) { + Write-Error "Could not determine the latest release version." + exit 1 + } + + [String]$download_url = "${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_FILENAME}" + Write-Output "Latest Parseable version: $release_tag" + Write-Output "Downloading Parseable Enterprise version $release_tag, for OS: $OS, CPU architecture: $CPU_ARCH" + Write-Output "Download URL: $download_url`n" + + New-Item -ItemType Directory -Force -Path $INSTALLDIR | Out-Null + try { + Invoke-WebRequest -Uri $download_url -OutFile $BIN + } + catch { + Remove-Item -Force -ErrorAction SilentlyContinue $BIN + Write-Error "Download failed: $_" + exit 1 + } + + Write-Output "Adding Parseable to PATH..." + $Path = (Get-Env -Key "Path") -split ';' + if ($Path -notcontains $INSTALLDIR) { + $Path += $INSTALLDIR + Write-Env -Key 'Path' -Value ($Path -join ';') + $env:PATH = $Path -join ';' + } +} + +Install-Parseable + +Write-Output "Parseable Enterprise was downloaded successfully at $INSTALLDIR" +Write-Output "Restart your terminal/editor, then type `"parseable-enterprise`"`n" diff --git a/scripts/download.sh b/scripts/download.sh index 86117fc5a..f2f0a133a 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -1,9 +1,9 @@ #!/bin/sh -DOWNLOAD_BASE_URL="https://github.com/parseablehq/parseable/releases/download" +DOWNLOAD_BASE_URL="https://cdn.parseable.com/parseablepublicrelease/parseable-enterprise" INSTALL_DIR="${HOME}/.parseable" BIN_DIR="${INSTALL_DIR}/bin" -BIN_NAME="${BIN_DIR}/parseable" +BIN_NAME="${BIN_DIR}/parseable-enterprise" # Get the system's CPU architecture and operating system. CPU_ARCH=$(uname -m) @@ -23,17 +23,16 @@ else exit 1 fi -# Match the platform names used by the release assets. Linux commonly reports -# ARM64 as "aarch64", while macOS reports it as "arm64". +# Match the platform names used by the enterprise release assets. case "${OS}_${CPU_ARCH}" in darwin_arm64) - PARSEABLE_PREFIX="Parseable_OSS_aarch64-apple-darwin" + PARSEABLE_FILENAME="Parseable_Enterprise_aarch64-apple-darwin" ;; linux_arm64|linux_aarch64) - PARSEABLE_PREFIX="Parseable_OSS_aarch64-unknown-linux-gnu" + PARSEABLE_FILENAME="Parseable_Enterprise_aarch64-unknown-linux-gnu" ;; linux_x86_64|linux_amd64) - PARSEABLE_PREFIX="Parseable_OSS_x86_64-unknown-linux-gnu" + PARSEABLE_FILENAME="Parseable_Enterprise_x86_64-unknown-linux-gnu" ;; *) printf 'Error: unsupported platform %s/%s.\n' "$OS" "$CPU_ARCH" >&2 @@ -60,7 +59,7 @@ if [ "$OS" = "linux" ]; then fi fi -# Get the latest release tag from the GitHub API. +# Enterprise releases use the latest Parseable OSS release tag as their version. fetch_release() { case "$DOWNLOADER" in curl) @@ -83,10 +82,10 @@ fi printf 'Latest Parseable version: %s\n' "$release_tag" -download_url="${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_PREFIX}" +download_url="${DOWNLOAD_BASE_URL}/${release_tag}/${PARSEABLE_FILENAME}" if [ -d "$INSTALL_DIR" ]; then - printf "A previous version of Parseable already exists. Run 'parseable --version' to check the version,\n" + printf "A previous version of Parseable Enterprise already exists. Run 'parseable-enterprise --version' to check the version,\n" printf 'or remove %s before installing a new version.\n' "$INSTALL_DIR" exit 1 fi @@ -105,7 +104,7 @@ cleanup_install() { trap 'cleanup_install' 0 trap 'cleanup_install; exit 1' 1 2 15 -printf 'Downloading Parseable version %s, for OS: %s, CPU architecture: %s\n' "$release_tag" "$OS" "$CPU_ARCH" +printf 'Downloading Parseable Enterprise version %s, for OS: %s, CPU architecture: %s\n' "$release_tag" "$OS" "$CPU_ARCH" printf 'Download URL: %s\n\n' "$download_url" # Download the selected release asset to the temporary installation path. @@ -134,7 +133,7 @@ mv "$TEMP_BIN" "$BIN_NAME" || { } trap - 0 1 2 15 -printf 'Parseable Server was successfully installed at: %s\n' "$BIN_NAME" +printf 'Parseable Enterprise was successfully installed at: %s\n' "$BIN_NAME" # Use the user's login shell to select its startup file. Do not source that file # here: this installer may be running under a different shell via `... | sh`.