Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sateetje authored Jul 5, 2021
1 parent 660cfa6 commit 9fc35b0
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# Usage: update.sh

# VARS:
DOCKERIMAGE="proximax/proximax-sirius-chain:v0.6.9-buster"
PEERS="http://207.180.195.181/peers-p2p.json"
DEFAULTPATH="/mnt/proximax/"

[[ ! -z "$1" ]] && DEFAULTPATH=$1
[[ ! -d $DEFAULTPATH ]] && { echo "Directory $DEFAULTPATH doesn't exists! Use update.sh {path}" ; exit 1 ; }

cd $DEFAULTPATH

# Loop through all folders starting with public-mainnet-peer-package*
i=1
for NODEFOLDER in $(find public-mainnet-peer-package* -maxdepth 0 -type d -printf '%f\n') ; do
if [[ $i -ge 2 ]]
then
echo $(date +%T) "Wait 5 minutes before updating the next node..."

sleep 300
fi

echo $NODEFOLDER

cd $NODEFOLDER

echo "Stop Docker container"
docker-compose down

echo "Replace docker image with: $DOCKERIMAGE"
sed -i "/^[[:space:]]*image:/ s|:.*|: $DOCKERIMAGE|" docker-compose.yml

echo "Download latest peers-p2p"
cd resources
curl -O $PEERS
cd ..

echo "Start Docker container"
docker-compose up -d

cd ..

i=$((i+1))
done

if [[ $i -eq 1 ]]
then
echo "No node folders found!"
else
docker container ls
fi

exit 0

0 comments on commit 9fc35b0

Please sign in to comment.