Self Hosting ComputeSDK
Learn how to self-host ComputeSDK in your own infrastructure.
ComputeSDK can be self-hosted in your own infrastructure using Kubernetes and Helm. This guide will walk you through the setup process, including licensing and configuration.
Prerequisites
- Kubernetes cluster (v1.19+)
- Helm v3 installed
kubectl
configured with cluster access- SSL certificates for your domains
- ComputeSDK license key
Installation Steps
1. Add the Helm Repository
helm repo add computesdk https://charts.computesdk.com
helm repo update
2. Configure values.yaml
Create a values.yaml
file to configure your ComputeSDK installation. Here’s a complete example:
# Basic Configuration
environment: production
clusterName: my-cluster
# Domain Configuration
domains:
api: api.yourdomain.com
preview: preview.yourdomain.com
# SSL Configuration
ssl:
enabled: true
# Choose either 'manual'
provider: manual
# For manual certificates:
certificates:
api:
secretName: computesdk-api-tls
preview:
secretName: computesdk-preview-tls
# License Configuration
license:
key: YOUR_LICENSE_KEY
# Environment Variables
env:
COMPUTE_SDK_API_URL: "https://api.yourdomain.com"
COMPUTE_SDK_PREVIEW_DOMAIN: "preview.yourdomain.com"
COMPUTE_SDK_LICENSE_KEY: "${LICENSE_KEY}"
# Add any additional environment variables here
3. Install ComputeSDK
Install the Helm chart using your configuration:
helm install computesdk computesdk/computesdk -f values.yaml
Environment Variables
ComputeSDK requires several environment variables for proper operation. These can be configured in your values.yaml
:
Variable | Description | Required |
---|---|---|
COMPUTE_SDK_API_URL | Your API domain URL | Yes |
COMPUTE_SDK_PREVIEW_DOMAIN | Domain for preview environments | Yes |
COMPUTE_SDK_LICENSE_KEY | Your ComputeSDK license key | Yes |
SSL Configuration
Before configuring SSL, ensure your DNS records are properly configured. You’ll need to:
- Point your API domain (
api.yourdomain.com
) to your Kubernetes cluster’s ingress controller or load balancer IP address - Point your preview domain (
preview.yourdomain.com
) to the same IP address
You can configure SSL in two ways:
1. Manual SSL (Recommended)
Use your existing certificates or preferred certificate provider:
- Create Kubernetes secrets with your certificates:
# For API domain
kubectl create secret tls computesdk-api-tls \
--cert=path/to/api-cert.pem \
--key=path/to/api-key.pem
# For preview domain
kubectl create secret tls computesdk-preview-tls \
--cert=path/to/preview-cert.pem \
--key=path/to/preview-key.pem
- Configure in values.yaml:
ssl:
enabled: true
provider: manual
certificates:
api:
secretName: computesdk-api-tls
preview:
secretName: computesdk-preview-tls
2. cert-manager
Alternatively, you can use cert-manager if you prefer automatic certificate management:
- Install cert-manager:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
- Configure in values.yaml:
ssl:
enabled: true
provider: cert-manager
certManager:
clusterIssuer: letsencrypt-prod
License Key
The license key is a required component for self-hosted installations. There are two ways to configure it:
- Direct in values.yaml:
license:
key: YOUR_LICENSE_KEY
- As a Kubernetes Secret:
kubectl create secret generic computesdk-license \
--from-literal=license-key=YOUR_LICENSE_KEY
Then reference it in your values.yaml
:
license:
existingSecret: computesdk-license
existingSecretKey: license-key
Validation and Testing
After installation, verify your deployment:
- Check all pods are running:
kubectl get pods -l app=computesdk
- Verify the API is accessible:
curl https://api.yourdomain.com/health
- Test license validation:
kubectl logs -l app=computesdk-api
Troubleshooting
Common issues and solutions:
License Issues
- Verify the license key is correctly set in environment variables
- Check API logs for license validation errors
- Ensure your license key is valid for self-hosted installations
Connection Issues
- Verify SSL certificates are properly configured
- Check DNS records for API and preview domains
- Ensure network policies allow required connections
Resource Issues
- Monitor resource usage with
kubectl top pods
- Adjust resource limits in
values.yaml
if needed - Check for pod evictions or OOM kills
Upgrading
To upgrade your ComputeSDK installation:
- Update the Helm repository:
helm repo update
- Upgrade the installation:
helm upgrade computesdk computesdk/computesdk -f values.yaml
Security Best Practices
-
Network Security
- Enable network policies
- Use private container registries
- Implement proper ingress controls
-
Access Control
- Use RBAC policies
- Limit service account permissions
- Regular audit of access patterns
-
Resource Management
- Set appropriate resource limits
- Configure pod disruption budgets
- Monitor resource usage