# Use postgres/example user/password credentials
version: "3.8"

services:

  psql:
    image: postgres
    hostname: psql
    restart: always
    environment:
      POSTGRES_PASSWORD: pgadmin
      POSTGRES_USER: pgadmin
    ports:
      - target: 5432
        published: 25432
        protocol: tcp
        mode: host

  pgadmin4:
    image: dpage/pgadmin4
    hostname: pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: "pgadmin@local.net"
      PGADMIN_DEFAULT_PASSWORD: pgadmin
    volumes:
      - type: bind
        source: ../pgadmin4/servers.json
        target: /pgadmin4/servers.json
        read_only: true
    ports:
      - target: 80
        published: 1238
        protocol: tcp
        mode: host
    depends_on:
      - psql

  zbx_srv:
    image: zabbix/zabbix-server-pgsql:ubuntu-6.0.21
    hostname: zbx_srv
    restart: always
    environment:
      DB_SERVER_HOST: psql
      POSTGRES_DB: zabbix
      POSTGRES_USER: pgadmin
      POSTGRES_PASSWORD: pgadmin
    depends_on:
      - psql
  
  zbx_fe:
    image: zabbix/zabbix-web-nginx-pgsql:ubuntu-6.0.21
    hostname: zbx_fe
    restart: always
    environment:
      ZBX_SERVER_HOST: zbx_srv
      ZBX_SERVER_PORT: 10051
      DB_SERVER_HOST: psql
      DB_SERVER_PORT: 5432
      POSTGRES_USER: pgadmin
      POSTGRES_PASSWORD: pgadmin
      ZBX_SERVER_NAME: zbx_fe
    ports:
      - target: 8080
        published: 1235
        protocol: tcp
        mode: host
      - target: 8443
        published: 1236
        protocol: tcp
        mode: host
      - target: 80
        published: 1237
        protocol: tcp
        mode: host
    depends_on:
      - zbx_srv
