services:
    # --- ODOO STACK ---
    odoo:
      image: odoo:19.0
      command: >
        odoo
        --proxy-mode
        --db_host=odoo-db
        --db_user=odoo
        --db_password=odoo_pass
        --workers=2
        --max-cron-threads=1
      depends_on:
        odoo-db:
          condition: service_healthy
      ports:
        - "8069:8069"
        - "8072:8072"   # Longpolling für Realtime-Features
      environment:
        - HOST=odoo-db
        - USER=odoo
        - PASSWORD=odoo_pass
      healthcheck:
        test: ["CMD", "curl", "-f", "http://localhost:8069/web/health"]
        interval: 30s
        timeout: 10s
        retries: 3

    odoo-db:
      image: postgres:17
      environment:
        - POSTGRES_DB=postgres
        - POSTGRES_PASSWORD=odoo_pass
        - POSTGRES_USER=odoo
      volumes:
        - ./odoo_data:/var/lib/postgresql/data
      healthcheck:
        test: ["CMD-SHELL", "pg_isready -U odoo"]
        interval: 10s
        timeout: 5s
        retries: 5
