Merge pull request #1346 from mempool/wiz/remove-old-mempool-install-script

Remove old install script, merge remaining stuff into upgrade script
This commit is contained in:
wiz 2022-03-12 11:59:31 +00:00 committed by GitHub
commit 800fff1744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 58 deletions

View File

@ -12,8 +12,8 @@
"MIN_PRIORITY": "debug" "MIN_PRIORITY": "debug"
}, },
"CORE_RPC": { "CORE_RPC": {
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4000" "REST_API_URL": "http://127.0.0.1:4000"
@ -22,9 +22,9 @@
"ENABLED": false, "ENABLED": false,
"HOST": "127.0.0.1", "HOST": "127.0.0.1",
"PORT": 3306, "PORT": 3306,
"USERNAME": "bmempool", "USERNAME": "mempool_bisq",
"PASSWORD": "bmempool", "PASSWORD": "mempool_bisq",
"DATABASE": "bmempool" "DATABASE": "mempool_bisq"
}, },
"STATISTICS": { "STATISTICS": {
"ENABLED": true, "ENABLED": true,

View File

@ -13,13 +13,13 @@
}, },
"CORE_RPC": { "CORE_RPC": {
"PORT": 7041, "PORT": 7041,
"USERNAME": "foo", "USERNAME": "__ELEMENTS_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__ELEMENTS_RPC_PASS__"
}, },
"SECOND_CORE_RPC": { "SECOND_CORE_RPC": {
"PORT": 8332, "PORT": 8332,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4001" "REST_API_URL": "http://127.0.0.1:4001"
@ -28,9 +28,9 @@
"ENABLED": true, "ENABLED": true,
"HOST": "127.0.0.1", "HOST": "127.0.0.1",
"PORT": 3306, "PORT": 3306,
"USERNAME": "lmempool", "USERNAME": "mempool_liquid",
"PASSWORD": "lmempool", "PASSWORD": "mempool_liquid",
"DATABASE": "lmempool" "DATABASE": "mempool_liquid"
}, },
"STATISTICS": { "STATISTICS": {
"ENABLED": true, "ENABLED": true,

View File

@ -13,13 +13,13 @@
}, },
"CORE_RPC": { "CORE_RPC": {
"PORT": 7040, "PORT": 7040,
"USERNAME": "foo", "USERNAME": "__ELEMENTS_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__ELEMENTS_RPC_PASS__"
}, },
"SECOND_CORE_RPC": { "SECOND_CORE_RPC": {
"PORT": 8332, "PORT": 8332,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4004" "REST_API_URL": "http://127.0.0.1:4004"

View File

@ -15,13 +15,13 @@
}, },
"CORE_RPC": { "CORE_RPC": {
"PORT": 8332, "PORT": 8332,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"SECOND_CORE_RPC": { "SECOND_CORE_RPC": {
"PORT": 8302, "PORT": 8302,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4000" "REST_API_URL": "http://127.0.0.1:4000"

View File

@ -13,8 +13,8 @@
}, },
"CORE_RPC": { "CORE_RPC": {
"PORT": 38332, "PORT": 38332,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4003" "REST_API_URL": "http://127.0.0.1:4003"
@ -23,9 +23,9 @@
"ENABLED": true, "ENABLED": true,
"HOST": "127.0.0.1", "HOST": "127.0.0.1",
"PORT": 3306, "PORT": 3306,
"USERNAME": "smempool", "USERNAME": "mempool_signet",
"PASSWORD": "smempool", "PASSWORD": "mempool_signet",
"DATABASE": "smempool" "DATABASE": "mempool_signet"
}, },
"STATISTICS": { "STATISTICS": {
"ENABLED": true, "ENABLED": true,

View File

@ -13,8 +13,8 @@
}, },
"CORE_RPC": { "CORE_RPC": {
"PORT": 18332, "PORT": 18332,
"USERNAME": "foo", "USERNAME": "__BITCOIN_RPC_USER__",
"PASSWORD": "bar" "PASSWORD": "__BITCOIN_RPC_PASS__"
}, },
"ESPLORA": { "ESPLORA": {
"REST_API_URL": "http://127.0.0.1:4002" "REST_API_URL": "http://127.0.0.1:4002"
@ -23,9 +23,9 @@
"ENABLED": true, "ENABLED": true,
"HOST": "127.0.0.1", "HOST": "127.0.0.1",
"PORT": 3306, "PORT": 3306,
"USERNAME": "tmempool", "USERNAME": "mempool_testnet",
"PASSWORD": "tmempool", "PASSWORD": "mempool_testnet",
"DATABASE": "tmempool" "DATABASE": "mempool_testnet"
}, },
"STATISTICS": { "STATISTICS": {
"ENABLED": true, "ENABLED": true,

View File

@ -1,23 +0,0 @@
#!/usr/local/bin/zsh
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
for site in mainnet liquid testnet bisq signet liquidtestnet
do
#git clone https://github.com/mempool/mempool "${HOME}/${site}"
mkdir -p "${HOME}/public_html/${site}/"
cd "${HOME}/${site}/backend/"
cp "${HOME}/mempool/production/mempool-config.${site}.json" "mempool-config.json"
npm install
npm run build
if [ "${site}" = "mainnet" ]
then
cd "${HOME}/${site}/frontend/"
cp "${HOME}/mempool/production/mempool-frontend-config.${site}.json" "mempool-frontend-config.json"
npm install
npm run build
rsync -av ./dist/mempool/browser/* "${HOME}/public_html/${site}/"
fi
done

View File

@ -4,6 +4,12 @@ HOSTNAME=$(hostname)
LOCKFILE="${HOME}/lock" LOCKFILE="${HOME}/lock"
REF=$(echo "${1:=origin/master}"|sed -e 's!:!/!') REF=$(echo "${1:=origin/master}"|sed -e 's!:!/!')
# get rpc credentials
BITCOIN_RPC_USER=$(grep '^rpcuser' /bitcoin/bitcoin.conf | cut -d '=' -f2)
BITCOIN_RPC_PASS=$(grep '^rpcpassword' /bitcoin/bitcoin.conf | cut -d '=' -f2)
ELEMENTS_RPC_USER=$(grep '^rpcuser' /elements/elements.conf | cut -d '=' -f2)
ELEMENTS_RPC_PASS=$(grep '^rpcpassword' /elements/elements.conf | cut -d '=' -f2)
if [ -f "${LOCKFILE}" ];then if [ -f "${LOCKFILE}" ];then
echo "upgrade already running? check lockfile ${LOCKFILE}" echo "upgrade already running? check lockfile ${LOCKFILE}"
exit 1 exit 1
@ -42,6 +48,9 @@ build_frontend()
echo "[*] Building frontend for ${site}" echo "[*] Building frontend for ${site}"
[ -z "${HASH}" ] && exit 1 [ -z "${HASH}" ] && exit 1
cd "$HOME/${site}/frontend" || exit 1 cd "$HOME/${site}/frontend" || exit 1
if [ ! -e "mempool-frontend-config.json" ];then
cp "${HOME}/mempool/production/mempool-frontend-config.${site}.json" "mempool-frontend-config.json"
fi
npm install --no-optional || exit 1 npm install --no-optional || exit 1
npm run build || exit 1 npm run build || exit 1
} }
@ -52,6 +61,15 @@ build_backend()
echo "[*] Building backend for ${site}" echo "[*] Building backend for ${site}"
[ -z "${HASH}" ] && exit 1 [ -z "${HASH}" ] && exit 1
cd "$HOME/${site}/backend" || exit 1 cd "$HOME/${site}/backend" || exit 1
if [ ! -e "mempool-config.json" ];then
cp "${HOME}/mempool/production/mempool-config.${site}.json" "mempool-config.json"
sed -i .orig \
-e "s!__BITCOIN_RPC_USER__!${BITCOIN_RPC_USER}!" \
-e "s!__BITCOIN_RPC_PASS__!${BITCOIN_RPC_PASS}!" \
-e "s!__ELEMENTS_RPC_USER__!${ELEMENTS_RPC_USER}!" \
-e "s!__ELEMENTS_RPC_PASS__!${ELEMENTS_RPC_PASS}!" \
"mempool-config.json"
fi
npm install --no-optional || exit 1 npm install --no-optional || exit 1
npm run build || exit 1 npm run build || exit 1
} }
@ -60,16 +78,28 @@ ship_frontend()
{ {
local site="$1" local site="$1"
cd "$HOME/${site}/frontend" || exit 1 cd "$HOME/${site}/frontend" || exit 1
rsync -av ./dist/mempool/browser/* "${HOME}/public_html/${site}/" || exit 1 mkdir -p "${HOME}/public_html/${site}/"
rsync -av "./dist/mempool/browser/" "${HOME}/public_html/${site}/" || exit 1
} }
export NVM_DIR="${HOME}/.nvm" export NVM_DIR="${HOME}/.nvm"
source "${NVM_DIR}/nvm.sh" source "${NVM_DIR}/nvm.sh"
for target in mainnet testnet signet liquid liquidtestnet bisq;do update_repo "${target}";done for target in mainnet testnet signet liquid liquidtestnet bisq;do
for target in mainnet testnet signet liquid liquidtestnet bisq;do build_backend "${target}";done update_repo "${target}"
for target in mainnet liquid bisq;do build_frontend "${target}";done done
for target in mainnet liquid bisq;do ship_frontend "${target}";done
for target in mainnet testnet signet liquid liquidtestnet bisq;do
build_backend "${target}"
done
for target in mainnet liquid bisq;do
build_frontend "${target}"
done
for target in mainnet liquid bisq;do
ship_frontend "${target}"
done
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.dev echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.dev
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.ops echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.ops