From 76a8b6e7763b3d2596d176cd89c9d6970188cb29 Mon Sep 17 00:00:00 2001 From: woody_lin Date: Wed, 14 Jan 2026 11:06:34 +0800 Subject: [PATCH 1/3] docs: add create helm chart example --- .../docs/demos/06-create-helm-chart.mdx | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 src/content/docs/demos/06-create-helm-chart.mdx diff --git a/src/content/docs/demos/06-create-helm-chart.mdx b/src/content/docs/demos/06-create-helm-chart.mdx new file mode 100644 index 0000000..82b2028 --- /dev/null +++ b/src/content/docs/demos/06-create-helm-chart.mdx @@ -0,0 +1,149 @@ +--- +title: Create Helm Chart +description: Packaging OpenBB into a Helm Chart and deploying it. +--- + +import { Steps, Aside, Tabs, TabItem } from '@astrojs/starlight/components'; + +This guide demonstrates how to package the OpenBB API Server into a Helm chart and deploy it. + +## Prerequisites + +Ensure you have the following tools installed: + +- **Helm**: [Installation Guide](https://helm.sh/docs/intro/install) +- **Docker**: For building the OpenBB image (if not already done) +- **Access to Registry**: To push your chart and image + +## Create and Package Helm Chart + + + +1. Create a new Helm chart: + + ```bash + helm create openbb + ``` + + This creates a directory named `openbb` with the standard Helm chart structure. + +2. Modify `values.yaml` to configure your deployment. + + Locate `openbb/values.yaml` and update the image and service settings. For OpenBB, you'll typically want to expose port 8000 (or whichever port your API listens on). + + ```yaml + image: + repository: ghcr.io/openbb-finance/openbb-platform # Official OpenBB Platform image + pullPolicy: IfNotPresent + tag: "latest" + + service: + type: NodePort + port: 8000 + targetPort: 8000 + nodePort: 30080 # Optional: Fixed NodePort for easier testing + ``` + + + +3. Package the Helm chart: + + ```bash + helm package openbb + ``` + + This will create a compressed archive, e.g., `openbb-0.1.0.tgz`. + +4. Push the chart to your registry (Optional but recommended): + + ```bash + helm push openbb-0.1.0.tgz oci:///charts --plain-http + ``` + + *Replace `` with your actual registry address.* + +5. Install/Deploy the chart: + + ```bash + helm install openbb ./openbb-0.1.0.tgz + ``` + + Or if you pushed it to a registry: + + ```bash + helm install openbb oci:///charts/openbb --version 0.1.0 --plain-http + ``` + + + +## Test with Python + +Once your OpenBB API Server is deployed and running, you can interact with it using Python. + + + +### API Interaction + +Use the following script to fetch data from your OpenBB API. + + + + +```python +import requests + +# Configuration +# Replace with your actual Node IP and the NodePort defined in values.yaml +BASE_URL = "http://:30080" + +def check_health(): + """Check if the API server is reachable.""" + try: + # Assuming a health check endpoint exists, usually / or /health + response = requests.get(f"{BASE_URL}/") + if response.status_code == 200: + print("✓ API is online!") + print("Response:", response.json()) + else: + print(f"✗ API returned status: {response.status_code}") + except requests.exceptions.RequestException as e: + print(f"✗ Failed to connect: {e}") + +def get_market_data(ticker="AAPL"): + """Example: Fetch market data for a ticker.""" + endpoint = f"{BASE_URL}/api/v1/equity/price/quote" # Example endpoint structure + params = {"symbol": ticker} + + try: + print(f"Fetching data for {ticker}...") + response = requests.get(endpoint, params=params) + + if response.status_code == 200: + data = response.json() + print("✓ Data received:") + print(data) + else: + print(f"✗ Error {response.status_code}: {response.text}") + + except Exception as e: + print(f"✗ Error: {e}") + +if __name__ == "__main__": + check_health() + # Uncomment below to test specific endpoints if your OpenBB instance supports them + # get_market_data("MSFT") +``` + + + + + \ No newline at end of file From 3497794e277089c6ef82a1550651f884c94ad46a Mon Sep 17 00:00:00 2001 From: woody_lin Date: Wed, 14 Jan 2026 15:44:34 +0800 Subject: [PATCH 2/3] docs: enhance Helm chart guide with custom Docker image instructions and configuration updates --- .../docs/demos/06-create-helm-chart.mdx | 99 ++++++++++++++----- 1 file changed, 76 insertions(+), 23 deletions(-) diff --git a/src/content/docs/demos/06-create-helm-chart.mdx b/src/content/docs/demos/06-create-helm-chart.mdx index 82b2028..f099390 100644 --- a/src/content/docs/demos/06-create-helm-chart.mdx +++ b/src/content/docs/demos/06-create-helm-chart.mdx @@ -15,6 +15,38 @@ Ensure you have the following tools installed: - **Docker**: For building the OpenBB image (if not already done) - **Access to Registry**: To push your chart and image +## Build Custom Docker Image + +Since the official image might be outdated, we recommend building your own Docker image from the latest source code. + + + +1. Clone the OpenBB repository and checkout a version: + + ```bash + git clone https://github.com/OpenBB-finance/OpenBB.git + cd OpenBB + + # Switch to a specific version (e.g., v4.6.0) + git checkout v4.6.0 + ``` + +2. Build and push the image using the existing Dockerfile: + + The OpenBB repository already includes a Dockerfile located at `build/docker/platform.dockerfile`. You can use this directly instead of creating a new one. + + ```bash + # Build the image with the version tag + docker build -f build/docker/platform.dockerfile -t /openbb:v4.6.0 . + + # Push the image to your registry + docker push /openbb:v4.6.0 + ``` + + *Replace `` with your actual registry address.* + + + ## Create and Package Helm Chart @@ -27,25 +59,57 @@ Ensure you have the following tools installed: This creates a directory named `openbb` with the standard Helm chart structure. -2. Modify `values.yaml` to configure your deployment. +2. Configure the Helm chart. + + **Update `Chart.yaml`**: - Locate `openbb/values.yaml` and update the image and service settings. For OpenBB, you'll typically want to expose port 8000 (or whichever port your API listens on). + Locate `openbb/Chart.yaml` and update the version to match your release. You can also add validation metadata like `icon`, `home`, and `maintainers`. + + ```yaml + apiVersion: v2 + name: openbb + description: A Helm chart for deploying the OpenBB Platform API + type: application + version: 0.1.0 + appVersion: "v4.6.0" + icon: https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/images/openbb_logo.png + home: https://openbb.co + sources: + - https://github.com/OpenBB-finance/OpenBB + maintainers: + - name: Your Name + email: your.email@example.com + ``` + + **Update `values.yaml`**: + + Locate `openbb/values.yaml` and update the `image` settings to point to your new custom image. Also, update the health checks (`livenessProbe` and `readinessProbe`) to check `/docs`, as the root path `/` might return 404. ```yaml image: - repository: ghcr.io/openbb-finance/openbb-platform # Official OpenBB Platform image + repository: /openbb pullPolicy: IfNotPresent - tag: "latest" + tag: "v4.6.0" service: type: NodePort port: 8000 targetPort: 8000 nodePort: 30080 # Optional: Fixed NodePort for easier testing + + livenessProbe: + httpGet: + path: /docs + port: http + + readinessProbe: + httpGet: + path: /docs + port: http ``` 3. Package the Helm chart: @@ -54,7 +118,7 @@ Ensure you have the following tools installed: helm package openbb ``` - This will create a compressed archive, e.g., `openbb-0.1.0.tgz`. + This will create a compressed archive: `openbb-0.1.0.tgz`. 4. Push the chart to your registry (Optional but recommended): @@ -64,17 +128,7 @@ Ensure you have the following tools installed: *Replace `` with your actual registry address.* -5. Install/Deploy the chart: - - ```bash - helm install openbb ./openbb-0.1.0.tgz - ``` - - Or if you pushed it to a registry: - - ```bash - helm install openbb oci:///charts/openbb --version 0.1.0 --plain-http - ``` + After uploading, navigate to the [Applications Store](/service/applications/04-store/) to update the Helm chart configuration to use your custom image. @@ -106,23 +160,22 @@ BASE_URL = "http://:30080" def check_health(): """Check if the API server is reachable.""" try: - # Assuming a health check endpoint exists, usually / or /health - response = requests.get(f"{BASE_URL}/") + # Check /docs as the root path might return 404 + response = requests.get(f"{BASE_URL}/docs") if response.status_code == 200: print("✓ API is online!") - print("Response:", response.json()) else: print(f"✗ API returned status: {response.status_code}") except requests.exceptions.RequestException as e: print(f"✗ Failed to connect: {e}") -def get_market_data(ticker="AAPL"): +def get_market_data(ticker="AAPL", provider="yfinance"): """Example: Fetch market data for a ticker.""" endpoint = f"{BASE_URL}/api/v1/equity/price/quote" # Example endpoint structure - params = {"symbol": ticker} + params = {"symbol": ticker, "provider": provider} try: - print(f"Fetching data for {ticker}...") + print(f"Fetching data for {ticker} from {provider}...") response = requests.get(endpoint, params=params) if response.status_code == 200: From 2a94dab17827cf7c5b338b54101ec5df5523949e Mon Sep 17 00:00:00 2001 From: woody_lin Date: Wed, 14 Jan 2026 16:05:04 +0800 Subject: [PATCH 3/3] docs: enhance Helm chart guide with detailed instructions for building custom Docker images and improved API interaction examples --- .../docs/demos/06-create-helm-chart.mdx | 115 +++++++++++------- 1 file changed, 68 insertions(+), 47 deletions(-) diff --git a/src/content/docs/demos/06-create-helm-chart.mdx b/src/content/docs/demos/06-create-helm-chart.mdx index f099390..fd991a7 100644 --- a/src/content/docs/demos/06-create-helm-chart.mdx +++ b/src/content/docs/demos/06-create-helm-chart.mdx @@ -5,15 +5,30 @@ description: Packaging OpenBB into a Helm Chart and deploying it. import { Steps, Aside, Tabs, TabItem } from '@astrojs/starlight/components'; -This guide demonstrates how to package the OpenBB API Server into a Helm chart and deploy it. +## About OpenBB + +The [**OpenBB Platform**](https://openbb.co/products/odp) is a unified financial data interface that simplifies API management for developers and analysts. + +**Key Benefits:** + +- **Single API Access** — Connect to multiple data providers without managing separate integrations +- **High-Quality Data** — Access reliable market data across stocks, crypto, forex, and more +- **Easy Integration** — Deploy as a containerized service for consistent environments + +## Overview + +This guide demonstrates how to containerize the OpenBB API Server using Helm charts, enabling you to deploy it consistently across Kubernetes clusters with standard deployment tools. + + ## Prerequisites -Ensure you have the following tools installed: +Before proceeding, ensure you have the following tools installed: -- **Helm**: [Installation Guide](https://helm.sh/docs/intro/install) -- **Docker**: For building the OpenBB image (if not already done) -- **Access to Registry**: To push your chart and image +- **Helm** 3.x or later — [Installation Guide](https://helm.sh/docs/intro/install) +- **Docker** — For building custom OpenBB images ## Build Custom Docker Image @@ -21,7 +36,9 @@ Since the official image might be outdated, we recommend building your own Docke -1. Clone the OpenBB repository and checkout a version: +1. **Clone the OpenBB repository** + + Start by cloning the repository and checking out a stable version: ```bash git clone https://github.com/OpenBB-finance/OpenBB.git @@ -31,19 +48,24 @@ Since the official image might be outdated, we recommend building your own Docke git checkout v4.6.0 ``` -2. Build and push the image using the existing Dockerfile: +2. **Build and push the Docker image** - The OpenBB repository already includes a Dockerfile located at `build/docker/platform.dockerfile`. You can use this directly instead of creating a new one. + The OpenBB repository includes a pre-configured Dockerfile at `build/docker/platform.dockerfile`. Use this directly: ```bash # Build the image with the version tag docker build -f build/docker/platform.dockerfile -t /openbb:v4.6.0 . + ``` + + After building, push the image to your registry: - # Push the image to your registry + ```bash docker push /openbb:v4.6.0 ``` - *Replace `` with your actual registry address.* + @@ -51,21 +73,19 @@ Since the official image might be outdated, we recommend building your own Docke -1. Create a new Helm chart: +1. **Create a new Helm chart** ```bash helm create openbb ``` - This creates a directory named `openbb` with the standard Helm chart structure. + This generates a directory named `openbb` with the standard Helm chart structure, including templates for Deployment, Service, and ConfigMaps. -2. Configure the Helm chart. +2. **Configure the Helm** - **Update `Chart.yaml`**: - - Locate `openbb/Chart.yaml` and update the version to match your release. You can also add validation metadata like `icon`, `home`, and `maintainers`. + Edit `openbb/Chart.yaml` to match your release metadata. You can add additional details like `icon`, `home`, and `maintainers` for better discoverability: - ```yaml + ```yaml title="openbb/Chart.yaml" apiVersion: v2 name: openbb description: A Helm chart for deploying the OpenBB Platform API @@ -81,11 +101,9 @@ Since the official image might be outdated, we recommend building your own Docke email: your.email@example.com ``` - **Update `values.yaml`**: - - Locate `openbb/values.yaml` and update the `image` settings to point to your new custom image. Also, update the health checks (`livenessProbe` and `readinessProbe`) to check `/docs`, as the root path `/` might return 404. + Edit `openbb/values.yaml` to configure the image and health check settings. Point the image to your custom registry image and configure probes to use `/docs` (since the root path `/` might return 404): - ```yaml + ```yaml title="openbb/values.yaml" image: repository: /openbb pullPolicy: IfNotPresent @@ -99,42 +117,44 @@ Since the official image might be outdated, we recommend building your own Docke livenessProbe: httpGet: - path: /docs + path: /docs # Use /docs instead of root path port: http readinessProbe: httpGet: - path: /docs + path: /docs # Use /docs instead of root path port: http ``` -3. Package the Helm chart: +3. **Package the Helm chart** ```bash helm package openbb ``` - This will create a compressed archive: `openbb-0.1.0.tgz`. + This creates a compressed archive: `openbb-0.1.0.tgz`. -4. Push the chart to your registry (Optional but recommended): +4. **Push the chart to your registry** ```bash helm push openbb-0.1.0.tgz oci:///charts --plain-http ``` - *Replace `` with your actual registry address.* + Replace `` with your actual registry address. - After uploading, navigate to the [Applications Store](/service/applications/04-store/) to update the Helm chart configuration to use your custom image. + Once uploaded, navigate to the [Applications Store](/service/applications/04-store/) to deploy the chart with your custom image. ## Test with Python -Once your OpenBB API Server is deployed and running, you can interact with it using Python. +Once your OpenBB API Server is deployed and running, you can interact with it programmatically using Python. + +### Setup