Skip to content

Commit e4f8049

Browse files
committed
feat: descripción del cambio
1 parent 4a1949c commit e4f8049

File tree

5 files changed

+648
-0
lines changed

5 files changed

+648
-0
lines changed

docs/API_REFERENCE.md

Whitespace-only changes.

docs/ARCHITECTURE.md

Whitespace-only changes.

docs/CONTRIBUTING.md

Whitespace-only changes.

docs/DEPLOYMENT_GUIDE.md

Lines changed: 347 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,347 @@
1+
# 🚀 Neural Nexus - Guía de Despliegue
2+
3+
## 📋 Requisitos Previos
4+
5+
### 🖥️ Hardware Mínimo
6+
7+
| Componente | Orchestrator | Edge Node | Raspberry Pi | NVIDIA Jetson |
8+
|------------|-------------|-----------|--------------|---------------|
9+
| **CPU** | 4 cores @ 2.5GHz | 2 cores @ 1.8GHz | ARM Cortex-A72 | ARM Cortex-A78AE |
10+
| **RAM** | 8GB DDR4 | 4GB DDR4 | 4GB LPDDR4 | 8GB LPDDR4x |
11+
| **Storage** | 100GB SSD | 50GB SSD | 32GB microSD | 64GB eMMC |
12+
| **Network** | 1Gbps | 100Mbps | 100Mbps | 1Gbps |
13+
| **GPU** | Opcional | Opcional | - | NVIDIA GPU |
14+
15+
### 🐳 Software Requerido
16+
17+
```bash
18+
# Instalar Docker y Docker Compose
19+
curl -fsSL https://get.docker.com -o get-docker.sh
20+
sh get-docker.sh
21+
sudo usermod -aG docker $USER
22+
23+
# Instalar Docker Compose
24+
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
25+
sudo chmod +x /usr/local/bin/docker-compose
26+
27+
# Instalar Kubernetes (opcional)
28+
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
29+
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
30+
sudo apt-get update
31+
sudo apt-get install -y kubectl
32+
```
33+
34+
## 🏗️ Despliegue Local (Desarrollo)
35+
36+
### 1. 📥 Clonar y Configurar
37+
38+
```bash
39+
# Clonar repositorio
40+
git clone https://github.com/mechmind-dwv/core-system.git
41+
cd core-system
42+
43+
# Configurar variables de entorno
44+
cp .env.example .env
45+
nano .env
46+
```
47+
48+
### 2. 🔧 Configuración de Entorno
49+
50+
```bash
51+
# .env
52+
NEURAL_NEXUS_ENV=development
53+
ORCHESTRATOR_HOST=localhost
54+
ORCHESTRATOR_PORT=8080
55+
POSTGRES_PASSWORD=neural_nexus_2024
56+
REDIS_PASSWORD=redis_neural_nexus
57+
MQTT_USERNAME=neural_nexus
58+
MQTT_PASSWORD=mqtt_neural_nexus
59+
```
60+
61+
### 3. 🚀 Levantar Servicios
62+
63+
```bash
64+
# Desarrollo completo
65+
docker-compose --profile development up -d
66+
67+
# Solo servicios core
68+
docker-compose up -d neural-nexus-orchestrator neural-nexus-node postgres redis mosquitto
69+
70+
# Verificar servicios
71+
docker-compose ps
72+
```
73+
74+
### 4. 🧪 Verificar Instalación
75+
76+
```bash
77+
# Health check del orchestrator
78+
curl http://localhost:8080/health
79+
80+
# Verificar nodo edge
81+
curl http://localhost:8081/health
82+
83+
# Verificar métricas
84+
curl http://localhost:8080/metrics
85+
```
86+
87+
## 🌐 Despliegue en Producción
88+
89+
### 1. 🏭 Usando Docker Swarm
90+
91+
```bash
92+
# Inicializar swarm
93+
docker swarm init
94+
95+
# Crear stack de producción
96+
docker stack deploy -c docker-compose.prod.yml neural-nexus
97+
98+
# Verificar servicios
99+
docker service ls
100+
```
101+
102+
### 2. ☸️ Despliegue en Kubernetes
103+
104+
```yaml
105+
# k8s/namespace.yaml
106+
apiVersion: v1
107+
kind: Namespace
108+
metadata:
109+
name: neural-nexus
110+
labels:
111+
name: neural-nexus
112+
```
113+
114+
```bash
115+
# Aplicar manifiestos
116+
kubectl apply -f k8s/namespace.yaml
117+
kubectl apply -f k8s/configmap.yaml
118+
kubectl apply -f k8s/secrets.yaml
119+
kubectl apply -f k8s/orchestrator.yaml
120+
kubectl apply -f k8s/node.yaml
121+
122+
# Verificar despliegue
123+
kubectl get pods -n neural-nexus
124+
kubectl get services -n neural-nexus
125+
```
126+
127+
### 3. 🔧 Configuración avanzada
128+
129+
```yaml
130+
# k8s/orchestrator.yaml
131+
apiVersion: apps/v1
132+
kind: Deployment
133+
metadata:
134+
name: neural-nexus-orchestrator
135+
namespace: neural-nexus
136+
spec:
137+
replicas: 3
138+
selector:
139+
matchLabels:
140+
app: neural-nexus-orchestrator
141+
template:
142+
metadata:
143+
labels:
144+
app: neural-nexus-orchestrator
145+
spec:
146+
containers:
147+
- name: orchestrator
148+
image: neuralnexus/orchestrator:latest
149+
ports:
150+
- containerPort: 8080
151+
- containerPort: 50051
152+
env:
153+
- name: RUST_LOG
154+
value: "info"
155+
- name: DATABASE_URL
156+
valueFrom:
157+
secretKeyRef:
158+
name: neural-nexus-secrets
159+
key: database-url
160+
resources:
161+
requests:
162+
memory: "512Mi"
163+
cpu: "500m"
164+
limits:
165+
memory: "1Gi"
166+
cpu: "1000m"
167+
livenessProbe:
168+
httpGet:
169+
path: /health
170+
port: 8080
171+
initialDelaySeconds: 30
172+
periodSeconds: 10
173+
readinessProbe:
174+
httpGet:
175+
path: /ready
176+
port: 8080
177+
initialDelaySeconds: 5
178+
periodSeconds: 5
179+
```
180+
181+
## 📱 Despliegue en Dispositivos Edge
182+
183+
### 1. 🥧 Raspberry Pi
184+
185+
```bash
186+
# Preparar Raspberry Pi
187+
sudo apt-get update
188+
sudo apt-get install -y docker.io
189+
sudo systemctl enable docker
190+
sudo usermod -aG docker pi
191+
192+
# Instalar Neural Nexus
193+
docker run -d \
194+
--name neural-nexus-rpi \
195+
--restart unless-stopped \
196+
-v /opt/neural-nexus:/app/data \
197+
-v /opt/neural-nexus/config:/app/config \
198+
-p 8080:8080 \
199+
-e DEVICE_TYPE=raspberry-pi \
200+
-e ORCHESTRATOR_URL=https://orchestrator.your-domain.com \
201+
neuralnexus/raspberry-pi:latest
202+
203+
# Verificar funcionamiento
204+
docker logs neural-nexus-rpi
205+
```
206+
207+
### 2. 🚀 NVIDIA Jetson
208+
209+
```bash
210+
# Instalar JetPack (si no está instalado)
211+
sudo apt-get install nvidia-jetpack
212+
213+
# Verificar CUDA
214+
nvidia-smi
215+
216+
# Desplegar Neural Nexus
217+
docker run -d \
218+
--name neural-nexus-jetson \
219+
--restart unless-stopped \
220+
--runtime nvidia \
221+
-v /opt/neural-nexus:/app/data \
222+
-v /opt/neural-nexus/models:/app/models \
223+
-p 8080:8080 \
224+
-e DEVICE_TYPE=jetson \
225+
-e GPU_ACCELERATION=true \
226+
neuralnexus/jetson:latest
227+
```
228+
229+
### 3. 🔧 Configuración Automática
230+
231+
```bash
232+
# Script de auto-configuración
233+
#!/bin/bash
234+
# scripts/deploy-edge.sh
235+
236+
DEVICE_TYPE=${1:-generic}
237+
ORCHESTRATOR_URL=${2:-http://localhost:8080}
238+
239+
echo "🚀 Desplegando Neural Nexus en $DEVICE_TYPE"
240+
241+
# Detectar arquitectura
242+
ARCH=$(uname -m)
243+
case $ARCH in
244+
armv7l) IMAGE_TAG="arm32v7" ;;
245+
aarch64) IMAGE_TAG="arm64v8" ;;
246+
x86_64) IMAGE_TAG="amd64" ;;
247+
*) echo "Arquitectura no soportada: $ARCH"; exit 1 ;;
248+
esac
249+
250+
# Crear directorio de configuración
251+
sudo mkdir -p /opt/neural-nexus/{config,data,models,logs}
252+
253+
# Generar configuración
254+
cat > /opt/neural-nexus/config/node.toml << EOF
255+
[node]
256+
id = "$(hostname)-$(date +%s)"
257+
type = "$DEVICE_TYPE"
258+
location = "$(hostname)"
259+
260+
[orchestrator]
261+
url = "$ORCHESTRATOR_URL"
262+
heartbeat_interval = 30
263+
264+
[inference]
265+
model_path = "/app/models/current.onnx"
266+
batch_size = 1
267+
max_latency_ms = 100
268+
EOF
269+
270+
# Desplegar contenedor
271+
docker run -d \
272+
--name neural-nexus-$DEVICE_TYPE \
273+
--restart unless-stopped \
274+
-v /opt/neural-nexus:/app \
275+
-p 8080:8080 \
276+
neuralnexus/edge-$IMAGE_TAG:latest
277+
278+
echo "✅ Neural Nexus desplegado exitosamente"
279+
```
280+
281+
## 🔧 Configuración de Red
282+
283+
### 1. 🌐 Load Balancer (Nginx)
284+
285+
```nginx
286+
# /etc/nginx/sites-available/neural-nexus
287+
upstream neural_nexus_orchestrator {
288+
server orchestrator1.neural-nexus.com:8080;
289+
server orchestrator2.neural-nexus.com:8080;
290+
server orchestrator3.neural-nexus.com:8080;
291+
}
292+
293+
server {
294+
listen 80;
295+
server_name neural-nexus.com;
296+
297+
location / {
298+
proxy_pass http://neural_nexus_orchestrator;
299+
proxy_set_header Host $host;
300+
proxy_set_header X-Real-IP $remote_addr;
301+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
302+
proxy_set_header X-Forwarded-Proto $scheme;
303+
}
304+
305+
location /metrics {
306+
proxy_pass http://neural_nexus_orchestrator;
307+
allow 10.0.0.0/8;
308+
deny all;
309+
}
310+
}
311+
```
312+
313+
### 2. 🔒 SSL/TLS con Let's Encrypt
314+
315+
```bash
316+
# Instalar Certbot
317+
sudo apt-get install certbot python3-certbot-nginx
318+
319+
# Obtener certificado
320+
sudo certbot --nginx -d neural-nexus.com
321+
322+
# Auto-renovación
323+
sudo crontab -e
324+
# Añadir: 0 12 * * * /usr/bin/certbot renew --quiet
325+
```
326+
327+
## 📊 Monitoreo y Logging
328+
329+
### 1. 📈 Prometheus + Grafana
330+
331+
```yaml
332+
# docker-compose.monitoring.yml
333+
version: '3.8'
334+
335+
services:
336+
prometheus:
337+
image: prom/prometheus:latest
338+
ports:
339+
- "9090:9090"
340+
volumes:
341+
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
342+
- prometheus_data:/prometheus
343+
command:
344+
- '--config.file=/etc/prometheus/prometheus.yml'
345+
- '--storage.tsdb.path=/prometheus'
346+
- '--web.console.libraries=/etc/prometheus/console_libraries'
347+
- '--web.console

0 commit comments

Comments
 (0)