From a5d3b38722c4154a5f48af95ce423bea79b0edf1 Mon Sep 17 00:00:00 2001 From: Patrick Balsiger Date: Sun, 21 Jan 2024 19:11:31 +0100 Subject: [PATCH] Update dashboard and control script --- README.md | 7 +- ctl.sh | 37 ++++-- grafana/dashboards/drift-keeper.json | 189 +-------------------------- 3 files changed, 32 insertions(+), 201 deletions(-) diff --git a/README.md b/README.md index 424a7f1..af8db10 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ More information: - DigitalOcean API Key (optional) Drift account is setup according to: https://docs.drift.trade/keeper-bots. -The account can also be set up using the trading app: https://app.drift.trade/. +The account can also be set up using the DEX app: https://app.drift.trade/. ## Configure @@ -53,14 +53,13 @@ Provision a DigitalOcean Droplet and deploy Keeper Bot with current configuratio By default ~/.ssh/id_rsa.pub is added to DigitalOcean and the Droplet. ``` -terraform init -terraform apply +./ctl.sh droplet provision ``` Wait until Droplet is up and the `droplet_ip` is printed. You may connect to the Droplet using ``` -ssh root@droplet_ip +./ctl.sh droplet connect ``` In case somethin went wrong with the provisioning, check the cloud-init-output log at `/var/log/cloud-init-output.log`. diff --git a/ctl.sh b/ctl.sh index 773e670..6c49fea 100755 --- a/ctl.sh +++ b/ctl.sh @@ -5,6 +5,30 @@ API_ENDPOINT=https://api.mainnet-beta.solana.com/ source .env +function image { + function build { + mkdir -p .build + git clone https://github.com/drift-labs/keeper-bots-v2 -b mainnet-beta .build/keeper-bots-v2 + docker build -f Dockerfile -t ${DOCKER_IMAGE} .build/keeper-bots-v2 + rm -rf .build + } + function push { + docker push ${DOCKER_IMAGE} + } + ${@:-} +} + +function droplet { + function provision { + terraform init + terraform apply + } + function connect { + ssh keeper@$(terraform output -raw droplet_ip) + } + ${@:-} +} + function balance { function sol { local addr=${1:-$WALLET_ADDRESS} @@ -41,17 +65,4 @@ function balance { ${@:-} } -function image { - function build { - mkdir -p .build - git clone https://github.com/drift-labs/keeper-bots-v2 -b mainnet-beta .build/keeper-bots-v2 - docker build -f Dockerfile -t ${DOCKER_IMAGE} .build/keeper-bots-v2 - rm -rf .build - } - function push { - docker push ${DOCKER_IMAGE} - } - ${@:-} -} - ${@:-} \ No newline at end of file diff --git a/grafana/dashboards/drift-keeper.json b/grafana/dashboards/drift-keeper.json index 5dc4e4d..7828302 100644 --- a/grafana/dashboards/drift-keeper.json +++ b/grafana/dashboards/drift-keeper.json @@ -176,7 +176,7 @@ "useBackend": false } ], - "title": "PNL", + "title": "Profit", "type": "stat" }, { @@ -436,7 +436,7 @@ "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": false + "showLegend": true }, "tooltip": { "mode": "single", @@ -538,7 +538,7 @@ "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": false + "showLegend": true }, "tooltip": { "mode": "single", @@ -646,110 +646,6 @@ "x": 0, "y": 23 }, - "id": 2, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true, - "sortBy": "Last *", - "sortDesc": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "successful_fills_total", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Successful Fills Total", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "displayName": "${__field.labels.instance}", - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 12, - "x": 12, - "y": 23 - }, "id": 1, "options": { "legend": { @@ -788,81 +684,6 @@ "title": "Attempted Fills Total", "type": "timeseries" }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-BlPu" - }, - "custom": { - "fillOpacity": 50, - "gradientMode": "hue", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1 - }, - "displayName": "${__field.labels.instance}", - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 12, - "x": 0, - "y": 35 - }, - "id": 6, - "options": { - "bucketOffset": 0, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(sdk_call_duration_histogram_sum{method=\"sendTx\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "SendTX Duration", - "type": "histogram" - }, { "datasource": { "type": "prometheus", @@ -906,7 +727,7 @@ "h": 12, "w": 12, "x": 12, - "y": 35 + "y": 23 }, "id": 5, "options": { @@ -957,6 +778,6 @@ "timezone": "", "title": "Drift Keeper", "uid": "f4c3a630-ffd0-41c8-a36a-52e0771b77fb", - "version": 6, + "version": 5, "weekStart": "" } \ No newline at end of file