diff --git a/Dockerfile.local b/Dockerfile.local new file mode 100644 index 00000000..27977a7e --- /dev/null +++ b/Dockerfile.local @@ -0,0 +1,34 @@ +FROM debian:bookworm-slim + +# Install runtime dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + libssl3 && \ + rm -rf /var/lib/apt/lists/* + +# Create a non-root user for running Wassette +RUN useradd -m -u 1000 -s /bin/bash wassette + +# Create necessary directories with proper permissions +RUN mkdir -p /home/wassette/.local/share/wassette/components && \ + mkdir -p /home/wassette/.config/wassette/secrets && \ + chown -R wassette:wassette /home/wassette + +# Copy the pre-built binary +COPY target/release/wassette /usr/local/bin/wassette + +# Set up environment +ENV HOME=/home/wassette +ENV XDG_DATA_HOME=/home/wassette/.local/share +ENV XDG_CONFIG_HOME=/home/wassette/.config + +# Switch to the non-root user +USER wassette +WORKDIR /home/wassette + +# Expose the default HTTP port +EXPOSE 9001 + +# Default command: start Wassette with streamable-http transport +CMD ["wassette", "serve", "--streamable-http"] diff --git a/deployment/README.md b/deployment/README.md new file mode 100644 index 00000000..075e26e7 --- /dev/null +++ b/deployment/README.md @@ -0,0 +1,338 @@ +# Deploying Wassette + +This directory contains deployment configurations for running Wassette on Kubernetes. + +## Overview + +Wassette can be deployed to Kubernetes using either raw manifests or Helm charts. Both options provide production-ready configurations with security best practices. + +## Deployment Options + +### 1. Kubernetes Manifests + +Use the raw Kubernetes manifests for simple deployments or when you need full control over the configuration. + +📁 **Location**: [`kubernetes/`](kubernetes/) + +**Quick Start:** +```bash +kubectl apply -f kubernetes/deployment.yaml +``` + +**Features:** +- Simple YAML-based deployment +- Single file for easy management +- Namespace isolation +- Health checks and resource limits +- Security context configuration + +**Use When:** +- You need a quick deployment +- You don't need advanced features like autoscaling +- You prefer direct kubectl management +- You want to customize the YAML directly + +[Learn more →](kubernetes/README.md) + +### 2. Helm Chart + +Use the Helm chart for production deployments with advanced features and easier upgrades. + +📁 **Location**: [`helm/wassette/`](helm/wassette/) + +**Quick Start:** +```bash +helm install wassette deployment/helm/wassette/ \ + --namespace wassette \ + --create-namespace +``` + +**Features:** +- Templated configuration with values +- Easy upgrades and rollbacks +- Autoscaling support +- Ingress configuration +- Network policies +- Persistent storage options +- Pod disruption budgets + +**Use When:** +- You need production-ready deployment +- You want easy configuration management +- You need advanced features (autoscaling, ingress, etc.) +- You prefer Helm for package management +- You need to maintain multiple environments + +[Learn more →](helm/wassette/README.md) + +## Integration with Kagent + +Wassette can be integrated with [kagent](https://github.com/kagent-dev/kagent), a Kubernetes-native framework for building AI agents. Kagent uses the `RemoteMCPServer` custom resource to connect to MCP servers like Wassette. + +**Architecture:** +``` +┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ +│ Kagent Agent │ ◄─────► │ RemoteMCPServer │ ◄─────► │ Wassette │ +│ │ │ (Kubernetes │ │ MCP Server │ +│ │ │ CRD) │ │ (streamable- │ +│ │ │ │ │ http) │ +└─────────────────┘ └──────────────────┘ └─────────────────┘ + │ + ▼ + ┌─────────────────┐ + │ WebAssembly │ + │ Components │ + └─────────────────┘ +``` + +**Quick Integration:** +```bash +# 1. Deploy Wassette +kubectl apply -f kubernetes/deployment.yaml + +# 2. Create RemoteMCPServer resource +kubectl apply -f kubernetes/wassette-remotemcp.yaml + +# 3. Verify integration +kubectl get remotemcpservers -n kagent +``` + +[Complete integration guide →](kubernetes/kagent-integration.md) + +## Choosing the Right Deployment Method + +| Feature | Kubernetes Manifests | Helm Chart | +|---------|---------------------|------------| +| **Ease of Setup** | ✅ Very Simple | ⚠️ Requires Helm | +| **Customization** | ✅ Direct YAML editing | ✅ Values-based config | +| **Upgrades** | ⚠️ Manual kubectl apply | ✅ helm upgrade | +| **Rollbacks** | ❌ Manual | ✅ helm rollback | +| **Autoscaling** | ❌ Not included | ✅ Built-in | +| **Ingress** | ❌ Not included | ✅ Built-in | +| **Persistent Storage** | ⚠️ Manual configuration | ✅ Built-in | +| **Network Policies** | ❌ Not included | ✅ Built-in | +| **Production Ready** | ⚠️ Basic features | ✅ Full features | +| **Multi-Environment** | ⚠️ Difficult | ✅ Easy with values | + +## Common Configurations + +### Minimal Deployment + +For testing or development: + +```bash +# Using kubectl +kubectl apply -f kubernetes/deployment.yaml + +# Using Helm +helm install wassette deployment/helm/wassette/ \ + --namespace wassette \ + --create-namespace +``` + +### Production Deployment + +For production with high availability: + +```bash +helm install wassette deployment/helm/wassette/ \ + --namespace wassette \ + --create-namespace \ + --set replicaCount=3 \ + --set persistence.enabled=true \ + --set autoscaling.enabled=true \ + --set podDisruptionBudget.enabled=true \ + --set networkPolicy.enabled=true +``` + +### With Persistent Storage + +To persist components across restarts: + +```bash +helm install wassette deployment/helm/wassette/ \ + --namespace wassette \ + --create-namespace \ + --set persistence.enabled=true \ + --set persistence.size=5Gi +``` + +### With Secrets + +To provide API keys to components: + +```bash +# Create values file +cat > values.yaml < values.yaml <..svc.cluster.local: + url: "http://wassette.wassette.svc.cluster.local:9001" + + # Optional: Timeout for requests to the MCP server + timeout: "30s" + + # Optional: Close the MCP server connection when the agent disconnects + terminateOnClose: true + + # Optional: Timeout for SSE reads (only relevant if using SSE protocol) + # sseReadTimeout: "60s" + + # Optional: Custom headers for authentication or other purposes + # headersFrom: + # - name: "Authorization" + # value: "Bearer token" + # - name: "X-API-Key" + # valueFrom: + # type: Secret + # name: wassette-auth + # key: api-key diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 55025d72..bb8fa0b9 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -10,6 +10,7 @@ # Deployment - [Docker](./deployment/docker.md) +- [Kubernetes](./deployment/kubernetes.md) - [Operations](./deployment/operations.md) # Developer Guide diff --git a/docs/deployment/kubernetes.md b/docs/deployment/kubernetes.md new file mode 100644 index 00000000..cd0adb6d --- /dev/null +++ b/docs/deployment/kubernetes.md @@ -0,0 +1,351 @@ +# Kubernetes Deployment + +This guide covers deploying Wassette on Kubernetes clusters, including integration with the [kagent](https://github.com/kagent-dev/kagent) framework. + +## Overview + +Wassette can be deployed to Kubernetes using either: +- **Raw Kubernetes manifests** - For simple deployments +- **Helm charts** - For production deployments with advanced features + +Both deployment methods are production-ready and include security best practices. + +## Quick Start + +### Using Kubernetes Manifests + +```bash +kubectl apply -f https://raw.githubusercontent.com/microsoft/wassette/main/deployment/kubernetes/deployment.yaml +``` + +This creates a namespace, deployment, and service for Wassette. + +### Using Helm Chart + +```bash +# From the repository root +helm install wassette deployment/helm/wassette/ \ + --namespace wassette \ + --create-namespace +``` + +## Deployment Options + +### Kubernetes Manifests + +**Location**: [`deployment/kubernetes/`](https://github.com/microsoft/wassette/tree/main/deployment/kubernetes) + +Simple YAML-based deployment suitable for: +- Quick deployments +- Development and testing +- When you need full control over YAML +- Simple production deployments + +[View detailed guide →](https://github.com/microsoft/wassette/blob/main/deployment/kubernetes/README.md) + +### Helm Chart + +**Location**: [`deployment/helm/wassette/`](https://github.com/microsoft/wassette/tree/main/deployment/helm/wassette) + +Production-ready Helm chart with: +- Autoscaling (HPA) +- Ingress configuration +- Network policies +- Persistent storage +- Pod disruption budgets +- ConfigMaps and Secrets management + +[View detailed guide →](https://github.com/microsoft/wassette/blob/main/deployment/helm/wassette/README.md) + +## Integration with Kagent + +Wassette integrates seamlessly with [kagent](https://github.com/kagent-dev/kagent), a Kubernetes-native framework for building AI agents. Kagent uses the `RemoteMCPServer` custom resource to connect to MCP servers like Wassette. + +### Architecture + +``` +┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ +│ Kagent Agent │ ◄─────► │ RemoteMCPServer │ ◄─────► │ Wassette │ +│ │ │ (Kubernetes │ │ MCP Server │ +│ │ │ CRD) │ │ (streamable- │ +│ │ │ │ │ http) │ +└─────────────────┘ └──────────────────┘ └─────────────────┘ + │ + ▼ + ┌─────────────────┐ + │ WebAssembly │ + │ Components │ + └─────────────────┘ +``` + +### Quick Integration + +1. **Deploy Wassette**: + ```bash + kubectl apply -f https://raw.githubusercontent.com/microsoft/wassette/main/deployment/kubernetes/deployment.yaml + ``` + +2. **Create RemoteMCPServer resource**: + ```bash + kubectl apply -f https://raw.githubusercontent.com/microsoft/wassette/main/deployment/kubernetes/wassette-remotemcp.yaml + ``` + +3. **Verify connection**: + ```bash + kubectl get remotemcpservers -n kagent + kubectl describe remotemcpserver wassette-mcp -n kagent + ``` + +4. **Use in an Agent**: + ```yaml + apiVersion: kagent.dev/v1alpha2 + kind: Agent + metadata: + name: my-agent + namespace: kagent + spec: + systemPrompt: "You have access to WebAssembly-based tools." + modelConfigRef: + name: default-model + toolServers: + - name: wassette-mcp + ``` + +[Complete integration guide →](https://github.com/microsoft/wassette/blob/main/deployment/kubernetes/kagent-integration.md) + +## Transport Protocols + +Wassette supports multiple MCP transport protocols in Kubernetes: + +### Streamable HTTP (Recommended) + +Default transport for Kubernetes deployments. Best performance and compatibility with kagent. + +```bash +# Service URL +http://wassette.wassette.svc.cluster.local:9001 +``` + +### SSE (Server-Sent Events) + +Alternative HTTP-based transport: + +```bash +# With Helm +helm install wassette deployment/helm/wassette/ \ + --set wassette.transport=sse + +# Service URL +http://wassette.wassette.svc.cluster.local:9001/sse +``` + +## Configuration + +### Resource Limits + +Adjust CPU and memory limits for your workload: + +```bash +# Using Helm +helm install wassette deployment/helm/wassette/ \ + --set resources.requests.cpu=200m \ + --set resources.requests.memory=256Mi \ + --set resources.limits.cpu=1000m \ + --set resources.limits.memory=1Gi +``` + +### Persistent Storage + +Enable persistent storage for components: + +```bash +helm install wassette deployment/helm/wassette/ \ + --set persistence.enabled=true \ + --set persistence.size=5Gi +``` + +### Secrets + +Provide API keys and credentials: + +```bash +# Create a values file +cat > values.yaml <