From 1bbc059f005b1e5421cbf1a24e2468a255b94a11 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 31 Dec 2020 10:45:31 -0800 Subject: [PATCH] big refactor, add makefile, update dashboard, use nocompile option --- wownero/Dockerfile-exporter | 11 -- wownero/Makefile | 19 +++ wownero/docker-compose.yaml | 14 +- wownero/dockerfiles/wownerod_exporter | 11 ++ wownero/dockerfiles/wownerod_nocompile | 40 +++++ wownero/files/grafana/daemon_metrics.json | 180 +++++++++++++++++----- 6 files changed, 217 insertions(+), 58 deletions(-) delete mode 100644 wownero/Dockerfile-exporter create mode 100644 wownero/Makefile create mode 100644 wownero/dockerfiles/wownerod_exporter create mode 100644 wownero/dockerfiles/wownerod_nocompile diff --git a/wownero/Dockerfile-exporter b/wownero/Dockerfile-exporter deleted file mode 100644 index 2575bc3..0000000 --- a/wownero/Dockerfile-exporter +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:8 - -WORKDIR /opt/monerod_exporter - -RUN git clone https://github.com/ExcitableAardvark/monerod_exporter.git --branch=master --depth=1 . - -RUN npm install - -EXPOSE 8080 - -ENTRYPOINT ["node", "index.js"] diff --git a/wownero/Makefile b/wownero/Makefile new file mode 100644 index 0000000..33e0890 --- /dev/null +++ b/wownero/Makefile @@ -0,0 +1,19 @@ +.PHONY: format help + +# Help system from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +.DEFAULT_GOAL := help + +help: + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +up: ## Build and run the required containers by fetching binaries + docker-compose -f docker-compose.yaml up -d + +build: ## Build the required containers by fetching binaries + docker-compose -f docker-compose.yaml build --no-cache + +down: ## Stop the containers + docker-compose -f docker-compose.yaml down + +logs: ## Get logs from the containers + docker-compose -f docker-compose.yaml logs -f diff --git a/wownero/docker-compose.yaml b/wownero/docker-compose.yaml index 16da5e8..98e2041 100644 --- a/wownero/docker-compose.yaml +++ b/wownero/docker-compose.yaml @@ -5,7 +5,7 @@ volumes: services: prometheus: image: prom/prometheus:v2.18.0 - container_name: prometheus + container_name: wownero_prometheus restart: unless-stopped command: - --config.file=/etc/prometheus/prometheus.yml @@ -20,7 +20,7 @@ services: - 127.0.0.1:9090:9090 grafana: image: grafana/grafana:6.5.0 - container_name: grafana + container_name: wownero_grafana restart: unless-stopped ports: - 127.0.0.1:3000:3000 @@ -40,9 +40,10 @@ services: - ./files/grafana/daemon_metrics.json:/var/lib/grafana/dashboards/daemon_metrics.json:ro - grafana:/var/lib/grafana exporter: + container_name: wownero_exporter build: - context: . - dockerfile: Dockerfile-exporter + context: dockerfiles + dockerfile: wownerod_exporter restart: unless-stopped environment: DAEMON_HOST: http://wownerod:34570 @@ -50,7 +51,10 @@ services: ports: - 127.0.0.1:8080:8080 wownerod: - image: lalanza808/wownero:v0.9.2.0 + container_name: wownero_daemon + build: + context: dockerfiles + dockerfile: wownerod_nocompile restart: unless-stopped volumes: - ~/data/daemon:/data diff --git a/wownero/dockerfiles/wownerod_exporter b/wownero/dockerfiles/wownerod_exporter new file mode 100644 index 0000000..37ebd8e --- /dev/null +++ b/wownero/dockerfiles/wownerod_exporter @@ -0,0 +1,11 @@ +FROM node:8 + +WORKDIR /opt/wownerod_exporter + +RUN git clone https://github.com/lalanza808/monerod_exporter.git --branch=master --depth=1 . + +RUN npm install + +EXPOSE 8080 + +ENTRYPOINT ["node", "index.js"] diff --git a/wownero/dockerfiles/wownerod_nocompile b/wownero/dockerfiles/wownerod_nocompile new file mode 100644 index 0000000..b05e85f --- /dev/null +++ b/wownero/dockerfiles/wownerod_nocompile @@ -0,0 +1,40 @@ +FROM ubuntu:20.04 + +ENV WOWNERO_HASH 44d654d8ccff8d98dcecc778873345c42d069dfa12e8d83acc9d787de7920387 +ENV WOWNERO_DL_URL https://git.wownero.com/attachments/6b7f2b29-dd0a-47d0-93ae-387f1a4e4adb +ENV WOWNERO_DL_FILE wownero.tar.bz2 +ENV WOWNERO_SUMS_FILE sha256sums + +WORKDIR /opt/wownero + +# Update system and install dependencies +# Download Wownero binaries from Gitea +# Confirm hashes match +# Install daemon binary +# Clean up + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y tar wget + +RUN wget -qO ${WOWNERO_DL_FILE} ${WOWNERO_DL_URL} \ + && echo "${WOWNERO_HASH} ${WOWNERO_DL_FILE}" > ${WOWNERO_SUMS_FILE} \ + && sha256sum -c ${WOWNERO_SUMS_FILE}; \ + if [ "$?" -eq 0 ]; \ + then \ + echo -e "[+] Hashes match - proceeding with container build"; \ + else \ + echo -e "[!] Hashes do not match - exiting"; \ + exit 5; \ + fi \ + && mkdir ./tmp \ + && tar xjf ${WOWNERO_DL_FILE} -C ./tmp --strip 1 \ + && mv ./tmp/* /usr/local/bin/ \ + && rm -rf ./tmp ${WOWNERO_SUMS_FILE} ${WOWNERO_DL_FILE} + +WORKDIR /data + +EXPOSE 18080 +EXPOSE 18081 +EXPOSE 18082 +EXPOSE 18083 diff --git a/wownero/files/grafana/daemon_metrics.json b/wownero/files/grafana/daemon_metrics.json index cf505d8..88b15fe 100644 --- a/wownero/files/grafana/daemon_metrics.json +++ b/wownero/files/grafana/daemon_metrics.json @@ -24,11 +24,11 @@ "dashLength": 10, "dashes": false, "datasource": null, - "fill": 1, - "fillGradient": 5, + "fill": 0, + "fillGradient": 0, "gridPos": { - "h": 6, - "w": 24, + "h": 9, + "w": 18, "x": 0, "y": 0 }, @@ -44,7 +44,7 @@ "values": false }, "lines": true, - "linewidth": 2, + "linewidth": 3, "nullPointMode": "connected", "options": { "dataLinks": [] @@ -55,7 +55,7 @@ "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, - "stack": true, + "stack": false, "steppedLine": false, "targets": [ { @@ -67,6 +67,11 @@ "expr": "avg(monerod_connections_outgoing)", "legendFormat": "Outgoing", "refId": "B" + }, + { + "expr": "avg(monerod_rpc_connections_count)", + "legendFormat": "RPC", + "refId": "C" } ], "thresholds": [], @@ -117,13 +122,13 @@ "dashLength": 10, "dashes": false, "datasource": null, - "fill": 1, + "fill": 0, "fillGradient": 0, "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 6 + "h": 9, + "w": 6, + "x": 18, + "y": 0 }, "hiddenSeries": false, "id": 8, @@ -136,7 +141,7 @@ "total": false, "values": false }, - "lines": true, + "lines": false, "linewidth": 1, "nullPointMode": "connected", "options": { @@ -144,7 +149,7 @@ }, "percentage": false, "pointradius": 2, - "points": false, + "points": true, "renderer": "flot", "seriesOverrides": [ { @@ -158,7 +163,7 @@ "targets": [ { "expr": "avg(monerod_block_reward)", - "legendFormat": "Block Reward (WOW)", + "legendFormat": "Block Reward (XMR)", "refId": "A" } ], @@ -166,7 +171,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Block Reward (WOW)", + "title": "Block Reward (XMR)", "tooltip": { "shared": true, "sort": 0, @@ -210,13 +215,105 @@ "dashLength": 10, "dashes": false, "datasource": null, - "fill": 1, + "fill": 0, "fillGradient": 0, "gridPos": { - "h": 7, + "h": 9, + "w": 12, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 1, + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": true, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/.*/", + "color": "#8F3BB8" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": true, + "targets": [ + { + "expr": "avg(monerod_tx_mempool)", + "legendFormat": "Pool Transactions", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Mempool Transactions", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 0, + "fillGradient": 0, + "gridPos": { + "h": 9, "w": 12, "x": 12, - "y": 6 + "y": 9 }, "hiddenSeries": false, "id": 2, @@ -230,7 +327,7 @@ "values": false }, "lines": true, - "linewidth": 1, + "linewidth": 3, "nullPointMode": "connected", "options": { "dataLinks": [] @@ -301,49 +398,48 @@ "dashLength": 10, "dashes": false, "datasource": null, - "fill": 1, + "fill": 0, "fillGradient": 0, "gridPos": { - "h": 7, - "w": 24, + "h": 8, + "w": 20, "x": 0, - "y": 13 + "y": 18 }, "hiddenSeries": false, - "id": 6, + "id": 12, "legend": { "avg": false, "current": false, "max": false, "min": false, - "show": false, + "show": true, "total": false, "values": false }, - "lines": false, - "linewidth": 2, - "nullPointMode": "connected", + "lines": true, + "linewidth": 3, + "nullPointMode": "null", "options": { "dataLinks": [] }, "percentage": false, - "pluginVersion": "6.5.0", - "pointradius": 0.5, - "points": true, + "pointradius": 2, + "points": false, "renderer": "flot", "seriesOverrides": [ { "alias": "/.*/", - "color": "#8F3BB8" + "color": "#1F60C4" } ], "spaceLength": 10, "stack": false, - "steppedLine": true, + "steppedLine": false, "targets": [ { - "expr": "avg(monerod_tx_mempool)", - "legendFormat": "Pool Transactions", + "expr": "monerod_database_size", + "legendFormat": "Chain Size", "refId": "A" } ], @@ -351,7 +447,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Mempool Transactions", + "title": "Chain Size", "tooltip": { "shared": true, "sort": 0, @@ -367,7 +463,7 @@ }, "yaxes": [ { - "format": "short", + "format": "decbytes", "label": null, "logBase": 1, "max": null, @@ -409,10 +505,10 @@ "thresholdMarkers": true }, "gridPos": { - "h": 5, - "w": 8, - "x": 8, - "y": 20 + "h": 8, + "w": 4, + "x": 20, + "y": 18 }, "id": 10, "interval": null, @@ -483,7 +579,7 @@ "list": [] }, "time": { - "from": "now-7d", + "from": "now-2d", "to": "now" }, "timepicker": {