Files
ATLAS/docs/guias/instalacion.md
ATLAS Admin e59aa2a742 feat: Complete ATLAS system installation and API fixes
## Backend Changes
- Add new API endpoints: combustible, pois, mantenimiento, video, configuracion
- Fix vehiculos endpoint to return paginated response with items array
- Add /vehiculos/all endpoint for non-paginated list
- Add /geocercas/all endpoint
- Add /alertas/configuracion GET/PUT endpoints
- Add /viajes/activos and /viajes/iniciar endpoints
- Add /reportes/stats, /reportes/templates, /reportes/preview endpoints
- Add /conductores/all and /conductores/disponibles endpoints
- Update router.py to include all new modules

## Frontend Changes
- Fix authentication token handling (snake_case vs camelCase)
- Update vehiculosApi.listAll to use /vehiculos/all
- Fix FuelGauge component usage in Combustible page
- Fix chart component exports (named + default exports)
- Update API client for proper token refresh

## Infrastructure
- Rename services from ADAN to ATLAS
- Configure Cloudflare tunnel for atlas.consultoria-as.com
- Update systemd service files
- Configure PostgreSQL with TimescaleDB
- Configure Redis, Mosquitto, Traccar, MediaMTX

## Documentation
- Update installation guides
- Update API reference
- Rename all ADAN references to ATLAS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:04:23 +00:00

265 lines
5.4 KiB
Markdown

# Guia de Instalacion
Esta guia cubre la instalacion completa del sistema ATLAS en un servidor Proxmox.
## Requisitos Previos
### Hardware (VM en Proxmox)
| Recurso | Minimo | Recomendado |
|---------|--------|-------------|
| CPU | 2 cores | 4 cores |
| RAM | 4 GB | 8 GB |
| Disco Sistema | 40 GB SSD | 60 GB SSD |
| Disco Videos | 500 GB HDD | 2 TB HDD |
### Software
- Proxmox VE 7.x o superior
- ISO Ubuntu 22.04 LTS Server
### Red
- IP estatica para la VM
- Puerto TCP 5055 accesible desde internet (para GPS)
- Dominio configurado (para Cloudflare Tunnel)
- Cuenta en Cloudflare (plan gratuito funciona)
## Paso 1: Crear VM en Proxmox
### Desde la interfaz web de Proxmox:
1. Click en "Create VM"
2. **General**:
- Name: `atlas-server`
- Start at boot: Si
3. **OS**:
- ISO image: ubuntu-22.04-live-server-amd64.iso
4. **System**:
- BIOS: Default
- Machine: q35
5. **Disks**:
- Disco 1: 60 GB (SSD/local-lvm)
- Agregar disco 2: 2 TB (HDD para videos)
6. **CPU**:
- Cores: 4
- Type: host
7. **Memory**:
- Memory: 8192 MB
8. **Network**:
- Bridge: vmbr0
- Model: VirtIO
### Instalar Ubuntu:
1. Iniciar VM y seguir instalador
2. Configurar IP estatica o DHCP con reserva
3. Crear usuario `admin`
4. Instalar OpenSSH server
5. Reiniciar
## Paso 2: Preparar el Sistema
Conectar por SSH:
```bash
ssh admin@IP_DE_TU_VM
```
Actualizar sistema:
```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl wget
```
## Paso 3: Clonar Repositorio
```bash
cd /opt
sudo git clone https://git.consultoria-as.com/tu-usuario/atlas.git atlas
sudo chown -R $USER:$USER /opt/atlas
cd /opt/atlas
```
## Paso 4: Configurar Variables
Editar el script de instalacion para configurar tu dominio:
```bash
nano deploy/scripts/install.sh
```
Modificar las variables al inicio:
```bash
DOMAIN="atlas.tudominio.com" # Tu dominio
ADMIN_EMAIL="admin@tudominio.com" # Email del admin
```
## Paso 5: Ejecutar Instalacion
```bash
sudo ./deploy/scripts/install.sh
```
El script realizara automaticamente:
1. Instalar PostgreSQL 15 + TimescaleDB
2. Instalar Redis
3. Instalar Python 3.11 y Node.js 20
4. Instalar Traccar Server
5. Instalar MediaMTX (video streaming)
6. Instalar Mosquitto MQTT
7. Configurar la aplicacion
8. Crear servicios systemd
9. Configurar firewall
10. Generar credenciales
**Duracion estimada: 10-15 minutos**
## Paso 6: Configurar Cloudflare Tunnel
### En el Dashboard de Cloudflare:
1. Ir a **Zero Trust** > **Access** > **Tunnels**
2. Click **Create a tunnel**
3. Nombre: `atlas`
4. Copiar el token del tunnel
### En tu servidor:
```bash
# El instalador ya instalo cloudflared
# Configurar con tu token
sudo cloudflared service install TOKEN_QUE_COPIASTE
```
### Configurar rutas en Cloudflare:
En el dashboard del tunnel, agregar Public Hostnames:
| Subdomain | Domain | Service |
|-----------|--------|---------|
| atlas | tudominio.com | http://localhost:3000 |
| atlas | tudominio.com | http://localhost:8000 (path: /api/*) |
| atlas | tudominio.com | http://localhost:8000 (path: /ws/*) |
## Paso 7: Verificar Instalacion
### Verificar servicios:
```bash
sudo systemctl status atlas-api
sudo systemctl status atlas-web
sudo systemctl status traccar
sudo systemctl status mediamtx
sudo systemctl status cloudflared
```
Todos deben mostrar `active (running)`.
### Verificar acceso web:
Abrir en navegador: `https://atlas.tudominio.com`
Deberia mostrar la pagina de login.
### Verificar puerto GPS:
```bash
# Desde otra maquina
nc -zv IP_DEL_SERVIDOR 5055
```
Debe mostrar "Connection succeeded".
## Paso 8: Credenciales
Las credenciales se generaron durante la instalacion.
Ver credenciales guardadas:
```bash
cat /opt/atlas/.credentials
```
Ejemplo de salida:
```
=================================
CREDENCIALES DE ACCESO
=================================
Dashboard: https://atlas.tudominio.com
Admin Email: admin@atlas.tudominio.com
Admin Password: xK9mN2pL5qR8
Database Password: [guardado en .env]
=================================
```
**IMPORTANTE**: Guarda estas credenciales en un lugar seguro y cambia la contrasena del admin despues del primer login.
## Paso 9: Configurar DNS para GPS
Los dispositivos GPS necesitan conectarse al puerto 5055 de tu servidor.
### Opcion A: IP Publica directa
Si tu servidor tiene IP publica, configura los GPS con:
- Servidor: `IP_PUBLICA`
- Puerto: `5055`
### Opcion B: Port forwarding
Si el servidor esta detras de NAT:
1. En tu router, hacer port forward del puerto 5055 TCP hacia la IP de la VM
2. Configurar GPS con tu IP publica o dominio DDNS
### Opcion C: Dominio con registro A
1. Crear registro A: `gps.tudominio.com` → IP_PUBLICA
2. Configurar GPS con:
- Servidor: `gps.tudominio.com`
- Puerto: `5055`
## Solucion de Problemas
### El servicio no inicia
```bash
# Ver logs detallados
journalctl -u atlas-api -n 100 --no-pager
# Verificar configuracion
cat /opt/atlas/.env
```
### No puedo acceder al dashboard
```bash
# Verificar tunnel
cloudflared tunnel info atlas
# Reiniciar tunnel
sudo systemctl restart cloudflared
```
### Los GPS no se conectan
```bash
# Verificar que el puerto esta abierto
sudo ufw status
sudo netstat -tlnp | grep 5055
# Ver logs de Traccar
journalctl -u traccar -f
```
## Siguientes Pasos
1. [Configurar el sistema](configuracion.md)
2. [Agregar vehiculos y dispositivos GPS](usuario-admin.md)
3. [Configurar camaras de video](video-streaming.md)
4. [Instalar app en celulares de conductores](usuario-conductor.md)