Hive-Engine Witness Setup, Part 2 - Setting Up The Server And Hive-Engine Witness Node

This is the second part of the Hive-Engine Witness Setup story. You cant find "Hive-Engine Witness Setup, Part 1 - Choosing The VPS Host" here.


Setting Up The Server

Remember, in the first part I ordered and received Time4VPS 8 GB Linux server ... Now, I'll install the OS and run the node setup script.


Sunday afternoon, 15:53.

1.  After logging into the client area and clicking on the Manage button ...

2.  Changing the hostname

3.  Installing the OS

Choosing Ubuntu 20.04.

You can run the initial script too!

I will jump on this wagon and enter the script provided by @blervin :)

Remember to enter your public signing key and Hive username and the end of the script!

#####################
## SET WITNESS KEY ##
#####################
cat > /var/$SERVER_NAME/.env << EOF
ACTIVE_SIGNING_KEY=5K...
ACCOUNT=ervin-lemark

Like this:

I also generated an ssh key and saved it in the interface.

Now It's finally time to click the Install button. It's 17:22 server local time. Lithuania is an hour ahead of Central Europe.

Three minutes later ...

image.png

Starting putty and entering the connection data along with the private ssh key ...

I am in!

Checking the log ...

It's doing the mongo magic ...

Now I really need to wait for the script to finish copying the database and catching the blocks. 50% of the database fetch done in three minutes.

Reading the blockchain data ...

At 18:28 server time, still working on data...

At 18:51

image.png

... Three hours later, after a great dinner - pizza and beer - and a doggy walk, I am back behind the computer and ...

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for steemsmartcontracts@1.1.0: wanted: {"node":">=13.7.0","npm":">=6.13.6"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm ERR! notsup Not compatible with your version of node/npm: steemsmartcontracts@1.1.0
npm ERR! notsup Not compatible with your version of node/npm: steemsmartcontracts@1.1.0
npm ERR! notsup Required: {"node":">=13.7.0","npm":">=6.13.6"}
npm ERR! notsup Actual:   {"npm":"6.14.4","node":"10.19.0"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2021-02-07T16_55_49_565Z-debug.log
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
/usr/local/bin/pm2-runtime -> /usr/local/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ pm2@4.5.4
added 202 packages from 197 contributors in 26.293s
Rules updated
Rules updated (v6)

Eh, some compatibility error - steemsmartcontracts module with node and npm

npm ERR! notsup Unsupported engine for steemsmartcontracts@1.1.0: wanted: {"node":">=13.7.0","npm":">=6.13.6"} (current: {"node":"10.19.0","npm":"6.14.4"})

I am a bit disappointed since everything so far was running so smoothly.

OK, first, I'll need to check how far the script came, mark the point of failure, upgrade node and npm, then rerun the remaining steps. Later ...

At 10 PM ... This version mismatch has to be in the node setup section. OK, I have two options now since Superbowl starts in less than three hours and I sort of wish to watch the game.

  1. postpone the solution until tomorrow
  2. cancel the script and continue manually

What should I do?


A couple of hours later while waiting for the Superbowl match to begin ...

I guess that node version is the culprit. Let's check the assumption.

root@hive-engine:~# npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
+ n@7.0.1

root@hive-engine:~# n latest
  installing : node-v15.8.0
       mkdir : /usr/local/n/versions/node/15.8.0
       fetch : https://nodejs.org/dist/v15.8.0/node-v15.8.0-linux-x64.tar.xz
   installed : v15.8.0 (with npm 7.5.1)

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /usr/local/bin/node
To reset the command location hash either start a new shell, or execute PATH="$PATH"

Is this enough?

Hmm, I might have been wrong. After inspecting the witness directory I realized that the script finished its work. Including editing config.json and setting the values in .env file.

Is it safe now to start the node? Let's do it!

root@hive-engine:/var/hewitness# pm2 start app.js --no-treekill --kill-timeout 10000 --no-autorestart --name engwit

                        -------------

__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
 _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
  _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
   _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
    _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
     _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
      _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
       _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
        _\///______________\///______________\///__\///////////////__


                          Runtime Edition

        PM2 is a Production Process Manager for Node.js applications
                     with a built-in Load Balancer.

                Start and Daemonize any application:
                $ pm2 start app.js

                Load Balance 4 instances of api.js:
                $ pm2 start api.js -i 4

                Monitor in production:
                $ pm2 monitor

                Make pm2 auto-boot at server restart:
                $ pm2 startup

                To go further checkout:
                http://pm2.io/


                        -------------

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /var/hewitness/app.js in fork_mode (1 instance)
[PM2] Done.
 id   name       namespace    version  mode     pid       uptime       status     cpu       mem       user      watching 
 0    engwit     default      1.1.0    fork     63285     0s      0     online     0%        30.3mb    root      disabled 

Checking the log ...

root@hive-engine:/var/hewitness# pm2 logs

Playing catch with the blockchain train ...

2021-02-08 01:07:16 info: [Streamer] head_block_number 51134890 currentBlock 50996651 Hive blockchain is 138239 blocks ahead
2021-02-08 01:08:47 info: [Streamer] head_block_number 51134920 currentBlock 50997930 Hive blockchain is 136990 blocks ahead
2021-02-08 01:09:07 info: [Streamer] head_block_number 51134927 currentBlock 50998221 Hive blockchain is 136706 blocks ahead
...
2021-02-08 01:18:52 info: [Streamer] head_block_number 51135118 currentBlock 51006944 Hive blockchain is 128174 blocks ahead

Time for the Superbowl :) In the morning the chain will be in the green.

Ps: I hope it's not too boring for you and that you didn't fall asleep while trying to follow these ramblings. I simply want to document the procedure as it happens. All mishaps included. Thank you.


Better and better

H2
H3
H4
3 columns
2 columns
1 column
5 Comments
Ecency