mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-29 04:52:32 +02:00
Mempool v2.0.0 (#1933)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
## mempool_ssl.conf
|
## mempool_ssl.conf
|
||||||
|
|
||||||
|
include /etc/nginx/snippets/mempool-http.conf;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 4081 ssl;
|
listen 4081 ssl;
|
||||||
@@ -8,25 +9,5 @@ server {
|
|||||||
|
|
||||||
include /etc/nginx/snippets/ssl-params.conf;
|
include /etc/nginx/snippets/ssl-params.conf;
|
||||||
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
|
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
|
||||||
|
include /etc/nginx/snippets/mempool.conf;
|
||||||
access_log /var/log/nginx/access_thub.log;
|
|
||||||
error_log /var/log/nginx/error_thub.log;
|
|
||||||
|
|
||||||
index index.html;
|
|
||||||
root /var/www/mempool;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api {
|
|
||||||
proxy_pass http://127.0.0.1:8999/api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ws {
|
|
||||||
proxy_pass http://127.0.0.1:8999/;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -6,27 +6,6 @@ server {
|
|||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
include /etc/nginx/snippets/ssl-params.conf;
|
include /etc/nginx/snippets/ssl-params.conf;
|
||||||
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
|
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
|
||||||
|
include /etc/nginx/snippets/mempool.conf;
|
||||||
access_log /var/log/nginx/access_thub.log;
|
|
||||||
error_log /var/log/nginx/error_thub.log;
|
|
||||||
|
|
||||||
index index.html;
|
|
||||||
root /var/www/mempool;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api {
|
|
||||||
proxy_pass http://127.0.0.1:8999/api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ws {
|
|
||||||
proxy_pass http://127.0.0.1:8999/;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,25 +7,5 @@ server {
|
|||||||
|
|
||||||
include /etc/nginx/snippets/ssl-params.conf;
|
include /etc/nginx/snippets/ssl-params.conf;
|
||||||
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
|
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
|
||||||
|
include /etc/nginx/snippets/mempool.conf;
|
||||||
access_log /var/log/nginx/access_thub.log;
|
|
||||||
error_log /var/log/nginx/error_thub.log;
|
|
||||||
|
|
||||||
index index.html;
|
|
||||||
root /var/www/mempool;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api {
|
|
||||||
proxy_pass http://127.0.0.1:8999/api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ws {
|
|
||||||
proxy_pass http://127.0.0.1:8999/;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
49
home.admin/assets/nginx/snippets/mempool-http.conf
Normal file
49
home.admin/assets/nginx/snippets/mempool-http.conf
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
proxy_read_timeout 300;
|
||||||
|
proxy_connect_timeout 300;
|
||||||
|
proxy_send_timeout 300;
|
||||||
|
|
||||||
|
map $http_accept_language $header_lang {
|
||||||
|
default en-US;
|
||||||
|
~*^en-US en-US;
|
||||||
|
~*^en en-US;
|
||||||
|
~*^ar ar;
|
||||||
|
~*^cs cs;
|
||||||
|
~*^de de;
|
||||||
|
~*^es es;
|
||||||
|
~*^fa fa;
|
||||||
|
~*^fr fr;
|
||||||
|
~*^ja ja;
|
||||||
|
~*^ka ka;
|
||||||
|
~*^nl nl;
|
||||||
|
~*^nn nn;
|
||||||
|
~*^pt pt;
|
||||||
|
~*^sl sl;
|
||||||
|
~*^sv sv;
|
||||||
|
~*^tr tr;
|
||||||
|
~*^uk uk;
|
||||||
|
~*^vi vi;
|
||||||
|
~*^zh zh;
|
||||||
|
}
|
||||||
|
|
||||||
|
map $cookie_lang $lang {
|
||||||
|
default $header_lang;
|
||||||
|
~*^en-US en-US;
|
||||||
|
~*^en en-US;
|
||||||
|
~*^ar ar;
|
||||||
|
~*^cs cs;
|
||||||
|
~*^de de;
|
||||||
|
~*^es es;
|
||||||
|
~*^fa fa;
|
||||||
|
~*^fr fr;
|
||||||
|
~*^ja ja;
|
||||||
|
~*^ka ka;
|
||||||
|
~*^nl nl;
|
||||||
|
~*^nn nn;
|
||||||
|
~*^pt pt;
|
||||||
|
~*^sl sl;
|
||||||
|
~*^sv sv;
|
||||||
|
~*^tr tr;
|
||||||
|
~*^uk uk;
|
||||||
|
~*^vi vi;
|
||||||
|
~*^zh zh;
|
||||||
|
}
|
62
home.admin/assets/nginx/snippets/mempool.conf
Normal file
62
home.admin/assets/nginx/snippets/mempool.conf
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
access_log /var/log/nginx/access_mempool.log;
|
||||||
|
error_log /var/log/nginx/error_mempool.log;
|
||||||
|
|
||||||
|
root /var/www/mempool/browser;
|
||||||
|
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# fallback for all URLs i.e. /address/foo /tx/foo /block/000
|
||||||
|
location / {
|
||||||
|
try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
|
||||||
|
}
|
||||||
|
location @index-redirect {
|
||||||
|
add_header vary accept-language;
|
||||||
|
rewrite (.*) /$lang/index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# location block using regex are matched in order
|
||||||
|
|
||||||
|
# used to rewrite resources from /<lang>/ to /en-US/
|
||||||
|
location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/resources/ {
|
||||||
|
rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1;
|
||||||
|
}
|
||||||
|
# used for cookie override
|
||||||
|
location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ {
|
||||||
|
try_files $uri $uri/ /$1/index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# static API docs
|
||||||
|
location = /api {
|
||||||
|
try_files $uri $uri/ /en-US/index.html =404;
|
||||||
|
}
|
||||||
|
location = /api/ {
|
||||||
|
try_files $uri $uri/ /en-US/index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# mainnet API
|
||||||
|
location /api/v1/donations {
|
||||||
|
proxy_pass https://mempool.space;
|
||||||
|
}
|
||||||
|
location /api/v1/donations/images {
|
||||||
|
proxy_pass https://mempool.space;
|
||||||
|
}
|
||||||
|
location /api/v1/ws {
|
||||||
|
proxy_pass http://127.0.0.1:8999/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
}
|
||||||
|
location /api/v1 {
|
||||||
|
proxy_pass http://127.0.0.1:8999/api/v1;
|
||||||
|
}
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://127.0.0.1:8999/api/v1/;
|
||||||
|
}
|
||||||
|
|
||||||
|
# mainnet API
|
||||||
|
location /ws {
|
||||||
|
proxy_pass http://127.0.0.1:8999/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
}
|
@@ -102,8 +102,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
|
|
||||||
# install nodeJS
|
# install nodeJS
|
||||||
/home/admin/config.scripts/bonus.nodejs.sh on
|
/home/admin/config.scripts/bonus.nodejs.sh on
|
||||||
/home/admin/config.scripts/bonus.typescript.sh on
|
|
||||||
/home/admin/config.scripts/bonus.angular_cli.sh on
|
|
||||||
|
|
||||||
# make sure that txindex of blockchain is switched on
|
# make sure that txindex of blockchain is switched on
|
||||||
/home/admin/config.scripts/network.txindex.sh on
|
/home/admin/config.scripts/network.txindex.sh on
|
||||||
@@ -118,7 +116,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
cd /home/mempool
|
cd /home/mempool
|
||||||
sudo -u mempool git clone https://github.com/mempool/mempool.git
|
sudo -u mempool git clone https://github.com/mempool/mempool.git
|
||||||
cd mempool
|
cd mempool
|
||||||
sudo -u mempool git reset --hard v1.0.1
|
sudo -u mempool git reset --hard v2.0.0
|
||||||
|
|
||||||
# modify an
|
# modify an
|
||||||
#echo "# try to suppress question on statistics report .."
|
#echo "# try to suppress question on statistics report .."
|
||||||
@@ -133,21 +131,30 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
echo "# npm install for mempool explorer (frontend)"
|
echo "# npm install for mempool explorer (frontend)"
|
||||||
|
|
||||||
cd frontend
|
cd frontend
|
||||||
sudo -u mempool bash -c "echo 'NG_CLI_ANALYTICS=ci' >> /home/mempool/.bashrc"
|
sudo -u mempool NG_CLI_ANALYTICS=false npm install
|
||||||
sudo -u mempool ng analytics off
|
if ! [ $? -eq 0 ]; then
|
||||||
yes | sudo -u mempool npm install
|
echo "FAIL - npm install did not run correctly, aborting"
|
||||||
sudo -u mempool npm run build
|
exit 1
|
||||||
|
fi
|
||||||
|
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||||
|
if ! [ $? -eq 0 ]; then
|
||||||
|
echo "FAIL - npm run build did not run correctly, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "# npm install for mempool explorer (backend)"
|
echo "# npm install for mempool explorer (backend)"
|
||||||
|
|
||||||
cd ../backend/
|
cd ../backend/
|
||||||
yes | sudo -u mempool npm install
|
sudo -u mempool NG_CLI_ANALYTICS=false npm install
|
||||||
sudo -u mempool npm run build
|
|
||||||
sudo -u mempool touch cache.json
|
|
||||||
if ! [ $? -eq 0 ]; then
|
if ! [ $? -eq 0 ]; then
|
||||||
echo "FAIL - npm install did not run correctly, aborting"
|
echo "FAIL - npm install did not run correctly, aborting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
sudo -u mempool NG_CLI_ANALYTICS=false npm run build
|
||||||
|
if ! [ $? -eq 0 ]; then
|
||||||
|
echo "FAIL - npm run build did not run correctly, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# prepare .env file
|
# prepare .env file
|
||||||
echo "# getting RPC credentials from the ${network}.conf"
|
echo "# getting RPC credentials from the ${network}.conf"
|
||||||
@@ -159,54 +166,40 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
sudo chmod 600 /home/admin/mempool-config.json || exit 1
|
sudo chmod 600 /home/admin/mempool-config.json || exit 1
|
||||||
cat > /home/admin/mempool-config.json <<EOF
|
cat > /home/admin/mempool-config.json <<EOF
|
||||||
{
|
{
|
||||||
"ENV": "dev",
|
"MEMPOOL": {
|
||||||
"DB_HOST": "localhost",
|
"NETWORK": "mainnet",
|
||||||
"DB_PORT": 3306,
|
"BACKEND": "electrum",
|
||||||
"DB_USER": "mempool",
|
"HTTP_PORT": 8999,
|
||||||
"DB_PASSWORD": "mempool",
|
"API_URL_PREFIX": "/api/v1/",
|
||||||
"DB_DATABASE": "mempool",
|
"POLL_RATE_MS": 2000
|
||||||
"HTTP_PORT": 8999,
|
},
|
||||||
"API_ENDPOINT": "/api/v1/",
|
"CORE_RPC": {
|
||||||
"CHAT_SSL_ENABLED": false,
|
"USERNAME": "$RPC_USER",
|
||||||
"CHAT_SSL_PRIVKEY": "",
|
"PASSWORD": "$PASSWORD_B"
|
||||||
"CHAT_SSL_CERT": "",
|
},
|
||||||
"CHAT_SSL_CHAIN": "",
|
"ELECTRUM": {
|
||||||
"MEMPOOL_REFRESH_RATE_MS": 500,
|
"HOST": "127.0.0.1",
|
||||||
"INITIAL_BLOCK_AMOUNT": 8,
|
"PORT": 50002,
|
||||||
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 3,
|
"TLS_ENABLED": true,
|
||||||
"KEEP_BLOCK_AMOUNT": 24,
|
"TX_LOOKUPS": false
|
||||||
"BITCOIN_NODE_HOST": "127.0.0.1",
|
},
|
||||||
"BITCOIN_NODE_PORT": 8332,
|
"DATABASE": {
|
||||||
"BITCOIN_NODE_USER": "$RPC_USER",
|
"ENABLED": true,
|
||||||
"BITCOIN_NODE_PASS": "$PASSWORD_B",
|
"HOST": "localhost",
|
||||||
"BACKEND_API": "bitcoind",
|
"PORT": 3306,
|
||||||
"ELECTRS_API_URL": "http://localhost:50001",
|
"USERNAME": "mempool",
|
||||||
"TX_PER_SECOND_SPAN_SECONDS": 150
|
"PASSWORD": "mempool",
|
||||||
|
"DATABASE": "mempool"
|
||||||
|
},
|
||||||
|
"STATISTICS": {
|
||||||
|
"ENABLED": true,
|
||||||
|
"TX_PER_SECOND_SAMPLE_PERIOD": 150
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
sudo mv /home/admin/mempool-config.json /home/mempool/mempool/backend/mempool-config.json
|
sudo mv /home/admin/mempool-config.json /home/mempool/mempool/backend/mempool-config.json
|
||||||
sudo chown mempool:mempool /home/mempool/mempool/backend/mempool-config.json
|
sudo chown mempool:mempool /home/mempool/mempool/backend/mempool-config.json
|
||||||
|
|
||||||
|
|
||||||
touch /home/admin/proxy.conf.json
|
|
||||||
sudo chmod 600 /home/admin/proxy.conf.json || exit 1
|
|
||||||
cat > /home/admin/proxy.conf.json <<EOF
|
|
||||||
{
|
|
||||||
"/api": {
|
|
||||||
"target": "http://localhost:8999/",
|
|
||||||
"secure": false
|
|
||||||
},
|
|
||||||
"/ws": {
|
|
||||||
"target": "http://localhost:8999/",
|
|
||||||
"secure": false,
|
|
||||||
"ws": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
sudo mv /home/admin/proxy.conf.json /home/mempool/mempool/frontend/proxy.conf.json
|
|
||||||
sudo chown mempool:mempool /home/mempool/mempool/frontend/proxy.conf.json
|
|
||||||
cd /home/mempool/mempool/frontend
|
cd /home/mempool/mempool/frontend
|
||||||
sudo -u mempool npm run build
|
|
||||||
|
|
||||||
sudo mkdir -p /var/www/mempool
|
sudo mkdir -p /var/www/mempool
|
||||||
sudo rsync -av --delete dist/mempool/ /var/www/mempool/
|
sudo rsync -av --delete dist/mempool/ /var/www/mempool/
|
||||||
@@ -222,21 +215,17 @@ EOF
|
|||||||
# NGINX
|
# NGINX
|
||||||
##################
|
##################
|
||||||
# setup nginx symlinks
|
# setup nginx symlinks
|
||||||
if ! [ -f /etc/nginx/sites-available/mempool_ssl.conf ]; then
|
sudo cp /home/admin/assets/nginx/snippets/mempool.conf /etc/nginx/snippets/mempool.conf
|
||||||
sudo cp /home/admin/assets/nginx/sites-available/mempool_ssl.conf /etc/nginx/sites-available/mempool_ssl.conf
|
sudo cp /home/admin/assets/nginx/snippets/mempool-http.conf /etc/nginx/snippets/mempool-http.conf
|
||||||
fi
|
sudo cp /home/admin/assets/nginx/sites-available/mempool_ssl.conf /etc/nginx/sites-available/mempool_ssl.conf
|
||||||
if ! [ -f /etc/nginx/sites-available/mempool_tor.conf ]; then
|
sudo cp /home/admin/assets/nginx/sites-available/mempool_tor.conf /etc/nginx/sites-available/mempool_tor.conf
|
||||||
sudo cp /home/admin/assets/nginx/sites-available/mempool_tor.conf /etc/nginx/sites-available/mempool_tor.conf
|
sudo cp /home/admin/assets/nginx/sites-available/mempool_tor_ssl.conf /etc/nginx/sites-available/mempool_tor_ssl.conf
|
||||||
fi
|
|
||||||
if ! [ -f /etc/nginx/sites-available/mempool_tor_ssl.conf ]; then
|
|
||||||
sudo cp /home/admin/assets/nginx/sites-available/mempool_tor_ssl.conf /etc/nginx/sites-available/mempool_tor_ssl.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo ln -sf /etc/nginx/sites-available/mempool_ssl.conf /etc/nginx/sites-enabled/
|
sudo ln -sf /etc/nginx/sites-available/mempool_ssl.conf /etc/nginx/sites-enabled/
|
||||||
sudo ln -sf /etc/nginx/sites-available/mempool_tor.conf /etc/nginx/sites-enabled/
|
sudo ln -sf /etc/nginx/sites-available/mempool_tor.conf /etc/nginx/sites-enabled/
|
||||||
sudo ln -sf /etc/nginx/sites-available/mempool_tor_ssl.conf /etc/nginx/sites-enabled/
|
sudo ln -sf /etc/nginx/sites-available/mempool_tor_ssl.conf /etc/nginx/sites-enabled/
|
||||||
sudo nginx -t
|
sudo nginx -t
|
||||||
sudo systemctl reload nginx
|
sudo systemctl restart nginx
|
||||||
|
|
||||||
# install service
|
# install service
|
||||||
echo "*** Install mempool systemd ***"
|
echo "*** Install mempool systemd ***"
|
||||||
@@ -269,6 +258,8 @@ EOF
|
|||||||
echo "# mempool already installed."
|
echo "# mempool already installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sudo systemctl start mempool
|
||||||
|
|
||||||
# setting value in raspi blitz config
|
# setting value in raspi blitz config
|
||||||
sudo sed -i "s/^mempoolExplorer=.*/mempoolExplorer=on/g" /mnt/hdd/raspiblitz.conf
|
sudo sed -i "s/^mempoolExplorer=.*/mempoolExplorer=on/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
@@ -300,6 +291,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||||||
sudo userdel -rf mempool
|
sudo userdel -rf mempool
|
||||||
|
|
||||||
# remove nginx symlinks
|
# remove nginx symlinks
|
||||||
|
sudo rm -f /etc/nginx/snippets/mempool.conf
|
||||||
|
sudo rm -f /etc/nginx/snippets/mempool-http.conf
|
||||||
sudo rm -f /etc/nginx/sites-enabled/mempool_ssl.conf
|
sudo rm -f /etc/nginx/sites-enabled/mempool_ssl.conf
|
||||||
sudo rm -f /etc/nginx/sites-enabled/mempool_tor.conf
|
sudo rm -f /etc/nginx/sites-enabled/mempool_tor.conf
|
||||||
sudo rm -f /etc/nginx/sites-enabled/mempool_tor_ssl.conf
|
sudo rm -f /etc/nginx/sites-enabled/mempool_tor_ssl.conf
|
||||||
|
Reference in New Issue
Block a user