# FOSSBilling — VM122 (Spec 024)

Billing open source na mesma VM do Desk. **OpenPanel não corre aqui** — ver `specs/024-openpanel-fossbilling/spec.md`.

## Pré-requisitos

- Swap 2 GB recomendado: `fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile`
- Porta `8092` livre em `10.10.10.122`

## Deploy

```bash
cd /opt/ligbox-ops-platform/deploy/vm122-fossbilling
cp .env.example .env
# editar MARIADB_PASSWORD
docker compose -f docker-compose.fossbilling.yml up -d
```

Abrir `http://10.10.10.122:8092` e completar o wizard:

| Campo | Valor |
|-------|--------|
| DB host | `fossbilling-mariadb` |
| DB name | `fossbilling` |
| DB user | `fossbilling` |
| DB password | valor do `.env` |

## OpenPanel server manager

Após install, dentro do container ou volume:

```bash
docker compose -f docker-compose.fossbilling.yml exec fossbilling bash
wget -O /var/www/html/library/Server/Manager/OpenPanel.php \
  https://raw.githubusercontent.com/stefanpejcic/FOSSBilling-OpenPanel/main/OpenPanel.php
```

Configurar servidor OpenPanel (VM dedicada) na UI: System → Hosting plans and servers.

## Monitorização

```bash
docker stats fossbilling fossbilling-mariadb
free -h
```

RAM alvo: stack billing < 1 GB em idle; VM122 total < 5 GB com Desk activo.
