---
version: '3.1'

services:
    prometheus-2:
        image: prom/prometheus:v2.50.1
        container_name: prometheus
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        volumes:
            - ./prometheus/:/etc/prometheus/
            - /mnt/data/prometheusv3:/prometheus
        command:
            - '--config.file=/etc/prometheus/prometheusv3-thamon02.yaml'
            - '--storage.tsdb.path=/prometheus'
            - '--storage.tsdb.max-block-duration=30m'
            - '--storage.tsdb.min-block-duration=30m'
            - '--storage.tsdb.retention.time=2h'
            - '--web.enable-lifecycle'
            - '--web.console.libraries=/usr/share/prometheus/console_libraries'
            - '--web.console.templates=/usr/share/prometheus/consoles'
        ports:
            - 9090:9090
        restart: always

    thanos-sidecar-2:
        image: quay.io/thanos/thanos:v0.31.0
        container_name: thanos-sidecar
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        volumes:
            - ./thanos/:/etc/thanos/
            - /mnt/data/prometheusv3:/prometheus
        command:
            - 'sidecar'
            - '--tsdb.path=/prometheus'
            - '--prometheus.url=http://prometheus-2:9090'
            - '--grpc-address=0.0.0.0:10901'
            - '--http-address=0.0.0.0:10902'
            - '--objstore.config-file=/etc/thanos/bucket_config.yaml'
        depends_on:
            - prometheus-2
        restart: always

    thanos-query-frontend-2:
        image: quay.io/thanos/thanos:v0.31.0
        container_name: thanos-query-frontend
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        command:
            - 'query-frontend'
            - '--http-address=0.0.0.0:10900'
            - '--query-frontend.downstream-url=http://thanos-query-2:10904'
        ports:
            - 10900:10900
        depends_on:
            - thanos-query-2
        restart: always

    thanos-query-2:
        image: quay.io/thanos/thanos:v0.31.0
        container_name: thanos-query
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        command:
            - 'query'
            - '--grpc-address=0.0.0.0:10903'
            - '--http-address=0.0.0.0:10904'
            - '--query.replica-label=replica'
            - '--store=thanos-sidecar-2:10901'
            - '--store=thanos-store-2:10905'
        ports:
            - 10904:10904
        depends_on:
            - thanos-sidecar-2
        restart: always

    thanos-store-2:
        image: quay.io/thanos/thanos:v0.31.0
        container_name: thanos-store
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        volumes:
            - ./thanos/:/etc/thanos/
            - /mnt/data/storev3:/var/thanos/store
        command:
            - 'store'
            - '--grpc-address=0.0.0.0:10905'
            - '--http-address=0.0.0.0:10906'
            - '--data-dir=/var/thanos/store'
            - '--objstore.config-file=/etc/thanos/bucket_config.yaml'
        restart: always


    node-exporter-2:
        image: prom/node-exporter:v1.7.0
        container_name: node-exporter
        logging:
          driver: journald
          options:
            tag: "{{.Name}}"
        volumes:
            - /proc:/host/proc:ro
            - /sys:/host/sys:ro
            - /:/rootfs:ro
        command:
            - '--path.procfs=/host/proc'
            - '--path.sysfs=/host/sys'
            - --collector.filesystem.ignored-mount-points
            - "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
        ports:
            - 9100:9100
        restart: always
