- CLAUDE.md for AI agents to understand the codebase - GITEA-GUIDE.md centralizes all Gitea operations (API, Registry, Auth) - DEVELOPMENT-WORKFLOW.md explains complete dev process - ROADMAP.md, NEXT-SESSION.md for planning - QUICK-REFERENCE.md, TROUBLESHOOTING.md for daily use - 40+ detailed docs in /docs folder - Backend as submodule from Gitea Everything documented for autonomous operation. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
391 lines
7.3 KiB
Markdown
391 lines
7.3 KiB
Markdown
# ⚡ Quick Reference - Comandos y URLs
|
|
|
|
Referencia rápida de todo lo importante en un solo lugar.
|
|
|
|
---
|
|
|
|
## 🌐 URLs
|
|
|
|
| Servicio | URL | Credenciales |
|
|
|----------|-----|--------------|
|
|
| Gitea | https://git.fuq.tv | admin / admin123 |
|
|
| ArgoCD | https://argocd.fuq.tv | admin / LyPF4Hy0wvp52IoU |
|
|
| Longhorn | https://longhorn.fuq.tv | admin / aiworker2026 |
|
|
| Backend Repo | https://git.fuq.tv/admin/aiworker-backend | - |
|
|
| Actions | https://git.fuq.tv/admin/aiworker-backend/actions | - |
|
|
| Packages | https://git.fuq.tv/admin/-/packages | - |
|
|
| Test App | https://test.fuq.tv | - |
|
|
| HAProxy Stats | http://108.165.47.221:8404/stats | admin / aiworker2026 |
|
|
|
|
---
|
|
|
|
## 🔑 Tokens y Secrets
|
|
|
|
```bash
|
|
# Gitea Full Access
|
|
159a5de2a16d15f33e388b55b1276e431dbca3f3
|
|
|
|
# Gitea Registry
|
|
7401126cfb56ab2aebba17755bdc968c20768c27
|
|
|
|
# K3s Token
|
|
K10e74a5aacfaf4e2e0a291c3b369db8588cf0b9c2590a4d66e04ab960e24fcb4db::server:bc53704a9707d3cd9188af9e558ab50c
|
|
```
|
|
|
|
---
|
|
|
|
## 💾 Base de Datos
|
|
|
|
### MariaDB (Interno)
|
|
```bash
|
|
Host: mariadb.control-plane.svc.cluster.local
|
|
Port: 3306
|
|
User: aiworker
|
|
Pass: AiWorker2026_UserPass!
|
|
DB: aiworker
|
|
```
|
|
|
|
### Conexión desde pod
|
|
```bash
|
|
kubectl exec -n control-plane mariadb-0 -- \
|
|
mariadb -uaiworker -pAiWorker2026_UserPass! aiworker
|
|
```
|
|
|
|
### Bases de datos
|
|
- `aiworker` - App principal
|
|
- `gitea` - Gitea data
|
|
|
|
---
|
|
|
|
## ☸️ Kubernetes
|
|
|
|
### Kubeconfig
|
|
```bash
|
|
export KUBECONFIG=~/.kube/aiworker-config
|
|
```
|
|
|
|
### Comandos Básicos
|
|
```bash
|
|
# Nodos
|
|
kubectl get nodes
|
|
|
|
# Todos los pods
|
|
kubectl get pods -A
|
|
|
|
# Pods en namespace
|
|
kubectl get pods -n control-plane
|
|
|
|
# Logs
|
|
kubectl logs -f <pod> -n <namespace>
|
|
|
|
# Exec
|
|
kubectl exec -it <pod> -n <namespace> -- /bin/sh
|
|
|
|
# Port-forward
|
|
kubectl port-forward svc/<service> 3000:3000 -n <namespace>
|
|
```
|
|
|
|
### Namespaces Principales
|
|
- `control-plane` - Backend, DB, Redis
|
|
- `agents` - Claude agents
|
|
- `gitea` - Git server
|
|
- `gitea-actions` - CI/CD runner
|
|
- `ingress-nginx` - Ingress
|
|
- `cert-manager` - TLS
|
|
- `longhorn-system` - Storage
|
|
- `argocd` - GitOps
|
|
|
|
---
|
|
|
|
## 🐳 Container Registry
|
|
|
|
### Login
|
|
```bash
|
|
docker login git.fuq.tv -u admin -p 7401126cfb56ab2aebba17755bdc968c20768c27
|
|
```
|
|
|
|
### Push
|
|
```bash
|
|
docker build -t git.fuq.tv/admin/<app>:<tag> .
|
|
docker push git.fuq.tv/admin/<app>:<tag>
|
|
```
|
|
|
|
### K8s Secret
|
|
```bash
|
|
kubectl create secret docker-registry gitea-registry \
|
|
--docker-server=git.fuq.tv \
|
|
--docker-username=admin \
|
|
--docker-password=7401126cfb56ab2aebba17755bdc968c20768c27 \
|
|
-n <namespace>
|
|
```
|
|
|
|
---
|
|
|
|
## 🖥️ SSH a Servidores
|
|
|
|
```bash
|
|
# Control Planes
|
|
ssh root@108.165.47.233 # k8s-cp-01
|
|
ssh root@108.165.47.235 # k8s-cp-02
|
|
ssh root@108.165.47.215 # k8s-cp-03
|
|
|
|
# Workers
|
|
ssh root@108.165.47.225 # k8s-worker-01
|
|
ssh root@108.165.47.224 # k8s-worker-02
|
|
ssh root@108.165.47.222 # k8s-worker-03
|
|
|
|
# Load Balancers
|
|
ssh root@108.165.47.221 # k8s-lb-01
|
|
ssh root@108.165.47.203 # k8s-lb-02
|
|
```
|
|
|
|
---
|
|
|
|
## 📦 Backend Development
|
|
|
|
### Local
|
|
```bash
|
|
cd backend
|
|
|
|
# Install deps
|
|
bun install
|
|
|
|
# Dev mode
|
|
bun run dev
|
|
|
|
# Generate migrations
|
|
bun run db:generate
|
|
|
|
# Build
|
|
bun build src/index.ts --outdir dist
|
|
```
|
|
|
|
### Port-forwards para desarrollo local
|
|
```bash
|
|
# Terminal 1: MariaDB
|
|
kubectl port-forward -n control-plane svc/mariadb 3306:3306
|
|
|
|
# Terminal 2: Redis
|
|
kubectl port-forward -n control-plane svc/redis 6379:6379
|
|
|
|
# Terminal 3: Backend
|
|
cd backend && bun run dev
|
|
```
|
|
|
|
---
|
|
|
|
## 🔄 Git Workflow
|
|
|
|
### Commits
|
|
```bash
|
|
git add .
|
|
git commit -m "Description
|
|
|
|
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>"
|
|
git push
|
|
```
|
|
|
|
### Ver Actions
|
|
```bash
|
|
open https://git.fuq.tv/admin/aiworker-backend/actions
|
|
```
|
|
|
|
### Build manual (si Actions falla)
|
|
```bash
|
|
# En un worker node
|
|
ssh root@108.165.47.225
|
|
|
|
cd /tmp
|
|
git clone https://git.fuq.tv/admin/aiworker-backend.git
|
|
cd aiworker-backend
|
|
|
|
docker build -t git.fuq.tv/admin/aiworker-backend:latest .
|
|
docker login git.fuq.tv -u admin -p 7401126cfb56ab2aebba17755bdc968c20768c27
|
|
docker push git.fuq.tv/admin/aiworker-backend:latest
|
|
```
|
|
|
|
---
|
|
|
|
## 🚀 Deploy
|
|
|
|
### Aplicar manifests
|
|
```bash
|
|
kubectl apply -f k8s/backend/
|
|
kubectl apply -f k8s/frontend/
|
|
```
|
|
|
|
### Ver estado
|
|
```bash
|
|
kubectl get all -n control-plane
|
|
kubectl logs -f deployment/backend -n control-plane
|
|
```
|
|
|
|
### Rollout
|
|
```bash
|
|
# Update image
|
|
kubectl set image deployment/backend backend=git.fuq.tv/admin/aiworker-backend:v2.0.0 -n control-plane
|
|
|
|
# Restart
|
|
kubectl rollout restart deployment/backend -n control-plane
|
|
|
|
# Status
|
|
kubectl rollout status deployment/backend -n control-plane
|
|
|
|
# Rollback
|
|
kubectl rollout undo deployment/backend -n control-plane
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Monitoring
|
|
|
|
### Resources
|
|
```bash
|
|
kubectl top nodes
|
|
kubectl top pods -A
|
|
kubectl top pods -n control-plane
|
|
```
|
|
|
|
### Logs
|
|
```bash
|
|
# Tail logs
|
|
kubectl logs -f <pod> -n <namespace>
|
|
|
|
# Logs recientes
|
|
kubectl logs --tail=100 <pod> -n <namespace>
|
|
|
|
# Logs de todos los containers
|
|
kubectl logs <pod> -n <namespace> --all-containers
|
|
```
|
|
|
|
### Events
|
|
```bash
|
|
kubectl get events -A --sort-by='.lastTimestamp' | tail -20
|
|
kubectl get events -n <namespace>
|
|
```
|
|
|
|
---
|
|
|
|
## 🗄️ Database
|
|
|
|
### Query rápido
|
|
```bash
|
|
kubectl exec -n control-plane mariadb-0 -- \
|
|
mariadb -uaiworker -pAiWorker2026_UserPass! aiworker \
|
|
-e "SHOW TABLES;"
|
|
```
|
|
|
|
### Backup
|
|
```bash
|
|
kubectl exec -n control-plane mariadb-0 -- \
|
|
mariadb-dump -uaiworker -pAiWorker2026_UserPass! aiworker \
|
|
> backup-$(date +%Y%m%d).sql
|
|
```
|
|
|
|
### Restore
|
|
```bash
|
|
cat backup.sql | kubectl exec -i -n control-plane mariadb-0 -- \
|
|
mariadb -uaiworker -pAiWorker2026_UserPass! aiworker
|
|
```
|
|
|
|
---
|
|
|
|
## 🔐 Secrets Management
|
|
|
|
### Create secret
|
|
```bash
|
|
kubectl create secret generic my-secret -n <namespace> \
|
|
--from-literal=key1=value1 \
|
|
--from-literal=key2=value2
|
|
```
|
|
|
|
### View secret
|
|
```bash
|
|
kubectl get secret my-secret -n <namespace> -o yaml
|
|
kubectl get secret my-secret -n <namespace> -o jsonpath='{.data.key1}' | base64 -d
|
|
```
|
|
|
|
---
|
|
|
|
## 🛠️ CubePath CLI
|
|
|
|
### Ver servidores
|
|
```bash
|
|
cubecli vps list
|
|
cubecli project list
|
|
```
|
|
|
|
### SSH a servidor
|
|
```bash
|
|
cubecli vps list | grep k8s-
|
|
ssh root@<ip>
|
|
```
|
|
|
|
---
|
|
|
|
## 🌍 DNS
|
|
|
|
**Configurado**:
|
|
```
|
|
*.fuq.tv → 108.165.47.221, 108.165.47.203
|
|
*.r.fuq.tv → 108.165.47.221, 108.165.47.203
|
|
```
|
|
|
|
**Verificar**:
|
|
```bash
|
|
dig api.fuq.tv +short
|
|
dig test.fuq.tv +short
|
|
```
|
|
|
|
---
|
|
|
|
## 📁 ESTRUCTURA DEL PROYECTO
|
|
|
|
```
|
|
teamSquadAiWorker/
|
|
├── backend/ # Bun backend
|
|
│ ├── src/
|
|
│ ├── Dockerfile
|
|
│ └── .gitea/workflows/
|
|
├── frontend/ # React (por crear)
|
|
├── docs/ # Documentación completa
|
|
├── scripts/ # Scripts de instalación
|
|
├── k8s/ # Manifests Kubernetes (por crear)
|
|
├── ROADMAP.md # Plan general
|
|
├── NEXT-SESSION.md # Próximos pasos detallados
|
|
├── TROUBLESHOOTING.md # Solución de problemas
|
|
├── QUICK-REFERENCE.md # Este archivo
|
|
├── CLUSTER-READY.md # Estado del cluster
|
|
└── CLUSTER-CREDENTIALS.md # Credenciales (sensible)
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 INICIO RÁPIDO DE SESIÓN
|
|
|
|
```bash
|
|
# 1. Verificar cluster
|
|
export KUBECONFIG=~/.kube/aiworker-config
|
|
kubectl get nodes
|
|
|
|
# 2. Ver servicios
|
|
kubectl get pods -n control-plane
|
|
kubectl get pods -n gitea
|
|
|
|
# 3. Backend local
|
|
cd backend
|
|
bun run dev
|
|
|
|
# 4. Ver Actions
|
|
open https://git.fuq.tv/admin/aiworker-backend/actions
|
|
|
|
# 5. Continuar donde te quedaste
|
|
code NEXT-SESSION.md
|
|
```
|
|
|
|
---
|
|
|
|
## 🎊 FIN DE QUICK REFERENCE
|
|
|
|
**Todo lo importante en un solo lugar. ¡Guarda este archivo!**
|