Renombrar FlotillasGPS a ADAN en todo el proyecto
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Solucion de Problemas
|
||||
|
||||
Guia para diagnosticar y resolver problemas comunes en FlotillasGPS.
|
||||
Guia para diagnosticar y resolver problemas comunes en ADAN.
|
||||
|
||||
## Diagnostico Rapido
|
||||
|
||||
@@ -8,10 +8,10 @@ Guia para diagnosticar y resolver problemas comunes en FlotillasGPS.
|
||||
|
||||
```bash
|
||||
# Ver estado de todos los servicios
|
||||
systemctl status flotillas-api flotillas-web traccar mediamtx cloudflared redis postgresql
|
||||
systemctl status adan-api adan-web traccar mediamtx cloudflared redis postgresql
|
||||
|
||||
# Resumen rapido
|
||||
for svc in flotillas-api flotillas-web traccar mediamtx cloudflared; do
|
||||
for svc in adan-api adan-web traccar mediamtx cloudflared; do
|
||||
echo "$svc: $(systemctl is-active $svc)"
|
||||
done
|
||||
```
|
||||
@@ -20,10 +20,10 @@ done
|
||||
|
||||
```bash
|
||||
# API Backend
|
||||
journalctl -u flotillas-api -f
|
||||
journalctl -u adan-api -f
|
||||
|
||||
# Frontend
|
||||
journalctl -u flotillas-web -f
|
||||
journalctl -u adan-web -f
|
||||
|
||||
# Traccar (GPS)
|
||||
journalctl -u traccar -f
|
||||
@@ -45,7 +45,7 @@ curl http://localhost:8000/api/v1/health
|
||||
curl http://localhost:3000
|
||||
|
||||
# Base de datos
|
||||
psql -U flotillas -d flotillas_db -c "SELECT 1"
|
||||
psql -U adan -d adan_db -c "SELECT 1"
|
||||
|
||||
# Redis
|
||||
redis-cli ping
|
||||
@@ -64,12 +64,12 @@ redis-cli ping
|
||||
1. Estado del tunnel de Cloudflare:
|
||||
```bash
|
||||
systemctl status cloudflared
|
||||
cloudflared tunnel info flotillas
|
||||
cloudflared tunnel info adan
|
||||
```
|
||||
|
||||
2. Estado del frontend:
|
||||
```bash
|
||||
systemctl status flotillas-web
|
||||
systemctl status adan-web
|
||||
curl http://localhost:3000
|
||||
```
|
||||
|
||||
@@ -90,17 +90,17 @@ systemctl restart cloudflared
|
||||
|
||||
**Verificar**:
|
||||
```bash
|
||||
systemctl status flotillas-api
|
||||
systemctl status adan-api
|
||||
curl http://localhost:8000/api/v1/health
|
||||
```
|
||||
|
||||
**Soluciones**:
|
||||
```bash
|
||||
# Reiniciar backend
|
||||
systemctl restart flotillas-api
|
||||
systemctl restart adan-api
|
||||
|
||||
# Ver logs de error
|
||||
journalctl -u flotillas-api -n 100 --no-pager
|
||||
journalctl -u adan-api -n 100 --no-pager
|
||||
```
|
||||
|
||||
### Error de SSL/Certificado
|
||||
@@ -186,7 +186,7 @@ curl http://localhost:8082/api/devices
|
||||
**Verificar**:
|
||||
```bash
|
||||
# Ver ubicaciones recientes en DB
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT vehiculo_id, tiempo, lat, lng
|
||||
FROM ubicaciones
|
||||
ORDER BY tiempo DESC
|
||||
@@ -210,7 +210,7 @@ psql -U flotillas -d flotillas_db -c "
|
||||
**Verificar en el servidor**:
|
||||
```bash
|
||||
# Ver ultimas ubicaciones de apps
|
||||
journalctl -u flotillas-api | grep "ubicacion" | tail -20
|
||||
journalctl -u adan-api | grep "ubicacion" | tail -20
|
||||
```
|
||||
|
||||
### App no puede conectar al servidor
|
||||
@@ -238,7 +238,7 @@ journalctl -u flotillas-api | grep "ubicacion" | tail -20
|
||||
**En el servidor**:
|
||||
```bash
|
||||
# Ver logs de notificaciones
|
||||
journalctl -u flotillas-api | grep "push\|notification"
|
||||
journalctl -u adan-api | grep "push\|notification"
|
||||
```
|
||||
|
||||
---
|
||||
@@ -284,21 +284,21 @@ ffprobe rtsp://usuario:password@IP_CAMARA/stream
|
||||
|
||||
1. Espacio en disco:
|
||||
```bash
|
||||
df -h /opt/flotillas/videos
|
||||
df -h /opt/adan/videos
|
||||
```
|
||||
|
||||
2. Permisos:
|
||||
```bash
|
||||
ls -la /opt/flotillas/videos
|
||||
ls -la /opt/adan/videos
|
||||
```
|
||||
|
||||
**Solucion**:
|
||||
```bash
|
||||
# Liberar espacio
|
||||
find /opt/flotillas/videos -name "*.mp4" -mtime +30 -delete
|
||||
find /opt/adan/videos -name "*.mp4" -mtime +30 -delete
|
||||
|
||||
# Arreglar permisos
|
||||
chown -R www-data:www-data /opt/flotillas/videos
|
||||
chown -R www-data:www-data /opt/adan/videos
|
||||
```
|
||||
|
||||
---
|
||||
@@ -312,7 +312,7 @@ chown -R www-data:www-data /opt/flotillas/videos
|
||||
systemctl status postgresql
|
||||
|
||||
# Verificar que acepta conexiones
|
||||
psql -U flotillas -d flotillas_db -c "SELECT 1"
|
||||
psql -U adan -d adan_db -c "SELECT 1"
|
||||
```
|
||||
|
||||
**Soluciones**:
|
||||
@@ -329,7 +329,7 @@ journalctl -u postgresql -f
|
||||
**Verificar**:
|
||||
```bash
|
||||
# Ver consultas lentas
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT pid, now() - pg_stat_activity.query_start AS duration, query
|
||||
FROM pg_stat_activity
|
||||
WHERE state != 'idle'
|
||||
@@ -341,26 +341,26 @@ psql -U flotillas -d flotillas_db -c "
|
||||
|
||||
1. Ejecutar VACUUM:
|
||||
```bash
|
||||
psql -U flotillas -d flotillas_db -c "VACUUM ANALYZE;"
|
||||
psql -U adan -d adan_db -c "VACUUM ANALYZE;"
|
||||
```
|
||||
|
||||
2. Verificar indices:
|
||||
```bash
|
||||
psql -U flotillas -d flotillas_db -c "\di"
|
||||
psql -U adan -d adan_db -c "\di"
|
||||
```
|
||||
|
||||
### Disco lleno por ubicaciones
|
||||
|
||||
**Verificar**:
|
||||
```bash
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT pg_size_pretty(pg_total_relation_size('ubicaciones'));
|
||||
"
|
||||
```
|
||||
|
||||
**Solucion**: Comprimir datos antiguos (TimescaleDB):
|
||||
```bash
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT compress_chunk(c)
|
||||
FROM show_chunks('ubicaciones', older_than => INTERVAL '7 days') c;
|
||||
"
|
||||
@@ -406,10 +406,10 @@ ps aux | grep uvicorn
|
||||
|
||||
1. Aumentar workers en el servicio:
|
||||
```bash
|
||||
# Editar /etc/systemd/system/flotillas-api.service
|
||||
# Editar /etc/systemd/system/adan-api.service
|
||||
# Cambiar --workers 4 a --workers 8
|
||||
systemctl daemon-reload
|
||||
systemctl restart flotillas-api
|
||||
systemctl restart adan-api
|
||||
```
|
||||
|
||||
2. Verificar conexiones a Redis:
|
||||
@@ -429,7 +429,7 @@ redis-cli info clients
|
||||
systemctl status mosquitto
|
||||
|
||||
# Suscribirse para ver mensajes
|
||||
mosquitto_sub -h localhost -t "flotillas/mesh/#" -u mesh_gateway -P password
|
||||
mosquitto_sub -h localhost -t "adan/mesh/#" -u mesh_gateway -P password
|
||||
```
|
||||
|
||||
**Verificar configuracion del gateway**:
|
||||
@@ -441,7 +441,7 @@ mosquitto_sub -h localhost -t "flotillas/mesh/#" -u mesh_gateway -P password
|
||||
|
||||
**Verificar**:
|
||||
```bash
|
||||
journalctl -u flotillas-api | grep "meshtastic\|mesh"
|
||||
journalctl -u adan-api | grep "meshtastic\|mesh"
|
||||
```
|
||||
|
||||
**Solucion**: Verificar que el servicio MQTT esta corriendo en el backend.
|
||||
@@ -455,38 +455,38 @@ journalctl -u flotillas-api | grep "meshtastic\|mesh"
|
||||
**Verificar**:
|
||||
```bash
|
||||
# Espacio en disco
|
||||
df -h /opt/flotillas/backups
|
||||
df -h /opt/adan/backups
|
||||
|
||||
# Permisos
|
||||
ls -la /opt/flotillas/scripts/backup.sh
|
||||
ls -la /opt/adan/scripts/backup.sh
|
||||
```
|
||||
|
||||
**Ejecutar manualmente para ver errores**:
|
||||
```bash
|
||||
/opt/flotillas/scripts/backup.sh 2>&1 | tee /tmp/backup.log
|
||||
/opt/adan/scripts/backup.sh 2>&1 | tee /tmp/backup.log
|
||||
```
|
||||
|
||||
### Restauracion falla
|
||||
|
||||
**Verificar integridad del backup**:
|
||||
```bash
|
||||
gunzip -t /opt/flotillas/backups/db_FECHA.sql.gz
|
||||
gunzip -t /opt/adan/backups/db_FECHA.sql.gz
|
||||
```
|
||||
|
||||
**Restaurar paso a paso**:
|
||||
```bash
|
||||
# Parar servicios
|
||||
systemctl stop flotillas-api
|
||||
systemctl stop adan-api
|
||||
|
||||
# Recrear base de datos
|
||||
psql -U postgres -c "DROP DATABASE flotillas_db;"
|
||||
psql -U postgres -c "CREATE DATABASE flotillas_db OWNER flotillas;"
|
||||
psql -U postgres -c "DROP DATABASE adan_db;"
|
||||
psql -U postgres -c "CREATE DATABASE adan_db OWNER adan;"
|
||||
|
||||
# Restaurar
|
||||
gunzip -c backup.sql.gz | psql -U flotillas -d flotillas_db
|
||||
gunzip -c backup.sql.gz | psql -U adan -d adan_db
|
||||
|
||||
# Iniciar servicios
|
||||
systemctl start flotillas-api
|
||||
systemctl start adan-api
|
||||
```
|
||||
|
||||
---
|
||||
@@ -495,7 +495,7 @@ systemctl start flotillas-api
|
||||
|
||||
```bash
|
||||
# Estado general del sistema
|
||||
systemctl status flotillas-api flotillas-web traccar mediamtx cloudflared
|
||||
systemctl status adan-api adan-web traccar mediamtx cloudflared
|
||||
|
||||
# Uso de recursos
|
||||
htop
|
||||
@@ -503,7 +503,7 @@ df -h
|
||||
free -h
|
||||
|
||||
# Logs en tiempo real
|
||||
journalctl -u flotillas-api -f
|
||||
journalctl -u adan-api -f
|
||||
|
||||
# Conexiones activas
|
||||
ss -tlnp
|
||||
@@ -515,10 +515,10 @@ netstat -tlnp
|
||||
curl -s http://localhost:8000/api/v1/health | jq
|
||||
|
||||
# Test de base de datos
|
||||
psql -U flotillas -d flotillas_db -c "SELECT COUNT(*) FROM vehiculos;"
|
||||
psql -U adan -d adan_db -c "SELECT COUNT(*) FROM vehiculos;"
|
||||
|
||||
# Ultimas ubicaciones
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT v.nombre, u.tiempo, u.lat, u.lng, u.velocidad
|
||||
FROM ubicaciones u
|
||||
JOIN vehiculos v ON u.vehiculo_id = v.id
|
||||
@@ -527,7 +527,7 @@ psql -U flotillas -d flotillas_db -c "
|
||||
"
|
||||
|
||||
# Alertas pendientes
|
||||
psql -U flotillas -d flotillas_db -c "
|
||||
psql -U adan -d adan_db -c "
|
||||
SELECT COUNT(*) as pendientes FROM alertas WHERE atendida = false;
|
||||
"
|
||||
```
|
||||
@@ -545,12 +545,12 @@ Si no puedes resolver el problema:
|
||||
echo "=== FECHA ==="
|
||||
date
|
||||
echo "=== SERVICIOS ==="
|
||||
systemctl status flotillas-api flotillas-web traccar mediamtx cloudflared
|
||||
systemctl status adan-api adan-web traccar mediamtx cloudflared
|
||||
echo "=== RECURSOS ==="
|
||||
free -h
|
||||
df -h
|
||||
echo "=== LOGS RECIENTES ==="
|
||||
journalctl -u flotillas-api -n 50 --no-pager
|
||||
journalctl -u adan-api -n 50 --no-pager
|
||||
} > /tmp/diagnostico.txt
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user