deploy/charts/backend/README.md
This Helm chart deploys the StorageHub MSP Backend API service that provides REST API access to the StorageHub network data.
The StorageHub MSP Backend API:
helm install sh-mspbackend ./charts/backend \
-f ./charts/backend/storagehub/sh-mspbackend.yaml
helm install sh-mspbackend ./charts/backend \
-f ./charts/backend/storagehub/sh-mspbackend.yaml \
-f ./environments/local/sh-mspbackend.yaml \
-n kt-datahaven-local
helm install sh-mspbackend ./charts/backend \
-f ./charts/backend/storagehub/sh-mspbackend.yaml \
-f ./environments/stagenet/sh-mspbackend.yaml \
-n datahaven-stagenet
| Parameter | Description | Default |
|---|---|---|
image.repository | Container image repository | moonsonglabs/storage-hub-msp-backend |
image.tag | Container image tag | latest |
replicaCount | Number of replicas | 1 |
service.type | Kubernetes service type | ClusterIP |
service.port | Service port | 8080 |
service.targetPort | Service target port | 80 |
backend.port | Backend application port | 8080 |
backend.database.url | PostgreSQL connection URL | postgresql://storagehub:storagehub@sh-indexer-db:5432/storagehub |
backend.rpc.endpoint | WebSocket RPC endpoint | ws://sh-idxnode:9944 |
backend.api.defaultPageSize | Default page size for API results | 20 |
backend.api.maxPageSize | Maximum page size for API results | 100 |
ingress.enabled | Enable ingress | false |
The backend uses a TOML configuration file passed via the --config CLI argument. This file is automatically generated from the Helm values and mounted as a ConfigMap at /configs/config.toml.
backend:
port: 8080
database:
url: postgresql://indexer:indexer@sh-idxnode-db-postgresql:5432/datahaven
rpc:
endpoint: ws://sh-mspnode-0:9955
api:
defaultPageSize: 20
maxPageSize: 100
auth:
jwtSecret: "your-secret-here"
args:
- "--config"
- "/configs/config.toml"
configMap:
enabled: true
The chart can also construct the database URL from separate components:
backend:
database:
host: sh-idxnode-db-postgresql
port: 5432
name: datahaven
user: indexer
password: production_password
Note: For production deployments, consider using Kubernetes Secrets or external secret management solutions for sensitive values like database passwords and JWT secrets.
Additional environment variables can be configured:
backend:
env:
NODE_ENV: production
LOG_LEVEL: info
You can add extra files to the ConfigMap:
configMap:
enabled: true
data:
custom-config.yaml: |
# Your custom configuration here
key: value
Additional CLI arguments can be specified to pass to the backend application:
backend:
args:
- "--config"
- "/configs/config.toml"
- "--log-level"
- "debug"
You can inject environment variables from existing ConfigMaps or Secrets:
backend:
envFrom:
- configMapRef:
name: my-config
- secretRef:
name: my-secret
When deployed with NodePort service type:
# Access via NodePort (configured as 30300 in local environment)
curl http://localhost:30300/
# Or via ingress if enabled
curl http://sh-mspbackend.datahaven.local/
# Access via ingress
curl https://sh-mspbackend.datahaven-kt.xyz/
The chart automatically generates a config.toml file with the following structure:
host = "0.0.0.0"
port = 8080
[api]
default_page_size = 20
max_page_size = 100
[storage_hub]
rpc_url = "ws://sh-mspnode-0:9955"
msp_callback_url = "http://sh-mspbackend:8080"
timeout_secs = 30
max_concurrent_requests = 100
verify_tls = true
mock_mode = false
[auth]
jwt_secret = "your-secret-here"
[database]
url = "postgresql://indexer:indexer@sh-idxnode-db-postgresql:5432/datahaven"
mock_mode = false
kubectl get pods -l app.kubernetes.io/name=sh-mspbackend -n <namespace>
kubectl logs -l app.kubernetes.io/name=sh-mspbackend -n <namespace>
For local environment:
kubectl exec -it deployment/sh-mspbackend -n kt-datahaven-local -- nc -zv sh-idxnode-db-postgresql 5432
For stagenet environment:
kubectl exec -it deployment/sh-mspbackend -n datahaven-stagenet -- nc -zv sh-idxnode-db-postgresql 5432
For local environment:
kubectl exec -it deployment/sh-mspbackend -n kt-datahaven-local -- nc -zv sh-mspnode-0 9955
For stagenet environment:
kubectl exec -it deployment/sh-mspbackend -n datahaven-stagenet -- nc -zv sh-mspnode-0 9955
kubectl get configmap sh-mspbackend-config -n <namespace> -o yaml
# For local environment
helm uninstall sh-mspbackend -n kt-datahaven-local
# For stagenet environment
helm uninstall sh-mspbackend -n datahaven-stagenet
See environments/local/sh-mspbackend.yaml for the complete local configuration, which includes:
sh-mspbackend.datahaven.localSee environments/stagenet/sh-mspbackend.yaml for the complete stagenet configuration, which includes:
sh-mspbackend.datahaven-kt.xyz