diff --git a/production/liquid-sync-assets b/production/liquid-sync-assets new file mode 100755 index 0000000000..feaa1ae3cd --- /dev/null +++ b/production/liquid-sync-assets @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh +set -e + +export NVM_DIR="$HOME/.nvm" +source "$NVM_DIR/nvm.sh" +nvm use v24.13.0 + +cd "$HOME/liquid/frontend" +npm run sync-assets + +rsync -av "$HOME/liquid/frontend/dist/mempool/browser/resources/assets"* "$HOME/public_html/liquid/resources/" diff --git a/production/mempool-update-assets b/production/mempool-update-assets deleted file mode 100755 index 10debd09b2..0000000000 --- a/production/mempool-update-assets +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env zsh -set -e - -wget -O /mempool/public_html/mainnet/resources/assets.json https://raw.githubusercontent.com/blockstream/asset_registry_db/master/index.json -wget -O /mempool/public_html/mainnet/resources/assets.minimal.json https://raw.githubusercontent.com/blockstream/asset_registry_db/master/index.minimal.json - -wget -O /mempool/public_html/mainnet/resources/assets.json https://raw.githubusercontent.com/blockstream/asset_registry_testnet_db/master/index.json -wget -O /mempool/public_html/mainnet/resources/assets.minimal.json https://raw.githubusercontent.com/blockstream/asset_registry_testnet_db/master/index.minimal.json - -exit 0 diff --git a/production/mempool.crontab b/production/mempool.crontab index 196c2566ef..705cf02c1d 100644 --- a/production/mempool.crontab +++ b/production/mempool.crontab @@ -5,5 +5,4 @@ 37 13 * * * sleep 30 ; /mempool/mempool.space/backup >/dev/null 2>&1 & # hourly liquid asset update -6 * * * * cd $HOME/liquid/frontend && npm run sync-assets && rsync -av $HOME/liquid/frontend/dist/mempool/browser/resources/assets* $HOME/public_html/liquid/resources/ >/dev/null 2>&1 - +6 * * * * $HOME/mempool/production/liquid-sync-assets >/dev/null 2>&1 diff --git a/production/nginx/server-common.conf b/production/nginx/server-common.conf index ee5081ced8..5532076ec5 100644 --- a/production/nginx/server-common.conf +++ b/production/nginx/server-common.conf @@ -94,6 +94,24 @@ location /resources/customize. { expires 5m; } +# only cache liquid asset registry files for 1 hour +location = /resources/assets.json { + try_files $uri =404; + expires 1h; +} +location = /resources/assets.minimal.json { + try_files $uri =404; + expires 1h; +} +location = /resources/assets-testnet.json { + try_files $uri =404; + expires 1h; +} +location = /resources/assets-testnet.minimal.json { + try_files $uri =404; + expires 1h; +} + # cache /main.f40e91d908a068a2.js forever since they never change location ~* ^/.+\..+\.(js|css)$ { try_files /$lang/$uri /en-US/$uri =404;