diff --git a/production/mempool-config.bisq.json b/production/mempool-config.bisq.json index f4b2e1480..6eef30192 100644 --- a/production/mempool-config.bisq.json +++ b/production/mempool-config.bisq.json @@ -12,8 +12,8 @@ "MIN_PRIORITY": "debug" }, "CORE_RPC": { - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4000" @@ -22,9 +22,9 @@ "ENABLED": false, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "bmempool", - "PASSWORD": "bmempool", - "DATABASE": "bmempool" + "USERNAME": "mempool_bisq", + "PASSWORD": "mempool_bisq", + "DATABASE": "mempool_bisq" }, "STATISTICS": { "ENABLED": true, diff --git a/production/mempool-config.liquid.json b/production/mempool-config.liquid.json index dc29af452..1d3e30731 100644 --- a/production/mempool-config.liquid.json +++ b/production/mempool-config.liquid.json @@ -13,13 +13,13 @@ }, "CORE_RPC": { "PORT": 7041, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__ELEMENTS_RPC_USER__", + "PASSWORD": "__ELEMENTS_RPC_PASS__" }, "SECOND_CORE_RPC": { "PORT": 8332, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4001" @@ -28,9 +28,9 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "lmempool", - "PASSWORD": "lmempool", - "DATABASE": "lmempool" + "USERNAME": "mempool_liquid", + "PASSWORD": "mempool_liquid", + "DATABASE": "mempool_liquid" }, "STATISTICS": { "ENABLED": true, diff --git a/production/mempool-config.liquidtestnet.json b/production/mempool-config.liquidtestnet.json index 17081a8ea..8805f4045 100644 --- a/production/mempool-config.liquidtestnet.json +++ b/production/mempool-config.liquidtestnet.json @@ -13,13 +13,13 @@ }, "CORE_RPC": { "PORT": 7040, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__ELEMENTS_RPC_USER__", + "PASSWORD": "__ELEMENTS_RPC_PASS__" }, "SECOND_CORE_RPC": { "PORT": 8332, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4004" diff --git a/production/mempool-config.mainnet.json b/production/mempool-config.mainnet.json index 49ce69479..2be5c565c 100644 --- a/production/mempool-config.mainnet.json +++ b/production/mempool-config.mainnet.json @@ -15,13 +15,13 @@ }, "CORE_RPC": { "PORT": 8332, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "SECOND_CORE_RPC": { "PORT": 8302, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4000" diff --git a/production/mempool-config.signet.json b/production/mempool-config.signet.json index 57246160c..5fb395dbe 100644 --- a/production/mempool-config.signet.json +++ b/production/mempool-config.signet.json @@ -13,8 +13,8 @@ }, "CORE_RPC": { "PORT": 38332, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4003" @@ -23,9 +23,9 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "smempool", - "PASSWORD": "smempool", - "DATABASE": "smempool" + "USERNAME": "mempool_signet", + "PASSWORD": "mempool_signet", + "DATABASE": "mempool_signet" }, "STATISTICS": { "ENABLED": true, diff --git a/production/mempool-config.testnet.json b/production/mempool-config.testnet.json index e96689d06..b17fcd98e 100644 --- a/production/mempool-config.testnet.json +++ b/production/mempool-config.testnet.json @@ -13,8 +13,8 @@ }, "CORE_RPC": { "PORT": 18332, - "USERNAME": "foo", - "PASSWORD": "bar" + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:4002" @@ -23,9 +23,9 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "tmempool", - "PASSWORD": "tmempool", - "DATABASE": "tmempool" + "USERNAME": "mempool_testnet", + "PASSWORD": "mempool_testnet", + "DATABASE": "mempool_testnet" }, "STATISTICS": { "ENABLED": true, diff --git a/production/mempool-install-all b/production/mempool-install-all deleted file mode 100755 index 1295de36c..000000000 --- a/production/mempool-install-all +++ /dev/null @@ -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 diff --git a/production/mempool-upgrade-all b/production/mempool-upgrade-all index 3aecdbd93..75cd03313 100755 --- a/production/mempool-upgrade-all +++ b/production/mempool-upgrade-all @@ -4,6 +4,12 @@ HOSTNAME=$(hostname) LOCKFILE="${HOME}/lock" 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 echo "upgrade already running? check lockfile ${LOCKFILE}" exit 1 @@ -42,6 +48,9 @@ build_frontend() echo "[*] Building frontend for ${site}" [ -z "${HASH}" ] && 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 run build || exit 1 } @@ -52,6 +61,15 @@ build_backend() echo "[*] Building backend for ${site}" [ -z "${HASH}" ] && 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 run build || exit 1 } @@ -60,16 +78,28 @@ ship_frontend() { local site="$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" 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 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 +for target in mainnet testnet signet liquid liquidtestnet bisq;do + update_repo "${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.ops