Upgrade Mempool to v2.3.0

This commit is contained in:
Taylor Helsper 2022-01-17 11:29:21 -06:00
parent 070a206a76
commit bb43410f0d
5 changed files with 26 additions and 23 deletions

View File

@ -12,6 +12,7 @@ EnvironmentFile=/mnt/hdd/mynode/settings/.btcrpc_environment
ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
ExecStartPre=/usr/bin/wait_on_docker_image_install.sh
ExecStartPre=/usr/bin/mynode_pre_mempool.sh
ExecStart=/usr/local/bin/docker-compose up
ExecStartPost=/usr/bin/mynode_post_mempool.sh

View File

@ -34,11 +34,9 @@ tar -xf /tmp/mynode_rootfs_${DEVICE_TYPE}.tar.gz -C /tmp/rootfs/
echo Done!
# Install files
if [ $IS_X86 = 1 ] || [ $IS_RASPI4_ARM64 = 1 ]; then
rsync -r -K /tmp/rootfs/out/rootfs_${DEVICE_TYPE}/* /
else
cp -rf /tmp/rootfs/out/rootfs_${DEVICE_TYPE}/* /
fi
rsync -r -K /tmp/rootfs/out/rootfs_${DEVICE_TYPE}/* /
# Update systemd service config
systemctl daemon-reload
# Sleep and sync FS
@ -46,12 +44,18 @@ echo "Syncing filesystem..."
sleep 1
sync
# Reload systemd files
systemctl daemon-reload
# Restart or reboot
if [ "$#" -ge 2 ]; then
# Restart service
if [ "$2" = "www" ]; then
echo "Restarting www service..."
systemctl restart www
elif [ "$2" = "mempool" ]; then
echo "Restarting mempool service..."
systemctl restart mempool &
elif [ "$2" = "files" ]; then
echo "Only updating files... Done."
elif [ "$2" = "reboot" ]; then

View File

@ -104,8 +104,7 @@ while true; do
cd /mnt/hdd/mynode/mempool
rm -rf data
rm -rf mysql
mkdir -p data mysql/data mysql/db-scripts
cp -f /usr/share/mynode/mempool-docker-compose.yml /mnt/hdd/mynode/docker-compose.yml
mkdir -p data mysql/data
rm -rf /opt/download/mempool
mkdir -p /opt/download/mempool
@ -114,10 +113,6 @@ while true; do
tar -xvf mempool.tar.gz
rm mempool.tar.gz
mv mempool-* mempool
cp -f mempool/mariadb-structure.sql /mnt/hdd/mynode/mempool/mysql/db-scripts/mariadb-structure.sql
# Update env variable to use latest version
sed -i "s/VERSION=.*/VERSION=$MEMPOOL_VERSION/g" /mnt/hdd/mynode/mempool/.env
docker pull mempool/frontend:${MEMPOOL_VERSION}
docker pull mempool/backend:${MEMPOOL_VERSION}

View File

@ -15,19 +15,22 @@ while [ 1 ]; do
isRunning=$(docker inspect --format="{{.State.Running}}" mempool_db_1)
if [ "$isRunning" == "true" ]; then
sleep 5s
blocks=$(docker exec -i mempool_db_1 mysql -uroot -padmin -D mempool -e "show tables;" | grep blocks)
if [[ "$blocks" == *"blocks"* ]]; then
echo "Mempool DB initialized!"
exit 0;
fi
if [ $IS_RASPI == 1 ]; then
echo "Initializing mempool db..."
docker exec -i mempool_db_1 bash -c "mysql -u root -padmin mempool" </mnt/hdd/mynode/mempool/mysql/db-scripts/mariadb-structure.sql
if [ $? -eq 0 ]; then
echo "Import success. Restart service by exiting 1."
exit 1
# Initialize database
databases=$(docker exec -i mempool_db_1 mysql -uroot -padmin -e "SHOW DATABASES;")
if [[ "$databases" == *"information_schema"* ]]; then # Check DB is responding
if [[ "$databases" == *"mempool"* ]]; then
# DB found, exit 0
exit 0
else
# Setup a database for mempool
$(docker exec -i mempool_db_1 mysql -uroot -padmin -e "drop database mempool;")
$(docker exec -i mempool_db_1 mysql -uroot -padmin -e "create database mempool;")
$(docker exec -i mempool_db_1 mysql -uroot -padmin -e "grant all privileges on mempool.* to 'mempool'@'%' identified by 'mempool';")
exit 0
fi
fi
else
echo "Waiting to initialize mempool DB..."
sleep 10s

View File

@ -32,7 +32,7 @@ ELECTRS_VERSION="v0.9.3"
ELECTRS_VERSION_FILE=/home/bitcoin/.mynode/electrs_version
ELECTRS_LATEST_VERSION_FILE=/home/bitcoin/.mynode/electrs_version_latest
MEMPOOL_VERSION="v2.2.2"
MEMPOOL_VERSION="v2.3.0"
MEMPOOL_VERSION_FILE=/mnt/hdd/mynode/settings/mempool_version
MEMPOOL_LATEST_VERSION_FILE=/mnt/hdd/mynode/settings/mempool_version_latest