## Backend Changes - Add new API endpoints: combustible, pois, mantenimiento, video, configuracion - Fix vehiculos endpoint to return paginated response with items array - Add /vehiculos/all endpoint for non-paginated list - Add /geocercas/all endpoint - Add /alertas/configuracion GET/PUT endpoints - Add /viajes/activos and /viajes/iniciar endpoints - Add /reportes/stats, /reportes/templates, /reportes/preview endpoints - Add /conductores/all and /conductores/disponibles endpoints - Update router.py to include all new modules ## Frontend Changes - Fix authentication token handling (snake_case vs camelCase) - Update vehiculosApi.listAll to use /vehiculos/all - Fix FuelGauge component usage in Combustible page - Fix chart component exports (named + default exports) - Update API client for proper token refresh ## Infrastructure - Rename services from ADAN to ATLAS - Configure Cloudflare tunnel for atlas.consultoria-as.com - Update systemd service files - Configure PostgreSQL with TimescaleDB - Configure Redis, Mosquitto, Traccar, MediaMTX ## Documentation - Update installation guides - Update API reference - Rename all ADAN references to ATLAS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
134 lines
3.7 KiB
Bash
134 lines
3.7 KiB
Bash
#!/bin/bash
|
|
# ============================================
|
|
# Sistema de ATLAS - Visor de Logs
|
|
# ============================================
|
|
# Muestra logs de los diferentes servicios
|
|
#
|
|
# Uso: ./logs.sh [servicio] [--follow] [--lines N]
|
|
#
|
|
# Servicios: api, web, traccar, mediamtx, postgres, redis, all
|
|
# ============================================
|
|
|
|
# Variables
|
|
LINES="${LINES:-100}"
|
|
FOLLOW=false
|
|
SERVICE="api"
|
|
|
|
# Colores
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
# ---------------------------------------------
|
|
# Parsear argumentos
|
|
# ---------------------------------------------
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
api|web|traccar|mediamtx|postgres|redis|mosquitto|all)
|
|
SERVICE="$1"
|
|
shift
|
|
;;
|
|
-f|--follow)
|
|
FOLLOW=true
|
|
shift
|
|
;;
|
|
-n|--lines)
|
|
LINES="$2"
|
|
shift 2
|
|
;;
|
|
--help|-h)
|
|
echo "Sistema de ATLAS - Visor de Logs"
|
|
echo ""
|
|
echo "Uso: $0 [servicio] [opciones]"
|
|
echo ""
|
|
echo "Servicios:"
|
|
echo " api - Backend FastAPI"
|
|
echo " web - Frontend"
|
|
echo " traccar - Traccar GPS"
|
|
echo " mediamtx - Video streaming"
|
|
echo " postgres - Base de datos"
|
|
echo " redis - Cache"
|
|
echo " mosquitto - MQTT"
|
|
echo " all - Todos los servicios"
|
|
echo ""
|
|
echo "Opciones:"
|
|
echo " -f, --follow Seguir logs en tiempo real"
|
|
echo " -n, --lines N Numero de lineas (default: 100)"
|
|
echo ""
|
|
echo "Ejemplos:"
|
|
echo " $0 api -f # Seguir logs de API"
|
|
echo " $0 traccar -n 500 # Ultimas 500 lineas de Traccar"
|
|
echo " $0 all -f # Todos los logs en tiempo real"
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Opcion desconocida: $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# ---------------------------------------------
|
|
# Mostrar logs
|
|
# ---------------------------------------------
|
|
show_logs() {
|
|
local unit="$1"
|
|
local name="$2"
|
|
|
|
echo -e "${BLUE}=== Logs de $name ===${NC}"
|
|
|
|
local cmd="journalctl -u $unit -n $LINES --no-pager"
|
|
|
|
if [[ "$FOLLOW" == "true" ]]; then
|
|
cmd="journalctl -u $unit -f"
|
|
fi
|
|
|
|
$cmd 2>/dev/null || echo "Servicio no disponible o sin logs"
|
|
echo ""
|
|
}
|
|
|
|
case $SERVICE in
|
|
api)
|
|
show_logs "atlas-api" "API Backend"
|
|
;;
|
|
web)
|
|
show_logs "atlas-web" "Frontend"
|
|
;;
|
|
traccar)
|
|
show_logs "traccar" "Traccar GPS"
|
|
# Tambien mostrar log de archivo si existe
|
|
if [[ -f "/opt/traccar/logs/tracker-server.log" ]]; then
|
|
echo -e "${BLUE}=== Log de archivo Traccar ===${NC}"
|
|
tail -n $LINES /opt/traccar/logs/tracker-server.log
|
|
fi
|
|
;;
|
|
mediamtx)
|
|
show_logs "mediamtx" "MediaMTX"
|
|
;;
|
|
postgres)
|
|
show_logs "postgresql" "PostgreSQL"
|
|
;;
|
|
redis)
|
|
show_logs "redis-server" "Redis"
|
|
;;
|
|
mosquitto)
|
|
show_logs "mosquitto" "Mosquitto MQTT"
|
|
;;
|
|
all)
|
|
if [[ "$FOLLOW" == "true" ]]; then
|
|
echo "Mostrando todos los logs en tiempo real..."
|
|
echo "Presiona Ctrl+C para salir"
|
|
echo ""
|
|
journalctl -u atlas-api -u atlas-web -u traccar -u mediamtx -u mosquitto -f
|
|
else
|
|
show_logs "atlas-api" "API Backend"
|
|
show_logs "atlas-web" "Frontend"
|
|
show_logs "traccar" "Traccar GPS"
|
|
show_logs "mediamtx" "MediaMTX"
|
|
show_logs "mosquitto" "Mosquitto MQTT"
|
|
fi
|
|
;;
|
|
esac
|