Files
openobserve/downloadO2.sh
T
mmosarafO2 5b4aa9c38d chore: added new download script for openobserve and o2-enterprise (#7576)
### **User description**
added new download script for openobserve and o2-enterprise


___

### **PR Type**
Enhancement


___

### **Description**
- Add downloadO2.sh script for releases

- Parse release type and version

- Detect OS platform and architecture

- Download and extract release tarball


___

### **Changes diagram**

```mermaid
flowchart LR
  A["Run downloadO2.sh"] --> B["Set release type and version"]
  B --> C["Detect platform and architecture"]
  C --> D["Build download URL"]
  D --> E["Download tarball"]
  E --> F["Extract and cleanup"]
```


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>downloadO2.sh</strong><dd><code>Add download script for
releases</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

downloadO2.sh

<li>New Bash script file added<br> <li> Accepts release type and
version<br> <li> Detects OS platform and architecture<br> <li> Downloads
and extracts release tarball


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7576/files#diff-444c10d9092d83300658d31120b477cfe468c85d2cf28c82de23c254d67c2f64">+56/-0</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>
2025-07-16 17:20:28 +05:30

56 lines
1.4 KiB
Bash

#!/bin/bash
# 1. Set release type based on first argument (default: o2-enterprise)
RELEASE_TYPE=$1
BASE_URL="https://downloads.openobserve.ai/releases"
# 2. Set base URL based on release type
if [ "$RELEASE_TYPE" == "opensource" ]; then
URL="${BASE_URL}/opensource"
BINARY_NAME="openobserve"
else
URL="${BASE_URL}/o2-enterprise"
BINARY_NAME="openobserve-ee"
fi
# 3. Optional version argument (default: latest)
VERSION=$2
# 4. Detect platform
echo "Detecting platform..."
case "$(uname -s)" in
Linux*) PLATFORM="linux" ;;
Darwin*) PLATFORM="darwin" ;;
CYGWIN*|MINGW32*|MSYS*|MINGW*) PLATFORM="windows" ;;
*) echo "Unsupported platform"; exit 1 ;;
esac
echo "Platform: $PLATFORM"
# 5. Detect architecture
echo "Detecting architecture..."
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture"; exit 1 ;;
esac
echo "Architecture: $ARCH"
# 6. Construct file name and URL
FILE_NAME="${BINARY_NAME}-${VERSION}-${PLATFORM}-${ARCH}.tar.gz"
DOWNLOAD_URL="${URL}/${VERSION}/${FILE_NAME}"
echo "Downloading: $DOWNLOAD_URL"
curl -fLo latest_release.tar.gz "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "Error: Download failed. Make sure the file exists."
exit 1
fi
# 7. Extract and clean up
echo "Extracting..."
tar -xzf latest_release.tar.gz
rm latest_release.tar.gz
echo "✅ Download and extraction complete!"