Script Updates
With the recent release of 1.4.0, my witness did NOT just update and move on. I ran into a TON of problems and ultimately had to just start over completely with a fresh deploy.
In my work, my script was updated quite a bit and I've gotten it back into a "one-click" state. You can literally go to Digital Ocean, deploy an Ubuntu 20.10 droplet, and simply paste in the script with their User Data feature.
This does download the mongodb and restore it, which does take awhile. You can log into the server and watch the progress with this command tail -fn5 /var/log/cloud-init-output.log
Once the script is done, just type mongo
and then show dbs
to confirm the hsc database exists, and is around 15GB.
Then, just two commands:
cd /var/witness
pm2 start app.js --no-treekill --kill-timeout 10000 --no-autorestart --name engwit
You can 'watch' the logs with pm2 logs
but the real way to keep track is this:
grep ahead /root/.pm2/logs/engwit-out.log | tail
You're looking for Hive blockchain is 0 blocks ahead
and again this can take awhile.
Finally, verify everything is working node find_divergent_block.js
This will generate some output, but hopefully ends with ok
If not, you have issues and may need to start over, but if you see ok
then everything is in full working order!
Vote my witness
I appreciate all the support I've received for my witness but I have lost some votes and fallen quite a few positions so I'm actively working to build that up a bit more. You can vote for witnesses very easily.
The Script
#!/bin/bash
###################
## SET VARIABLES ##
###################
SERVER_NAME="witness"
GIT_REPO="https://github.com/hive-engine/steemsmartcontracts.git"
GIT_TAG=he_v1.4.0
##################
## INIT UPDATES ##
##################
apt-get update \
-o Dpkg::Options::=--force-confold \
-o Dpkg::Options::=--force-confdef \
-y --allow-downgrades --allow-remove-essential --allow-change-held-packages
####################
## INSTALL BASICS ##
####################
apt install git -y
apt install ufw -y
################
## CLONE REPO ##
################
mkdir -p /var/$SERVER_NAME
cd /var/$SERVER_NAME
git clone --recursive --branch $GIT_TAG $GIT_REPO ./
#####################
## INSTALL MONGODB ##
#####################
cd /var/$SERVER_NAME
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt-get update -y
apt-get -y -o Dpkg::Options::="--force-confold" install mongodb-org
sed -i '/replication/a \ \ \ replSetName: "rs0"' /etc/mongod.conf
sed -i 's/#replication/replication/g' /etc/mongod.conf
systemctl stop mongod
systemctl start mongod
mongo --eval "rs.initiate()"
##############
## SET SWAP ##
##############
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
##################
## INSTALL NODE ##
##################
curl -sL https://deb.nodesource.com/setup_15.x | bash -
apt-get install -y nodejs
apt-get -y install npm
#################
## FINAL SETUP ##
#################
cd /var/$SERVER_NAME
npm install dotenv
npm i
npm i -g pm2
sed -i 's/"startHiveBlock": 41967000/"startHiveBlock": 54107973/g' config.json
sed -i 's/"witnessEnabled": false/"witnessEnabled": true/g' config.json
ufw allow 5001
#####################
## SET WITNESS KEY ##
#####################
cat > /var/$SERVER_NAME/.env << EOF
ACTIVE_SIGNING_KEY=5K...
ACCOUNT=youraccount
EOF
################
## RESTORE DB ##
################
mongo --eval "rs.initiate()"
systemctl restart mongod
cd /var/$SERVER_NAME
wget https://cdn.rishipanthee.com/hiveengine/hsc_live.archive
systemctl restart mongod
mongorestore --gzip --archive=hsc_live.archive
Congratulations @blervin! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :
Your next target is to reach 59000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!