docs: Add project status document for continuity
- Document all services and their status - List all backend endpoints added - Document frontend fixes made - List known issues and pending tasks - Add useful commands reference - Add next steps recommendations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
248
docs/ESTADO-PROYECTO.md
Normal file
248
docs/ESTADO-PROYECTO.md
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
# Estado del Proyecto ATLAS
|
||||||
|
|
||||||
|
**Ultima actualizacion:** 2026-01-25
|
||||||
|
**Servidor:** ATLAS-GPS (192.168.10.212)
|
||||||
|
**Dominio:** https://atlas.consultoria-as.com
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Resumen de Instalacion
|
||||||
|
|
||||||
|
El sistema ATLAS fue instalado y configurado exitosamente con los siguientes componentes:
|
||||||
|
|
||||||
|
### Servicios Activos
|
||||||
|
|
||||||
|
| Servicio | Puerto | Estado | Descripcion |
|
||||||
|
|----------|--------|--------|-------------|
|
||||||
|
| atlas-api | 8000 | ✅ Activo | Backend FastAPI |
|
||||||
|
| Frontend (Vite) | 3000 | ✅ Activo | React + TypeScript |
|
||||||
|
| PostgreSQL | 5432 | ✅ Activo | Base de datos + TimescaleDB |
|
||||||
|
| Redis | 6379 | ✅ Activo | Cache y sesiones |
|
||||||
|
| Traccar | 5055, 8082 | ✅ Activo | Servidor GPS |
|
||||||
|
| MediaMTX | 8554, 8888, 8889 | ✅ Activo | Streaming de video |
|
||||||
|
| Mosquitto | 1883 | ✅ Activo | MQTT Broker |
|
||||||
|
| Cloudflared | - | ✅ Activo | Tunnel a Cloudflare |
|
||||||
|
|
||||||
|
### Credenciales
|
||||||
|
|
||||||
|
Las credenciales se encuentran en: `/root/atlas-credentials.txt`
|
||||||
|
|
||||||
|
```
|
||||||
|
Usuario admin: admin@atlas.com
|
||||||
|
Base de datos: atlas_db
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cambios Realizados
|
||||||
|
|
||||||
|
### Backend (FastAPI)
|
||||||
|
|
||||||
|
#### Nuevos Archivos Creados:
|
||||||
|
- `backend/app/api/v1/combustible.py` - Gestion de cargas de combustible
|
||||||
|
- `backend/app/api/v1/pois.py` - Puntos de interes
|
||||||
|
- `backend/app/api/v1/mantenimiento.py` - Gestion de mantenimientos
|
||||||
|
- `backend/app/api/v1/video.py` - Camaras y streaming
|
||||||
|
- `backend/app/api/v1/configuracion.py` - Configuracion del sistema
|
||||||
|
|
||||||
|
#### Endpoints Agregados:
|
||||||
|
|
||||||
|
**Vehiculos:**
|
||||||
|
- `GET /vehiculos/all` - Lista todos los vehiculos (sin paginacion)
|
||||||
|
- `GET /vehiculos/fleet/stats` - Estadisticas de la flota
|
||||||
|
- `GET /vehiculos/ubicaciones/actuales` - Ubicaciones actuales
|
||||||
|
|
||||||
|
**Conductores:**
|
||||||
|
- `GET /conductores/all` - Lista todos los conductores
|
||||||
|
- `GET /conductores/disponibles` - Conductores sin vehiculo asignado
|
||||||
|
|
||||||
|
**Geocercas:**
|
||||||
|
- `GET /geocercas/all` - Lista todas las geocercas activas
|
||||||
|
|
||||||
|
**Alertas:**
|
||||||
|
- `GET /alertas/configuracion` - Configuracion de alertas
|
||||||
|
- `PUT /alertas/configuracion` - Actualizar configuracion
|
||||||
|
|
||||||
|
**Viajes:**
|
||||||
|
- `GET /viajes/activos` - Viajes en curso
|
||||||
|
- `POST /viajes/iniciar` - Iniciar viaje manualmente
|
||||||
|
|
||||||
|
**Reportes:**
|
||||||
|
- `GET /reportes/stats` - Estadisticas de reportes
|
||||||
|
- `GET /reportes/templates` - Plantillas disponibles
|
||||||
|
- `POST /reportes/preview` - Previsualizar reporte
|
||||||
|
- `GET /reportes/programados` - Reportes programados
|
||||||
|
- `POST /reportes/programar` - Programar nuevo reporte
|
||||||
|
|
||||||
|
**Combustible:**
|
||||||
|
- `GET /combustible` - Listar cargas
|
||||||
|
- `GET /combustible/stats` - Estadisticas
|
||||||
|
- `GET /combustible/{id}` - Detalle de carga
|
||||||
|
|
||||||
|
**POIs:**
|
||||||
|
- `GET /pois` - Listar POIs
|
||||||
|
- `GET /pois/all` - Todos los POIs activos
|
||||||
|
- `POST /pois` - Crear POI
|
||||||
|
- `GET /pois/{id}` - Detalle de POI
|
||||||
|
|
||||||
|
**Mantenimiento:**
|
||||||
|
- `GET /mantenimiento` - Listar mantenimientos
|
||||||
|
- `GET /mantenimiento/proximos` - Proximos mantenimientos
|
||||||
|
- `GET /mantenimiento/vencidos` - Mantenimientos vencidos
|
||||||
|
- `POST /mantenimiento` - Crear mantenimiento
|
||||||
|
|
||||||
|
**Video:**
|
||||||
|
- `GET /video/camaras` - Listar camaras
|
||||||
|
- `GET /video/camaras/{id}` - Detalle de camara
|
||||||
|
|
||||||
|
**Configuracion:**
|
||||||
|
- `GET /configuracion` - Obtener configuracion
|
||||||
|
- `PATCH /configuracion` - Actualizar configuracion
|
||||||
|
|
||||||
|
### Frontend (React + Vite)
|
||||||
|
|
||||||
|
#### Correcciones Realizadas:
|
||||||
|
|
||||||
|
1. **Autenticacion (client.ts, auth.ts, types/index.ts)**
|
||||||
|
- Corregido manejo de tokens: `access_token`/`refresh_token` (snake_case)
|
||||||
|
- El backend devuelve snake_case, el frontend esperaba camelCase
|
||||||
|
|
||||||
|
2. **API de Vehiculos (vehiculos.ts)**
|
||||||
|
- `listAll()` ahora usa `/vehiculos/all` en lugar de `/vehiculos`
|
||||||
|
- Esto evita el error de paginacion cuando se espera un array
|
||||||
|
|
||||||
|
3. **Componentes de Graficos**
|
||||||
|
- `KPICard.tsx` - Corregido export (named + default)
|
||||||
|
- `FuelGauge.tsx` - Corregido export
|
||||||
|
- `LineChart.tsx` - Corregido export
|
||||||
|
- `BarChart.tsx` - Corregido export
|
||||||
|
|
||||||
|
4. **Pagina Combustible (Combustible.tsx)**
|
||||||
|
- Cambiado `FuelGauge` por `CircularGauge` (el componente correcto para size numerico)
|
||||||
|
|
||||||
|
### Infraestructura
|
||||||
|
|
||||||
|
1. **Servicios Systemd**
|
||||||
|
- Renombrado `adan-api.service` → `atlas-api.service`
|
||||||
|
- Renombrado `adan-web.service` → `atlas-web.service`
|
||||||
|
|
||||||
|
2. **Cloudflare Tunnel**
|
||||||
|
- Configurado para `atlas.consultoria-as.com`
|
||||||
|
- Rutas: `/` → :3000, `/api/*` → :8000, `/ws/*` → :8000
|
||||||
|
|
||||||
|
3. **Base de Datos**
|
||||||
|
- PostgreSQL 15 con TimescaleDB habilitado
|
||||||
|
- Usuario admin creado manualmente en la tabla `usuarios`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Problemas Conocidos / Pendientes
|
||||||
|
|
||||||
|
### 1. WebSocket no conecta
|
||||||
|
```
|
||||||
|
WebSocket connection to 'wss://atlas.consultoria-as.com/ws' failed
|
||||||
|
```
|
||||||
|
**Causa probable:** El endpoint de WebSocket no esta configurado en el backend o el tunnel de Cloudflare no lo soporta correctamente.
|
||||||
|
|
||||||
|
**Solucion pendiente:** Verificar la configuracion de WebSocket en el backend y/o configurar WebSocket en Cloudflare.
|
||||||
|
|
||||||
|
### 2. Frontend en modo desarrollo
|
||||||
|
El frontend esta corriendo con `vite preview` en lugar de un servidor de produccion como Nginx.
|
||||||
|
|
||||||
|
**Solucion recomendada:**
|
||||||
|
```bash
|
||||||
|
# Instalar y configurar Nginx
|
||||||
|
sudo apt install nginx
|
||||||
|
# Copiar build a /var/www/atlas
|
||||||
|
sudo cp -r /opt/atlas/frontend/dist/* /var/www/atlas/
|
||||||
|
# Configurar Nginx como proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Pagina de Combustible
|
||||||
|
La pagina funciona pero muestra "Sin datos" porque no hay registros en la base de datos.
|
||||||
|
|
||||||
|
### 4. Datos de prueba
|
||||||
|
No hay datos de prueba en el sistema (vehiculos, conductores, etc.)
|
||||||
|
|
||||||
|
**Para agregar datos de prueba:**
|
||||||
|
```bash
|
||||||
|
cd /opt/atlas/backend
|
||||||
|
source venv/bin/activate
|
||||||
|
python -c "from app.core.database import init_db; import asyncio; asyncio.run(init_db())"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Comandos Utiles
|
||||||
|
|
||||||
|
### Ver estado de servicios
|
||||||
|
```bash
|
||||||
|
systemctl status atlas-api atlas-frontend cloudflared traccar redis postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ver logs del API
|
||||||
|
```bash
|
||||||
|
journalctl -u atlas-api -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reiniciar servicios
|
||||||
|
```bash
|
||||||
|
systemctl restart atlas-api
|
||||||
|
pkill -f "vite preview" && cd /opt/atlas/frontend && nohup pnpm vite preview --host 0.0.0.0 --port 3000 &
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reconstruir frontend
|
||||||
|
```bash
|
||||||
|
cd /opt/atlas/frontend
|
||||||
|
pnpm vite build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Acceder a la base de datos
|
||||||
|
```bash
|
||||||
|
sudo -u postgres psql atlas_db
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ver credenciales
|
||||||
|
```bash
|
||||||
|
cat /root/atlas-credentials.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Archivos de Configuracion Importantes
|
||||||
|
|
||||||
|
| Archivo | Descripcion |
|
||||||
|
|---------|-------------|
|
||||||
|
| `/opt/atlas/backend/.env` | Variables de entorno del backend |
|
||||||
|
| `/opt/atlas/frontend/.env` | Variables de entorno del frontend |
|
||||||
|
| `/etc/systemd/system/atlas-api.service` | Servicio del API |
|
||||||
|
| `/etc/postgresql/15/main/postgresql.conf` | Config de PostgreSQL |
|
||||||
|
| `/etc/redis/redis.conf` | Config de Redis |
|
||||||
|
| `/opt/traccar/conf/traccar.xml` | Config de Traccar |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Proximos Pasos Recomendados
|
||||||
|
|
||||||
|
1. [ ] Configurar Nginx para servir el frontend en produccion
|
||||||
|
2. [ ] Resolver problema de WebSocket
|
||||||
|
3. [ ] Agregar datos de prueba (vehiculos, conductores, dispositivos)
|
||||||
|
4. [ ] Configurar dispositivos GPS reales en Traccar
|
||||||
|
5. [ ] Configurar camaras de video
|
||||||
|
6. [ ] Configurar backups automaticos
|
||||||
|
7. [ ] Configurar SSL/HTTPS local (si se accede sin tunnel)
|
||||||
|
8. [ ] Revisar y ajustar permisos de usuario en la base de datos
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Repositorio Git
|
||||||
|
|
||||||
|
- **URL:** http://192.168.10.150:3000/consultoria-as/ATLAS.git
|
||||||
|
- **Branch:** main
|
||||||
|
- **Ultimo commit:** docs: Update API reference with all new endpoints
|
||||||
|
|
||||||
|
Para continuar el desarrollo:
|
||||||
|
```bash
|
||||||
|
cd /opt/atlas
|
||||||
|
git pull origin main
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user