# Deployment Guide ## Docker ### Building the Image ```bash # Build with default tag docker build -t cleverclaude:latest . # Build with specific version docker build -t cleverclaude:v0.1.0 . ``` ### Running the Container ```bash # Show help docker run --rm cleverclaude:latest # Run with custom arguments docker run --rm cleverclaude:latest --name Docker --count 3 ``` ### Multi-Platform Builds ```bash # Build for multiple platforms docker buildx build --platform linux/amd64,linux/arm64 \ -t ghcr.io/cleverthis/cleverclaude:latest \ --push . ``` ## Kubernetes with Helm ### Prerequisites - Kubernetes cluster (1.23+) - Helm 3.x installed - kubectl configured ### Basic Installation ```bash # Install with default values helm install cleverclaude ./k8s # Install with custom values helm install cleverclaude ./k8s \ --set image.tag=v0.1.0 \ --set replicaCount=3 ``` ### Customization Create a `values-prod.yaml` file: ```yaml image: tag: v0.1.0 pullPolicy: Always resources: limits: cpu: 1000m memory: 512Mi requests: cpu: 200m memory: 256Mi autoscaling: enabled: true minReplicas: 3 maxReplicas: 10 targetCPUUtilizationPercentage: 60 ingress: enabled: true className: nginx hosts: - host: api.example.com paths: - path: / pathType: Prefix tls: - secretName: api-tls hosts: - api.example.com ``` Deploy with custom values: ```bash helm upgrade --install cleverclaude ./k8s \ -f values-prod.yaml \ --namespace production \ --create-namespace ``` ### Monitoring the Deployment ```bash # Check deployment status kubectl get deployments -n production # Check pod status kubectl get pods -n production -l app.kubernetes.io/name=cleverclaude # Check HPA status kubectl get hpa -n production # View logs kubectl logs -n production -l app.kubernetes.io/name=cleverclaude ``` ### Rollback ```bash # View release history helm history cleverclaude -n production # Rollback to previous version helm rollback cleverclaude -n production # Rollback to specific revision helm rollback cleverclaude 3 -n production ``` ## CI/CD Pipeline The Forgejo Actions workflow automatically: 1. Runs linting and type checking 2. Executes behavior tests on Python 3.11, 3.12, and 3.13 3. Builds the wheel package 4. Creates and tests the Docker image 5. Validates the Helm chart ### Continuous Deployment Add this job to `.forgejo/workflows/ci.yml` for automated deployments: ```yaml deploy: needs: [docker, helm] runs-on: docker if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - name: Deploy to Kubernetes env: KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_BASE64 }} run: | echo "$KUBECONFIG_DATA" | base64 -d > /tmp/kubeconfig export KUBECONFIG=/tmp/kubeconfig helm upgrade --install cleverclaude ./k8s \ --namespace production \ --set image.tag=${{ github.sha }} \ --wait ```