diff --git a/.env b/.env index b78d5fd..5cdaf2c 100644 --- a/.env +++ b/.env @@ -7,7 +7,8 @@ TRAEFIK_TLS_PORT=443 TRAEFIK_HTTP_PORT=80 MONEROD_TAG=latest -MONEROD_RPC_PORT=18089 +MONEROD_RPC_PORT=18081 +MONEROD_RESTRICTED_RPC_PORT=18089 MONEROD_P2P_PORT=18080 MONEROD_EXTRA_PARAMS=--prune-blockchain MONEROD_accessControlAllowOriginList=* diff --git a/config/grafana/dashboards/monero.json b/config/grafana/dashboards/monero.json index 9ea24af..0e342e4 100644 --- a/config/grafana/dashboards/monero.json +++ b/config/grafana/dashboards/monero.json @@ -274,7 +274,7 @@ ], "title": "Height and Target", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -368,7 +368,7 @@ ], "title": "Block size median and limit", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -452,7 +452,7 @@ ], "title": "Uptime", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -538,7 +538,7 @@ ], "title": "Alternative blocks", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -623,7 +623,7 @@ ], "title": "Free space", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -708,7 +708,7 @@ ], "title": "Database Size", "transparent": true, - "type": "timeseries" + "type": "graph" } ], "title": "Overall", @@ -914,7 +914,7 @@ ], "title": "White Peerlist last seen distribution", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -998,7 +998,7 @@ ], "title": "Peerlists' count", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1090,7 +1090,7 @@ ], "title": "Data rate", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1174,7 +1174,7 @@ ], "title": "Connections by direction (in/out)", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1258,7 +1258,7 @@ ], "title": "Connections by connection state", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1350,7 +1350,7 @@ ], "title": "Data", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1541,7 +1541,7 @@ ], "title": "P2P Peers Data Receive Rate", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1732,7 +1732,7 @@ ], "title": "P2P Peers Data Transmission Rate", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -1923,7 +1923,7 @@ ], "title": "Connected Peers' Height", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2114,7 +2114,7 @@ ], "title": "Connections' Age", "transparent": true, - "type": "timeseries" + "type": "graph" } ], "title": "Networking", @@ -2216,7 +2216,7 @@ ], "title": "RPC hits per minute", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2300,7 +2300,7 @@ ], "title": "Time spent serving RPC methods", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2386,7 +2386,7 @@ ], "title": "RPC Connections", "transparent": true, - "type": "timeseries" + "type": "graph" } ], "title": "RPC", @@ -2485,7 +2485,7 @@ ], "title": "Spent Key Images", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2569,7 +2569,7 @@ ], "title": "Size", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2653,7 +2653,7 @@ ], "title": "Transactions", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -2844,7 +2844,7 @@ ], "title": "Transaction Size", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3035,7 +3035,7 @@ ], "title": "Transaction Fees Distribution (per kB)", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3119,7 +3119,7 @@ ], "title": "Fees", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3309,7 +3309,7 @@ ], "title": "Transaction Inputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3499,7 +3499,7 @@ ], "title": "Transaction Outputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3591,7 +3591,7 @@ ], "title": "Inputs and Outputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3699,7 +3699,7 @@ ], "title": "Weird cases", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -3890,7 +3890,7 @@ ], "title": "Transaction Age", "transparent": true, - "type": "timeseries" + "type": "graph" } ], "title": "Transaction Pool", @@ -3989,7 +3989,7 @@ ], "title": "Height", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4073,7 +4073,7 @@ ], "title": "Fees", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4158,7 +4158,7 @@ ], "title": "Subsidy", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4349,7 +4349,7 @@ ], "title": "Transaction Fees Distribution (per kB)", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4433,7 +4433,7 @@ ], "title": "Rewards", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4517,7 +4517,7 @@ ], "title": "Size", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4601,7 +4601,7 @@ ], "title": "Transactions", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4693,7 +4693,7 @@ ], "title": "Inputs and Outputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -4884,7 +4884,7 @@ ], "title": "Transaction Size Distribution", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -5074,7 +5074,7 @@ ], "title": "Transaction Inputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -5264,7 +5264,7 @@ ], "title": "Transaction Outputs", "transparent": true, - "type": "timeseries" + "type": "graph" }, { "datasource": null, @@ -5348,7 +5348,7 @@ ], "title": "Difficulty", "transparent": true, - "type": "timeseries" + "type": "graph" } ], "title": "Last Block", diff --git a/config/grafana/grafana.ini b/config/grafana/grafana.ini index c1c31f9..6d6478f 100644 --- a/config/grafana/grafana.ini +++ b/config/grafana/grafana.ini @@ -14,13 +14,14 @@ org_role = Admin [dashboards] min_refresh_interval = 1m - +default_home_dashboard_path = dashboards/monero.json [paths] provisioning = /etc/grafana/provisioning [server] +root_url = https://127.0.0.1/grafana enable_gzip = true read_timeout = 2m diff --git a/docker-compose.yml b/docker-compose.yml index c508ca8..37de078 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,9 +28,10 @@ x-traefik-command-nole: &traefik-command-nole x-monerod-command: &monerod-command command: >- - --restricted-rpc --public-node --no-igd --no-zmq + --public-node --no-igd --no-zmq --enable-dns-blocklist --rpc-restricted-bind-ip=0.0.0.0 - --rpc-restricted-bind-port=${MONEROD_RPC_PORT} --confirm-external-bind + --rpc-restricted-bind-port=${MONEROD_RESTRICTED_RPC_PORT} --confirm-external-bind + --rpc-bind-port=${MONEROD_RPC_PORT} --rpc-bind-ip=0.0.0.0 ${MONEROD_EXTRA_PARAMS} x-tor-service: &tor-service @@ -40,7 +41,7 @@ x-tor-service: &tor-service links: - monerod environment: - MONEROD_TOR_SERVICE_HOSTS: "${TOR_HTTP_PORT}:monerod:${MONEROD_RPC_PORT}" + MONEROD_TOR_SERVICE_HOSTS: "${TOR_HTTP_PORT}:monerod:${MONEROD_RESTRICTED_RPC_PORT}" volumes: - tor-keys:/var/lib/tor/hidden_service/ @@ -73,7 +74,6 @@ x-monero-exporter-service: &monero-exporter-service - --monero-addr=http://monerod:${MONEROD_RPC_PORT} container_name: monero-exporter image: utxobr/monero-exporter@sha256:737413b1054583535e835e1417b61a8d59a4c08723e4a15c61c4249c2a7d69a4 - network_mode: service:monerod x-grafana-service: &grafana-service grafana: @@ -101,6 +101,7 @@ x-grafana-service: &grafana-service x-prometheus-service: &prometheus-service prometheus: + user: root command: - --config.file=/etc/prometheus/config.yaml - --storage.tsdb.path=/data @@ -139,7 +140,6 @@ services: <<: *monerod-command ports: - "${MONEROD_P2P_PORT}:${MONEROD_P2P_PORT}" # Exposes P2P port - - "${MONEROD_RPC_PORT}" volumes: - "monerod-data:/home/monero/.bitmonero" labels: @@ -150,21 +150,19 @@ services: - "traefik.http.routers.monerod.entrypoints=websecure" - "traefik.http.routers.monerod.tls" - "traefik.http.routers.monerod.service=monerod" - - "traefik.http.services.monerod.loadbalancer.server.port=${MONEROD_RPC_PORT}" + - "traefik.http.services.monerod.loadbalancer.server.port=${MONEROD_RESTRICTED_RPC_PORT}" # - "traefik.http.middlewares.corsheader.headers.accessControlAllowOriginList=${MONEROD_accessControlAllowOriginList}" #!cors # - "traefik.http.routers.monerod.middlewares=corsheader" #!cors restart: unless-stopped # <<: *tor-service #!tor # <<: *explorer-service #!explorer - <<: *monero-exporter-service #!monero-exporter - - <<: *grafana-service #!grafana - - <<: *prometheus-service #!prometheus + # <<: *monero-exporter-service #!monero-exporter + # <<: *grafana-service #!grafana + # <<: *prometheus-service #!prometheus # <<: *watchtower-service #!watchtower volumes: monerod-data: {} # tor-keys: {} #!tor - prometheus-data: {} #!prometheus + # prometheus-data: {} #!prometheus diff --git a/install b/install index 645e820..cb05b13 100755 --- a/install +++ b/install @@ -52,6 +52,7 @@ TLS_PORT="" TLS_DOMAIN="" TLS_EMAIL="" NETWORK="mainnet" +ENABLE_GRAFANA="" ################################################################ # Functions # @@ -282,6 +283,24 @@ configure_explorer() { done } +configure_grafana() { + echo -e "${OkBullet}Configuring grafana..." + while true; do + read -r -e -p " Do you want to enable a grafana monitoring dashboard? [y/n]: " yn + case $yn in + [Yy]*) + ENABLE_GRAFANA=true + sed -i '/#!monero-exporter/s/# //g' docker-compose.yml + sed -i '/#!grafana/s/# //g' docker-compose.yml + sed -i '/#!prometheus/s/# //g' docker-compose.yml + break + ;; + [Nn]*) break ;; + *) echo " Please answer yes or no." ;; + esac + done +} + configure_watchtower() { echo -e "${OkBullet}Configuring watchtower..." while true; do @@ -341,13 +360,18 @@ completed() { echo -e " ${Red}┌───────────────────────────────────────────────────────────────────────────[info]──" echo -e " ${Red}│${Stat} Network: ${StatInfo}${NETWORK}" echo -e " ${Red}│${Stat} URL: ${StatInfo}https://${HOST}${PORT_SUFF}" - if [ "$ENABLE_EXPLORER" = true ]; then - echo -e " ${Red}│${Stat} Explorer URL: ${StatInfo}https://${HOST}${PORT_SUFF}/explorer" - fi + echo -e " ${Red}│${Stat} Public IP: ${StatInfo}${PUBLIC_IP}" if [ "$ENABLE_TOR" = true ]; then echo -e " ${Red}│${Stat} Onion Service: ${StatInfo}$ONION" fi + if [ "$ENABLE_EXPLORER" = true ]; then + echo -e " ${Red}│${Stat} Explorer URL: ${StatInfo}https://${HOST}${PORT_SUFF}/explorer" + fi + if [ "$ENABLE_GRAFANA" = true ]; then + echo -e " ${Red}│${Stat} Grafana URL: ${StatInfo}https://${HOST}${PORT_SUFF}/grafana" + fi + echo -e " ${Red}│${Stat} Project installed in: ${StatInfo}${XMRSH_DIR}" echo -e " ${Red}│${Off}" echo } @@ -377,7 +401,7 @@ configure_cors configure_tor configure_explorer configure_watchtower -# configure_monitor +configure_grafana # configure_lws start_xmrsh completed