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)",
"Bash(git init:*)",
"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
# =============================================================================
# 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_MAX_OVERFLOW=20
@@ -40,7 +40,7 @@ MEDIAMTX_API=http://localhost:9997
MEDIAMTX_RTSP=rtsp://localhost:8554
MEDIAMTX_WEBRTC=http://localhost:8889
MEDIAMTX_HLS=http://localhost:8888
VIDEO_STORAGE_PATH=/opt/flotillas/videos
VIDEO_STORAGE_PATH=/opt/adan/videos
VIDEO_RETENTION_DAYS=30
# =============================================================================
@@ -51,7 +51,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883
MQTT_USER=mesh_gateway
MQTT_PASSWORD=cambiar_password
MQTT_TOPIC=flotillas/mesh/#
MQTT_TOPIC=adan/mesh/#
# =============================================================================
# NOTIFICACIONES
@@ -61,14 +61,14 @@ SMTP_HOST=smtp.ejemplo.com
SMTP_PORT=587
SMTP_USER=notificaciones@ejemplo.com
SMTP_PASSWORD=password
SMTP_FROM=FlotillasGPS <notificaciones@ejemplo.com>
SMTP_FROM=ADAN <notificaciones@ejemplo.com>
# =============================================================================
# DOMINIO Y URLs
# =============================================================================
DOMAIN=flotillas.tudominio.com
API_URL=https://flotillas.tudominio.com/api
FRONTEND_URL=https://flotillas.tudominio.com
DOMAIN=adan.tudominio.com
API_URL=https://adan.tudominio.com/api
FRONTEND_URL=https://adan.tudominio.com
# =============================================================================
# CONFIGURACION
@@ -76,7 +76,7 @@ FRONTEND_URL=https://flotillas.tudominio.com
ENVIRONMENT=production
DEBUG=false
LOG_LEVEL=info
CORS_ORIGINS=https://flotillas.tudominio.com
CORS_ORIGINS=https://adan.tudominio.com
DEFAULT_MAX_SPEED=80
DEFAULT_STOP_ALERT_MINUTES=30
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
@@ -63,8 +63,8 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
```bash
# Clonar repositorio
git clone https://git.consultoria-as.com/tu-usuario/flotillas-gps.git
cd flotillas-gps
git clone https://git.consultoria-as.com/tu-usuario/adan.git
cd adan
# Ejecutar instalador
sudo ./deploy/scripts/install.sh
@@ -75,7 +75,7 @@ El script instalara y configurara automaticamente todos los componentes.
## Estructura del Proyecto
```
flotillas-gps/
adan/
├── backend/ # API FastAPI
├── frontend/ # Dashboard React
├── mobile/ # App React Native
@@ -113,16 +113,16 @@ Las credenciales se generan durante la instalacion y se muestran al final.
```bash
# Ver estado de servicios
systemctl status flotillas-api flotillas-web traccar mediamtx
systemctl status adan-api adan-web traccar mediamtx
# Ver logs
journalctl -u flotillas-api -f
journalctl -u adan-api -f
# Backup manual
/opt/flotillas/scripts/backup.sh
/opt/adan/scripts/backup.sh
# Actualizar
/opt/flotillas/scripts/update.sh
/opt/adan/scripts/update.sh
```
## Seguridad

View File

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

View File

@@ -1,7 +1,7 @@
"""
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
- Gestión de vehículos y conductores
- Alertas y geocercas
@@ -59,7 +59,7 @@ app = FastAPI(
description="""
## Adan Fleet Monitor API
Sistema de monitoreo de flotillas GPS.
Sistema de monitoreo de adan GPS.
### Funcionalidades principales:
- **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
@@ -17,8 +17,8 @@ deploy/
│ ├── status.sh # Estado del sistema
│ └── logs.sh # Visor de logs
├── services/ # Servicios systemd
│ ├── flotillas-api.service
│ ├── flotillas-web.service
│ ├── adan-api.service
│ ├── adan-web.service
│ ├── mediamtx.service
│ └── cloudflared.service
├── cloudflare/ # Configuracion tunnel
@@ -44,15 +44,15 @@ deploy/
```bash
# 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
```bash
# Clonar repositorio
git clone https://github.com/tuorg/flotillas.git /opt/flotillas
cd /opt/flotillas
git clone https://github.com/tuorg/adan.git /opt/adan
cd /opt/adan
# Ejecutar instalador
sudo ./deploy/scripts/install.sh
@@ -101,18 +101,18 @@ cloudflared tunnel login
3. Crear tunnel:
```bash
cloudflared tunnel create flotillas
cloudflared tunnel create adan
```
4. Configurar DNS:
```bash
cloudflared tunnel route dns flotillas flotillas.tudominio.com
cloudflared tunnel route dns adan adan.tudominio.com
```
5. Copiar config y habilitar servicio:
```bash
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 start cloudflared
```
@@ -144,7 +144,7 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
./deploy/scripts/restore.sh --latest
# 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
@@ -164,8 +164,8 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
| Servicio | Puerto | Descripcion |
|----------|--------|-------------|
| flotillas-api | 8000 | Backend FastAPI |
| flotillas-web | 3000 | Frontend |
| adan-api | 8000 | Backend FastAPI |
| adan-web | 3000 | Frontend |
| postgresql | 5432 | Base de datos |
| redis | 6379 | Cache |
| traccar | 5055 | GPS Server |
@@ -176,17 +176,17 @@ Backups automaticos: diariamente a las 3 AM (configurado por install.sh)
```bash
# Estado
systemctl status flotillas-api
systemctl status adan-api
# Reiniciar
systemctl restart flotillas-api
systemctl restart adan-api
# Logs
journalctl -u flotillas-api -f
journalctl -u adan-api -f
# Habilitar/Deshabilitar
systemctl enable flotillas-api
systemctl disable flotillas-api
systemctl enable adan-api
systemctl disable adan-api
```
## Seguridad
@@ -217,13 +217,13 @@ systemctl disable flotillas-api
```bash
# Ver logs
journalctl -u flotillas-api -n 100
journalctl -u adan-api -n 100
# Verificar puerto
ss -tlnp | grep 8000
# 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
@@ -243,19 +243,19 @@ nc -zv localhost 5055
```bash
# 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
# Editar /etc/systemd/system/flotillas-api.service
# Editar /etc/systemd/system/adan-api.service
# Cambiar --workers 4 a --workers 2
systemctl daemon-reload
systemctl restart flotillas-api
systemctl restart adan-api
```
## Credenciales
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.

View File

@@ -6,9 +6,9 @@
# Para usar esta configuracion:
# 1. Instalar cloudflared: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation
# 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
# 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/
# ============================================
@@ -33,29 +33,29 @@ ingress:
# ----------------------------------------
# API Backend - /api/* y /docs
# ----------------------------------------
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /api/*
service: http://localhost:8000
originRequest:
connectTimeout: 30s
noTLSVerify: false
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /docs
service: http://localhost:8000
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /redoc
service: http://localhost:8000
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /openapi.json
service: http://localhost:8000
# ----------------------------------------
# WebSocket - /ws/*
# ----------------------------------------
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /ws/*
service: http://localhost:8000
originRequest:
@@ -68,20 +68,20 @@ ingress:
# ----------------------------------------
# Video Streaming - WebRTC/HLS
# ----------------------------------------
- hostname: stream.flotillas.tudominio.com
- hostname: stream.adan.tudominio.com
path: /*
service: http://localhost:8889
originRequest:
noTLSVerify: false
- hostname: hls.flotillas.tudominio.com
- hostname: hls.adan.tudominio.com
path: /*
service: http://localhost:8888
# ----------------------------------------
# API de MediaMTX (interno/admin)
# ----------------------------------------
- hostname: mediamtx-api.flotillas.tudominio.com
- hostname: mediamtx-api.adan.tudominio.com
path: /*
service: http://localhost:9997
originRequest:
@@ -91,7 +91,7 @@ ingress:
# ----------------------------------------
# Frontend Web - Todo lo demas
# ----------------------------------------
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
service: http://localhost:3000
originRequest:
noTLSVerify: false
@@ -106,9 +106,9 @@ ingress:
# ============================================
#
# DOMINIOS RECOMENDADOS:
# - flotillas.tudominio.com -> Frontend + API
# - stream.flotillas.tudominio.com -> Video WebRTC
# - hls.flotillas.tudominio.com -> Video HLS
# - adan.tudominio.com -> Frontend + API
# - stream.adan.tudominio.com -> Video WebRTC
# - hls.adan.tudominio.com -> Video HLS
#
# INSTALACION RAPIDA CON TOKEN:
# 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
#

View File

@@ -1,9 +1,9 @@
#!/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
# instalar el sistema de flotillas
# instalar el sistema de adan
#
# Ejecutar en el HOST de Proxmox (no en una VM)
#
@@ -33,7 +33,7 @@ NC='\033[0m'
# VM
VMID="${VMID:-200}"
VM_NAME="${VM_NAME:-flotillas}"
VM_NAME="${VM_NAME:-adan}"
VM_MEMORY="${VM_MEMORY:-4096}" # MB
VM_CORES="${VM_CORES:-4}"
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)
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_SSH_KEY="${CI_SSH_KEY:-}" # Ruta a archivo de clave publica
@@ -153,13 +153,13 @@ parse_args() {
}
show_help() {
echo "Sistema de Flotillas - Crear VM en Proxmox"
echo "Sistema de ADAN - Crear VM en Proxmox"
echo ""
echo "Uso: $0 [opciones]"
echo ""
echo "Opciones:"
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 " --cores N Numero de cores (default: 4)"
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 ""
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"
}
@@ -281,7 +281,7 @@ create_vm() {
# Crear VM base
qm create $VMID \
--name "$VM_NAME" \
--description "Sistema de Flotillas GPS" \
--description "Sistema de ADAN GPS" \
--ostype l26 \
--machine q35 \
--bios ovmf \
@@ -405,7 +405,7 @@ configure_vm_options() {
# qm set $VMID --protection 1
# Tags para organizacion
qm set $VMID --tags "flotillas,gps,produccion"
qm set $VMID --tags "adan,gps,produccion"
log_success "Opciones configuradas"
}
@@ -419,9 +419,9 @@ create_post_install_script() {
POST_INSTALL_DIR="/var/lib/vz/snippets"
mkdir -p "$POST_INSTALL_DIR"
cat > "${POST_INSTALL_DIR}/flotillas-postinstall.sh" <<'SCRIPT'
cat > "${POST_INSTALL_DIR}/adan-postinstall.sh" <<'SCRIPT'
#!/bin/bash
# Script de post-instalacion para Sistema de Flotillas
# Script de post-instalacion para Sistema de ADAN
# Ejecutar despues de instalar Ubuntu
set -e
@@ -452,14 +452,14 @@ ufw --force enable
echo "=== Listo! ==="
echo "Ahora ejecuta el script de instalacion:"
echo " cd /opt && git clone REPO_URL flotillas"
echo " cd flotillas/deploy/scripts"
echo " cd /opt && git clone REPO_URL adan"
echo " cd adan/deploy/scripts"
echo " sudo ./install.sh"
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
# ============================================
# Credenciales VM Sistema de Flotillas
# Credenciales VM Sistema de ADAN
# ============================================
# Generadas: $(date)
@@ -540,8 +540,8 @@ show_summary() {
fi
echo " 3. Ejecutar script de instalacion del sistema:"
echo " git clone <REPO_URL> /opt/flotillas"
echo " cd /opt/flotillas/deploy/scripts"
echo " git clone <REPO_URL> /opt/adan"
echo " cd /opt/adan/deploy/scripts"
echo " sudo ./install.sh"
echo ""
echo -e "${GREEN}============================================${NC}"
@@ -555,7 +555,7 @@ main() {
echo ""
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 ""

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# ============================================
# Sistema de Flotillas - Estado del Sistema
# Sistema de ADAN - Estado del Sistema
# ============================================
# Muestra informacion completa del estado
# ============================================
@@ -13,7 +13,7 @@ BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
INSTALL_DIR="${INSTALL_DIR:-/opt/flotillas}"
INSTALL_DIR="${INSTALL_DIR:-/opt/adan}"
# Cargar variables
if [[ -f "$INSTALL_DIR/.env" ]]; then
@@ -24,7 +24,7 @@ clear
echo ""
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 ""
@@ -84,8 +84,8 @@ check_service() {
printf "│ %-14s %s\n" "$name:" "$status"
}
check_service "flotillas-api" "API Backend" "${API_PORT:-8000}"
check_service "flotillas-web" "Frontend" "${FRONTEND_PORT:-3000}"
check_service "adan-api" "API Backend" "${API_PORT:-8000}"
check_service "adan-web" "Frontend" "${FRONTEND_PORT:-3000}"
check_service "postgresql" "PostgreSQL" "5432"
check_service "redis-server" "Redis" "6379"
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
# 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}"
# 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"
# 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
echo -e "│ Posiciones: ${POSITIONS} registros"
fi
@@ -150,10 +150,10 @@ echo -e "${BLUE}┌─ GPS / Unidades ──────────────
if systemctl is-active --quiet postgresql; then
# 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)
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 "│ Activas: ${ACTIVE_UNITS:-0} (ultimo 5 min)"
@@ -190,7 +190,7 @@ echo ""
# ---------------------------------------------
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
echo -e "${GREEN}Sin errores en la ultima hora${NC}"

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
[Unit]
Description=Cloudflare Tunnel - Sistema de Flotillas
Description=Cloudflare Tunnel - Sistema de ADAN
Documentation=https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
After=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
# Cargar variables de entorno
EnvironmentFile=/opt/flotillas/.env
EnvironmentFile=/opt/adan/.env
# Reinicio automatico
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/
@@ -37,7 +37,7 @@ Esta configuracion:
<entry key='database.driver'>org.postgresql.Driver</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>
<!-- Pool de conexiones -->

View File

@@ -1,13 +1,13 @@
# Referencia de API
Documentacion de la API REST de FlotillasGPS.
Documentacion de la API REST de ADAN.
## Informacion General
- **Base URL**: `https://flotillas.tudominio.com/api/v1`
- **Base URL**: `https://adan.tudominio.com/api/v1`
- **Autenticacion**: JWT Bearer Token
- **Formato**: JSON
- **Documentacion interactiva**: `https://flotillas.tudominio.com/api/docs`
- **Documentacion interactiva**: `https://adan.tudominio.com/api/docs`
## Autenticacion
@@ -649,7 +649,7 @@ GET /reportes/{id}/descargar
### Conexion
```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 = () => {
// Autenticar

View File

@@ -1,16 +1,16 @@
# Guia de Configuracion
Configuracion detallada de todos los componentes del sistema FlotillasGPS.
Configuracion detallada de todos los componentes del sistema ADAN.
## 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
```bash
# PostgreSQL
DATABASE_URL=postgresql://flotillas:PASSWORD@localhost:5432/flotillas_db
DATABASE_URL=postgresql://adan:PASSWORD@localhost:5432/adan_db
# Conexiones maximas al pool
DB_POOL_SIZE=10
@@ -60,7 +60,7 @@ MEDIAMTX_WEBRTC=http://localhost:8889
MEDIAMTX_HLS=http://localhost:8888
# Directorio de grabaciones
VIDEO_STORAGE_PATH=/opt/flotillas/videos
VIDEO_STORAGE_PATH=/opt/adan/videos
VIDEO_RETENTION_DAYS=30
```
@@ -71,7 +71,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883
MQTT_USER=mesh_gateway
MQTT_PASSWORD=password_seguro
MQTT_TOPIC=flotillas/mesh/#
MQTT_TOPIC=adan/mesh/#
```
### Notificaciones
@@ -82,18 +82,18 @@ SMTP_HOST=smtp.tudominio.com
SMTP_PORT=587
SMTP_USER=notificaciones@tudominio.com
SMTP_PASSWORD=password
SMTP_FROM=FlotillasGPS <notificaciones@tudominio.com>
SMTP_FROM=ADAN <notificaciones@tudominio.com>
# Push Notifications (Firebase)
FIREBASE_CREDENTIALS_FILE=/opt/flotillas/firebase-credentials.json
FIREBASE_CREDENTIALS_FILE=/opt/adan/firebase-credentials.json
```
### Dominio
```bash
DOMAIN=flotillas.tudominio.com
API_URL=https://flotillas.tudominio.com/api
FRONTEND_URL=https://flotillas.tudominio.com
DOMAIN=adan.tudominio.com
API_URL=https://adan.tudominio.com/api
FRONTEND_URL=https://adan.tudominio.com
```
---
@@ -108,8 +108,8 @@ Archivo: `/opt/traccar/conf/traccar.xml`
<properties>
<!-- Base de datos -->
<entry key='database.driver'>org.postgresql.Driver</entry>
<entry key='database.url'>jdbc:postgresql://localhost:5432/flotillas_db</entry>
<entry key='database.user'>flotillas</entry>
<entry key='database.url'>jdbc:postgresql://localhost:5432/adan_db</entry>
<entry key='database.user'>adan</entry>
<entry key='database.password'>TU_PASSWORD</entry>
<!-- Deshabilitar web UI de Traccar (usamos nuestro dashboard) -->
@@ -192,7 +192,7 @@ hlsSegmentDuration: 1s
# Grabacion
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:
@@ -231,17 +231,17 @@ credentials-file: /root/.cloudflared/TU_TUNNEL_ID.json
ingress:
# API Backend
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /api/*
service: http://localhost:8000
# WebSocket
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
path: /ws/*
service: http://localhost:8000
# Frontend (default)
- hostname: flotillas.tudominio.com
- hostname: adan.tudominio.com
service: http://localhost:3000
# Catch-all
@@ -352,21 +352,21 @@ ufw enable
## Configuracion de Systemd Services
### flotillas-api.service
### adan-api.service
```ini
[Unit]
Description=FlotillasGPS API Backend
Description=ADAN API Backend
After=network.target postgresql.service redis.service
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/opt/flotillas/backend
Environment="PATH=/opt/flotillas/venv/bin"
EnvironmentFile=/opt/flotillas/.env
ExecStart=/opt/flotillas/venv/bin/uvicorn app.main:app \
WorkingDirectory=/opt/adan/backend
Environment="PATH=/opt/adan/venv/bin"
EnvironmentFile=/opt/adan/.env
ExecStart=/opt/adan/venv/bin/uvicorn app.main:app \
--host 127.0.0.1 \
--port 8000 \
--workers 4 \
@@ -379,18 +379,18 @@ RestartSec=5
WantedBy=multi-user.target
```
### flotillas-web.service
### adan-web.service
```ini
[Unit]
Description=FlotillasGPS Web Frontend
Description=ADAN Web Frontend
After=network.target
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/opt/flotillas/frontend
WorkingDirectory=/opt/adan/frontend
ExecStart=/usr/bin/npx serve -s dist -l 3000
Restart=always
RestartSec=5
@@ -439,11 +439,11 @@ Despues de modificar archivos de configuracion:
systemctl daemon-reload
# Reiniciar servicio especifico
systemctl restart flotillas-api
systemctl restart adan-api
# Reiniciar todos los servicios
systemctl restart flotillas-api flotillas-web traccar mediamtx
systemctl restart adan-api adan-web traccar mediamtx
# 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
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
@@ -31,7 +31,7 @@ Esta guia cubre la instalacion completa del sistema FlotillasGPS en un servidor
1. Click en "Create VM"
2. **General**:
- Name: `flotillas-server`
- Name: `adan-server`
- Start at boot: Si
3. **OS**:
- ISO image: ubuntu-22.04-live-server-amd64.iso
@@ -77,9 +77,9 @@ sudo apt install -y git curl wget
```bash
cd /opt
sudo git clone https://git.consultoria-as.com/tu-usuario/flotillas-gps.git flotillas
sudo chown -R $USER:$USER /opt/flotillas
cd /opt/flotillas
sudo git clone https://git.consultoria-as.com/tu-usuario/adan.git adan
sudo chown -R $USER:$USER /opt/adan
cd /opt/adan
```
## Paso 4: Configurar Variables
@@ -93,7 +93,7 @@ nano deploy/scripts/install.sh
Modificar las variables al inicio:
```bash
DOMAIN="flotillas.tudominio.com" # Tu dominio
DOMAIN="adan.tudominio.com" # Tu dominio
ADMIN_EMAIL="admin@tudominio.com" # Email del admin
```
@@ -124,7 +124,7 @@ El script realizara automaticamente:
1. Ir a **Zero Trust** > **Access** > **Tunnels**
2. Click **Create a tunnel**
3. Nombre: `flotillas`
3. Nombre: `adan`
4. Copiar el token del tunnel
### En tu servidor:
@@ -141,17 +141,17 @@ En el dashboard del tunnel, agregar Public Hostnames:
| Subdomain | Domain | Service |
|-----------|--------|---------|
| flotillas | tudominio.com | http://localhost:3000 |
| flotillas | tudominio.com | http://localhost:8000 (path: /api/*) |
| flotillas | tudominio.com | http://localhost:8000 (path: /ws/*) |
| adan | tudominio.com | http://localhost:3000 |
| adan | tudominio.com | http://localhost:8000 (path: /api/*) |
| adan | tudominio.com | http://localhost:8000 (path: /ws/*) |
## Paso 7: Verificar Instalacion
### Verificar servicios:
```bash
sudo systemctl status flotillas-api
sudo systemctl status flotillas-web
sudo systemctl status adan-api
sudo systemctl status adan-web
sudo systemctl status traccar
sudo systemctl status mediamtx
sudo systemctl status cloudflared
@@ -161,7 +161,7 @@ Todos deben mostrar `active (running)`.
### Verificar acceso web:
Abrir en navegador: `https://flotillas.tudominio.com`
Abrir en navegador: `https://adan.tudominio.com`
Deberia mostrar la pagina de login.
@@ -181,7 +181,7 @@ Las credenciales se generaron durante la instalacion.
Ver credenciales guardadas:
```bash
cat /opt/flotillas/.credentials
cat /opt/adan/.credentials
```
Ejemplo de salida:
@@ -190,8 +190,8 @@ Ejemplo de salida:
=================================
CREDENCIALES DE ACCESO
=================================
Dashboard: https://flotillas.tudominio.com
Admin Email: admin@flotillas.tudominio.com
Dashboard: https://adan.tudominio.com
Admin Email: admin@adan.tudominio.com
Admin Password: xK9mN2pL5qR8
Database Password: [guardado en .env]
=================================
@@ -229,17 +229,17 @@ Si el servidor esta detras de NAT:
```bash
# Ver logs detallados
journalctl -u flotillas-api -n 100 --no-pager
journalctl -u adan-api -n 100 --no-pager
# Verificar configuracion
cat /opt/flotillas/.env
cat /opt/adan/.env
```
### No puedo acceder al dashboard
```bash
# Verificar tunnel
cloudflared tunnel info flotillas
cloudflared tunnel info adan
# Reiniciar tunnel
sudo systemctl restart cloudflared

View File

@@ -1,6 +1,6 @@
# Integracion Meshtastic
Guia para configurar dispositivos Meshtastic con FlotillasGPS.
Guia para configurar dispositivos Meshtastic con ADAN.
## Que es Meshtastic
@@ -11,7 +11,7 @@ Meshtastic es una plataforma de comunicacion mesh usando radio LoRa:
- **Bajo costo**: Dispositivos desde $20 USD
- **Bajo consumo**: Semanas de bateria
### Casos de Uso en Flotillas
### Casos de Uso en ADAN
- Vehiculos en zonas rurales sin cobertura celular
- Operaciones en minas, campos, areas remotas
@@ -48,7 +48,7 @@ Meshtastic es una plataforma de comunicacion mesh usando radio LoRa:
| MQTT / Internet
v
[Tu Servidor]
FlotillasGPS
ADAN
```
---
@@ -153,7 +153,7 @@ meshtastic --set mqtt.enabled true
meshtastic --set mqtt.address tu-servidor.com
meshtastic --set mqtt.username mesh_gateway
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.json_enabled true
```
@@ -168,7 +168,7 @@ MQTT Enabled: true
MQTT Server: tu-servidor.com:1883
MQTT Username: mesh_gateway
MQTT Password: tu_password
Root Topic: flotillas/mesh
Root Topic: adan/mesh
JSON Enabled: true
```
@@ -190,7 +190,7 @@ mosquitto_passwd -c /etc/mosquitto/passwd mesh_gateway
# Ingresar password
```
Configuracion `/etc/mosquitto/conf.d/flotillas.conf`:
Configuracion `/etc/mosquitto/conf.d/adan.conf`:
```
listener 1883
allow_anonymous false
@@ -207,12 +207,12 @@ systemctl restart mosquitto
Suscribirse al topic para ver mensajes:
```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.
### 3. Configurar en FlotillasGPS
### 3. Configurar en ADAN
Variables de entorno en `.env`:
```bash
@@ -220,7 +220,7 @@ MQTT_HOST=localhost
MQTT_PORT=1883
MQTT_USER=mesh_gateway
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:
```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:

View File

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

View File

@@ -1,12 +1,12 @@
# Manual del Administrador
Guia completa para administrar el sistema FlotillasGPS.
Guia completa para administrar el sistema ADAN.
## Acceso al Sistema
### 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
3. Click en "Ingresar"
@@ -386,15 +386,15 @@ Los mensajes y respuestas aparecen como conversacion en el detalle del conductor
```bash
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
```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
@@ -408,5 +408,5 @@ Se ejecutan diariamente a las 3:00 AM. Se mantienen los ultimos 7 dias.
Para problemas tecnicos:
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

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
### Android
1. Abrir Play Store
2. Buscar "FlotillasGPS Conductor"
2. Buscar "ADAN Conductor"
3. Instalar la aplicacion
4. Abrir la app
### iPhone
1. Abrir App Store
2. Buscar "FlotillasGPS Conductor"
2. Buscar "ADAN Conductor"
3. Instalar la aplicacion
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:
1. Ir a **Configuracion** del telefono
2. Buscar la app **FlotillasGPS**
2. Buscar la app **ADAN**
3. Tocar **Permisos**
4. Asegurar que **Ubicacion** este en **Siempre permitir**

View File

@@ -1,6 +1,6 @@
# 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
@@ -12,7 +12,7 @@ Camaras en Vehiculos Servidor Dashboard/App
[Cam IP] --RTSP--> |
|
[Grabaciones]
/opt/flotillas/videos/
/opt/adan/videos/
```
## Tipos de Camaras Soportadas
@@ -50,7 +50,7 @@ Cualquier camara con:
### 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
- Calidad depende del celular
- Consume bateria y datos
@@ -240,7 +240,7 @@ Configurar en **Configuracion** > **Retencion de datos**:
Script de limpieza automatica:
```bash
# 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:
```bash
# Espacio en disco
df -h /opt/flotillas/videos
df -h /opt/adan/videos
# Permisos
ls -la /opt/flotillas/videos
ls -la /opt/adan/videos
# Logs de MediaMTX
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
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
**Estado:** Pendiente de aprobación
@@ -41,7 +41,7 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ 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
- `flotillas-api.service` - Backend FastAPI
- `flotillas-web.service` - Frontend React
- `adan-api.service` - Backend FastAPI
- `adan-web.service` - Frontend React
- `traccar.service` - Servidor GPS
- `mediamtx.service` - Streaming video
- `cloudflared.service` - Tunnel Cloudflare
@@ -219,7 +219,7 @@ Sistema completo de monitoreo de flotillas vehiculares con rastreo GPS en tiempo
## Repositorio
**URL:** https://git.consultoria-as.com
**Nombre:** flotillas-gps
**Nombre:** adan
---

View File

@@ -4,9 +4,9 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<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" />
<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.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">

View File

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

View File

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

View File

@@ -95,7 +95,7 @@ export default function Sidebar() {
<MapPinIcon className="w-6 h-6 text-white" />
</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>
</div>
</div>

View File

@@ -49,7 +49,7 @@ export default function Login() {
<MapPinIcon className="w-7 h-7 text-white" />
</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>
</div>
</div>
@@ -138,7 +138,7 @@ export default function Login() {
{/* Footer */}
<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>
</div>
</div>

View File

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

View File

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

View File

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