services:
  glances:
    image: nicolargo/glances:4.5.6@sha256:1d41d61685b620256a8189ca6761129d30c76eb2ef50f100b9dc6265d977f1a3
    environment:
      - GLANCES_OPT=--webserver --port 61208
      - TZ=America/Los_Angeles
    entrypoint:
      - /bin/sh
      - -c
      - |
        set -e
        /venv/bin/python3 - <<'PY'
        import configparser
        p = "/etc/glances/glances.conf"
        c = configparser.ConfigParser(interpolation=None)
        c.read(p)
        c["network"]["hide"] = "veth.*,docker.*,br-.*,lo"
        c["fs"]["show"] = "/host/.*"
        c["fs"]["allow"] = "virtiofs"
        c.write(open(p, "w"))
        PY
        exec /venv/bin/python$${PYTHON_VERSION} -m glances $${GLANCES_OPT}
    networks:
      - hostnet
    volumes:
      - type: bind
        source: /etc/os-release
        target: /etc/os-release
        read_only: true
      - type: bind
        source: /var/lib/glances-probe
        target: /host/root
        read_only: true
      - type: bind
        source: /mnt/docker-cephFS/.glances-probe
        target: /host/cephfs
        read_only: true
    deploy:
      mode: global

networks:
  hostnet:
    external: true
    name: host
