# VM123 — FOSSBilling + Odoo 16 (Spec 024)
# OpenPanel corre NO HOST (bare metal), não neste compose.
# Uso: docker compose --env-file .env up -d

version: "3.8"

services:
  foss-mariadb:
    image: mariadb:11
    restart: unless-stopped
    environment:
      MARIADB_DATABASE: fossbilling
      MARIADB_USER: fossbilling
      MARIADB_PASSWORD: ${FOSS_MARIADB_PASSWORD:?set FOSS_MARIADB_PASSWORD}
      MARIADB_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - foss-mariadb:/var/lib/mysql
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --innodb-buffer-pool-size=128M
      - --max-connections=40
    mem_limit: 384m
    networks: [finance]

  fossbilling:
    image: fossbilling/fossbilling:0.8.2
    restart: unless-stopped
    ports:
      - "8092:80"
    volumes:
      - fossbilling-data:/var/www/html
    depends_on: [foss-mariadb]
    mem_limit: 384m
    networks: [finance]

  odoo-db:
    image: postgres:15-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: ${ODOO_DB_PASSWORD:?set ODOO_DB_PASSWORD}
    volumes:
      - odoo-db:/var/lib/postgresql/data
    command: postgres -c shared_buffers=128MB -c max_connections=40
    mem_limit: 384m
    networks: [finance]

  odoo:
    image: odoo:16.0
    restart: unless-stopped
    ports:
      - "8069:8069"
    environment:
      HOST: odoo-db
      USER: odoo
      PASSWORD: ${ODOO_DB_PASSWORD}
    command: odoo --proxy-mode --db-filter=^ligbox$
    volumes:
      - odoo-data:/var/lib/odoo
    depends_on: [odoo-db]
    mem_limit: 768m
    networks: [finance]

volumes:
  foss-mariadb:
  fossbilling-data:
  odoo-db:
  odoo-data:

networks:
  finance:
    driver: bridge
