Update misc files used for mempool.space production website

This commit is contained in:
wiz 2020-05-25 18:42:00 +09:00
parent 2c345426cb
commit 003361befb
No known key found for this signature in database
GPG Key ID: A394E332255A6173
10 changed files with 105 additions and 0 deletions

View File

@ -22,6 +22,7 @@
"scripts": {
"build": "tsc",
"start": "npm run build && node dist/index.js",
"production": "until false;do npm install;npm run build;node dist/index.js;sleep 1;done",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {

1
production/README.md Normal file
View File

@ -0,0 +1 @@
### misc scripts for running mempool.space production site

View File

@ -0,0 +1,19 @@
{
"HTTP_PORT": 8998,
"DB_HOST": "localhost",
"DB_PORT": 3306,
"DB_USER": "lmempool",
"DB_PASSWORD": "lmempool",
"DB_DATABASE": "lmempool",
"API_ENDPOINT": "/api/v1/",
"ELECTRS_POLL_RATE_MS": 2000,
"MEMPOOL_REFRESH_RATE_MS": 2000,
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 8,
"KEEP_BLOCK_AMOUNT": 24,
"INITIAL_BLOCK_AMOUNT": 8,
"TX_PER_SECOND_SPAN_SECONDS": 150,
"ELECTRS_API_URL": "http://[::1]:3001",
"SSL": false,
"SSL_CERT_FILE_PATH": "/etc/letsencrypt/live/mysite/fullchain.pem",
"SSL_KEY_FILE_PATH": "/etc/letsencrypt/live/mysite/privkey.pem"
}

View File

@ -0,0 +1,19 @@
{
"HTTP_PORT": 8999,
"DB_HOST": "localhost",
"DB_PORT": 3306,
"DB_USER": "mempool",
"DB_PASSWORD": "mempool",
"DB_DATABASE": "mempool",
"API_ENDPOINT": "/api/v1/",
"ELECTRS_POLL_RATE_MS": 2000,
"MEMPOOL_REFRESH_RATE_MS": 2000,
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 8,
"KEEP_BLOCK_AMOUNT": 24,
"INITIAL_BLOCK_AMOUNT": 8,
"TX_PER_SECOND_SPAN_SECONDS": 150,
"ELECTRS_API_URL": "http://[::1]:3000",
"SSL": false,
"SSL_CERT_FILE_PATH": "/etc/letsencrypt/live/mysite/fullchain.pem",
"SSL_KEY_FILE_PATH": "/etc/letsencrypt/live/mysite/privkey.pem"
}

View File

@ -0,0 +1,19 @@
{
"HTTP_PORT": 8997,
"DB_HOST": "localhost",
"DB_PORT": 3306,
"DB_USER": "tmempool",
"DB_PASSWORD": "tmempool",
"DB_DATABASE": "tmempool",
"API_ENDPOINT": "/api/v1/",
"ELECTRS_POLL_RATE_MS": 2000,
"MEMPOOL_REFRESH_RATE_MS": 2000,
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 8,
"KEEP_BLOCK_AMOUNT": 24,
"INITIAL_BLOCK_AMOUNT": 8,
"TX_PER_SECOND_SPAN_SECONDS": 150,
"ELECTRS_API_URL": "http://[::1]:3002",
"SSL": false,
"SSL_CERT_FILE_PATH": "/etc/letsencrypt/live/mysite/fullchain.pem",
"SSL_KEY_FILE_PATH": "/etc/letsencrypt/live/mysite/privkey.pem"
}

12
production/mempool-install-all Executable file
View File

@ -0,0 +1,12 @@
#!/usr/local/bin/zsh
for site in mainnet liquid testnet
do
git clone https://github.com/mempool/mempool "${HOME}/${site}"
cd "${HOME}/${site}/backend/"
cp "../production/mempool-config.${site}.json" "mempool-config.json"
npm install
npm run build
cd "${HOME}/${site}/frontend/"
npm install
npm run build
done

9
production/mempool-start-all Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/zsh
for site in mainnet liquid testnet
do
cd "${HOME}/${site}/backend/"
screen -dmS "${site}" npm run production
done
#cd "${HOME}/webhook/"
#screen -dmS webhook ./start

25
production/mempool-upgrade-all Executable file
View File

@ -0,0 +1,25 @@
#!/usr/local/bin/zsh -x
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$HOME/bin
[ -f $HOME/lock ] && exit 1
touch $HOME/lock
echo 'rebuilding mempool sites'|wall
for site in mainnet liquid testnet
do
cd "$HOME/${site}"
git pull origin master
hash=$(git rev-parse HEAD)
cd "$HOME/${site}/frontend"
npm run build
rsync -av ./dist/mempool/* "${HOME}/public_html/${site}/"
cd "$HOME/${site}/backend"
npm run build
done
ps uaxw|grep 'node dist/index'|grep -v grep|awk '{print $2}'|xargs -n 1 kill
keybase chat send --channel dev mempool "All mempool sites updated to ${hash}"
rm "$HOME/lock"