first commit

This commit is contained in:
Roger Oriol
2026-02-03 23:50:19 +01:00
commit 87fb32b559
80 changed files with 8884 additions and 0 deletions

99
k8s/deploy.sh Executable file
View File

@@ -0,0 +1,99 @@
#!/bin/bash
# Deployment script for MyOrg Assistant to k3s
set -e
echo "🚀 Deploying MyOrg Assistant to k3s..."
# Check if kubectl is available
if ! command -v kubectl &> /dev/null; then
echo "❌ kubectl not found. Please install kubectl first."
exit 1
fi
# Check if we're connected to the cluster
if ! kubectl cluster-info &> /dev/null; then
echo "❌ Cannot connect to k3s cluster. Please check your kubeconfig."
exit 1
fi
echo "✅ Connected to k3s cluster"
# Build Docker image
echo ""
echo "📦 Building Docker image..."
cd ..
docker build -t myorg-assistant:latest .
# Load image into k3s (if using k3s)
echo ""
echo "📥 Loading image into k3s..."
if command -v k3s &> /dev/null; then
docker save myorg-assistant:latest | sudo k3s ctr images import -
else
echo "⚠️ k3s command not found, assuming image is already available"
fi
cd k8s
# Check if secret exists
if kubectl get secret myorg-assistant-secret &> /dev/null; then
echo ""
echo "✅ Secret already exists"
else
echo ""
echo "⚠️ Secret not found!"
echo "Please create k8s/secret.yaml from k8s/secret.yaml.example and apply it:"
echo " cp secret.yaml.example secret.yaml"
echo " # Edit secret.yaml with your credentials"
echo " kubectl apply -f secret.yaml"
exit 1
fi
# Apply manifests
echo ""
echo "📝 Applying Kubernetes manifests..."
echo " - ConfigMap..."
kubectl apply -f configmap.yaml
echo " - PersistentVolumeClaim..."
kubectl apply -f pvc.yaml
echo " - Service..."
kubectl apply -f service.yaml
echo " - Deployment..."
kubectl apply -f deployment.yaml
echo " - CronJobs..."
kubectl apply -f cronjobs/
# Wait for deployment
echo ""
echo "⏳ Waiting for deployment to be ready..."
kubectl rollout status deployment/myorg-assistant --timeout=300s
# Show status
echo ""
echo "✅ Deployment complete!"
echo ""
echo "📊 Status:"
kubectl get pods -l app=myorg-assistant
echo ""
kubectl get svc myorg-assistant-service
echo ""
# Show logs
echo "📋 Recent logs:"
POD_NAME=$(kubectl get pods -l app=myorg-assistant -o jsonpath='{.items[0].metadata.name}')
kubectl logs $POD_NAME --tail=20
echo ""
echo "🎉 MyOrg Assistant is now running!"
echo ""
echo "Useful commands:"
echo " View logs: kubectl logs -f $POD_NAME"
echo " Pod shell: kubectl exec -it $POD_NAME -- /bin/bash"
echo " Restart: kubectl rollout restart deployment/myorg-assistant"
echo " Delete: kubectl delete -f k8s/"