version: "3.7"

services:

  app_proxy:
    environment:
      APP_HOST: zabbix_zabbix-frontend_1
      APP_PORT: 8080

  zabbix-frontend:
    image: zabbix/zabbix-web-nginx-pgsql:7.4.8-alpine@sha256:4d23de6390cc1b176214598210df660d7f6904fe66e45d776948740c5a8e2abf
    hostname: zabbix-frontend
    restart: on-failure
    environment:
      DB_SERVER_HOST: zabbix-database
      POSTGRES_USER: zabbix
      POSTGRES_PASSWORD: zabbix
      ZBX_SERVER_HOST: zabbix-server
      PHP_TZ: UTC
    depends_on:
      - zabbix-server
      - zabbix-database

  zabbix-server:
    image: zabbix/zabbix-server-pgsql:7.4.8-alpine@sha256:b118d2f69194c0bf1cb52698050db06fa06e4a11ebb271c6af889dba183e7d69
    hostname: zabbix-server
    restart: on-failure
    init: true
    environment:
      DB_SERVER_HOST: zabbix-database
      POSTGRES_USER: zabbix
      POSTGRES_PASSWORD: zabbix
    ports:
      - "10050:10050"
    depends_on:
      - zabbix-database

  zabbix-agent:
    image: zabbix/zabbix-agent2:7.4.8-alpine@sha256:2323ac07ff647f430d48cc0fea16c844a3ff2c46308eebf8af460498b508b336
    hostname: zabbix-agent
    restart: on-failure
    init: true
    environment:
      ZBX_HOSTNAME: zabbix-agent
      ZBX_SERVER_HOST: zabbix-server

  zabbix-database:
    image: postgres:13.18-alpine3.20@sha256:77815c1f18ae761b0e503503a494475a03149d7ce544934ccecdbafdb3956c94
    hostname: zabbix-database
    restart: on-failure
    environment:
      POSTGRES_PASSWORD: zabbix
      POSTGRES_USER: zabbix
      POSTGRES_DB: zabbix
    volumes:
      - ${APP_DATA_DIR}/data/postgres:/var/lib/postgresql/data
