Files
onever_drive/docs/proxmox_deployment_guide.md

112 lines
4.7 KiB
Markdown

# OnEver Drive — Guía de Despliegue Nativo en Proxmox VE (LXC Debian 12 / 13)
Este documento detalla la instalación paso a paso en **Proxmox Virtual Environment (PVE)** ejecutando la aplicación **100% nativa en contenedores Linux (LXC) sobre Debian 12 (Bookworm) o Debian 13 (Trixie)**, sin Docker ni capas intermedias.
---
## 1. Topología del Sistema en Proxmox VE
```text
┌─────────────────────────────────────────────────────────┐
│ PROXMOX VE HOST │
│ │
│ ZFS / LVM Pool: /mnt/pve/backup-pool │
│ ├── backups/ (Repositorio de respaldos) │
│ └── temp/ (Directorio temporal de chunks) │
└────────────────────────────┬────────────────────────────┘
│ Mountpoints (-mp0, -mp1)
┌─────────────────────────────────────────────────────────┐
│ CT 100 — onever-backend (Debian 12/13) │
│ │
│ • FastAPI Backend Service (/etc/systemd/system/...) │
│ • PostgreSQL 15/16 Nativo (Base de datos transaccional)│
│ • Nginx Reverse Proxy (Streaming Chunks + WebSockets) │
│ • Frontend Web Dashboard (/var/www/onever-drive-web) │
│ • Python Virtualenv (/opt/onever_drive/venv) │
└─────────────────────────────────────────────────────────┘
```
---
## 2. Paso 1: Creación del Contenedor LXC en Proxmox Host
Ejecute en la consola Shell del nodo Proxmox VE (root):
```bash
# 1. Copiar o clonar scripts de aprovisionamiento
git clone <URL_REPOSITORIO> /tmp/onever_drive
# 2. Ejecutar creación automática de LXC y montaje de almacenamiento
bash /tmp/onever_drive/deployment/proxmox/01-create-lxc-pve-host.sh
```
El script:
- Descarga la plantilla oficial `debian-12-standard` o `debian-13-standard`.
- Crea el contenedor **CT 100** (2 GB RAM, 2 Cores, 20 GB disco del sistema).
- Monta directamente el pool de almacenamiento del Host hacia `/storage/backups` y `/storage/temp` en el LXC.
- Inicia el contenedor.
---
## 3. Paso 2: Instalación Nativa en el Contenedor (Debian 12 / 13)
Ingrese al contenedor e inicie el instalador nativo:
```bash
# En el Host Proxmox:
pct enter 100
# Dentro del contenedor Debian 12 / 13:
git clone <URL_REPOSITORIO> /opt/onever_drive
bash /opt/onever_drive/deployment/proxmox/02-install-backend-debian.sh
```
El instalador automatiza todo el proceso:
1. Instala paquetes nativos: `postgresql`, `nginx`, `python3`, `python3-venv`, `nodejs`, `npm`.
2. Inicializa PostgreSQL y crea la base de datos `onever_drive` con el esquema DDL e índices.
3. Configura el entorno virtual de Python y dependencias en `/opt/onever_drive/venv`.
4. Compila la interfaz Web React y la ubica en `/var/www/onever-drive-web`.
5. Instala el servicio `onever-backend.service` en **systemd** y lo inicia automáticamente.
6. Configura **Nginx** con soporte para streaming de bloques por chunks ilimitados y WebSockets.
---
## 4. Paso 3: Configuración de Certificado SSL / HTTPS
Para habilitar HTTPS en el puerto 443:
```bash
# Para dominio público con Let's Encrypt (Certbot):
bash /opt/onever_drive/deployment/proxmox/03-configure-ssl.sh backup.midominio.com
# Para entorno LAN / Intranet (Certificado autofirmado 4096 bits):
bash /opt/onever_drive/deployment/proxmox/03-configure-ssl.sh self-signed
```
---
## 5. Paso 4: Mantenimiento y Backups del Sistema
Para programar el backup diario de la base de datos PostgreSQL de OnEver Drive hacia el almacenamiento persistente:
```bash
# Agregar tarea en cron en CT 100:
crontab -e
# Agregar línea (ejecutar diariamente a las 01:00 AM):
0 1 * * * bash /opt/onever_drive/deployment/proxmox/04-backup-maintenance.sh
```
---
## 6. Comprobación y Estado de Servicios
Verificar que todos los servicios nativos están activos:
```bash
systemctl status onever-backend.service
systemctl status postgresql
systemctl status nginx
```