datahaven/deploy/charts/node/datahaven/dh-bootnode.yaml
Steve Degosserie 5988691a2f
feat: Add deployment charts for StorageHub MSP, BSP & Indexer nodes (Local & Stagenet envs) (#160)
## Summary

This PR adds comprehensive Kubernetes deployment infrastructure for
StorageHub components, enabling deployment of the full StorageHub
network stack (MSP, BSP, Indexer, and Fisherman nodes) alongside
DataHaven nodes in both local and stagenet environments.

### What's Added

**1. New Helm Chart: StorageHub MSP Backend API**
(`deploy/charts/backend/`)
- REST API service for StorageHub operations
- Connects to PostgreSQL database for indexed blockchain data
- Connects to RPC nodes for real-time blockchain queries
- Configurable via TOML configuration file
- Supports environment-specific overrides
- Includes comprehensive documentation

**2. StorageHub Node Deployment Charts**
(`deploy/charts/node/storagehub/`)
- **MSP Node** (`sh-mspnode`): Main Service Provider nodes with charging
capabilities
- **BSP Node** (`sh-bspnode`): Backup Service Provider nodes for
redundancy
- **Indexer Node** (`sh-idxnode`): Full indexing node with PostgreSQL
integration
- **Fisherman Node** (`sh-fisherman`): Network monitoring and
verification node

**3. Environment Configurations**
- **Local environment** (`deploy/environments/local/`): Development
setup with hostpath storage
- **Stagenet environment** (`deploy/environments/stagenet/`):
Production-like setup with AWS EBS
- PostgreSQL database configurations for Indexer and Fisherman nodes
- Proper service discovery and network configuration

**4. Enhanced CLI Tooling** (`test/cli/`)
- New `deploy storagehub` command for deploying StorageHub components
- Updated `launch storagehub` command for local testing
- Interactive deployment with environment selection
- Automatic database provisioning via Bitnami PostgreSQL charts

**5. Node Configuration Improvements**
- Fork-aware transaction pool for DH boot & validator nodes
- Unsafe RPC methods exposed on MSP nodes (for provider operations)
- JWT secret support for MSP Backend authentication
- ECDSA key scheme for StorageHub BCSV keys (DataHaven compatibility)

### Architecture

```
StorageHub Stack:
├── MSP Nodes (2 replicas) → Storage providers with charging
├── BSP Nodes (2 replicas) → Backup storage providers
├── Indexer Node → Database indexing + PostgreSQL
├── Fisherman Node → Monitoring + PostgreSQL (shared with Indexer)
└── MSP Backend API → REST API for StorageHub operations
```

### Testing

**Local Testing**:
```bash
cd test
bun cli launch storagehub  # Interactive launcher
# or
bun cli deploy storagehub  # Deploy via Helm
```

**Stagenet Deployment**:
```bash
cd deploy
helm install sh-mspnode ./charts/node \
  -f ./charts/node/storagehub/sh-mspnode.yaml \
  -f ./environments/stagenet/sh-mspnode.yaml \
  -n datahaven-stagenet
```

### Breaking Changes

None - This is purely additive infrastructure.

### Migration Notes

For existing deployments:
1. DataHaven nodes now use `--pool-type fork-aware` flag
2. Bootnode and validator node configs updated accordingly
3. No action required for existing DataHaven-only deployments
2025-10-21 23:18:50 +03:00

93 lines
No EOL
2.9 KiB
YAML

name: dh-bootnode
description: Datahaven Bootnode
fullnameOverride: dh-bootnode
image:
repository: datahavenxyz/datahaven
tag: main
pullPolicy: Always
imagePullSecrets:
- name: datahaven-dockerhub
node:
command: datahaven-node
customChainspec: true # see extraInitContainers, chainspec-generator
role: full
replicas: 1
chainData:
pruning: 1000
storageClass: "gp2"
chainKeystore:
mountInMemory:
enabled: true
persistGeneratedNodeKey: true
flags:
- "--allow-private-ipv4"
- "--discover-local"
- "--network-backend libp2p"
- "--pool-type fork-aware"
ingress:
enabled: false
perReplica: false
wildcardDomain: datahaven.local
# If enabled, this would generate:
# - dh-bootnode-0.datahaven.local
# Generate chainspec, and expose it as url
extraInitContainers:
- name: chainspec-generator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
securityContext:
runAsUser: 0
command: ["/bin/bash"]
args:
- -c
- |
{{- if .Values.customChainspecContent }}
# Custom chainspec provided, just copy it
echo "Using custom chainspec provided via CLI"
cp {{ .Values.node.customChainspecPath }} /chain-data/chainspec.json
{{- else }}
# Generate chainspec dynamically
apt update || true
apt install -y jq
# Wait for node key to be generated by the persist-generated-node-key init container
echo "Waiting for node key generation..."
for i in {1..60}; do
[ -f /keystore/node-key ] && break
echo "Node key not found, waiting ($i/60)…"
sleep 2
done
[ -f /keystore/node-key ] || { echo "Node key generation timed out"; exit 1; }
# Extract the peer ID from the generated node key
NODE_PEER_ID="$({{ .Values.node.command }} key inspect-node-key --file /keystore/node-key)"
echo "Using generated peer ID: ${NODE_PEER_ID}"
# Generate chainspec with dynamic peer ID
{{ .Values.node.command }} build-spec --chain {{ .Values.node.chain }} > base.json
echo "{\"bootNodes\":[\"/dns/dh-bootnode-0/tcp/30333/p2p/${NODE_PEER_ID}\"]}" > override1.json
jq -s '.[0] * .[1]' base.json override1.json | sed 's/1e+18/1000000000000000000/' > plain.json
cut -c -256 plain.json
{{ .Values.node.command }} build-spec --chain plain.json --raw > chainspec.json
cp chainspec.json {{ .Values.node.customChainspecPath }}
{{- end }}
volumeMounts:
- mountPath: /chain-data
name: chain-data
- mountPath: /keystore
name: chain-keystore
extraContainers:
- name: chainspec
image: nginxinc/nginx-unprivileged:stable
ports:
- containerPort: 8080
name: web
volumeMounts:
- name: chain-data
subPath: chainspec.json
mountPath: /usr/share/nginx/html/chainspec.json
readOnly: true