Renombrar FlotillasGPS a ADAN en todo el proyecto

This commit is contained in:
FlotillasGPS Developer
2026-01-21 08:26:01 +00:00
parent 51d78bacf4
commit 6d24ad6f61
37 changed files with 350 additions and 345 deletions

View File

@@ -5,7 +5,12 @@
"WebFetch(domain:palegreen-goldfish-709023.hostingersite.com)", "WebFetch(domain:palegreen-goldfish-709023.hostingersite.com)",
"Bash(git init:*)", "Bash(git init:*)",
"Bash(git config:*)", "Bash(git config:*)",
"Bash(git add:*)" "Bash(git add:*)",
"Bash(git commit:*)",
"Bash(curl:*)",
"Bash(git branch:*)",
"Bash(git remote add origin https://consultoria-as:b708144ceef22fef31217f1259a695005d67477b@git.consultoria-as.com/consultoria-as/ADAN.git)",
"Bash(git push:*)"
] ]
} }
} }

View File

@@ -1,12 +1,12 @@
# ============================================================================= # =============================================================================
# FlotillasGPS - Variables de Entorno # ADAN - Variables de Entorno
# ============================================================================= # =============================================================================
# Copiar este archivo a .env y configurar los valores # Copiar este archivo a .env y configurar los valores
# ============================================================================= # =============================================================================
# BASE DE DATOS # BASE DE DATOS
# ============================================================================= # =============================================================================
DATABASE_URL=postgresql://flotillas:password@localhost:5432/flotillas_db DATABASE_URL=postgresql://adan:password@localhost:5432/adan_db
DB_POOL_SIZE=10 DB_POOL_SIZE=10
DB_MAX_OVERFLOW=20 DB_MAX_OVERFLOW=20
@@ -40,7 +40,7 @@ MEDIAMTX_API=http://localhost:9997
MEDIAMTX_RTSP=rtsp://localhost:8554 MEDIAMTX_RTSP=rtsp://localhost:8554
MEDIAMTX_WEBRTC=http://localhost:8889 MEDIAMTX_WEBRTC=http://localhost:8889
MEDIAMTX_HLS=http://localhost:8888 MEDIAMTX_HLS=http://localhost:8888
VIDEO_STORAGE_PATH=/opt/flotillas/videos VIDEO_STORAGE_PATH=/opt/adan/videos
VIDEO_RETENTION_DAYS=30 VIDEO_RETENTION_DAYS=30
# ============================================================================= # =============================================================================
@@ -51,7 +51,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883 MQTT_PORT=1883
MQTT_USER=mesh_gateway MQTT_USER=mesh_gateway
MQTT_PASSWORD=cambiar_password MQTT_PASSWORD=cambiar_password
MQTT_TOPIC=flotillas/mesh/# MQTT_TOPIC=adan/mesh/#
# ============================================================================= # =============================================================================
# NOTIFICACIONES # NOTIFICACIONES
@@ -61,14 +61,14 @@ SMTP_HOST=smtp.ejemplo.com
SMTP_PORT=587 SMTP_PORT=587
SMTP_USER=notificaciones@ejemplo.com SMTP_USER=notificaciones@ejemplo.com
SMTP_PASSWORD=password SMTP_PASSWORD=password
SMTP_FROM=FlotillasGPS <notificaciones@ejemplo.com> SMTP_FROM=ADAN <notificaciones@ejemplo.com>
# ============================================================================= # =============================================================================
# DOMINIO Y URLs # DOMINIO Y URLs
# ============================================================================= # =============================================================================
DOMAIN=flotillas.tudominio.com DOMAIN=adan.tudominio.com
API_URL=https://flotillas.tudominio.com/api API_URL=https://adan.tudominio.com/api
FRONTEND_URL=https://flotillas.tudominio.com FRONTEND_URL=https://adan.tudominio.com
# ============================================================================= # =============================================================================
# CONFIGURACION # CONFIGURACION
@@ -76,7 +76,7 @@ FRONTEND_URL=https://flotillas.tudominio.com
ENVIRONMENT=production ENVIRONMENT=production
DEBUG=false DEBUG=false
LOG_LEVEL=info LOG_LEVEL=info
CORS_ORIGINS=https://flotillas.tudominio.com CORS_ORIGINS=https://adan.tudominio.com
DEFAULT_MAX_SPEED=80 DEFAULT_MAX_SPEED=80
DEFAULT_STOP_ALERT_MINUTES=30 DEFAULT_STOP_ALERT_MINUTES=30
DEFAULT_OFFLINE_ALERT_MINUTES=15 DEFAULT_OFFLINE_ALERT_MINUTES=15

View File

@@ -1,6 +1,6 @@
# FlotillasGPS - Sistema de Monitoreo de Flotillas # ADAN - Sistema de Monitoreo de ADAN
Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo real, video streaming, y app movil para conductores. Sistema completo de monitoreo de adan vehiculares con rastreo GPS en tiempo real, video streaming, y app movil para conductores.
## Caracteristicas Principales ## Caracteristicas Principales
@@ -63,8 +63,8 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
```bash ```bash
# Clonar repositorio # Clonar repositorio
git clone https://git.consultoria-as.com/tu-usuario/flotillas-gps.git git clone https://git.consultoria-as.com/tu-usuario/adan.git
cd flotillas-gps cd adan
# Ejecutar instalador # Ejecutar instalador
sudo ./deploy/scripts/install.sh sudo ./deploy/scripts/install.sh
@@ -75,7 +75,7 @@ El script instalara y configurara automaticamente todos los componentes.
## Estructura del Proyecto ## Estructura del Proyecto
``` ```
flotillas-gps/ adan/
├── backend/ # API FastAPI ├── backend/ # API FastAPI
├── frontend/ # Dashboard React ├── frontend/ # Dashboard React
├── mobile/ # App React Native ├── mobile/ # App React Native
@@ -113,16 +113,16 @@ Las credenciales se generan durante la instalacion y se muestran al final.
```bash ```bash
# Ver estado de servicios # Ver estado de servicios
systemctl status flotillas-api flotillas-web traccar mediamtx systemctl status adan-api adan-web traccar mediamtx
# Ver logs # Ver logs
journalctl -u flotillas-api -f journalctl -u adan-api -f
# Backup manual # Backup manual
/opt/flotillas/scripts/backup.sh /opt/adan/scripts/backup.sh
# Actualizar # Actualizar
/opt/flotillas/scripts/update.sh /opt/adan/scripts/update.sh
``` ```
## Seguridad ## Seguridad

View File

@@ -1,7 +1,7 @@
""" """
Adan Fleet Monitor Backend. Adan Fleet Monitor Backend.
Sistema de monitoreo de flotillas GPS. Sistema de monitoreo de adan GPS.
""" """
__version__ = "1.0.0" __version__ = "1.0.0"

View File

@@ -1,7 +1,7 @@
""" """
Aplicación principal FastAPI para Adan Fleet Monitor. Aplicación principal FastAPI para Adan Fleet Monitor.
Sistema de monitoreo de flotillas GPS con soporte para: Sistema de monitoreo de adan GPS con soporte para:
- Tracking en tiempo real - Tracking en tiempo real
- Gestión de vehículos y conductores - Gestión de vehículos y conductores
- Alertas y geocercas - Alertas y geocercas
@@ -59,7 +59,7 @@ app = FastAPI(
description=""" description="""
## Adan Fleet Monitor API ## Adan Fleet Monitor API
Sistema de monitoreo de flotillas GPS. Sistema de monitoreo de adan GPS.
### Funcionalidades principales: ### Funcionalidades principales:
- **Tracking en tiempo real** de vehículos - **Tracking en tiempo real** de vehículos

View File

@@ -1,6 +1,6 @@
# Deploy - Sistema de Flotillas # Deploy - Sistema de ADAN
Scripts y configuraciones para desplegar el sistema de flotillas en produccion. Scripts y configuraciones para desplegar el sistema de adan en produccion.
## Estructura ## Estructura
@@ -17,8 +17,8 @@ deploy/
│ ├── status.sh # Estado del sistema │ ├── status.sh # Estado del sistema
│ └── logs.sh # Visor de logs │ └── logs.sh # Visor de logs
├── services/ # Servicios systemd ├── services/ # Servicios systemd
│ ├── flotillas-api.service │ ├── adan-api.service
│ ├── flotillas-web.service │ ├── adan-web.service
│ ├── mediamtx.service │ ├── mediamtx.service
│ └── cloudflared.service │ └── cloudflared.service
├── cloudflare/ # Configuracion tunnel ├── cloudflare/ # Configuracion tunnel
@@ -44,15 +44,15 @@ deploy/
```bash ```bash
# Crear VM automaticamente # Crear VM automaticamente
./deploy/proxmox/vm-setup.sh --vmid 200 --name flotillas --memory 8192 ./deploy/proxmox/vm-setup.sh --vmid 200 --name adan --memory 8192
``` ```
### 2. En Ubuntu ### 2. En Ubuntu
```bash ```bash
# Clonar repositorio # Clonar repositorio
git clone https://github.com/tuorg/flotillas.git /opt/flotillas git clone https://github.com/tuorg/adan.git /opt/adan
cd /opt/flotillas cd /opt/adan
# Ejecutar instalador # Ejecutar instalador
sudo ./deploy/scripts/install.sh sudo ./deploy/scripts/install.sh
@@ -101,18 +101,18 @@ cloudflared tunnel login
3. Crear tunnel: 3. Crear tunnel:
```bash ```bash
cloudflared tunnel create flotillas cloudflared tunnel create adan
``` ```
4. Configurar DNS: 4. Configurar DNS:
```bash ```bash
cloudflared tunnel route dns flotillas flotillas.tudominio.com cloudflared tunnel route dns adan adan.tudominio.com
``` ```
5. Copiar config y habilitar servicio: 5. Copiar config y habilitar servicio:
```bash ```bash
mkdir -p /etc/cloudflared mkdir -p /etc/cloudflared
cp /opt/flotillas/deploy/cloudflare/config.yml /etc/cloudflared/ cp /opt/adan/deploy/cloudflare/config.yml /etc/cloudflared/
systemctl enable cloudflared systemctl enable cloudflared
systemctl start cloudflared systemctl start cloudflared
``` ```
@@ -144,7 +144,7 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
./deploy/scripts/restore.sh --latest ./deploy/scripts/restore.sh --latest
# Restaurar backup especifico # Restaurar backup especifico
./deploy/scripts/restore.sh --db /var/backups/flotillas/daily/flotillas_20240115_db.sql.gz ./deploy/scripts/restore.sh --db /var/backups/adan/daily/adan_20240115_db.sql.gz
``` ```
### Actualizar ### Actualizar
@@ -164,8 +164,8 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
| Servicio | Puerto | Descripcion | | Servicio | Puerto | Descripcion |
|----------|--------|-------------| |----------|--------|-------------|
| flotillas-api | 8000 | Backend FastAPI | | adan-api | 8000 | Backend FastAPI |
| flotillas-web | 3000 | Frontend | | adan-web | 3000 | Frontend |
| postgresql | 5432 | Base de datos | | postgresql | 5432 | Base de datos |
| redis | 6379 | Cache | | redis | 6379 | Cache |
| traccar | 5055 | GPS Server | | traccar | 5055 | GPS Server |
@@ -176,17 +176,17 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
```bash ```bash
# Estado # Estado
systemctl status flotillas-api systemctl status adan-api
# Reiniciar # Reiniciar
systemctl restart flotillas-api systemctl restart adan-api
# Logs # Logs
journalctl -u flotillas-api -f journalctl -u adan-api -f
# Habilitar/Deshabilitar # Habilitar/Deshabilitar
systemctl enable flotillas-api systemctl enable adan-api
systemctl disable flotillas-api systemctl disable adan-api
``` ```
## Seguridad ## Seguridad
@@ -217,13 +217,13 @@ systemctl disable flotillas-api
```bash ```bash
# Ver logs # Ver logs
journalctl -u flotillas-api -n 100 journalctl -u adan-api -n 100
# Verificar puerto # Verificar puerto
ss -tlnp | grep 8000 ss -tlnp | grep 8000
# Verificar base de datos # Verificar base de datos
psql -h localhost -U flotillas -d flotillas -c "SELECT 1" psql -h localhost -U adan -d adan -c "SELECT 1"
``` ```
### Traccar no recibe datos ### Traccar no recibe datos
@@ -243,19 +243,19 @@ nc -zv localhost 5055
```bash ```bash
# Ver uso de memoria por servicio # Ver uso de memoria por servicio
systemctl status flotillas-api --no-pager | grep Memory systemctl status adan-api --no-pager | grep Memory
# Reducir workers de API # Reducir workers de API
# Editar /etc/systemd/system/flotillas-api.service # Editar /etc/systemd/system/adan-api.service
# Cambiar --workers 4 a --workers 2 # Cambiar --workers 4 a --workers 2
systemctl daemon-reload systemctl daemon-reload
systemctl restart flotillas-api systemctl restart adan-api
``` ```
## Credenciales ## Credenciales
Las credenciales se generan durante la instalacion y se guardan en: Las credenciales se generan durante la instalacion y se guardan en:
- `/root/flotillas-credentials.txt` - `/root/adan-credentials.txt`
**IMPORTANTE**: Guardar en lugar seguro y eliminar el archivo despues. **IMPORTANTE**: Guardar en lugar seguro y eliminar el archivo despues.

View File

@@ -6,9 +6,9 @@
# Para usar esta configuracion: # Para usar esta configuracion:
# 1. Instalar cloudflared: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation # 1. Instalar cloudflared: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation
# 2. Autenticarse: cloudflared tunnel login # 2. Autenticarse: cloudflared tunnel login
# 3. Crear tunnel: cloudflared tunnel create flotillas # 3. Crear tunnel: cloudflared tunnel create adan
# 4. Obtener el UUID del tunnel y actualizar este archivo # 4. Obtener el UUID del tunnel y actualizar este archivo
# 5. Crear registros DNS: cloudflared tunnel route dns flotillas flotillas.tudominio.com # 5. Crear registros DNS: cloudflared tunnel route dns adan adan.tudominio.com
# 6. Copiar credenciales a /etc/cloudflared/ # 6. Copiar credenciales a /etc/cloudflared/
# ============================================ # ============================================
@@ -33,29 +33,29 @@ ingress:
# ---------------------------------------- # ----------------------------------------
# API Backend - /api/* y /docs # API Backend - /api/* y /docs
# ---------------------------------------- # ----------------------------------------
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /api/* path: /api/*
service: http://localhost:8000 service: http://localhost:8000
originRequest: originRequest:
connectTimeout: 30s connectTimeout: 30s
noTLSVerify: false noTLSVerify: false
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /docs path: /docs
service: http://localhost:8000 service: http://localhost:8000
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /redoc path: /redoc
service: http://localhost:8000 service: http://localhost:8000
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /openapi.json path: /openapi.json
service: http://localhost:8000 service: http://localhost:8000
# ---------------------------------------- # ----------------------------------------
# WebSocket - /ws/* # WebSocket - /ws/*
# ---------------------------------------- # ----------------------------------------
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /ws/* path: /ws/*
service: http://localhost:8000 service: http://localhost:8000
originRequest: originRequest:
@@ -68,20 +68,20 @@ ingress:
# ---------------------------------------- # ----------------------------------------
# Video Streaming - WebRTC/HLS # Video Streaming - WebRTC/HLS
# ---------------------------------------- # ----------------------------------------
- hostname: stream.flotillas.tudominio.com - hostname: stream.adan.tudominio.com
path: /* path: /*
service: http://localhost:8889 service: http://localhost:8889
originRequest: originRequest:
noTLSVerify: false noTLSVerify: false
- hostname: hls.flotillas.tudominio.com - hostname: hls.adan.tudominio.com
path: /* path: /*
service: http://localhost:8888 service: http://localhost:8888
# ---------------------------------------- # ----------------------------------------
# API de MediaMTX (interno/admin) # API de MediaMTX (interno/admin)
# ---------------------------------------- # ----------------------------------------
- hostname: mediamtx-api.flotillas.tudominio.com - hostname: mediamtx-api.adan.tudominio.com
path: /* path: /*
service: http://localhost:9997 service: http://localhost:9997
originRequest: originRequest:
@@ -91,7 +91,7 @@ ingress:
# ---------------------------------------- # ----------------------------------------
# Frontend Web - Todo lo demas # Frontend Web - Todo lo demas
# ---------------------------------------- # ----------------------------------------
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
service: http://localhost:3000 service: http://localhost:3000
originRequest: originRequest:
noTLSVerify: false noTLSVerify: false
@@ -106,9 +106,9 @@ ingress:
# ============================================ # ============================================
# #
# DOMINIOS RECOMENDADOS: # DOMINIOS RECOMENDADOS:
# - flotillas.tudominio.com -> Frontend + API # - adan.tudominio.com -> Frontend + API
# - stream.flotillas.tudominio.com -> Video WebRTC # - stream.adan.tudominio.com -> Video WebRTC
# - hls.flotillas.tudominio.com -> Video HLS # - hls.adan.tudominio.com -> Video HLS
# #
# INSTALACION RAPIDA CON TOKEN: # INSTALACION RAPIDA CON TOKEN:
# Si prefieres usar token en lugar de archivo de config: # Si prefieres usar token en lugar de archivo de config:

View File

@@ -1,5 +1,5 @@
# ============================================ # ============================================
# MediaMTX - Configuracion para Sistema de Flotillas # MediaMTX - Configuracion para Sistema de ADAN
# ============================================ # ============================================
# Documentacion: https://github.com/bluenviron/mediamtx # Documentacion: https://github.com/bluenviron/mediamtx
# #

View File

@@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Crear VM en Proxmox # Sistema de ADAN - Crear VM en Proxmox
# ============================================ # ============================================
# Este script crea una VM en Proxmox VE lista para # Este script crea una VM en Proxmox VE lista para
# instalar el sistema de flotillas # instalar el sistema de adan
# #
# Ejecutar en el HOST de Proxmox (no en una VM) # Ejecutar en el HOST de Proxmox (no en una VM)
# #
@@ -33,7 +33,7 @@ NC='\033[0m'
# VM # VM
VMID="${VMID:-200}" VMID="${VMID:-200}"
VM_NAME="${VM_NAME:-flotillas}" VM_NAME="${VM_NAME:-adan}"
VM_MEMORY="${VM_MEMORY:-4096}" # MB VM_MEMORY="${VM_MEMORY:-4096}" # MB
VM_CORES="${VM_CORES:-4}" VM_CORES="${VM_CORES:-4}"
VM_DISK_SIZE="${VM_DISK_SIZE:-50}" # GB VM_DISK_SIZE="${VM_DISK_SIZE:-50}" # GB
@@ -57,7 +57,7 @@ UBUNTU_URL="https://releases.ubuntu.com/22.04/${UBUNTU_ISO}"
# Cloud-init (para configuracion automatica) # Cloud-init (para configuracion automatica)
USE_CLOUD_INIT="${USE_CLOUD_INIT:-true}" USE_CLOUD_INIT="${USE_CLOUD_INIT:-true}"
CI_USER="${CI_USER:-flotillas}" CI_USER="${CI_USER:-adan}"
CI_PASSWORD="${CI_PASSWORD:-}" # Se genera si esta vacio CI_PASSWORD="${CI_PASSWORD:-}" # Se genera si esta vacio
CI_SSH_KEY="${CI_SSH_KEY:-}" # Ruta a archivo de clave publica CI_SSH_KEY="${CI_SSH_KEY:-}" # Ruta a archivo de clave publica
@@ -153,13 +153,13 @@ parse_args() {
} }
show_help() { show_help() {
echo "Sistema de Flotillas - Crear VM en Proxmox" echo "Sistema de ADAN - Crear VM en Proxmox"
echo "" echo ""
echo "Uso: $0 [opciones]" echo "Uso: $0 [opciones]"
echo "" echo ""
echo "Opciones:" echo "Opciones:"
echo " --vmid ID ID de la VM (default: 200)" echo " --vmid ID ID de la VM (default: 200)"
echo " --name NOMBRE Nombre de la VM (default: flotillas)" echo " --name NOMBRE Nombre de la VM (default: adan)"
echo " --memory MB Memoria RAM en MB (default: 4096)" echo " --memory MB Memoria RAM en MB (default: 4096)"
echo " --cores N Numero de cores (default: 4)" echo " --cores N Numero de cores (default: 4)"
echo " --disk GB Tamanio de disco en GB (default: 50)" echo " --disk GB Tamanio de disco en GB (default: 50)"
@@ -171,7 +171,7 @@ show_help() {
echo " --no-cloud-init No usar cloud-init" echo " --no-cloud-init No usar cloud-init"
echo "" echo ""
echo "Ejemplos:" echo "Ejemplos:"
echo " $0 --vmid 200 --name flotillas --memory 8192 --cores 4" echo " $0 --vmid 200 --name adan --memory 8192 --cores 4"
echo " $0 --ip 192.168.1.100/24 --gateway 192.168.1.1" echo " $0 --ip 192.168.1.100/24 --gateway 192.168.1.1"
} }
@@ -281,7 +281,7 @@ create_vm() {
# Crear VM base # Crear VM base
qm create $VMID \ qm create $VMID \
--name "$VM_NAME" \ --name "$VM_NAME" \
--description "Sistema de Flotillas GPS" \ --description "Sistema de ADAN GPS" \
--ostype l26 \ --ostype l26 \
--machine q35 \ --machine q35 \
--bios ovmf \ --bios ovmf \
@@ -405,7 +405,7 @@ configure_vm_options() {
# qm set $VMID --protection 1 # qm set $VMID --protection 1
# Tags para organizacion # Tags para organizacion
qm set $VMID --tags "flotillas,gps,produccion" qm set $VMID --tags "adan,gps,produccion"
log_success "Opciones configuradas" log_success "Opciones configuradas"
} }
@@ -419,9 +419,9 @@ create_post_install_script() {
POST_INSTALL_DIR="/var/lib/vz/snippets" POST_INSTALL_DIR="/var/lib/vz/snippets"
mkdir -p "$POST_INSTALL_DIR" mkdir -p "$POST_INSTALL_DIR"
cat > "${POST_INSTALL_DIR}/flotillas-postinstall.sh" <<'SCRIPT' cat > "${POST_INSTALL_DIR}/adan-postinstall.sh" <<'SCRIPT'
#!/bin/bash #!/bin/bash
# Script de post-instalacion para Sistema de Flotillas # Script de post-instalacion para Sistema de ADAN
# Ejecutar despues de instalar Ubuntu # Ejecutar despues de instalar Ubuntu
set -e set -e
@@ -452,14 +452,14 @@ ufw --force enable
echo "=== Listo! ===" echo "=== Listo! ==="
echo "Ahora ejecuta el script de instalacion:" echo "Ahora ejecuta el script de instalacion:"
echo " cd /opt && git clone REPO_URL flotillas" echo " cd /opt && git clone REPO_URL adan"
echo " cd flotillas/deploy/scripts" echo " cd adan/deploy/scripts"
echo " sudo ./install.sh" echo " sudo ./install.sh"
SCRIPT SCRIPT
chmod +x "${POST_INSTALL_DIR}/flotillas-postinstall.sh" chmod +x "${POST_INSTALL_DIR}/adan-postinstall.sh"
log_success "Script creado en: ${POST_INSTALL_DIR}/flotillas-postinstall.sh" log_success "Script creado en: ${POST_INSTALL_DIR}/adan-postinstall.sh"
} }
# --------------------------------------------- # ---------------------------------------------
@@ -470,7 +470,7 @@ save_credentials() {
cat > "$CREDS_FILE" <<EOF cat > "$CREDS_FILE" <<EOF
# ============================================ # ============================================
# Credenciales VM Sistema de Flotillas # Credenciales VM Sistema de ADAN
# ============================================ # ============================================
# Generadas: $(date) # Generadas: $(date)
@@ -540,8 +540,8 @@ show_summary() {
fi fi
echo " 3. Ejecutar script de instalacion del sistema:" echo " 3. Ejecutar script de instalacion del sistema:"
echo " git clone <REPO_URL> /opt/flotillas" echo " git clone <REPO_URL> /opt/adan"
echo " cd /opt/flotillas/deploy/scripts" echo " cd /opt/adan/deploy/scripts"
echo " sudo ./install.sh" echo " sudo ./install.sh"
echo "" echo ""
echo -e "${GREEN}============================================${NC}" echo -e "${GREEN}============================================${NC}"
@@ -555,7 +555,7 @@ main() {
echo "" echo ""
echo -e "${BLUE}============================================${NC}" echo -e "${BLUE}============================================${NC}"
echo -e "${BLUE} CREAR VM PARA SISTEMA DE FLOTILLAS${NC}" echo -e "${BLUE} CREAR VM PARA SISTEMA DE ADAN${NC}"
echo -e "${BLUE}============================================${NC}" echo -e "${BLUE}============================================${NC}"
echo "" echo ""

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Script de Backup # Sistema de ADAN - Script de Backup
# ============================================ # ============================================
# Realiza backup de base de datos y configuracion # Realiza backup de base de datos y configuracion
# #
@@ -27,8 +27,8 @@ NC='\033[0m'
# --------------------------------------------- # ---------------------------------------------
# Variables de Configuracion # Variables de Configuracion
# --------------------------------------------- # ---------------------------------------------
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
BACKUP_DIR="${BACKUP_DIR:-/var/backups/flotillas}" BACKUP_DIR="${BACKUP_DIR:-/var/backups/adan}"
RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-7}" RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-7}"
# Cargar variables de entorno # Cargar variables de entorno
@@ -39,8 +39,8 @@ fi
# Base de datos # Base de datos
DB_HOST="${POSTGRES_HOST:-localhost}" DB_HOST="${POSTGRES_HOST:-localhost}"
DB_PORT="${POSTGRES_PORT:-5432}" DB_PORT="${POSTGRES_PORT:-5432}"
DB_NAME="${POSTGRES_DB:-flotillas}" DB_NAME="${POSTGRES_DB:-adan}"
DB_USER="${POSTGRES_USER:-flotillas}" DB_USER="${POSTGRES_USER:-adan}"
DB_PASSWORD="${POSTGRES_PASSWORD:-}" DB_PASSWORD="${POSTGRES_PASSWORD:-}"
# S3 (opcional) # S3 (opcional)
@@ -50,7 +50,7 @@ S3_ENDPOINT="${S3_ENDPOINT:-https://s3.amazonaws.com}"
# Timestamp para este backup # Timestamp para este backup
TIMESTAMP=$(date +%Y%m%d_%H%M%S) TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="flotillas_${TIMESTAMP}" BACKUP_NAME="adan_${TIMESTAMP}"
# Flags # Flags
FULL_BACKUP=false FULL_BACKUP=false
@@ -228,8 +228,8 @@ backup_config() {
"$INSTALL_DIR/deploy" "$INSTALL_DIR/deploy"
"/opt/traccar/conf/traccar.xml" "/opt/traccar/conf/traccar.xml"
"/opt/mediamtx/mediamtx.yml" "/opt/mediamtx/mediamtx.yml"
"/etc/mosquitto/conf.d/flotillas.conf" "/etc/mosquitto/conf.d/adan.conf"
"/etc/systemd/system/flotillas-*.service" "/etc/systemd/system/adan-*.service"
"/etc/systemd/system/mediamtx.service" "/etc/systemd/system/mediamtx.service"
) )
@@ -290,7 +290,7 @@ rotate_backups() {
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
rm -f "$file" rm -f "$file"
((deleted++)) ((deleted++))
done < <(find "$BACKUP_DIR/daily" -type f -name "flotillas_*.gz" -mtime +${RETENTION_DAYS} -print0 2>/dev/null) done < <(find "$BACKUP_DIR/daily" -type f -name "adan_*.gz" -mtime +${RETENTION_DAYS} -print0 2>/dev/null)
if [[ $deleted -gt 0 ]]; then if [[ $deleted -gt 0 ]]; then
log_info "Eliminados $deleted backups antiguos" log_info "Eliminados $deleted backups antiguos"
@@ -356,7 +356,7 @@ create_backup_index() {
# Cabecera # Cabecera
cat > "$index_file" <<EOF cat > "$index_file" <<EOF
# Indice de Backups - Sistema de Flotillas # Indice de Backups - Sistema de ADAN
# Generado: $(date) # Generado: $(date)
# Retencion: ${RETENTION_DAYS} dias # Retencion: ${RETENTION_DAYS} dias
# #
@@ -426,7 +426,7 @@ send_notification() {
curl -s -X POST \ curl -s -X POST \
"https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="${TELEGRAM_CHAT_ID}" \ -d chat_id="${TELEGRAM_CHAT_ID}" \
-d text="${emoji} Backup Flotillas: ${message}" \ -d text="${emoji} Backup ADAN: ${message}" \
> /dev/null 2>&1 > /dev/null 2>&1
fi fi
} }

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Health Check # Sistema de ADAN - Health Check
# ============================================ # ============================================
# Verifica el estado de todos los servicios # Verifica el estado de todos los servicios
# #
@@ -19,7 +19,7 @@ BLUE='\033[0;34m'
NC='\033[0m' NC='\033[0m'
# Variables # Variables
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
VERBOSE=false VERBOSE=false
JSON_OUTPUT=false JSON_OUTPUT=false
EXIT_CODE=0 EXIT_CODE=0
@@ -81,8 +81,8 @@ check_url() {
check_db() { check_db() {
local host="${POSTGRES_HOST:-localhost}" local host="${POSTGRES_HOST:-localhost}"
local port="${POSTGRES_PORT:-5432}" local port="${POSTGRES_PORT:-5432}"
local db="${POSTGRES_DB:-flotillas}" local db="${POSTGRES_DB:-adan}"
local user="${POSTGRES_USER:-flotillas}" local user="${POSTGRES_USER:-adan}"
if PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "$host" -p "$port" -U "$user" -d "$db" -c "SELECT 1" > /dev/null 2>&1; then if PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "$host" -p "$port" -U "$user" -d "$db" -c "SELECT 1" > /dev/null 2>&1; then
echo "ok" echo "ok"
@@ -142,18 +142,18 @@ main() {
if [[ "$JSON_OUTPUT" != "true" ]]; then if [[ "$JSON_OUTPUT" != "true" ]]; then
echo "" echo ""
echo -e "${BLUE}========================================${NC}" echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} HEALTH CHECK - Sistema de Flotillas${NC}" echo -e "${BLUE} HEALTH CHECK - Sistema de ADAN${NC}"
echo -e "${BLUE}========================================${NC}" echo -e "${BLUE}========================================${NC}"
echo "" echo ""
echo -e "${BLUE}Servicios Systemd:${NC}" echo -e "${BLUE}Servicios Systemd:${NC}"
fi fi
# Servicios systemd # Servicios systemd
results[flotillas_api]=$(check_service "flotillas-api" "API Backend") results[adan_api]=$(check_service "adan-api" "API Backend")
print_status "flotillas-api" "${results[flotillas_api]}" print_status "adan-api" "${results[adan_api]}"
results[flotillas_web]=$(check_service "flotillas-web" "Frontend Web") results[adan_web]=$(check_service "adan-web" "Frontend Web")
print_status "flotillas-web" "${results[flotillas_web]}" print_status "adan-web" "${results[adan_web]}"
results[postgresql]=$(check_service "postgresql" "PostgreSQL") results[postgresql]=$(check_service "postgresql" "PostgreSQL")
print_status "postgresql" "${results[postgresql]}" print_status "postgresql" "${results[postgresql]}"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Script de Instalacion # Sistema de ADAN - Script de Instalacion
# ============================================ # ============================================
# Este script instala y configura todo el sistema # Este script instala y configura todo el sistema
# Ejecutar como root en Ubuntu 22.04 LTS # Ejecutar como root en Ubuntu 22.04 LTS
@@ -28,10 +28,10 @@ NC='\033[0m' # No Color
# --------------------------------------------- # ---------------------------------------------
# Variables de Configuracion # Variables de Configuracion
# --------------------------------------------- # ---------------------------------------------
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
REPO_URL="${REPO_URL:-https://github.com/tuorganizacion/flotillas.git}" REPO_URL="${REPO_URL:-https://github.com/tuorganizacion/adan.git}"
REPO_BRANCH="${REPO_BRANCH:-main}" REPO_BRANCH="${REPO_BRANCH:-main}"
BACKUP_DIR="${BACKUP_DIR:-/var/backups/flotillas}" BACKUP_DIR="${BACKUP_DIR:-/var/backups/adan}"
# Versiones # Versiones
POSTGRES_VERSION="15" POSTGRES_VERSION="15"
@@ -51,7 +51,7 @@ SKIP_TRACCAR=false
DEV_MODE=false DEV_MODE=false
# Archivo de credenciales generadas # Archivo de credenciales generadas
CREDENTIALS_FILE="/root/flotillas-credentials.txt" CREDENTIALS_FILE="/root/adan-credentials.txt"
# --------------------------------------------- # ---------------------------------------------
# Funciones de utilidad # Funciones de utilidad
@@ -478,8 +478,8 @@ configure_database() {
DB_PASSWORD=$(generate_password 24) DB_PASSWORD=$(generate_password 24)
fi fi
DB_NAME="${POSTGRES_DB:-flotillas}" DB_NAME="${POSTGRES_DB:-adan}"
DB_USER="${POSTGRES_USER:-flotillas}" DB_USER="${POSTGRES_USER:-adan}"
log_info "Creando usuario y base de datos..." log_info "Creando usuario y base de datos..."
@@ -611,7 +611,7 @@ generate_credentials() {
# Guardar en archivo seguro # Guardar en archivo seguro
cat > "$CREDENTIALS_FILE" <<EOF cat > "$CREDENTIALS_FILE" <<EOF
# ============================================ # ============================================
# Credenciales del Sistema de Flotillas # Credenciales del Sistema de ADAN
# Generadas: $(date) # Generadas: $(date)
# IMPORTANTE: Guardar en lugar seguro y eliminar este archivo # IMPORTANTE: Guardar en lugar seguro y eliminar este archivo
# ============================================ # ============================================
@@ -619,10 +619,10 @@ generate_credentials() {
# PostgreSQL # PostgreSQL
POSTGRES_HOST=localhost POSTGRES_HOST=localhost
POSTGRES_PORT=5432 POSTGRES_PORT=5432
POSTGRES_DB=flotillas POSTGRES_DB=adan
POSTGRES_USER=flotillas POSTGRES_USER=adan
POSTGRES_PASSWORD=${DB_PASSWORD} POSTGRES_PASSWORD=${DB_PASSWORD}
DATABASE_URL=postgresql://flotillas:${DB_PASSWORD}@localhost:5432/flotillas DATABASE_URL=postgresql://adan:${DB_PASSWORD}@localhost:5432/adan
# Redis # Redis
REDIS_PASSWORD=${REDIS_PASSWORD} REDIS_PASSWORD=${REDIS_PASSWORD}
@@ -633,11 +633,11 @@ SECRET_KEY=${SECRET_KEY}
API_PORT=${API_PORT} API_PORT=${API_PORT}
# MQTT # MQTT
MQTT_USER=flotillas MQTT_USER=adan
MQTT_PASSWORD=${MQTT_PASSWORD} MQTT_PASSWORD=${MQTT_PASSWORD}
# Admin inicial # Admin inicial
ADMIN_EMAIL=admin@flotillas.local ADMIN_EMAIL=admin@adan.local
ADMIN_PASSWORD=${ADMIN_PASSWORD} ADMIN_PASSWORD=${ADMIN_PASSWORD}
# Puertos # Puertos
@@ -665,10 +665,10 @@ create_env_file() {
# Base de Datos # Base de Datos
POSTGRES_HOST=localhost POSTGRES_HOST=localhost
POSTGRES_PORT=5432 POSTGRES_PORT=5432
POSTGRES_DB=flotillas POSTGRES_DB=adan
POSTGRES_USER=flotillas POSTGRES_USER=adan
POSTGRES_PASSWORD=${DB_PASSWORD} POSTGRES_PASSWORD=${DB_PASSWORD}
DATABASE_URL=postgresql://flotillas:${DB_PASSWORD}@localhost:5432/flotillas DATABASE_URL=postgresql://adan:${DB_PASSWORD}@localhost:5432/adan
# Redis # Redis
REDIS_HOST=localhost REDIS_HOST=localhost
@@ -697,7 +697,7 @@ TRACCAR_FORWARD_URL=http://localhost:${API_PORT}/api/v1/traccar/position
# MQTT # MQTT
MQTT_HOST=localhost MQTT_HOST=localhost
MQTT_PORT=1883 MQTT_PORT=1883
MQTT_USER=flotillas MQTT_USER=adan
MQTT_PASSWORD=${MQTT_PASSWORD} MQTT_PASSWORD=${MQTT_PASSWORD}
# MediaMTX # MediaMTX
@@ -771,11 +771,11 @@ configure_mosquitto() {
# Crear archivo de passwords # Crear archivo de passwords
touch /etc/mosquitto/passwd touch /etc/mosquitto/passwd
mosquitto_passwd -b /etc/mosquitto/passwd flotillas "${MQTT_PASSWORD}" mosquitto_passwd -b /etc/mosquitto/passwd adan "${MQTT_PASSWORD}"
# Configuracion # Configuracion
cat > /etc/mosquitto/conf.d/flotillas.conf <<EOF cat > /etc/mosquitto/conf.d/adan.conf <<EOF
# Configuracion para Sistema de Flotillas # Configuracion para Sistema de ADAN
listener 1883 localhost listener 1883 localhost
listener 9001 listener 9001
@@ -819,7 +819,7 @@ install_services() {
SERVICES_DIR="$INSTALL_DIR/deploy/services" SERVICES_DIR="$INSTALL_DIR/deploy/services"
# Copiar servicios # Copiar servicios
for service in flotillas-api flotillas-web mediamtx cloudflared; do for service in adan-api adan-web mediamtx cloudflared; do
if [[ -f "$SERVICES_DIR/${service}.service" ]]; then if [[ -f "$SERVICES_DIR/${service}.service" ]]; then
log_info "Instalando servicio: ${service}" log_info "Instalando servicio: ${service}"
cp "$SERVICES_DIR/${service}.service" /etc/systemd/system/ cp "$SERVICES_DIR/${service}.service" /etc/systemd/system/
@@ -830,14 +830,14 @@ install_services() {
systemctl daemon-reload systemctl daemon-reload
# Habilitar servicios # Habilitar servicios
systemctl enable flotillas-api 2>/dev/null || true systemctl enable adan-api 2>/dev/null || true
systemctl enable flotillas-web 2>/dev/null || true systemctl enable adan-web 2>/dev/null || true
systemctl enable mediamtx 2>/dev/null || true systemctl enable mediamtx 2>/dev/null || true
# Iniciar servicios # Iniciar servicios
log_info "Iniciando servicios..." log_info "Iniciando servicios..."
systemctl start flotillas-api 2>/dev/null || log_warn "flotillas-api no pudo iniciar (puede requerir configuracion adicional)" systemctl start adan-api 2>/dev/null || log_warn "adan-api no pudo iniciar (puede requerir configuracion adicional)"
systemctl start flotillas-web 2>/dev/null || log_warn "flotillas-web no pudo iniciar" systemctl start adan-web 2>/dev/null || log_warn "adan-web no pudo iniciar"
systemctl start mediamtx 2>/dev/null || log_warn "mediamtx no pudo iniciar" systemctl start mediamtx 2>/dev/null || log_warn "mediamtx no pudo iniciar"
log_success "Servicios instalados" log_success "Servicios instalados"
@@ -864,7 +864,7 @@ run_migrations() {
# Ejecutar init.sql si existe y no hay migraciones # Ejecutar init.sql si existe y no hay migraciones
if [[ ! -d "alembic" ]] && [[ -f "$INSTALL_DIR/deploy/postgres/init.sql" ]]; then if [[ ! -d "alembic" ]] && [[ -f "$INSTALL_DIR/deploy/postgres/init.sql" ]]; then
log_info "Ejecutando script init.sql..." log_info "Ejecutando script init.sql..."
PGPASSWORD="${DB_PASSWORD}" psql -h localhost -U flotillas -d flotillas -f "$INSTALL_DIR/deploy/postgres/init.sql" || true PGPASSWORD="${DB_PASSWORD}" psql -h localhost -U adan -d adan -f "$INSTALL_DIR/deploy/postgres/init.sql" || true
fi fi
deactivate deactivate
@@ -936,8 +936,8 @@ EOF
configure_logrotate() { configure_logrotate() {
log_section "Configurando Logrotate" log_section "Configurando Logrotate"
cat > /etc/logrotate.d/flotillas <<EOF cat > /etc/logrotate.d/adan <<EOF
/var/log/flotillas/*.log { /var/log/adan/*.log {
daily daily
missingok missingok
rotate 14 rotate 14
@@ -947,12 +947,12 @@ configure_logrotate() {
create 0640 root root create 0640 root root
sharedscripts sharedscripts
postrotate postrotate
systemctl reload flotillas-api > /dev/null 2>&1 || true systemctl reload adan-api > /dev/null 2>&1 || true
endscript endscript
} }
EOF EOF
mkdir -p /var/log/flotillas mkdir -p /var/log/adan
log_success "Logrotate configurado" log_success "Logrotate configurado"
} }
@@ -964,7 +964,7 @@ configure_cron() {
log_section "Configurando Backups Automaticos" log_section "Configurando Backups Automaticos"
# Crear cron para backup diario a las 3 AM # Crear cron para backup diario a las 3 AM
CRON_JOB="0 3 * * * $INSTALL_DIR/deploy/scripts/backup.sh >> /var/log/flotillas/backup.log 2>&1" CRON_JOB="0 3 * * * $INSTALL_DIR/deploy/scripts/backup.sh >> /var/log/adan/backup.log 2>&1"
# Agregar si no existe # Agregar si no existe
(crontab -l 2>/dev/null | grep -v "backup.sh"; echo "$CRON_JOB") | crontab - (crontab -l 2>/dev/null | grep -v "backup.sh"; echo "$CRON_JOB") | crontab -
@@ -980,7 +980,7 @@ show_summary() {
echo "" echo ""
echo -e "${GREEN}============================================${NC}" echo -e "${GREEN}============================================${NC}"
echo -e "${GREEN} SISTEMA DE FLOTILLAS INSTALADO ${NC}" echo -e "${GREEN} SISTEMA DE ADAN INSTALADO ${NC}"
echo -e "${GREEN}============================================${NC}" echo -e "${GREEN}============================================${NC}"
echo "" echo ""
echo -e "${BLUE}Servicios:${NC}" echo -e "${BLUE}Servicios:${NC}"
@@ -992,8 +992,8 @@ show_summary() {
echo "" echo ""
echo -e "${BLUE}Base de Datos:${NC}" echo -e "${BLUE}Base de Datos:${NC}"
echo " - PostgreSQL: localhost:5432" echo " - PostgreSQL: localhost:5432"
echo " - Database: flotillas" echo " - Database: adan"
echo " - Usuario: flotillas" echo " - Usuario: adan"
echo "" echo ""
echo -e "${BLUE}Credenciales:${NC}" echo -e "${BLUE}Credenciales:${NC}"
echo " - Guardadas en: ${CREDENTIALS_FILE}" echo " - Guardadas en: ${CREDENTIALS_FILE}"
@@ -1004,8 +1004,8 @@ show_summary() {
echo " 3. El unico puerto publico es ${TRACCAR_PORT} (GPS)" echo " 3. El unico puerto publico es ${TRACCAR_PORT} (GPS)"
echo "" echo ""
echo -e "${BLUE}Comandos utiles:${NC}" echo -e "${BLUE}Comandos utiles:${NC}"
echo " - Ver logs API: journalctl -u flotillas-api -f" echo " - Ver logs API: journalctl -u adan-api -f"
echo " - Reiniciar API: systemctl restart flotillas-api" echo " - Reiniciar API: systemctl restart adan-api"
echo " - Backup manual: ${INSTALL_DIR}/deploy/scripts/backup.sh" echo " - Backup manual: ${INSTALL_DIR}/deploy/scripts/backup.sh"
echo " - Actualizar: ${INSTALL_DIR}/deploy/scripts/update.sh" echo " - Actualizar: ${INSTALL_DIR}/deploy/scripts/update.sh"
echo "" echo ""
@@ -1026,7 +1026,7 @@ main() {
echo "" echo ""
echo -e "${GREEN}============================================${NC}" echo -e "${GREEN}============================================${NC}"
echo -e "${GREEN} INSTALADOR SISTEMA DE FLOTILLAS ${NC}" echo -e "${GREEN} INSTALADOR SISTEMA DE ADAN ${NC}"
echo -e "${GREEN}============================================${NC}" echo -e "${GREEN}============================================${NC}"
echo "" echo ""
echo "Directorio instalacion: $INSTALL_DIR" echo "Directorio instalacion: $INSTALL_DIR"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Visor de Logs # Sistema de ADAN - Visor de Logs
# ============================================ # ============================================
# Muestra logs de los diferentes servicios # Muestra logs de los diferentes servicios
# #
@@ -39,7 +39,7 @@ while [[ $# -gt 0 ]]; do
shift 2 shift 2
;; ;;
--help|-h) --help|-h)
echo "Sistema de Flotillas - Visor de Logs" echo "Sistema de ADAN - Visor de Logs"
echo "" echo ""
echo "Uso: $0 [servicio] [opciones]" echo "Uso: $0 [servicio] [opciones]"
echo "" echo ""
@@ -91,10 +91,10 @@ show_logs() {
case $SERVICE in case $SERVICE in
api) api)
show_logs "flotillas-api" "API Backend" show_logs "adan-api" "API Backend"
;; ;;
web) web)
show_logs "flotillas-web" "Frontend" show_logs "adan-web" "Frontend"
;; ;;
traccar) traccar)
show_logs "traccar" "Traccar GPS" show_logs "traccar" "Traccar GPS"
@@ -121,10 +121,10 @@ case $SERVICE in
echo "Mostrando todos los logs en tiempo real..." echo "Mostrando todos los logs en tiempo real..."
echo "Presiona Ctrl+C para salir" echo "Presiona Ctrl+C para salir"
echo "" echo ""
journalctl -u flotillas-api -u flotillas-web -u traccar -u mediamtx -u mosquitto -f journalctl -u adan-api -u adan-web -u traccar -u mediamtx -u mosquitto -f
else else
show_logs "flotillas-api" "API Backend" show_logs "adan-api" "API Backend"
show_logs "flotillas-web" "Frontend" show_logs "adan-web" "Frontend"
show_logs "traccar" "Traccar GPS" show_logs "traccar" "Traccar GPS"
show_logs "mediamtx" "MediaMTX" show_logs "mediamtx" "MediaMTX"
show_logs "mosquitto" "Mosquitto MQTT" show_logs "mosquitto" "Mosquitto MQTT"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Script de Restauracion # Sistema de ADAN - Script de Restauracion
# ============================================ # ============================================
# Restaura backups de base de datos y configuracion # Restaura backups de base de datos y configuracion
# #
@@ -29,8 +29,8 @@ NC='\033[0m'
# --------------------------------------------- # ---------------------------------------------
# Variables # Variables
# --------------------------------------------- # ---------------------------------------------
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
BACKUP_DIR="${BACKUP_DIR:-/var/backups/flotillas}" BACKUP_DIR="${BACKUP_DIR:-/var/backups/adan}"
# Cargar variables de entorno # Cargar variables de entorno
if [[ -f "$INSTALL_DIR/.env" ]]; then if [[ -f "$INSTALL_DIR/.env" ]]; then
@@ -40,8 +40,8 @@ fi
# Base de datos # Base de datos
DB_HOST="${POSTGRES_HOST:-localhost}" DB_HOST="${POSTGRES_HOST:-localhost}"
DB_PORT="${POSTGRES_PORT:-5432}" DB_PORT="${POSTGRES_PORT:-5432}"
DB_NAME="${POSTGRES_DB:-flotillas}" DB_NAME="${POSTGRES_DB:-adan}"
DB_USER="${POSTGRES_USER:-flotillas}" DB_USER="${POSTGRES_USER:-adan}"
DB_PASSWORD="${POSTGRES_PASSWORD:-}" DB_PASSWORD="${POSTGRES_PASSWORD:-}"
# Opciones # Opciones
@@ -109,7 +109,7 @@ parse_args() {
} }
show_help() { show_help() {
echo "Sistema de Flotillas - Restauracion de Backup" echo "Sistema de ADAN - Restauracion de Backup"
echo "" echo ""
echo "Uso: $0 [opciones]" echo "Uso: $0 [opciones]"
echo "" echo ""
@@ -124,7 +124,7 @@ show_help() {
echo " $0 --list" echo " $0 --list"
echo " $0 --latest" echo " $0 --latest"
echo " $0 --date 20240115" echo " $0 --date 20240115"
echo " $0 --db /var/backups/flotillas/daily/flotillas_20240115_030000_db.sql.gz" echo " $0 --db /var/backups/adan/daily/adan_20240115_030000_db.sql.gz"
} }
# --------------------------------------------- # ---------------------------------------------
@@ -204,7 +204,7 @@ find_backup_by_date() {
local type="$1" local type="$1"
local date="$2" local date="$2"
local pattern="flotillas_${date}*_${type}.*gz" local pattern="adan_${date}*_${type}.*gz"
local found=$(ls -t "$BACKUP_DIR/daily"/$pattern 2>/dev/null | head -1) local found=$(ls -t "$BACKUP_DIR/daily"/$pattern 2>/dev/null | head -1)
@@ -222,8 +222,8 @@ find_backup_by_date() {
stop_services() { stop_services() {
log_info "Deteniendo servicios..." log_info "Deteniendo servicios..."
systemctl stop flotillas-api 2>/dev/null || true systemctl stop adan-api 2>/dev/null || true
systemctl stop flotillas-web 2>/dev/null || true systemctl stop adan-web 2>/dev/null || true
# Esperar a que se detengan # Esperar a que se detengan
sleep 2 sleep 2
@@ -237,8 +237,8 @@ stop_services() {
start_services() { start_services() {
log_info "Iniciando servicios..." log_info "Iniciando servicios..."
systemctl start flotillas-api 2>/dev/null || true systemctl start adan-api 2>/dev/null || true
systemctl start flotillas-web 2>/dev/null || true systemctl start adan-web 2>/dev/null || true
log_success "Servicios iniciados" log_success "Servicios iniciados"
} }
@@ -389,7 +389,7 @@ restore_config() {
fi fi
# Servicios systemd # Servicios systemd
for service in $temp_dir/etc/systemd/system/flotillas-*.service; do for service in $temp_dir/etc/systemd/system/adan-*.service; do
if [[ -f "$service" ]]; then if [[ -f "$service" ]]; then
cp "$service" /etc/systemd/system/ cp "$service" /etc/systemd/system/
log_info "Restaurado: $(basename "$service")" log_info "Restaurado: $(basename "$service")"
@@ -472,7 +472,7 @@ main() {
# Modo interactivo si no se especificaron opciones # Modo interactivo si no se especificaron opciones
if [[ -z "$DB_BACKUP" ]] && [[ -z "$CONFIG_BACKUP" ]] && [[ "$USE_LATEST" != "true" ]] && [[ -z "$RESTORE_DATE" ]]; then if [[ -z "$DB_BACKUP" ]] && [[ -z "$CONFIG_BACKUP" ]] && [[ "$USE_LATEST" != "true" ]] && [[ -z "$RESTORE_DATE" ]]; then
echo "" echo ""
echo "Sistema de Flotillas - Restauracion" echo "Sistema de ADAN - Restauracion"
echo "====================================" echo "===================================="
echo "" echo ""
echo "Selecciona una opcion:" echo "Selecciona una opcion:"
@@ -540,8 +540,8 @@ main() {
log_success "==========================================" log_success "=========================================="
echo "" echo ""
echo "Verifica que los servicios esten funcionando:" echo "Verifica que los servicios esten funcionando:"
echo " systemctl status flotillas-api" echo " systemctl status adan-api"
echo " systemctl status flotillas-web" echo " systemctl status adan-web"
echo "" echo ""
} }

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Estado del Sistema # Sistema de ADAN - Estado del Sistema
# ============================================ # ============================================
# Muestra informacion completa del estado # Muestra informacion completa del estado
# ============================================ # ============================================
@@ -13,7 +13,7 @@ BLUE='\033[0;34m'
CYAN='\033[0;36m' CYAN='\033[0;36m'
NC='\033[0m' NC='\033[0m'
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
# Cargar variables # Cargar variables
if [[ -f "$INSTALL_DIR/.env" ]]; then if [[ -f "$INSTALL_DIR/.env" ]]; then
@@ -24,7 +24,7 @@ clear
echo "" echo ""
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}" echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ SISTEMA DE FLOTILLAS - ESTADO DEL SISTEMA ║${NC}" echo -e "${CYAN}║ SISTEMA DE ADAN - ESTADO DEL SISTEMA ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}" echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}"
echo "" echo ""
@@ -84,8 +84,8 @@ check_service() {
printf "│ %-14s %s\n" "$name:" "$status" printf "│ %-14s %s\n" "$name:" "$status"
} }
check_service "flotillas-api" "API Backend" "${API_PORT:-8000}" check_service "adan-api" "API Backend" "${API_PORT:-8000}"
check_service "flotillas-web" "Frontend" "${FRONTEND_PORT:-3000}" check_service "adan-web" "Frontend" "${FRONTEND_PORT:-3000}"
check_service "postgresql" "PostgreSQL" "5432" check_service "postgresql" "PostgreSQL" "5432"
check_service "redis-server" "Redis" "6379" check_service "redis-server" "Redis" "6379"
check_service "traccar" "Traccar GPS" "${TRACCAR_PORT:-5055}" check_service "traccar" "Traccar GPS" "${TRACCAR_PORT:-5055}"
@@ -103,15 +103,15 @@ echo -e "${BLUE}┌─ Base de Datos ──────────────
if systemctl is-active --quiet postgresql; then if systemctl is-active --quiet postgresql; then
# Tamanio de BD # Tamanio de BD
DB_SIZE=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-flotillas}" -d "${POSTGRES_DB:-flotillas}" -t -c "SELECT pg_size_pretty(pg_database_size(current_database()));" 2>/dev/null | xargs) DB_SIZE=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-adan}" -d "${POSTGRES_DB:-adan}" -t -c "SELECT pg_size_pretty(pg_database_size(current_database()));" 2>/dev/null | xargs)
echo -e "│ Tamanio BD: ${DB_SIZE:-N/A}" echo -e "│ Tamanio BD: ${DB_SIZE:-N/A}"
# Conexiones activas # Conexiones activas
CONNECTIONS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-flotillas}" -d "${POSTGRES_DB:-flotillas}" -t -c "SELECT count(*) FROM pg_stat_activity WHERE datname = current_database();" 2>/dev/null | xargs) CONNECTIONS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-adan}" -d "${POSTGRES_DB:-adan}" -t -c "SELECT count(*) FROM pg_stat_activity WHERE datname = current_database();" 2>/dev/null | xargs)
echo -e "│ Conexiones: ${CONNECTIONS:-N/A} activas" echo -e "│ Conexiones: ${CONNECTIONS:-N/A} activas"
# Posiciones (si existe la tabla) # Posiciones (si existe la tabla)
POSITIONS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-flotillas}" -d "${POSTGRES_DB:-flotillas}" -t -c "SELECT COUNT(*) FROM positions;" 2>/dev/null | xargs) POSITIONS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-adan}" -d "${POSTGRES_DB:-adan}" -t -c "SELECT COUNT(*) FROM positions;" 2>/dev/null | xargs)
if [[ -n "$POSITIONS" ]]; then if [[ -n "$POSITIONS" ]]; then
echo -e "│ Posiciones: ${POSITIONS} registros" echo -e "│ Posiciones: ${POSITIONS} registros"
fi fi
@@ -150,10 +150,10 @@ echo -e "${BLUE}┌─ GPS / Unidades ──────────────
if systemctl is-active --quiet postgresql; then if systemctl is-active --quiet postgresql; then
# Total de unidades # Total de unidades
TOTAL_UNITS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-flotillas}" -d "${POSTGRES_DB:-flotillas}" -t -c "SELECT COUNT(*) FROM units;" 2>/dev/null | xargs) TOTAL_UNITS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-adan}" -d "${POSTGRES_DB:-adan}" -t -c "SELECT COUNT(*) FROM units;" 2>/dev/null | xargs)
# Unidades activas (con posicion en ultimos 5 min) # Unidades activas (con posicion en ultimos 5 min)
ACTIVE_UNITS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-flotillas}" -d "${POSTGRES_DB:-flotillas}" -t -c "SELECT COUNT(DISTINCT unit_id) FROM positions WHERE device_time > NOW() - INTERVAL '5 minutes';" 2>/dev/null | xargs) ACTIVE_UNITS=$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -h localhost -U "${POSTGRES_USER:-adan}" -d "${POSTGRES_DB:-adan}" -t -c "SELECT COUNT(DISTINCT unit_id) FROM positions WHERE device_time > NOW() - INTERVAL '5 minutes';" 2>/dev/null | xargs)
echo -e "│ Total: ${TOTAL_UNITS:-0} unidades" echo -e "│ Total: ${TOTAL_UNITS:-0} unidades"
echo -e "│ Activas: ${ACTIVE_UNITS:-0} (ultimo 5 min)" echo -e "│ Activas: ${ACTIVE_UNITS:-0} (ultimo 5 min)"
@@ -190,7 +190,7 @@ echo ""
# --------------------------------------------- # ---------------------------------------------
echo -e "${BLUE}┌─ Ultimos Errores (API) ────────────────────────────────────┐${NC}" echo -e "${BLUE}┌─ Ultimos Errores (API) ────────────────────────────────────┐${NC}"
ERRORS=$(journalctl -u flotillas-api --since "1 hour ago" -p err --no-pager -q 2>/dev/null | tail -3) ERRORS=$(journalctl -u adan-api --since "1 hour ago" -p err --no-pager -q 2>/dev/null | tail -3)
if [[ -z "$ERRORS" ]]; then if [[ -z "$ERRORS" ]]; then
echo -e "${GREEN}Sin errores en la ultima hora${NC}" echo -e "${GREEN}Sin errores en la ultima hora${NC}"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ============================================ # ============================================
# Sistema de Flotillas - Script de Actualizacion # Sistema de ADAN - Script de Actualizacion
# ============================================ # ============================================
# Actualiza la aplicacion a la ultima version # Actualiza la aplicacion a la ultima version
# #
@@ -29,7 +29,7 @@ NC='\033[0m'
# --------------------------------------------- # ---------------------------------------------
# Variables # Variables
# --------------------------------------------- # ---------------------------------------------
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}" INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
REPO_BRANCH="${REPO_BRANCH:-main}" REPO_BRANCH="${REPO_BRANCH:-main}"
BACKUP_BEFORE_UPDATE=true BACKUP_BEFORE_UPDATE=true
FORCE_UPDATE=false FORCE_UPDATE=false
@@ -308,11 +308,11 @@ restart_services() {
log_info "Reiniciando servicios..." log_info "Reiniciando servicios..."
if [[ "$UPDATE_BACKEND" == "true" ]]; then if [[ "$UPDATE_BACKEND" == "true" ]]; then
systemctl restart flotillas-api 2>/dev/null && log_success "flotillas-api reiniciado" || log_warn "flotillas-api no existe" systemctl restart adan-api 2>/dev/null && log_success "adan-api reiniciado" || log_warn "adan-api no existe"
fi fi
if [[ "$UPDATE_FRONTEND" == "true" ]]; then if [[ "$UPDATE_FRONTEND" == "true" ]]; then
systemctl restart flotillas-web 2>/dev/null && log_success "flotillas-web reiniciado" || log_warn "flotillas-web no existe" systemctl restart adan-web 2>/dev/null && log_success "adan-web reiniciado" || log_warn "adan-web no existe"
fi fi
} }
@@ -328,19 +328,19 @@ verify_services() {
sleep 3 sleep 3
if [[ "$UPDATE_BACKEND" == "true" ]]; then if [[ "$UPDATE_BACKEND" == "true" ]]; then
if systemctl is-active --quiet flotillas-api; then if systemctl is-active --quiet adan-api; then
log_success "flotillas-api: activo" log_success "adan-api: activo"
else else
log_error "flotillas-api: inactivo" log_error "adan-api: inactivo"
all_ok=false all_ok=false
fi fi
fi fi
if [[ "$UPDATE_FRONTEND" == "true" ]]; then if [[ "$UPDATE_FRONTEND" == "true" ]]; then
if systemctl is-active --quiet flotillas-web; then if systemctl is-active --quiet adan-web; then
log_success "flotillas-web: activo" log_success "adan-web: activo"
else else
log_error "flotillas-web: inactivo" log_error "adan-web: inactivo"
all_ok=false all_ok=false
fi fi
fi fi
@@ -357,8 +357,8 @@ verify_services() {
if [[ "$all_ok" == "false" ]]; then if [[ "$all_ok" == "false" ]]; then
log_error "Algunos servicios fallaron. Revisa los logs:" log_error "Algunos servicios fallaron. Revisa los logs:"
echo " journalctl -u flotillas-api -n 50" echo " journalctl -u adan-api -n 50"
echo " journalctl -u flotillas-web -n 50" echo " journalctl -u adan-web -n 50"
return 1 return 1
fi fi
@@ -412,8 +412,8 @@ show_summary() {
echo "Branch: $REPO_BRANCH" echo "Branch: $REPO_BRANCH"
echo "" echo ""
echo "Servicios:" echo "Servicios:"
systemctl is-active flotillas-api 2>/dev/null && echo " - flotillas-api: activo" || echo " - flotillas-api: inactivo" systemctl is-active adan-api 2>/dev/null && echo " - adan-api: activo" || echo " - adan-api: inactivo"
systemctl is-active flotillas-web 2>/dev/null && echo " - flotillas-web: activo" || echo " - flotillas-web: inactivo" systemctl is-active adan-web 2>/dev/null && echo " - adan-web: activo" || echo " - adan-web: inactivo"
echo "" echo ""
} }
@@ -425,7 +425,7 @@ main() {
echo "" echo ""
echo -e "${BLUE}========================================${NC}" echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} ACTUALIZANDO SISTEMA DE FLOTILLAS${NC}" echo -e "${BLUE} ACTUALIZANDO SISTEMA DE ADAN${NC}"
echo -e "${BLUE}========================================${NC}" echo -e "${BLUE}========================================${NC}"
echo "" echo ""
echo "Branch: $REPO_BRANCH" echo "Branch: $REPO_BRANCH"

View File

@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Sistema de Flotillas - API Backend Description=Sistema de ADAN - API Backend
Documentation=https://github.com/tuorganizacion/flotillas Documentation=https://github.com/tuorganizacion/adan
After=network.target postgresql.service redis.service After=network.target postgresql.service redis.service
Wants=postgresql.service redis.service Wants=postgresql.service redis.service
@@ -8,14 +8,14 @@ Wants=postgresql.service redis.service
Type=exec Type=exec
User=root User=root
Group=root Group=root
WorkingDirectory=/opt/flotillas/backend WorkingDirectory=/opt/adan/backend
# Cargar variables de entorno # Cargar variables de entorno
EnvironmentFile=/opt/flotillas/.env EnvironmentFile=/opt/adan/.env
# Comando de inicio # Comando de inicio
# Uvicorn con multiples workers para produccion # Uvicorn con multiples workers para produccion
ExecStart=/opt/flotillas/backend/venv/bin/uvicorn \ ExecStart=/opt/adan/backend/venv/bin/uvicorn \
app.main:app \ app.main:app \
--host 0.0.0.0 \ --host 0.0.0.0 \
--port 8000 \ --port 8000 \
@@ -44,12 +44,12 @@ NoNewPrivileges=true
PrivateTmp=true PrivateTmp=true
ProtectSystem=strict ProtectSystem=strict
ProtectHome=true ProtectHome=true
ReadWritePaths=/opt/flotillas /var/log/flotillas /tmp ReadWritePaths=/opt/adan /var/log/adan /tmp
# Logging # Logging
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=flotillas-api SyslogIdentifier=adan-api
# Health check (systemd 253+) # Health check (systemd 253+)
# WatchdogSec=30 # WatchdogSec=30

View File

@@ -1,17 +1,17 @@
[Unit] [Unit]
Description=Sistema de Flotillas - Frontend Web Description=Sistema de ADAN - Frontend Web
Documentation=https://github.com/tuorganizacion/flotillas Documentation=https://github.com/tuorganizacion/adan
After=network.target flotillas-api.service After=network.target adan-api.service
Wants=flotillas-api.service Wants=adan-api.service
[Service] [Service]
Type=exec Type=exec
User=root User=root
Group=root Group=root
WorkingDirectory=/opt/flotillas/frontend WorkingDirectory=/opt/adan/frontend
# Cargar variables de entorno # Cargar variables de entorno
EnvironmentFile=/opt/flotillas/.env EnvironmentFile=/opt/adan/.env
# Comando de inicio usando 'serve' para servir archivos estaticos # Comando de inicio usando 'serve' para servir archivos estaticos
# Opcion 1: Usando serve (recomendado para SPA React/Vue) # Opcion 1: Usando serve (recomendado para SPA React/Vue)
@@ -22,7 +22,7 @@ ExecStart=/usr/bin/serve \
--single --single
# Opcion 2: Si usas Next.js en modo standalone # Opcion 2: Si usas Next.js en modo standalone
# ExecStart=/usr/bin/node /opt/flotillas/frontend/.next/standalone/server.js # ExecStart=/usr/bin/node /opt/adan/frontend/.next/standalone/server.js
# Opcion 3: Si prefieres usar Node directamente # Opcion 3: Si prefieres usar Node directamente
# ExecStart=/usr/bin/npx serve -s dist -l 3000 # ExecStart=/usr/bin/npx serve -s dist -l 3000
@@ -47,12 +47,12 @@ NoNewPrivileges=true
PrivateTmp=true PrivateTmp=true
ProtectSystem=strict ProtectSystem=strict
ProtectHome=true ProtectHome=true
ReadWritePaths=/opt/flotillas ReadWritePaths=/opt/adan
# Logging # Logging
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=flotillas-web SyslogIdentifier=adan-web
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Cloudflare Tunnel - Sistema de Flotillas Description=Cloudflare Tunnel - Sistema de ADAN
Documentation=https://developers.cloudflare.com/cloudflare-one/connections/connect-apps Documentation=https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
@@ -20,7 +20,7 @@ ExecStart=/usr/local/bin/cloudflared tunnel --no-autoupdate run --token ${CLOUDF
# ExecStart=/usr/local/bin/cloudflared tunnel --config /etc/cloudflared/config.yml run # ExecStart=/usr/local/bin/cloudflared tunnel --config /etc/cloudflared/config.yml run
# Cargar variables de entorno # Cargar variables de entorno
EnvironmentFile=/opt/flotillas/.env EnvironmentFile=/opt/adan/.env
# Reinicio automatico # Reinicio automatico
Restart=always Restart=always

View File

@@ -2,7 +2,7 @@
<!-- <!--
============================================ ============================================
Traccar Server - Configuracion para Sistema de Flotillas Traccar Server - Configuracion para Sistema de ADAN
============================================ ============================================
Documentacion: https://www.traccar.org/configuration-file/ Documentacion: https://www.traccar.org/configuration-file/
@@ -37,7 +37,7 @@ Esta configuracion:
<entry key='database.driver'>org.postgresql.Driver</entry> <entry key='database.driver'>org.postgresql.Driver</entry>
<entry key='database.url'>jdbc:postgresql://localhost:5432/traccar</entry> <entry key='database.url'>jdbc:postgresql://localhost:5432/traccar</entry>
<entry key='database.user'>flotillas</entry> <entry key='database.user'>adan</entry>
<entry key='database.password'>POSTGRES_PASSWORD</entry> <entry key='database.password'>POSTGRES_PASSWORD</entry>
<!-- Pool de conexiones --> <!-- Pool de conexiones -->

View File

@@ -1,13 +1,13 @@
# Referencia de API # Referencia de API
Documentacion de la API REST de FlotillasGPS. Documentacion de la API REST de ADAN.
## Informacion General ## Informacion General
- **Base URL**: `https://flotillas.tudominio.com/api/v1` - **Base URL**: `https://adan.tudominio.com/api/v1`
- **Autenticacion**: JWT Bearer Token - **Autenticacion**: JWT Bearer Token
- **Formato**: JSON - **Formato**: JSON
- **Documentacion interactiva**: `https://flotillas.tudominio.com/api/docs` - **Documentacion interactiva**: `https://adan.tudominio.com/api/docs`
## Autenticacion ## Autenticacion
@@ -649,7 +649,7 @@ GET /reportes/{id}/descargar
### Conexion ### Conexion
```javascript ```javascript
const ws = new WebSocket('wss://flotillas.tudominio.com/ws/v1/ubicaciones'); const ws = new WebSocket('wss://adan.tudominio.com/ws/v1/ubicaciones');
ws.onopen = () => { ws.onopen = () => {
// Autenticar // Autenticar

View File

@@ -1,16 +1,16 @@
# Guia de Configuracion # Guia de Configuracion
Configuracion detallada de todos los componentes del sistema FlotillasGPS. Configuracion detallada de todos los componentes del sistema ADAN.
## Variables de Entorno ## Variables de Entorno
El archivo `/opt/flotillas/.env` contiene todas las configuraciones del sistema. El archivo `/opt/adan/.env` contiene todas las configuraciones del sistema.
### Base de Datos ### Base de Datos
```bash ```bash
# PostgreSQL # PostgreSQL
DATABASE_URL=postgresql://flotillas:PASSWORD@localhost:5432/flotillas_db DATABASE_URL=postgresql://adan:PASSWORD@localhost:5432/adan_db
# Conexiones maximas al pool # Conexiones maximas al pool
DB_POOL_SIZE=10 DB_POOL_SIZE=10
@@ -60,7 +60,7 @@ MEDIAMTX_WEBRTC=http://localhost:8889
MEDIAMTX_HLS=http://localhost:8888 MEDIAMTX_HLS=http://localhost:8888
# Directorio de grabaciones # Directorio de grabaciones
VIDEO_STORAGE_PATH=/opt/flotillas/videos VIDEO_STORAGE_PATH=/opt/adan/videos
VIDEO_RETENTION_DAYS=30 VIDEO_RETENTION_DAYS=30
``` ```
@@ -71,7 +71,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883 MQTT_PORT=1883
MQTT_USER=mesh_gateway MQTT_USER=mesh_gateway
MQTT_PASSWORD=password_seguro MQTT_PASSWORD=password_seguro
MQTT_TOPIC=flotillas/mesh/# MQTT_TOPIC=adan/mesh/#
``` ```
### Notificaciones ### Notificaciones
@@ -82,18 +82,18 @@ SMTP_HOST=smtp.tudominio.com
SMTP_PORT=587 SMTP_PORT=587
SMTP_USER=notificaciones@tudominio.com SMTP_USER=notificaciones@tudominio.com
SMTP_PASSWORD=password SMTP_PASSWORD=password
SMTP_FROM=FlotillasGPS <notificaciones@tudominio.com> SMTP_FROM=ADAN <notificaciones@tudominio.com>
# Push Notifications (Firebase) # Push Notifications (Firebase)
FIREBASE_CREDENTIALS_FILE=/opt/flotillas/firebase-credentials.json FIREBASE_CREDENTIALS_FILE=/opt/adan/firebase-credentials.json
``` ```
### Dominio ### Dominio
```bash ```bash
DOMAIN=flotillas.tudominio.com DOMAIN=adan.tudominio.com
API_URL=https://flotillas.tudominio.com/api API_URL=https://adan.tudominio.com/api
FRONTEND_URL=https://flotillas.tudominio.com FRONTEND_URL=https://adan.tudominio.com
``` ```
--- ---
@@ -108,8 +108,8 @@ Archivo: `/opt/traccar/conf/traccar.xml`
<properties> <properties>
<!-- Base de datos --> <!-- Base de datos -->
<entry key='database.driver'>org.postgresql.Driver</entry> <entry key='database.driver'>org.postgresql.Driver</entry>
<entry key='database.url'>jdbc:postgresql://localhost:5432/flotillas_db</entry> <entry key='database.url'>jdbc:postgresql://localhost:5432/adan_db</entry>
<entry key='database.user'>flotillas</entry> <entry key='database.user'>adan</entry>
<entry key='database.password'>TU_PASSWORD</entry> <entry key='database.password'>TU_PASSWORD</entry>
<!-- Deshabilitar web UI de Traccar (usamos nuestro dashboard) --> <!-- Deshabilitar web UI de Traccar (usamos nuestro dashboard) -->
@@ -192,7 +192,7 @@ hlsSegmentDuration: 1s
# Grabacion # Grabacion
record: no # Manejamos grabacion desde nuestra API record: no # Manejamos grabacion desde nuestra API
recordPath: /opt/flotillas/videos/%path/%Y%m%d_%H%M%S.mp4 recordPath: /opt/adan/videos/%path/%Y%m%d_%H%M%S.mp4
# Paths (camaras) # Paths (camaras)
paths: paths:
@@ -231,17 +231,17 @@ credentials-file: /root/.cloudflared/TU_TUNNEL_ID.json
ingress: ingress:
# API Backend # API Backend
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /api/* path: /api/*
service: http://localhost:8000 service: http://localhost:8000
# WebSocket # WebSocket
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
path: /ws/* path: /ws/*
service: http://localhost:8000 service: http://localhost:8000
# Frontend (default) # Frontend (default)
- hostname: flotillas.tudominio.com - hostname: adan.tudominio.com
service: http://localhost:3000 service: http://localhost:3000
# Catch-all # Catch-all
@@ -352,21 +352,21 @@ ufw enable
## Configuracion de Systemd Services ## Configuracion de Systemd Services
### flotillas-api.service ### adan-api.service
```ini ```ini
[Unit] [Unit]
Description=FlotillasGPS API Backend Description=ADAN API Backend
After=network.target postgresql.service redis.service After=network.target postgresql.service redis.service
[Service] [Service]
Type=simple Type=simple
User=www-data User=www-data
Group=www-data Group=www-data
WorkingDirectory=/opt/flotillas/backend WorkingDirectory=/opt/adan/backend
Environment="PATH=/opt/flotillas/venv/bin" Environment="PATH=/opt/adan/venv/bin"
EnvironmentFile=/opt/flotillas/.env EnvironmentFile=/opt/adan/.env
ExecStart=/opt/flotillas/venv/bin/uvicorn app.main:app \ ExecStart=/opt/adan/venv/bin/uvicorn app.main:app \
--host 127.0.0.1 \ --host 127.0.0.1 \
--port 8000 \ --port 8000 \
--workers 4 \ --workers 4 \
@@ -379,18 +379,18 @@ RestartSec=5
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
### flotillas-web.service ### adan-web.service
```ini ```ini
[Unit] [Unit]
Description=FlotillasGPS Web Frontend Description=ADAN Web Frontend
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=www-data User=www-data
Group=www-data Group=www-data
WorkingDirectory=/opt/flotillas/frontend WorkingDirectory=/opt/adan/frontend
ExecStart=/usr/bin/npx serve -s dist -l 3000 ExecStart=/usr/bin/npx serve -s dist -l 3000
Restart=always Restart=always
RestartSec=5 RestartSec=5
@@ -439,11 +439,11 @@ Despues de modificar archivos de configuracion:
systemctl daemon-reload systemctl daemon-reload
# Reiniciar servicio especifico # Reiniciar servicio especifico
systemctl restart flotillas-api systemctl restart adan-api
# Reiniciar todos los servicios # Reiniciar todos los servicios
systemctl restart flotillas-api flotillas-web traccar mediamtx systemctl restart adan-api adan-web traccar mediamtx
# Verificar estado # Verificar estado
systemctl status flotillas-api flotillas-web traccar mediamtx systemctl status adan-api adan-web traccar mediamtx
``` ```

View File

@@ -1,6 +1,6 @@
# Guia de Instalacion # Guia de Instalacion
Esta guia cubre la instalacion completa del sistema FlotillasGPS en un servidor Proxmox. Esta guia cubre la instalacion completa del sistema ADAN en un servidor Proxmox.
## Requisitos Previos ## Requisitos Previos
@@ -31,7 +31,7 @@ Esta guia cubre la instalacion completa del sistema FlotillasGPS en un servidor
1. Click en "Create VM" 1. Click en "Create VM"
2. **General**: 2. **General**:
- Name: `flotillas-server` - Name: `adan-server`
- Start at boot: Si - Start at boot: Si
3. **OS**: 3. **OS**:
- ISO image: ubuntu-22.04-live-server-amd64.iso - ISO image: ubuntu-22.04-live-server-amd64.iso
@@ -77,9 +77,9 @@ sudo apt install -y git curl wget
```bash ```bash
cd /opt cd /opt
sudo git clone https://git.consultoria-as.com/tu-usuario/flotillas-gps.git flotillas sudo git clone https://git.consultoria-as.com/tu-usuario/adan.git adan
sudo chown -R $USER:$USER /opt/flotillas sudo chown -R $USER:$USER /opt/adan
cd /opt/flotillas cd /opt/adan
``` ```
## Paso 4: Configurar Variables ## Paso 4: Configurar Variables
@@ -93,7 +93,7 @@ nano deploy/scripts/install.sh
Modificar las variables al inicio: Modificar las variables al inicio:
```bash ```bash
DOMAIN="flotillas.tudominio.com" # Tu dominio DOMAIN="adan.tudominio.com" # Tu dominio
ADMIN_EMAIL="admin@tudominio.com" # Email del admin ADMIN_EMAIL="admin@tudominio.com" # Email del admin
``` ```
@@ -124,7 +124,7 @@ El script realizara automaticamente:
1. Ir a **Zero Trust** > **Access** > **Tunnels** 1. Ir a **Zero Trust** > **Access** > **Tunnels**
2. Click **Create a tunnel** 2. Click **Create a tunnel**
3. Nombre: `flotillas` 3. Nombre: `adan`
4. Copiar el token del tunnel 4. Copiar el token del tunnel
### En tu servidor: ### En tu servidor:
@@ -141,17 +141,17 @@ En el dashboard del tunnel, agregar Public Hostnames:
| Subdomain | Domain | Service | | Subdomain | Domain | Service |
|-----------|--------|---------| |-----------|--------|---------|
| flotillas | tudominio.com | http://localhost:3000 | | adan | tudominio.com | http://localhost:3000 |
| flotillas | tudominio.com | http://localhost:8000 (path: /api/*) | | adan | tudominio.com | http://localhost:8000 (path: /api/*) |
| flotillas | tudominio.com | http://localhost:8000 (path: /ws/*) | | adan | tudominio.com | http://localhost:8000 (path: /ws/*) |
## Paso 7: Verificar Instalacion ## Paso 7: Verificar Instalacion
### Verificar servicios: ### Verificar servicios:
```bash ```bash
sudo systemctl status flotillas-api sudo systemctl status adan-api
sudo systemctl status flotillas-web sudo systemctl status adan-web
sudo systemctl status traccar sudo systemctl status traccar
sudo systemctl status mediamtx sudo systemctl status mediamtx
sudo systemctl status cloudflared sudo systemctl status cloudflared
@@ -161,7 +161,7 @@ Todos deben mostrar `active (running)`.
### Verificar acceso web: ### Verificar acceso web:
Abrir en navegador: `https://flotillas.tudominio.com` Abrir en navegador: `https://adan.tudominio.com`
Deberia mostrar la pagina de login. Deberia mostrar la pagina de login.
@@ -181,7 +181,7 @@ Las credenciales se generaron durante la instalacion.
Ver credenciales guardadas: Ver credenciales guardadas:
```bash ```bash
cat /opt/flotillas/.credentials cat /opt/adan/.credentials
``` ```
Ejemplo de salida: Ejemplo de salida:
@@ -190,8 +190,8 @@ Ejemplo de salida:
================================= =================================
CREDENCIALES DE ACCESO CREDENCIALES DE ACCESO
================================= =================================
Dashboard: https://flotillas.tudominio.com Dashboard: https://adan.tudominio.com
Admin Email: admin@flotillas.tudominio.com Admin Email: admin@adan.tudominio.com
Admin Password: xK9mN2pL5qR8 Admin Password: xK9mN2pL5qR8
Database Password: [guardado en .env] Database Password: [guardado en .env]
================================= =================================
@@ -229,17 +229,17 @@ Si el servidor esta detras de NAT:
```bash ```bash
# Ver logs detallados # Ver logs detallados
journalctl -u flotillas-api -n 100 --no-pager journalctl -u adan-api -n 100 --no-pager
# Verificar configuracion # Verificar configuracion
cat /opt/flotillas/.env cat /opt/adan/.env
``` ```
### No puedo acceder al dashboard ### No puedo acceder al dashboard
```bash ```bash
# Verificar tunnel # Verificar tunnel
cloudflared tunnel info flotillas cloudflared tunnel info adan
# Reiniciar tunnel # Reiniciar tunnel
sudo systemctl restart cloudflared sudo systemctl restart cloudflared

View File

@@ -1,6 +1,6 @@
# Integracion Meshtastic # Integracion Meshtastic
Guia para configurar dispositivos Meshtastic con FlotillasGPS. Guia para configurar dispositivos Meshtastic con ADAN.
## Que es Meshtastic ## Que es Meshtastic
@@ -11,7 +11,7 @@ Meshtastic es una plataforma de comunicacion mesh usando radio LoRa:
- **Bajo costo**: Dispositivos desde $20 USD - **Bajo costo**: Dispositivos desde $20 USD
- **Bajo consumo**: Semanas de bateria - **Bajo consumo**: Semanas de bateria
### Casos de Uso en Flotillas ### Casos de Uso en ADAN
- Vehiculos en zonas rurales sin cobertura celular - Vehiculos en zonas rurales sin cobertura celular
- Operaciones en minas, campos, areas remotas - Operaciones en minas, campos, areas remotas
@@ -48,7 +48,7 @@ Meshtastic es una plataforma de comunicacion mesh usando radio LoRa:
| MQTT / Internet | MQTT / Internet
v v
[Tu Servidor] [Tu Servidor]
FlotillasGPS ADAN
``` ```
--- ---
@@ -153,7 +153,7 @@ meshtastic --set mqtt.enabled true
meshtastic --set mqtt.address tu-servidor.com meshtastic --set mqtt.address tu-servidor.com
meshtastic --set mqtt.username mesh_gateway meshtastic --set mqtt.username mesh_gateway
meshtastic --set mqtt.password tu_password meshtastic --set mqtt.password tu_password
meshtastic --set mqtt.root_topic flotillas/mesh meshtastic --set mqtt.root_topic adan/mesh
meshtastic --set mqtt.encryption_enabled true meshtastic --set mqtt.encryption_enabled true
meshtastic --set mqtt.json_enabled true meshtastic --set mqtt.json_enabled true
``` ```
@@ -168,7 +168,7 @@ MQTT Enabled: true
MQTT Server: tu-servidor.com:1883 MQTT Server: tu-servidor.com:1883
MQTT Username: mesh_gateway MQTT Username: mesh_gateway
MQTT Password: tu_password MQTT Password: tu_password
Root Topic: flotillas/mesh Root Topic: adan/mesh
JSON Enabled: true JSON Enabled: true
``` ```
@@ -190,7 +190,7 @@ mosquitto_passwd -c /etc/mosquitto/passwd mesh_gateway
# Ingresar password # Ingresar password
``` ```
Configuracion `/etc/mosquitto/conf.d/flotillas.conf`: Configuracion `/etc/mosquitto/conf.d/adan.conf`:
``` ```
listener 1883 listener 1883
allow_anonymous false allow_anonymous false
@@ -207,12 +207,12 @@ systemctl restart mosquitto
Suscribirse al topic para ver mensajes: Suscribirse al topic para ver mensajes:
```bash ```bash
mosquitto_sub -h localhost -t "flotillas/mesh/#" -u mesh_gateway -P tu_password mosquitto_sub -h localhost -t "adan/mesh/#" -u mesh_gateway -P tu_password
``` ```
Deberian aparecer mensajes JSON cuando los nodos envien posicion. Deberian aparecer mensajes JSON cuando los nodos envien posicion.
### 3. Configurar en FlotillasGPS ### 3. Configurar en ADAN
Variables de entorno en `.env`: Variables de entorno en `.env`:
```bash ```bash
@@ -220,7 +220,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883 MQTT_PORT=1883
MQTT_USER=mesh_gateway MQTT_USER=mesh_gateway
MQTT_PASSWORD=tu_password MQTT_PASSWORD=tu_password
MQTT_TOPIC=flotillas/mesh/# MQTT_TOPIC=adan/mesh/#
``` ```
--- ---
@@ -319,7 +319,7 @@ Cada vehiculo puede actuar como relay si esta configurado como ROUTER_CLIENT.
1. Verificar que el gateway recibe mensajes: 1. Verificar que el gateway recibe mensajes:
```bash ```bash
mosquitto_sub -h localhost -t "flotillas/mesh/#" -u mesh_gateway -P password mosquitto_sub -h localhost -t "adan/mesh/#" -u mesh_gateway -P password
``` ```
2. Verificar que el nodo esta en el mismo canal: 2. Verificar que el nodo esta en el mismo canal:

View File

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

View File

@@ -1,12 +1,12 @@
# Manual del Administrador # Manual del Administrador
Guia completa para administrar el sistema FlotillasGPS. Guia completa para administrar el sistema ADAN.
## Acceso al Sistema ## Acceso al Sistema
### Iniciar Sesion ### Iniciar Sesion
1. Abrir `https://flotillas.tudominio.com` en el navegador 1. Abrir `https://adan.tudominio.com` en el navegador
2. Ingresar email y contrasena 2. Ingresar email y contrasena
3. Click en "Ingresar" 3. Click en "Ingresar"
@@ -386,15 +386,15 @@ Los mensajes y respuestas aparecen como conversacion en el detalle del conductor
```bash ```bash
ssh admin@servidor ssh admin@servidor
/opt/flotillas/scripts/backup.sh /opt/adan/scripts/backup.sh
``` ```
Los backups se guardan en `/opt/flotillas/backups/` Los backups se guardan en `/opt/adan/backups/`
### Restaurar Backup ### Restaurar Backup
```bash ```bash
/opt/flotillas/scripts/restore.sh /opt/flotillas/backups/db_20260121.sql.gz /opt/adan/scripts/restore.sh /opt/adan/backups/db_20260121.sql.gz
``` ```
### Backups Automaticos ### Backups Automaticos
@@ -408,5 +408,5 @@ Se ejecutan diariamente a las 3:00 AM. Se mantienen los ultimos 7 dias.
Para problemas tecnicos: Para problemas tecnicos:
1. Revisar [Solucion de Problemas](troubleshooting.md) 1. Revisar [Solucion de Problemas](troubleshooting.md)
2. Revisar logs: `journalctl -u flotillas-api -f` 2. Revisar logs: `journalctl -u adan-api -f`
3. Contactar soporte tecnico 3. Contactar soporte tecnico

View File

@@ -1,20 +1,20 @@
# Manual del Conductor - App FlotillasGPS # Manual del Conductor - App ADAN
Guia completa para usar la aplicacion movil de FlotillasGPS. Guia completa para usar la aplicacion movil de ADAN.
## Instalacion de la App ## Instalacion de la App
### Android ### Android
1. Abrir Play Store 1. Abrir Play Store
2. Buscar "FlotillasGPS Conductor" 2. Buscar "ADAN Conductor"
3. Instalar la aplicacion 3. Instalar la aplicacion
4. Abrir la app 4. Abrir la app
### iPhone ### iPhone
1. Abrir App Store 1. Abrir App Store
2. Buscar "FlotillasGPS Conductor" 2. Buscar "ADAN Conductor"
3. Instalar la aplicacion 3. Instalar la aplicacion
4. Abrir la app 4. Abrir la app
@@ -238,7 +238,7 @@ La app muestra el numero de telefono de emergencia de tu empresa. Puedes tocarlo
Si tienes problemas con el GPS: Si tienes problemas con el GPS:
1. Ir a **Configuracion** del telefono 1. Ir a **Configuracion** del telefono
2. Buscar la app **FlotillasGPS** 2. Buscar la app **ADAN**
3. Tocar **Permisos** 3. Tocar **Permisos**
4. Asegurar que **Ubicacion** este en **Siempre permitir** 4. Asegurar que **Ubicacion** este en **Siempre permitir**

View File

@@ -1,6 +1,6 @@
# Configuracion de Video Streaming # Configuracion de Video Streaming
Guia para configurar camaras y video streaming en FlotillasGPS. Guia para configurar camaras y video streaming en ADAN.
## Arquitectura de Video ## Arquitectura de Video
@@ -12,7 +12,7 @@ Camaras en Vehiculos Servidor Dashboard/App
[Cam IP] --RTSP--> | [Cam IP] --RTSP--> |
| |
[Grabaciones] [Grabaciones]
/opt/flotillas/videos/ /opt/adan/videos/
``` ```
## Tipos de Camaras Soportadas ## Tipos de Camaras Soportadas
@@ -50,7 +50,7 @@ Cualquier camara con:
### 4. Celular como Dashcam ### 4. Celular como Dashcam
La app FlotillasGPS puede usar la camara del celular: La app ADAN puede usar la camara del celular:
- Sin costo adicional - Sin costo adicional
- Calidad depende del celular - Calidad depende del celular
- Consume bateria y datos - Consume bateria y datos
@@ -240,7 +240,7 @@ Configurar en **Configuracion** > **Retencion de datos**:
Script de limpieza automatica: Script de limpieza automatica:
```bash ```bash
# Ejecutar diariamente via cron # Ejecutar diariamente via cron
find /opt/flotillas/videos -name "*.mp4" -mtime +30 -delete find /opt/adan/videos -name "*.mp4" -mtime +30 -delete
``` ```
--- ---
@@ -344,10 +344,10 @@ Soluciones:
Verificar: Verificar:
```bash ```bash
# Espacio en disco # Espacio en disco
df -h /opt/flotillas/videos df -h /opt/adan/videos
# Permisos # Permisos
ls -la /opt/flotillas/videos ls -la /opt/adan/videos
# Logs de MediaMTX # Logs de MediaMTX
journalctl -u mediamtx -f journalctl -u mediamtx -f

View File

@@ -1,8 +1,8 @@
# Sistema de Monitoreo de Flotillas GPS + IA # Sistema de Monitoreo de ADAN GPS + IA
## Resumen Ejecutivo ## Resumen Ejecutivo
Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo real, video streaming, integración con dispositivos Meshtastic, y app móvil para conductores. Diseñado para escala pequeña (1-20 vehículos) con arquitectura preparada para crecimiento futuro. Sistema completo de monitoreo de adan vehiculares con rastreo GPS en tiempo real, video streaming, integración con dispositivos Meshtastic, y app móvil para conductores. Diseñado para escala pequeña (1-20 vehículos) con arquitectura preparada para crecimiento futuro.
**Fecha:** 2026-01-21 **Fecha:** 2026-01-21
**Estado:** Pendiente de aprobación **Estado:** Pendiente de aprobación
@@ -41,7 +41,7 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
│ │ │ │
│ ┌─────────────────────────────────────────────────────────┐ │ │ ┌─────────────────────────────────────────────────────────┐ │
│ │ CLOUDFLARED (Tunnel) │ │ │ │ CLOUDFLARED (Tunnel) │ │
│ │ flotillas.tudominio.com → localhost │ │ │ │ adan.tudominio.com → localhost │ │
│ └─────────────────────┬───────────────────────────────────┘ │ │ └─────────────────────┬───────────────────────────────────┘ │
│ │ │ │ │ │
│ ┌──────────────┴──────────────┐ │ │ ┌──────────────┴──────────────┐ │
@@ -186,8 +186,8 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
### Servicios ### Servicios
- `flotillas-api.service` - Backend FastAPI - `adan-api.service` - Backend FastAPI
- `flotillas-web.service` - Frontend React - `adan-web.service` - Frontend React
- `traccar.service` - Servidor GPS - `traccar.service` - Servidor GPS
- `mediamtx.service` - Streaming video - `mediamtx.service` - Streaming video
- `cloudflared.service` - Tunnel Cloudflare - `cloudflared.service` - Tunnel Cloudflare
@@ -219,7 +219,7 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
## Repositorio ## Repositorio
**URL:** https://git.consultoria-as.com **URL:** https://git.consultoria-as.com
**Nombre:** flotillas-gps **Nombre:** adan
--- ---

View File

@@ -4,9 +4,9 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Sistema de Monitoreo de Flotillas GPS" /> <meta name="description" content="Sistema de Monitoreo de ADAN GPS" />
<meta name="theme-color" content="#0f172a" /> <meta name="theme-color" content="#0f172a" />
<title>Flotillas GPS - Sistema de Monitoreo</title> <title>ADAN GPS - Sistema de Monitoreo</title>
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">

View File

@@ -1,5 +1,5 @@
{ {
"name": "flotillas-gps-frontend", "name": "adan-frontend",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",

View File

@@ -12,8 +12,8 @@ const apiClient: AxiosInstance = axios.create({
}) })
// Token storage // Token storage
const TOKEN_KEY = 'flotillas_access_token' const TOKEN_KEY = 'adan_access_token'
const REFRESH_TOKEN_KEY = 'flotillas_refresh_token' const REFRESH_TOKEN_KEY = 'adan_refresh_token'
export const getAccessToken = (): string | null => { export const getAccessToken = (): string | null => {
return localStorage.getItem(TOKEN_KEY) return localStorage.getItem(TOKEN_KEY)

View File

@@ -95,7 +95,7 @@ export default function Sidebar() {
<MapPinIcon className="w-6 h-6 text-white" /> <MapPinIcon className="w-6 h-6 text-white" />
</div> </div>
<div> <div>
<h1 className="text-lg font-bold text-white">Flotillas</h1> <h1 className="text-lg font-bold text-white">ADAN</h1>
<p className="text-xs text-slate-500">GPS Monitor</p> <p className="text-xs text-slate-500">GPS Monitor</p>
</div> </div>
</div> </div>

View File

@@ -49,7 +49,7 @@ export default function Login() {
<MapPinIcon className="w-7 h-7 text-white" /> <MapPinIcon className="w-7 h-7 text-white" />
</div> </div>
<div> <div>
<h1 className="text-2xl font-bold text-white">Flotillas GPS</h1> <h1 className="text-2xl font-bold text-white">ADAN GPS</h1>
<p className="text-sm text-slate-500">Sistema de Monitoreo</p> <p className="text-sm text-slate-500">Sistema de Monitoreo</p>
</div> </div>
</div> </div>
@@ -138,7 +138,7 @@ export default function Login() {
{/* Footer */} {/* Footer */}
<p className="mt-8 text-center text-sm text-slate-600"> <p className="mt-8 text-center text-sm text-slate-600">
Flotillas GPS v1.0.0 | Sistema de Monitoreo de Flota ADAN GPS v1.0.0 | Sistema de Monitoreo de Flota
</p> </p>
</div> </div>
</div> </div>

View File

@@ -102,7 +102,7 @@ export const useAuthStore = create<AuthState>()(
setLoading: (loading: boolean) => set({ isLoading: loading }), setLoading: (loading: boolean) => set({ isLoading: loading }),
}), }),
{ {
name: 'flotillas-auth', name: 'adan-auth',
storage: createJSONStorage(() => localStorage), storage: createJSONStorage(() => localStorage),
partialize: (state) => ({ partialize: (state) => ({
user: state.user, user: state.user,

View File

@@ -152,7 +152,7 @@ export const useConfigStore = create<ConfigState>()(
})), })),
}), }),
{ {
name: 'flotillas-config', name: 'adan-config',
storage: createJSONStorage(() => localStorage), storage: createJSONStorage(() => localStorage),
} }
) )

View File

@@ -252,7 +252,7 @@ export const useMapaStore = create<MapaStoreState>()(
}, },
}), }),
{ {
name: 'flotillas-mapa', name: 'adan-mapa',
storage: createJSONStorage(() => localStorage), storage: createJSONStorage(() => localStorage),
partialize: (state) => ({ partialize: (state) => ({
centro: state.centro, centro: state.centro,