services:
  zabbix-server-mysql:
    container_name: ${CONTAINER_NAME}
    restart: always
    networks:
      - 1panel-network
    ports:
      - "${PANEL_APP_PORT_HTTP2}:10051"
    environment:
      - DB_SERVER_HOST=mysql-server
      - DB_SERVER_PORT=3306
      - MYSQL_DATABASE=${PANEL_DB_NAME}
      - MYSQL_USER=${PANEL_DB_USER}
      - MYSQL_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
      - ZBX_JAVAGATEWAY=zabbix-java-gateway
    image: zabbix/zabbix-server-mysql:7.4.6-alpine
    depends_on:
      - zabbix-java-gateway
      - mysql-server
    labels:
      createdBy: Apps

  mysql-server:
    container_name: ${CONTAINER_NAME}-mysql
    restart: always
    networks:
      - 1panel-network
    volumes:
      - ./data/:/var/lib/mysql
      - ./conf/my.cnf:/etc/my.cnf
      - ./log:/var/log/mysql
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_DATABASE=${PANEL_DB_NAME}
      - MYSQL_USER=${PANEL_DB_USER}
      - MYSQL_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
    command: --character-set-server=utf8 --collation-server=utf8_bin --default-authentication-plugin=mysql_native_password
    image: mysql:8.0.36
    labels:
      createdBy: Apps

  zabbix-java-gateway:
    container_name: ${CONTAINER_NAME}-gateway
    restart: always
    networks:
      - 1panel-network
    image: zabbix/zabbix-java-gateway:7.4.6-alpine
    labels:
      createdBy: Apps

  zabbix-web-nginx-mysql:
    container_name: ${CONTAINER_NAME}-nginx
    restart: always
    networks:
      - 1panel-network
    environment:
      - ZBX_SERVER_HOST=zabbix-server-mysql
      - DB_SERVER_HOST=mysql-server
      - MYSQL_DATABASE=${PANEL_DB_NAME}
      - MYSQL_USER=${PANEL_DB_USER}
      - MYSQL_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
    ports:
      - ${PANEL_APP_PORT_HTTP}:8080
    image: zabbix/zabbix-web-nginx-mysql:7.4.6-alpine
    depends_on:
      - zabbix-server-mysql
      - mysql-server
    labels:
      createdBy: Apps
networks:
  1panel-network:
    external: true
