Files
gob-alert/docs/DEPLOYMENT.md
2026-02-09 01:34:24 +01:00

56 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Despliegue en miniPCs
## Requisitos
- Docker + Docker Compose
- Postgres y Redis (opcional)
## Variables de entorno recomendadas
- `DATABASE_URL`
- `API_ADMIN_KEY`
- `JWT_SECRET`
- `INGEST_CRON`
- `ALERTS_CRON`
- `BACKUP_CRON`
- `BACKUP_DIR`
- `INGEST_ENABLED`
- `ALERTS_ENABLED`
- `BACKUP_ENABLED`
- `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM`
- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_DEFAULT_CHAT`
## Arranque rápido (todoenuno)
```bash
# Desde la raíz del repo
pnpm install
pnpm build
pnpm start
```
## Arranque con Docker Compose
```bash
docker compose build
docker compose up -d
```
## Coolify (producción)
- Usa `docker-compose.coolify.yml` como compose principal.
- No publiques puertos de Postgres/Redis; deja que Coolify gestione el proxy.
- Define las variables en Coolify (Environment/Secrets). Hay un ejemplo en `.env.coolify.example`:
- `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`
- `DATABASE_URL` (ejemplo: `postgres://gob:***@postgres:5432/gob_alert`)
- `API_ADMIN_KEY`
- `API_URL` (ejemplo: `http://api:3000`)
## Estrategia recomendada (2 miniPCs)
1. **MiniPC 1**: ejecutar Postgres + Redis + jobs de ingesta.
2. **MiniPC 2**: ejecutar API + web + backups + alertas.
3. Definir `DATABASE_URL` apuntando al Postgres del MiniPC 1.
Sugerencia de flags:
- MiniPC 1: `INGEST_ENABLED=true`, `ALERTS_ENABLED=false`, `BACKUP_ENABLED=false`.
- MiniPC 2: `INGEST_ENABLED=false`, `ALERTS_ENABLED=true`, `BACKUP_ENABLED=true`.
## Backups
- Programados por `BACKUP_CRON`.
- Manual: `POST /admin/backup/run`.