|
| 1 | +# AlphaTrion Helm Chart - Quick Start Guide |
| 2 | + |
| 3 | +This guide will help you quickly deploy AlphaTrion on Kubernetes using Helm. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Kubernetes cluster (1.19+) |
| 8 | +- Helm 3.0+ |
| 9 | +- kubectl configured to access your cluster |
| 10 | +- **PostgreSQL database** (external, version 12 or later) |
| 11 | + |
| 12 | +## Quick Install (Local Development) |
| 13 | + |
| 14 | +### 1. Build Docker Images |
| 15 | + |
| 16 | +```bash |
| 17 | +# Build backend image |
| 18 | +docker build -t alphatrion-server:latest . |
| 19 | + |
| 20 | +# Build dashboard image |
| 21 | +docker build -t alphatrion-dashboard:latest ./dashboard |
| 22 | +``` |
| 23 | + |
| 24 | +### 2. Load Images to Kubernetes (if using minikube/kind) |
| 25 | + |
| 26 | +```bash |
| 27 | +# For minikube |
| 28 | +minikube image load alphatrion-server:latest |
| 29 | +minikube image load alphatrion-dashboard:latest |
| 30 | + |
| 31 | +# For kind |
| 32 | +kind load docker-image alphatrion-server:latest |
| 33 | +kind load docker-image alphatrion-dashboard:latest |
| 34 | +``` |
| 35 | + |
| 36 | +### 3. Setup PostgreSQL Database |
| 37 | + |
| 38 | +You need an external PostgreSQL database. For local development, you can quickly spin one up: |
| 39 | + |
| 40 | +```bash |
| 41 | +# Using Docker |
| 42 | +docker run -d --name alphatrion-postgres \ |
| 43 | + -e POSTGRES_DB=alphatrion \ |
| 44 | + -e POSTGRES_USER=alphatrion \ |
| 45 | + -e POSTGRES_PASSWORD=alphatr1on \ |
| 46 | + -p 5432:5432 \ |
| 47 | + postgres:16-alpine |
| 48 | + |
| 49 | +# Or using Kubernetes |
| 50 | +kubectl run postgres --image=postgres:16-alpine \ |
| 51 | + --env="POSTGRES_DB=alphatrion" \ |
| 52 | + --env="POSTGRES_USER=alphatrion" \ |
| 53 | + --env="POSTGRES_PASSWORD=alphatr1on" \ |
| 54 | + --port=5432 |
| 55 | + |
| 56 | +kubectl expose pod postgres --port=5432 --target-port=5432 |
| 57 | +``` |
| 58 | + |
| 59 | +### 4. Install Helm Chart |
| 60 | + |
| 61 | +```bash |
| 62 | +# Install with PostgreSQL connection |
| 63 | +helm install alphatrion ./helm-charts/alphatrion \ |
| 64 | + -f ./helm-charts/alphatrion/values-dev.yaml \ |
| 65 | + --set postgresql.host=postgres \ |
| 66 | + --set postgresql.password=alphatr1on |
| 67 | +``` |
| 68 | + |
| 69 | +**Note:** If using Docker PostgreSQL from your host, use `host.docker.internal` or your host IP instead of `postgres`. |
| 70 | + |
| 71 | +### 5. Wait for Pods to Start |
| 72 | + |
| 73 | +```bash |
| 74 | +kubectl get pods -l app.kubernetes.io/name=alphatrion -w |
| 75 | +``` |
| 76 | + |
| 77 | +### 6. Initialize AlphaTrion |
| 78 | + |
| 79 | +```bash |
| 80 | +kubectl exec -it deploy/alphatrion-server -- alphatrion init \ |
| 81 | + --username admin \ |
| 82 | + --email admin@example.com |
| 83 | +``` |
| 84 | + |
| 85 | +Save the `USER_ID` and `TEAM_ID` from the output. |
| 86 | + |
| 87 | +### 7. Access the Dashboard |
| 88 | + |
| 89 | +```bash |
| 90 | +kubectl port-forward svc/alphatrion-dashboard 8080:80 |
| 91 | +``` |
| 92 | + |
| 93 | +Visit http://localhost:8080 in your browser. |
| 94 | + |
| 95 | +## Common Operations |
| 96 | + |
| 97 | +### View Logs |
| 98 | + |
| 99 | +```bash |
| 100 | +# Backend logs |
| 101 | +kubectl logs -l app.kubernetes.io/component=server -f |
| 102 | + |
| 103 | +# Dashboard logs |
| 104 | +kubectl logs -l app.kubernetes.io/component=dashboard -f |
| 105 | + |
| 106 | +# Migration logs |
| 107 | +kubectl logs job/alphatrion-migration |
| 108 | +``` |
| 109 | + |
| 110 | +### Access Backend API |
| 111 | + |
| 112 | +```bash |
| 113 | +kubectl port-forward svc/alphatrion-server 8000:8000 |
| 114 | +curl http://localhost:8000/health |
| 115 | +``` |
| 116 | + |
| 117 | +### Access PostgreSQL |
| 118 | + |
| 119 | +```bash |
| 120 | +# If using Kubernetes PostgreSQL pod |
| 121 | +kubectl port-forward pod/postgres 5432:5432 |
| 122 | +psql -h localhost -U alphatrion -d alphatrion |
| 123 | +# Password: alphatr1on (dev default) |
| 124 | + |
| 125 | +# If using Docker PostgreSQL |
| 126 | +psql -h localhost -U alphatrion -d alphatrion |
| 127 | +# Password: alphatr1on (dev default) |
| 128 | +``` |
| 129 | + |
| 130 | +### Upgrade Release |
| 131 | + |
| 132 | +```bash |
| 133 | +helm upgrade alphatrion ./helm-charts/alphatrion -f ./helm-charts/alphatrion/values-dev.yaml |
| 134 | +``` |
| 135 | + |
| 136 | +### Uninstall |
| 137 | + |
| 138 | +```bash |
| 139 | +helm uninstall alphatrion |
| 140 | + |
| 141 | +# Optionally delete PostgreSQL (if you created it for dev) |
| 142 | +kubectl delete pod postgres |
| 143 | +kubectl delete svc postgres |
| 144 | + |
| 145 | +# Or if using Docker |
| 146 | +docker stop alphatrion-postgres |
| 147 | +docker rm alphatrion-postgres |
| 148 | +``` |
| 149 | + |
| 150 | +## Production Deployment |
| 151 | + |
| 152 | +For production, use `values-prod.yaml` and customize it: |
| 153 | + |
| 154 | +1. Update image repositories to your registry |
| 155 | +2. Configure your production PostgreSQL connection |
| 156 | +3. Enable ClickHouse for tracing |
| 157 | +4. Enable Docker Registry for artifacts |
| 158 | +5. Configure Ingress with TLS |
| 159 | +6. Set up proper secrets management |
| 160 | + |
| 161 | +```bash |
| 162 | +# Copy and customize production values |
| 163 | +cp helm-charts/alphatrion/values-prod.yaml my-prod-values.yaml |
| 164 | +# Edit my-prod-values.yaml with your PostgreSQL host and other settings |
| 165 | + |
| 166 | +# Create secret for PostgreSQL password |
| 167 | +kubectl create secret generic alphatrion-postgres-credentials \ |
| 168 | + --from-literal=password=your-secure-password |
| 169 | + |
| 170 | +# Install |
| 171 | +helm install alphatrion ./helm-charts/alphatrion -f my-prod-values.yaml |
| 172 | +``` |
| 173 | + |
| 174 | +## Troubleshooting |
| 175 | + |
| 176 | +### Pods Not Starting |
| 177 | + |
| 178 | +```bash |
| 179 | +# Check pod status |
| 180 | +kubectl get pods -l app.kubernetes.io/name=alphatrion |
| 181 | + |
| 182 | +# Describe pod for events |
| 183 | +kubectl describe pod <pod-name> |
| 184 | + |
| 185 | +# Check logs |
| 186 | +kubectl logs <pod-name> |
| 187 | +``` |
| 188 | + |
| 189 | +### Database Connection Issues |
| 190 | + |
| 191 | +```bash |
| 192 | +# Check if PostgreSQL is ready |
| 193 | +kubectl get pods -l app.kubernetes.io/name=postgresql |
| 194 | + |
| 195 | +# Check migration job logs |
| 196 | +kubectl logs job/alphatrion-migration |
| 197 | + |
| 198 | +# Test database connection |
| 199 | +kubectl exec -it deploy/alphatrion-server -- sh -c 'python -c "import os; print(os.getenv(\"ALPHATRION_METADATA_DB_URL\"))"' |
| 200 | +``` |
| 201 | + |
| 202 | +### Migration Failures |
| 203 | + |
| 204 | +```bash |
| 205 | +# View migration logs |
| 206 | +kubectl logs job/alphatrion-migration |
| 207 | + |
| 208 | +# If you need to re-run migrations |
| 209 | +kubectl delete job alphatrion-migration |
| 210 | +helm upgrade alphatrion ./helm-charts/alphatrion |
| 211 | +``` |
| 212 | + |
| 213 | +## Using AlphaTrion in Your Application |
| 214 | + |
| 215 | +After initialization, use AlphaTrion in your Python code: |
| 216 | + |
| 217 | +```python |
| 218 | +import alphatrion as alpha |
| 219 | + |
| 220 | +# Initialize with your USER_ID from the init command |
| 221 | +alpha.init(user_id='<YOUR_USER_ID>') |
| 222 | + |
| 223 | +# Create an experiment |
| 224 | +experiment = alpha.create_experiment( |
| 225 | + name="my-experiment", |
| 226 | + description="My first experiment" |
| 227 | +) |
| 228 | + |
| 229 | +# Track your GenAI application |
| 230 | +# ... your code here ... |
| 231 | +``` |
| 232 | + |
| 233 | +## Next Steps |
| 234 | + |
| 235 | +- Read the full [README.md](alphatrion/README.md) for detailed configuration options |
| 236 | +- Check the [values.yaml](alphatrion/values.yaml) for all available settings |
| 237 | +- Review [values-dev.yaml](alphatrion/values-dev.yaml) and [values-prod.yaml](alphatrion/values-prod.yaml) for environment-specific examples |
| 238 | + |
| 239 | +## Support |
| 240 | + |
| 241 | +- Documentation: https://github.com/InftyAI/alphatrion |
| 242 | +- Issues: https://github.com/InftyAI/alphatrion/issues |
0 commit comments