version: "3.9"
services:
  admin:
    image: postgres:latest
    environment:
      POSTGRES_DB: admin
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: admin
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - testNetwork

  pgadmin:
    image: dpage/pgadmin4:latest
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: admin
    ports:
      - "5051:80"
    networks:
      - testNetwork

  prometheus_exporter:
    image: exporter_custom
    ports:
      - "8000:8000"
    networks:
      - testNetwork
    depends_on:
      - admin 

  odoo:
    image: odoo_custom
    environment:
      HOST: admin
      USER: admin
      PASSWORD: admin
      DATABASE: admin
      ODOO_PASSWORD: admin
    ports:
      - "8069:8069"
    volumes:
      - ./odoo.conf:/etc/odoo/odoo.conf
      - ./logs/odoo:/var/log/odoo
    networks:
      - testNetwork
    depends_on:
      - admin

  grafana:
    image: grafana/grafana:latest
    environment:
      GF_SECURITY_ADMIN_PASSWORD: grafana_pwd
      GF_DATASOURCES_PROMETHEUS_URL: http://prometheus:9090
    ports:
      - "3000:3000"
    networks:
      - testNetwork
    depends_on:
       - prometheus

  prometheus:
    image: prom/prometheus:latest
    ports:
      - "9090:9090"
    volumes:
      - prometheus-data:/prometheus
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    networks:
      - testNetwork

  fluentd:
    image: fluent/fluentd:v1.13-1
    ports:
      - "24224:24224"
    volumes:
      - ./logs/odoo:/var/log/odoo
      - ./fluent.conf:/fluentd/etc/fluent.conf
    networks:
      - testNetwork
    depends_on:
      - odoo


  backup:
    image: backup_custom
    environment:
      POSTGRES_HOST: admin
      POSTGRES_DB: admin
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: admin
    volumes:
      - backup-data:/backup
    networks:
      - testNetwork
    depends_on:
      - admin

networks:
  testNetwork:
    driver: bridge

volumes:
  postgres-data:
  prometheus-data:
  backup-data: