From 890cf37ff4d47bc18630e2b2efe0b34d3b2f1457 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Thu, 18 Jul 2024 16:02:53 +0100 Subject: [PATCH] Provisioning --- Makefile | 2 +- docker-compose-azure.yaml | 20 +-- docker-compose-claude.yaml | 20 +-- docker-compose-ollama.yaml | 47 ++++-- docker-compose-vertexai.yaml | 20 +-- grafana/dashboard.json | 298 +++++++++++++++++++++++++++++++++++ grafana/dashboard.yml | 13 ++ grafana/datasource.yml | 11 ++ prometheus/prometheus.yml | 35 ++++ setup.py | 2 +- 10 files changed, 426 insertions(+), 42 deletions(-) create mode 100644 grafana/dashboard.json create mode 100644 grafana/dashboard.yml create mode 100644 grafana/datasource.yml create mode 100644 prometheus/prometheus.yml diff --git a/Makefile b/Makefile index ef2ee557..bc4e7340 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # VERSION=$(shell git describe | sed 's/^v//') -VERSION=0.3.3 +VERSION=0.4.0 all: container diff --git a/docker-compose-azure.yaml b/docker-compose-azure.yaml index f970add6..b5c63d64 100644 --- a/docker-compose-azure.yaml +++ b/docker-compose-azure.yaml @@ -91,7 +91,7 @@ services: restart: on-failure:100 pdf-decoder: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "pdf-decoder" - "-p" @@ -99,7 +99,7 @@ services: restart: on-failure:100 chunker: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "chunker-recursive" - "-p" @@ -107,7 +107,7 @@ services: restart: on-failure:100 vectorize: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-vectorize" - "-p" @@ -115,7 +115,7 @@ services: restart: on-failure:100 embeddings: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-hf" - "-p" @@ -123,7 +123,7 @@ services: restart: on-failure:100 kg-extract-definitions: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-definitions" - "-p" @@ -131,7 +131,7 @@ services: restart: on-failure:100 kg-extract-relationships: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-relationships" - "-p" @@ -139,7 +139,7 @@ services: restart: on-failure:100 vector-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "vector-write-milvus" - "-p" @@ -149,7 +149,7 @@ services: restart: on-failure:100 graph-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-write-cassandra" - "-p" @@ -159,7 +159,7 @@ services: restart: on-failure:100 llm: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "llm-azure-text" - "-p" @@ -171,7 +171,7 @@ services: restart: on-failure:100 graph-rag: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-rag" - "-p" diff --git a/docker-compose-claude.yaml b/docker-compose-claude.yaml index bbceceac..7ade6a7f 100644 --- a/docker-compose-claude.yaml +++ b/docker-compose-claude.yaml @@ -91,7 +91,7 @@ services: restart: on-failure:100 pdf-decoder: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "pdf-decoder" - "-p" @@ -99,7 +99,7 @@ services: restart: on-failure:100 chunker: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "chunker-recursive" - "-p" @@ -107,7 +107,7 @@ services: restart: on-failure:100 vectorize: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-vectorize" - "-p" @@ -115,7 +115,7 @@ services: restart: on-failure:100 embeddings: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-hf" - "-p" @@ -123,7 +123,7 @@ services: restart: on-failure:100 kg-extract-definitions: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-definitions" - "-p" @@ -131,7 +131,7 @@ services: restart: on-failure:100 kg-extract-relationships: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-relationships" - "-p" @@ -139,7 +139,7 @@ services: restart: on-failure:100 vector-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "vector-write-milvus" - "-p" @@ -149,7 +149,7 @@ services: restart: on-failure:100 graph-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-write-cassandra" - "-p" @@ -159,7 +159,7 @@ services: restart: on-failure:100 llm: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "llm-claude-text" - "-p" @@ -169,7 +169,7 @@ services: restart: on-failure:100 graph-rag: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-rag" - "-p" diff --git a/docker-compose-ollama.yaml b/docker-compose-ollama.yaml index dd618cd2..0f61a6b9 100644 --- a/docker-compose-ollama.yaml +++ b/docker-compose-ollama.yaml @@ -6,6 +6,8 @@ volumes: etcd: minio-data: milvus: + prometheus-data: + grafana-storage: services: @@ -90,8 +92,33 @@ services: - "milvus:/var/lib/milvus" restart: on-failure:100 + prometheus: + image: docker.io/prom/prometheus:v2.53.1 + ports: + - "9090:9090" + volumes: + - "./prometheus:/etc/prometheus" + - "prometheus-data:/prometheus" + restart: on-failure:100 + + grafana: + image: docker.io/grafana/grafana:10.0.0 + ports: + - "3000:3000" + volumes: + - "grafana-storage:/var/lib/grafana" + - "./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml" + - "./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml" + - "./grafana/dashboard.json:/var/lib/grafana/dashboards/dashboard.json" + environment: + GF_AUTH_ANONYMOUS_ORG_ROLE: Admin + GF_AUTH_ANONYMOUS_ENABLED: true + GF_ORG_NAME: trustgraph.ai +# GF_SERVER_ROOT_URL: https://example.com + restart: on-failure:100 + pdf-decoder: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "pdf-decoder" - "-p" @@ -99,7 +126,7 @@ services: restart: on-failure:100 chunker: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "chunker-recursive" - "-p" @@ -107,7 +134,7 @@ services: restart: on-failure:100 vectorize: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-vectorize" - "-p" @@ -115,7 +142,7 @@ services: restart: on-failure:100 embeddings: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-hf" - "-p" @@ -125,7 +152,7 @@ services: restart: on-failure:100 kg-extract-definitions: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-definitions" - "-p" @@ -133,7 +160,7 @@ services: restart: on-failure:100 kg-extract-relationships: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-relationships" - "-p" @@ -141,7 +168,7 @@ services: restart: on-failure:100 vector-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "vector-write-milvus" - "-p" @@ -151,7 +178,7 @@ services: restart: on-failure:100 graph-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-write-cassandra" - "-p" @@ -161,7 +188,7 @@ services: restart: on-failure:100 llm: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "llm-ollama-text" - "-p" @@ -171,7 +198,7 @@ services: restart: on-failure:100 graph-rag: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-rag" - "-p" diff --git a/docker-compose-vertexai.yaml b/docker-compose-vertexai.yaml index b3a90f7a..5cae73a9 100644 --- a/docker-compose-vertexai.yaml +++ b/docker-compose-vertexai.yaml @@ -91,7 +91,7 @@ services: restart: on-failure:100 pdf-decoder: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "pdf-decoder" - "-p" @@ -99,7 +99,7 @@ services: restart: on-failure:100 chunker: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "chunker-recursive" - "-p" @@ -107,7 +107,7 @@ services: restart: on-failure:100 vectorize: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-vectorize" - "-p" @@ -115,7 +115,7 @@ services: restart: on-failure:100 embeddings: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "embeddings-hf" - "-p" @@ -123,7 +123,7 @@ services: restart: on-failure:100 kg-extract-definitions: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-definitions" - "-p" @@ -131,7 +131,7 @@ services: restart: on-failure:100 kg-extract-relationships: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "kg-extract-relationships" - "-p" @@ -139,7 +139,7 @@ services: restart: on-failure:100 vector-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "vector-write-milvus" - "-p" @@ -149,7 +149,7 @@ services: restart: on-failure:100 graph-write: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-write-cassandra" - "-p" @@ -159,7 +159,7 @@ services: restart: on-failure:100 llm: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "llm-vertexai-text" - "-p" @@ -173,7 +173,7 @@ services: restart: on-failure:100 graph-rag: - image: docker.io/trustgraph/trustgraph-flow:0.3.3 + image: docker.io/trustgraph/trustgraph-flow:0.4.0 command: - "graph-rag" - "-p" diff --git a/grafana/dashboard.json b/grafana/dashboard.json new file mode 100644 index 00000000..4535a3bd --- /dev/null +++ b/grafana/dashboard.json @@ -0,0 +1,298 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 4, + "options": { + "bucketOffset": 0, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "editorMode": "builder", + "expr": "avg(rate(request_latency_bucket{instance=\"llm:8000\"}[5m]))", + "instant": false, + "range": true, + "refId": "A" + } + ], + "title": "LLM latency", + "type": "histogram" + }, + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-RdYlGr" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 39, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "percent" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "editorMode": "builder", + "expr": "sum by(status) (rate(processing_count_total[5m]))", + "format": "time_series", + "instant": false, + "interval": "", + "range": true, + "refId": "A" + } + ], + "title": "Error rate", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "b7a520e5-9efe-4e0b-961b-9d1d3854800d" + }, + "editorMode": "builder", + "expr": "rate(request_latency_count[1m])", + "instant": false, + "range": true, + "refId": "A" + } + ], + "title": "Request count", + "type": "timeseries" + } + ], + "refresh": "10s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Trustgraph", + "uid": "b5c8abf8-fe79-496b-b028-10bde917d1f0", + "version": 7, + "weekStart": "" +} diff --git a/grafana/dashboard.yml b/grafana/dashboard.yml new file mode 100644 index 00000000..ee4891d1 --- /dev/null +++ b/grafana/dashboard.yml @@ -0,0 +1,13 @@ +apiVersion: 1 + +providers: + + - name: 'Trustgraph' + type: file + disableDeletion: false + editable: true + updateIntervalSeconds: 30 + allowUiUpdates: false + options: + path: /var/lib/grafana/dashboards + diff --git a/grafana/datasource.yml b/grafana/datasource.yml new file mode 100644 index 00000000..9e4c8108 --- /dev/null +++ b/grafana/datasource.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + basicAuth: false + isDefault: true + readOnly: false + diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml new file mode 100644 index 00000000..5d1e4b56 --- /dev/null +++ b/prometheus/prometheus.yml @@ -0,0 +1,35 @@ +global: + + scrape_interval: 15s # By default, scrape targets every 15 seconds. + + # Attach these labels to any time series or alerts when communicating with + # external systems (federation, remote storage, Alertmanager). + external_labels: + monitor: 'trustgraph' + +# A scrape configuration containing exactly one endpoint to scrape: +# Here it's Prometheus itself. +scrape_configs: + + # The job name is added as a label `job=` to any timeseries + # scraped from this config. + + - job_name: 'trustgraph' + + # Override the global default and scrape targets from this job every + # 5 seconds. + scrape_interval: 5s + + static_configs: + - targets: + - 'pdf-decoder:8000' + - 'chunker:8000' + - 'vectorize:8000' + - 'embeddings:8000' + - 'kg-extract-definitions:8000' + - 'kg-extract-relationships:8000' + - 'vector-write:8000' + - 'graph-write:8000' + - 'llm:8000' + - 'graph-rag:8000' + diff --git a/setup.py b/setup.py index ad66a2e9..a3ae5e2b 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import os with open("README.md", "r") as fh: long_description = fh.read() -version = "0.3.3" +version = "0.4.0" setuptools.setup( name="trustgraph",