From 1088655b1f442fc860875b862eb86ca8d6ced0f8 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Wed, 30 Mar 2022 01:06:42 +0900 Subject: [PATCH 1/3] Use slugs in cache warmer --- production/nginx-cache-warmer | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/production/nginx-cache-warmer b/production/nginx-cache-warmer index f9b89b7fa..a8fde4511 100755 --- a/production/nginx-cache-warmer +++ b/production/nginx-cache-warmer @@ -39,12 +39,11 @@ do for url in / \ curl -s "https://${hostname}${url}" >/dev/null done - counter=1 - while [ $counter -le 134 ] + slugs=$(cat pools.json | jq -r .slugs[]) + for slug in $slugs do - curl -s "https://${hostname}/api/v1/mining/pool/${counter}/hashrate" >/dev/null - curl -s "https://${hostname}/api/v1/mining/pool/${counter}" >/dev/null - ((counter++)) + curl -s "https://${hostname}/api/v1/mining/pool/${slug}/hashrate" >/dev/null + curl -s "https://${hostname}/api/v1/mining/pool/${slug}" >/dev/null done sleep 10 From 0561a207d93b1b4f3129540bf4414b722266657a Mon Sep 17 00:00:00 2001 From: wiz Date: Tue, 29 Mar 2022 11:25:25 -0500 Subject: [PATCH 2/3] Add jq to production deps in install script --- production/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/production/install b/production/install index e4d3f14b8..4db418693 100755 --- a/production/install +++ b/production/install @@ -321,7 +321,7 @@ LIQUIDTESTNET_ASSET_REGISTRY_DB_NAME=asset_registry_testnet_db # packages needed for mempool ecosystem DEBIAN_PKG=() DEBIAN_PKG+=(zsh vim curl screen openssl python3) -DEBIAN_PKG+=(build-essential git git-lfs clang cmake) +DEBIAN_PKG+=(build-essential git git-lfs clang cmake jq) DEBIAN_PKG+=(autotools-dev autoconf automake pkg-config bsdmainutils) DEBIAN_PKG+=(libevent-dev libdb-dev libssl-dev libtool-dev autotools-dev) DEBIAN_PKG+=(libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev) @@ -330,7 +330,7 @@ DEBIAN_PKG+=(nodejs npm mariadb-server nginx-core python-certbot-nginx rsync ufw # packages needed for mempool ecosystem FREEBSD_PKG=() FREEBSD_PKG+=(zsh sudo git screen curl wget calc neovim) -FREEBSD_PKG+=(openssh-portable py38-pip rust llvm90) +FREEBSD_PKG+=(openssh-portable py38-pip rust llvm90 jq) FREEBSD_PKG+=(boost-libs autoconf automake gmake gcc libevent libtool pkgconf) FREEBSD_PKG+=(nginx rsync py38-certbot-nginx mariadb105-server keybase) From a33d55829460c0225f0295e60509d08f6f6f00b5 Mon Sep 17 00:00:00 2001 From: wiz Date: Tue, 29 Mar 2022 11:34:49 -0500 Subject: [PATCH 3/3] Fix nginx cache warmer script for url slugs --- production/nginx-cache-warmer | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/production/nginx-cache-warmer b/production/nginx-cache-warmer index a8fde4511..7aa055778 100755 --- a/production/nginx-cache-warmer +++ b/production/nginx-cache-warmer @@ -1,5 +1,7 @@ #!/usr/bin/env zsh hostname=$(hostname) +slugs=(`curl -sSL https://raw.githubusercontent.com/mempool/mining-pools/master/pools.json | jq -r '.slugs[]'`) + while true do for url in / \ '/api/v1/statistics/2h' \ @@ -39,7 +41,6 @@ do for url in / \ curl -s "https://${hostname}${url}" >/dev/null done - slugs=$(cat pools.json | jq -r .slugs[]) for slug in $slugs do curl -s "https://${hostname}/api/v1/mining/pool/${slug}/hashrate" >/dev/null