ops: Add liquid to warm cache script, clean up SSR stuff

This commit is contained in:
wiz 2026-07-14 17:15:56 +09:00
parent b59c8eec77
commit 6c1822c8fc
No known key found for this signature in database
GPG key ID: A394E332255A6173
2 changed files with 45 additions and 54 deletions

View file

@ -1,44 +1,17 @@
#!/usr/bin/env zsh
delay=0.25
hostname=$(hostname)
slugs=(`curl -sSL https://${hostname}/api/v1/mining/pools/3y|jq -r -S '(.pools[].slug)'`)
warmSlurp()
{
echo "$1"
curl -o /dev/null -s -H 'User-Agent: Googlebot' "$1"
}
warmUnfurl()
{
echo "$1"
curl -o /dev/null -s -H 'User-Agent: Twitterbot' "$1"
}
delay=0.5
hostnameBitcoin=127.0.0.1:82
hostnameLiquid=127.0.0.1:83
warm()
{
echo "$1"
curl -o /dev/null -s "$1"
time curl -o /dev/null -s "$1"
sleep $delay # delay between queries to not DoS mariadb
echo
}
warmSlurpURLs=(
'/'
'/mining'
'/lightning'
'/graphs'
'/docs'
'/docs/faq'
'/docs/api/rest'
'/about'
)
warmUnfurlURLs=(
'/'
'/mining'
'/lightning'
)
warmURLs=(
warmCommonURLs=(
'/api/v1/blocks'
'/api/v1/statistics/2h'
'/api/v1/statistics/24h'
@ -51,6 +24,9 @@ warmURLs=(
'/api/v1/statistics/3y'
'/api/v1/statistics/4y'
'/api/v1/statistics/all'
)
warmMiningURLs=(
'/api/v1/mining/pools/24h'
'/api/v1/mining/pools/3d'
'/api/v1/mining/pools/1w'
@ -114,6 +90,9 @@ warmURLs=(
'/api/v1/mining/difficulty-adjustments/2y'
'/api/v1/mining/difficulty-adjustments/3y'
'/api/v1/mining/difficulty-adjustments/all'
)
warmLightningURLs=(
'/api/v1/lightning/channels-geo?style=widget'
'/api/v1/lightning/channels-geo?style=graph'
'/api/v1/lightning/statistics/latest'
@ -153,43 +132,49 @@ warmURLs=(
'/api/v1/lightning/nodes/rankings/age'
)
echo "waiting for mempool backend to start..."
echo "[*] Wait 60s for mempool backend to start..."
sleep 60
while true
do
echo "starting warm cache cycle..."
echo "[*] Starting warm cache cycle..."
date
for url in $warmSlurpURLs
for url in $warmCommonURLs
do
warmSlurp "https://${hostname}${url}"
sleep $delay # delay between queries to not DoS unfurler
warm "http://${hostnameBitcoin}${url}"
warm "http://${hostnameBitcoin}/testnet${url}"
warm "http://${hostnameBitcoin}/testnet4${url}"
warm "http://${hostnameBitcoin}/signet${url}"
warm "http://${hostnameLiquid}${url}"
warm "http://${hostnameLiquid}/testnet${url}"
done
for url in $warmUnfurlURLs
for url in $warmMiningURLs
do
warmUnfurl "https://${hostname}${url}"
sleep $delay # delay between queries to not DoS unfurler
warm "http://${hostnameBitcoin}${url}"
warm "http://${hostnameBitcoin}/testnet${url}"
warm "http://${hostnameBitcoin}/testnet4${url}"
warm "http://${hostnameBitcoin}/signet${url}"
done
for url in $warmURLs
for url in $warmLightningURLs
do
warm "https://${hostname}${url}"
warm "https://${hostname}/testnet${url}"
warm "https://${hostname}/testnet4${url}"
warm "https://${hostname}/signet${url}"
sleep $delay # delay between queries to not DoS mariadb
warm "http://${hostnameBitcoin}${url}"
warm "http://${hostnameBitcoin}/testnet${url}"
warm "http://${hostnameBitcoin}/signet${url}"
done
slugs=(`curl -sSL http://${hostnameBitcoin}/api/v1/mining/pools/3y|jq -r -S '(.pools[].slug)'`)
for slug in $slugs
do
warm "https://${hostname}/api/v1/mining/pool/${slug}"
sleep $delay # delay between queries to not DoS mariadb
warm "https://${hostname}/api/v1/mining/pool/${slug}/hashrate"
sleep $delay # delay between queries to not DoS mariadb
warm "https://${hostname}/api/v1/mining/pool/${slug}/blocks"
sleep $delay # delay between queries to not DoS mariadb
warm "http://${hostnameBitcoin}/api/v1/mining/pool/${slug}"
warm "http://${hostnameBitcoin}/api/v1/mining/pool/${slug}/hashrate"
warm "http://${hostnameBitcoin}/api/v1/mining/pool/${slug}/blocks"
done
date
echo "[*] Completed warm cache cycle"
sleep 1
done

View file

@ -58,6 +58,12 @@ warmUnfurl()
sipURLs=(
'/'
'/mining'
'/lightning'
'/graphs'
'/docs'
'/docs/faq'
'/docs/api/rest'
'/about'
)
unfurlURLs=(