Files
cleverclaude-core/docs/deployment.md
T
2025-08-01 18:38:09 -04:00

2.9 KiB

Deployment Guide

Docker

Building the Image

# Build with default tag
docker build -t boilerplate:latest .

# Build with specific version
docker build -t boilerplate:v0.1.0 .

Running the Container

# Show help
docker run --rm boilerplate:latest

# Run with custom arguments
docker run --rm boilerplate:latest --name Docker --count 3

Multi-Platform Builds

# Build for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 \
  -t ghcr.io/cleverthis/boilerplate:latest \
  --push .

Kubernetes with Helm

Prerequisites

  • Kubernetes cluster (1.23+)
  • Helm 3.x installed
  • kubectl configured

Basic Installation

# Install with default values
helm install boilerplate ./k8s

# Install with custom values
helm install boilerplate ./k8s \
  --set image.tag=v0.1.0 \
  --set replicaCount=3

Customization

Create a values-prod.yaml file:

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:

helm upgrade --install boilerplate ./k8s \
  -f values-prod.yaml \
  --namespace production \
  --create-namespace

Monitoring the Deployment

# Check deployment status
kubectl get deployments -n production

# Check pod status
kubectl get pods -n production -l app.kubernetes.io/name=boilerplate

# Check HPA status
kubectl get hpa -n production

# View logs
kubectl logs -n production -l app.kubernetes.io/name=boilerplate

Rollback

# View release history
helm history boilerplate -n production

# Rollback to previous version
helm rollback boilerplate -n production

# Rollback to specific revision
helm rollback boilerplate 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:

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 boilerplate ./k8s \
          --namespace production \
          --set image.tag=${{ github.sha }} \
          --wait