Enhance LLM sandbox with persistent caching, helper scripts, and improved UX

Added comprehensive improvements to ClawdBox for better LLM agent experience:

- Tools: Added tree, tmux, htop, strace, file, less for enhanced debugging
- Python packages: httpie, pyyaml, requests, black, ipython pre-installed
- Persistent caching: pip/npm caches now survive container restarts
- Git config persistence: .gitconfig auto-links from /data volume
- Shell improvements: colored prompt, aliases (ll, k, dc), 10k line history
- Helper scripts: ConfigMap with disk-usage, health-check, clean-workspace, install-tools
- Environment variables: TERM, TZ, DEBIAN_FRONTEND for better compatibility
- Makefile: Common operations (build, deploy, logs, shell, health-check)
- Documentation: Comprehensive README with troubleshooting and workflows

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 23:51:26 +11:00
parent 8fe712cda7
commit e039f77f0e
5 changed files with 562 additions and 8 deletions

80
Makefile Normal file
View File

@@ -0,0 +1,80 @@
.PHONY: build push deploy redeploy logs shell disk-usage clean-cache health-check help
IMAGE_NAME=default-route-openshift-image-registry.apps.lab.apilab.us/clawdbox/clawdbox:latest
NAMESPACE=clawdbox
SSH_HOST=clawdbox.apps.lab.apilab.us
SSH_PORT=2222
SSH_USER=claw
help:
@echo "ClawdBox Makefile - Common Operations"
@echo ""
@echo "Build & Deploy:"
@echo " make build - Build Docker image"
@echo " make push - Build and push image to registry"
@echo " make deploy - Deploy all manifests to cluster"
@echo " make redeploy - Push image and restart deployment"
@echo ""
@echo "Operations:"
@echo " make logs - Stream pod logs"
@echo " make shell - SSH into container"
@echo " make disk-usage - Check /data disk usage"
@echo " make clean-cache - Clear pip/npm caches"
@echo " make health-check - Run comprehensive health diagnostics"
@echo ""
@echo "Debugging:"
@echo " make describe - Describe deployment"
@echo " make events - Show namespace events"
@echo " make restart - Restart deployment (without push)"
build:
docker build -t $(IMAGE_NAME) .
push: build
docker push $(IMAGE_NAME)
deploy:
kubectl apply -f manifests/
redeploy: push
kubectl rollout restart deployment/clawdbox -n $(NAMESPACE)
@echo "Waiting for rollout to complete..."
kubectl rollout status deployment/clawdbox -n $(NAMESPACE)
restart:
kubectl rollout restart deployment/clawdbox -n $(NAMESPACE)
kubectl rollout status deployment/clawdbox -n $(NAMESPACE)
logs:
kubectl logs -f -n $(NAMESPACE) deployment/clawdbox
shell:
ssh -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST)
disk-usage:
@ssh -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST) "df -h /data && echo '' && echo 'Top 10 Largest Directories:' && du -h /data 2>/dev/null | sort -rh | head -10"
clean-cache:
@ssh -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST) "rm -rf /data/.cache/pip/* /data/.cache/npm/* && echo 'Package caches cleared'"
health-check:
@ssh -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST) "/data/scripts/health-check.sh"
describe:
kubectl describe deployment/clawdbox -n $(NAMESPACE)
events:
kubectl get events -n $(NAMESPACE) --sort-by='.lastTimestamp'
status:
@echo "=== Deployment Status ==="
@kubectl get deployment -n $(NAMESPACE)
@echo ""
@echo "=== Pod Status ==="
@kubectl get pods -n $(NAMESPACE)
@echo ""
@echo "=== Service Status ==="
@kubectl get svc -n $(NAMESPACE)
@echo ""
@echo "=== Route Status ==="
@kubectl get route -n $(NAMESPACE) 2>/dev/null || echo "No routes found (not on OpenShift?)"