# ⚑ Quick Reference - Comandos y URLs Referencia rΓ‘pida de todo lo importante en un solo lugar. --- ## 🌐 URLs | Servicio | URL | Credenciales | Estado | |----------|-----|--------------|--------| | **Frontend** | https://app.fuq.tv | - | βœ… Running (2 pods) | | **Backend API** | https://api.fuq.tv | - | βœ… Running (2 pods) | | **Terminal Web** | https://claude.fuq.tv | - | βœ… Running (tmux persistente) | | **Gitea** | https://git.fuq.tv | admin / admin123 | βœ… Running | | **ArgoCD** | https://argocd.fuq.tv | admin / LyPF4Hy0wvp52IoU | βœ… Running | | **Longhorn** | https://longhorn.fuq.tv | admin / aiworker2026 | βœ… Running | | **HAProxy Stats** | http://108.165.47.221:8404/stats | admin / aiworker2026 | βœ… Running | ### Repositorios Git | Repo | URL | DescripciΓ³n | |------|-----|-------------| | Frontend | https://git.fuq.tv/admin/aiworker-frontend | React + Vite + Tailwind | | Backend | https://git.fuq.tv/admin/aiworker-backend | Bun + Drizzle + MCP | | Agent | https://git.fuq.tv/admin/aiworker-agent | Ubuntu 24.04 + Claude Code | | Actions (frontend) | https://git.fuq.tv/admin/aiworker-frontend/actions | CI/CD | | Actions (backend) | https://git.fuq.tv/admin/aiworker-backend/actions | CI/CD | | Actions (agent) | https://git.fuq.tv/admin/aiworker-agent/actions | CI/CD | | Packages | https://git.fuq.tv/admin/-/packages | Container Registry | --- ## πŸ”‘ 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 -n # Exec kubectl exec -it -n -- /bin/sh # Port-forward kubectl port-forward svc/ 3000:3000 -n ``` ### 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/: . docker push git.fuq.tv/admin/: ``` ### K8s Secret ```bash kubectl create secret docker-registry gitea-registry \ --docker-server=git.fuq.tv \ --docker-username=admin \ --docker-password=7401126cfb56ab2aebba17755bdc968c20768c27 \ -n ``` --- ## πŸ–₯️ 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) " 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 -n # Logs recientes kubectl logs --tail=100 -n # Logs de todos los containers kubectl logs -n --all-containers ``` ### Events ```bash kubectl get events -A --sort-by='.lastTimestamp' | tail -20 kubectl get events -n ``` --- ## πŸ—„οΈ 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 \ --from-literal=key1=value1 \ --from-literal=key2=value2 ``` ### View secret ```bash kubectl get secret my-secret -n -o yaml kubectl get secret my-secret -n -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@ ``` --- ## 🌍 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 ``` --- ## πŸ”Œ API Endpoints ### Backend API (https://api.fuq.tv) ```bash # Health GET /api/health # Auth POST /api/auth/register POST /api/auth/login POST /api/auth/logout GET /api/auth/me # Projects (CRUD) GET /api/projects GET /api/projects/:id POST /api/projects PATCH /api/projects/:id DELETE /api/projects/:id # Tasks (CRUD) GET /api/tasks GET /api/tasks/:id POST /api/tasks PATCH /api/tasks/:id DELETE /api/tasks/:id # Agents (CRUD) GET /api/agents GET /api/agents/:id POST /api/agents PATCH /api/agents/:id DELETE /api/agents/:id # MCP Tools (para agentes) GET /api/mcp/tools POST /api/mcp/get_next_task POST /api/mcp/update_task_status POST /api/mcp/create_branch POST /api/mcp/create_pull_request POST /api/mcp/ask_user_question ``` --- ## πŸ“ ESTRUCTURA DEL PROYECTO ``` teamSquadAiWorker/ β”œβ”€β”€ backend/ # Bun backend (βœ… Desplegado) β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ api/routes/ # Auth, Projects, Tasks, Agents, MCP β”‚ β”‚ β”œβ”€β”€ db/ # Drizzle schema + migrations β”‚ β”‚ └── index.ts # Bun.serve() β”‚ β”œβ”€β”€ Dockerfile β”‚ └── .gitea/workflows/ β”œβ”€β”€ frontend/ # React + Vite (βœ… Desplegado) β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ components/ # UI components β”‚ β”‚ β”œβ”€β”€ pages/ # Login, Register, Dashboard β”‚ β”‚ β”œβ”€β”€ api/ # API client β”‚ β”‚ └── lib/ # Auth context β”‚ β”œβ”€β”€ Dockerfile β”‚ └── .gitea/workflows/ β”œβ”€β”€ agents/ # Claude Code agent (βœ… Desplegado) β”‚ β”œβ”€β”€ Dockerfile # Ubuntu 24.04 + Node 24 + Bun β”‚ β”œβ”€β”€ mcp-bridge-server.js β”‚ β”œβ”€β”€ claude-code-config.json β”‚ └── AGENT-ACCESS.md β”œβ”€β”€ k8s/ # Kubernetes manifests (βœ… Aplicados) β”‚ β”œβ”€β”€ backend/ # Deployment, Service, Ingress β”‚ β”œβ”€β”€ frontend/ # Deployment, Service, Ingress β”‚ └── agents/ # Deployment, ServiceAccount β”œβ”€β”€ docs/ # DocumentaciΓ³n completa β”œβ”€β”€ past-sessions/ # Sesiones anteriores β”‚ β”œβ”€β”€ 2026-01-19-infrastructure-deployment.md β”‚ β”œβ”€β”€ 2026-01-19-backend-api-implementation.md β”‚ └── 2026-01-20-frontend-mcp-agents.md β”œβ”€β”€ ROADMAP.md # Plan general β”œβ”€β”€ NEXT-SESSION.md # PrΓ³ximos pasos detallados β”œβ”€β”€ TROUBLESHOOTING.md # SoluciΓ³n de problemas β”œβ”€β”€ QUICK-REFERENCE.md # Este archivo β”œβ”€β”€ K8S-CLUSTER.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 # frontend, backend kubectl get pods -n agents # claude-agent, claude-terminal kubectl get pods -n gitea # gitea # 3. Verificar URLs funcionan curl -s https://app.fuq.tv/ | grep "AiWorker" curl -s https://api.fuq.tv/api/health | jq . curl -s https://claude.fuq.tv/ | head -5 # 4. Desarrollo local cd backend && bun run dev # Backend cd frontend && bun run dev # Frontend # 5. Ver CI/CD builds open https://git.fuq.tv/admin/aiworker-frontend/actions open https://git.fuq.tv/admin/aiworker-backend/actions open https://git.fuq.tv/admin/aiworker-agent/actions # 6. Rollout restart despuΓ©s de builds kubectl rollout restart deployment/frontend -n control-plane kubectl rollout restart deployment/backend -n control-plane kubectl rollout restart deployment/claude-agent -n agents # 7. Continuar donde te quedaste cat NEXT-SESSION.md ``` --- ## πŸ§ͺ Testing RΓ‘pido ### Frontend ```bash # Login y crear proyecto open https://app.fuq.tv # Register β†’ Login β†’ New Project β†’ Click Project β†’ New Task ``` ### Backend API ```bash # Health check curl -s https://api.fuq.tv/api/health | jq . # Register user curl -X POST https://api.fuq.tv/api/auth/register \ -H "Content-Type: application/json" \ -d '{"email":"test@test.com","username":"test","password":"test1234"}' # List projects curl -s https://api.fuq.tv/api/projects | jq . # MCP tools curl -s https://api.fuq.tv/api/mcp/tools | jq '.tools[] | .name' ``` ### Agent ```bash # Conectar al terminal web open https://claude.fuq.tv # O conectar al pod directamente kubectl exec -it -n agents deployment/claude-agent -- /bin/bash cd /workspace claude ``` --- ## 🎊 FIN DE QUICK REFERENCE **Todo lo importante en un solo lugar. Β‘Guarda este archivo!**