Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 223 additions & 0 deletions src/content/docs/demos/06-create-helm-chart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
---
title: Create Helm Chart
description: Packaging OpenBB into a Helm Chart and deploying it.
---

import { Steps, Aside, Tabs, TabItem } from '@astrojs/starlight/components';

## 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.

<Aside type="note">
Containerizing OpenBB with Helm provides reproducible deployments, easy scaling, and simplified management across different environments.
</Aside>

## Prerequisites

Before proceeding, ensure you have the following tools installed:

- **Helm** 3.x or later — [Installation Guide](https://helm.sh/docs/intro/install)
- **Docker** — For building custom OpenBB images

## Build Custom Docker Image

Since the official image might be outdated, we recommend building your own Docker image from the latest source code.

<Steps>

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
cd OpenBB

# Switch to a specific version (e.g., v4.6.0)
git checkout v4.6.0
```

2. **Build and push the Docker image**

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 <registry_url>/openbb:v4.6.0 .
```

After building, push the image to your registry:

```bash
docker push <registry_url>/openbb:v4.6.0
```

<Aside type="note">
Replace `<registry_url>` with your actual registry address (e.g., `myregistry.azurecr.io`, `my-docker-hub-username`).
</Aside>

</Steps>

## Create and Package Helm Chart

<Steps>

1. **Create a new Helm chart**

```bash
helm create openbb
```

This generates a directory named `openbb` with the standard Helm chart structure, including templates for Deployment, Service, and ConfigMaps.

2. **Configure the Helm**

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heading text is incomplete - it reads "Configure the Helm" but should specify what is being configured. Consider changing to "Configure the Helm Chart" or "Configure Helm Chart Values".

Suggested change
2. **Configure the Helm**
2. **Configure the Helm Chart**

Copilot uses AI. Check for mistakes.

Edit `openbb/Chart.yaml` to match your release metadata. You can add additional details like `icon`, `home`, and `maintainers` for better discoverability:

```yaml title="openbb/Chart.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
Comment on lines +100 to +101

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The YAML for maintainers is incorrectly indented. The email key should be aligned with the name key. This will cause a parsing error if a user copies this snippet. I've corrected the indentation and also added comments to remind users to replace the placeholder values.

     - name: Your Name # Replace with your name
       email: your.email@example.com # Replace with your email

```

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 title="openbb/values.yaml"
image:
repository: <registry_url>/openbb
pullPolicy: IfNotPresent
tag: "v4.6.0"

service:
type: NodePort
port: 8000
targetPort: 8000
nodePort: 30080 # Optional: Fixed NodePort for easier testing

livenessProbe:
httpGet:
path: /docs # Use /docs instead of root path
port: http

readinessProbe:
httpGet:
path: /docs # Use /docs instead of root path
port: http
Comment on lines +118 to +126

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The YAML comment states "Use /docs instead of root path" in both liveness and readiness probes, but this could be misleading. The root path issue mentioned in line 104 should be clarified - either explain why the root path returns 404 or provide more context about proper health check endpoints. Consider documenting whether /docs is the official health check endpoint or if there are dedicated health endpoints like /health or /healthz that would be more appropriate for liveness and readiness probes.

Copilot uses AI. Check for mistakes.
```

<Aside type="tip">
Make sure `targetPort` (8000) matches the port your OpenBB application listens on inside the container.
</Aside>

3. **Package the Helm chart**

```bash
helm package openbb
```

This creates a compressed archive: `openbb-0.1.0.tgz`.

4. **Push the chart to your registry**

```bash
helm push openbb-0.1.0.tgz oci://<registry_url>/charts --plain-http

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The --plain-http flag disables TLS encryption when pushing the Helm chart. This is a significant security risk if the registry is not on a trusted local network, as it can expose credentials. It's crucial to add a warning explaining when it is appropriate to use this flag and to recommend using a secure registry with HTTPS for production environments.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The helm push command hardcodes the chart filename openbb-0.1.0.tgz. This is brittle because if a user changes the version in Chart.yaml, this command will fail. Using a wildcard * for the version makes the command more robust, as it will match the generated file regardless of the version.

   helm push openbb-*.tgz oci://<registry_url>/charts --plain-http

```

Replace `<registry_url>` with your actual registry address.
Comment on lines +144 to +147

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sample command uses helm push ... --plain-http, which explicitly disables TLS when pushing charts to an OCI registry, exposing chart contents and credentials to interception and allowing a man-in-the-middle attacker to inject a malicious chart.
An attacker on the network path could tamper with the pushed artifact so that subsequent installs pull and execute modified images or hooks.
Use TLS-secured registry endpoints and avoid --plain-http for production or any environment where network traffic may be observable or modifiable.

Suggested change
helm push openbb-0.1.0.tgz oci://<registry_url>/charts --plain-http
```
Replace `<registry_url>` with your actual registry address.
helm push openbb-0.1.0.tgz oci://<registry_url>/charts

Replace <registry_url> with your actual, TLS-secured registry address (HTTPS). Avoid using --plain-http except in tightly controlled local test environments.

Copilot uses AI. Check for mistakes.

Once uploaded, navigate to the [Applications Store](/service/applications/04-store/) to deploy the chart with your custom image.

</Steps>

## Test with Python

Once your OpenBB API Server is deployed and running, you can interact with it programmatically using Python.

### Setup

<Aside type="note">
**Prerequisite**: Install the `requests` library.
```bash
pip install requests
```
</Aside>

### API Interaction

Use the following Python script to fetch data from your OpenBB API:

<Tabs>
<TabItem label="Basic Example" icon="code">

```python title="test_openbb_api.py"
import requests

# Configuration
# Replace with your actual Node IP and the NodePort from values.yaml
BASE_URL = "http://<node_ip>:30080"

def check_health():
"""Check if the OpenBB API server is reachable."""
try:
response = requests.get(f"{BASE_URL}/docs")
if response.status_code == 200:
print("✓ API is online!")
return True
else:
print(f"✗ API returned status: {response.status_code}")
return False
except requests.exceptions.RequestException as e:
print(f"✗ Failed to connect: {e}")
return False

def get_market_data(ticker="AAPL", provider="yfinance"):
"""Fetch market data for a given ticker."""
endpoint = f"{BASE_URL}/api/v1/equity/price/quote"
params = {"symbol": ticker, "provider": provider}

try:
print(f"\nFetching {ticker} data from {provider}...")
response = requests.get(endpoint, params=params)

if response.status_code == 200:
data = response.json()
print("✓ Data received:")
print(data)
Comment on lines +203 to +206

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python code example lacks proper error handling for JSON parsing. If the response status is 200 but the response body is not valid JSON, the response.json() call on line 204 could raise a JSONDecodeError. Consider wrapping this in a try-except block or validating the response content type before parsing.

Copilot uses AI. Check for mistakes.
else:
print(f"✗ Error {response.status_code}: {response.text}")
Comment on lines +188 to +208

Copilot AI Jan 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message format is inconsistent. Lines 188 and 191 use "✗" symbols with different message structures ("API returned status:" vs "Failed to connect:"), while line 208 uses "Error {status_code}:" format. Consider standardizing the error message format across all error cases for better consistency and readability.

Copilot uses AI. Check for mistakes.
except Exception as e:
print(f"✗ Error: {e}")
Comment on lines +209 to +210

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Catching a generic Exception is too broad and can hide bugs or swallow important exceptions. It's better to catch more specific exceptions. For network-related issues, requests.exceptions.RequestException is more appropriate, as used in the check_health function.

    except requests.exceptions.RequestException as e:
        print(f"✗ Request failed: {e}")


if __name__ == "__main__":
if check_health():
get_market_data("AAPL")
# get_market_data("MSFT")
```

</TabItem>
</Tabs>

<Aside type="note">
The specific API endpoints depend on your OpenBB Server version and configuration. Check the [OpenBB API documentation](https://docs.openbb.co) for the complete list of available endpoints and parameters.
</Aside>
Loading