Deploying Hive Node Service on Docker based on Ubuntu-18.04

Zlong
3 min readJan 14, 2021

As a production environment, we strongly recommend using Hive Node service on Linux system, especially on Ubuntu or Debian LTS version.

Here is a detailed guide that will walk you through the entire process of deploying a Hive Node in Dockers on the Ubuntu 18.04 LTS.

1. Python3 and Docker are required

Before beginning the deployment, you need to be sure that Python3 and Docker have already been shipped on the target server. Generally, there is python3.6 already built-into the Ubuntu 18.04. About Docker, run the snippet of commands below to install Docker when no Docker found:

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo usermod -aG docker your-userid

Notice: here your-userid is the user identity you login onto the target system.

2. Download source package

After the Docker environment having been settled, you will need to logout from the target server and login again to make Docker work effectively. Remember that you will be unable to carry out the installation unless Python3 and Docker are being shipped.

You can now download the released source code package from here and unpack it onto your target server, or just run the command below:

$ curl -fsL https://github.com/elastos/Elastos.NET.Hive.Node/archive/release-v2.0.1.tar.gz -o release.tar.gz
$ tar -xzvf release.tar.gz

3. Start the installation

Enter into the source code folder, directly run the command to install the Hive node service:

$ /bin/bash -c “$(curl -fsSL https://www.trinity-tech.io/hivenode/scripts/run.sh)" -s docker

Because we introduced Elastos DIDs into our sign-in system on Hive Node, you need to input mnemonic when deciding to deploy a Hive Node on your own. Recommend to use elastOS application to generate a new DID and export the mnemonic to use it here. And also need to be noticed that this DID must have been published on DID Sidechain.

As you input the mnemonic, you will be asked to input passphrase and secret next. The passphrase would be the one generated along with the mnemonic if you were requiring with the option passphrase. If no passphrase was bred with the mnemonic, skip the input. You can input any strong password string when asking you to enter the secret.

4. Checking the installation

After that, get a coffee and wait for the installation to finish. It would not take you much time. As the whole process is completed, you can use the command to check the installation succeeded or not.

$ docker ps

In the case of success, you will see two docker instances running on your target server as hive-node and hive-mongo.

There also is a simple API to check whether the Hive node service is running correctly:

$ curl -XPOST -H “Content-Type: application/json” -d ‘{“key”:”value”}’ http://YOUR-HIVE-NODE-IP:5000/api/v1/echo

With success, you will get a response something like:

{“key”:”value”}

5. Talking about ‘.env’

Under the directory of the Hive Node source code, you can see the whole content of config file .env displayed below:

DID_RESOLVER=http://api.elastos.io:20606
ELA_RESOLVER=http://api.elastos.io:20336

DID_MNEMONIC="street embark patrol frequent insect slot good model list armor absorb ripple"
DID_PASSPHRASE=
DID_STOREPASS=password

HIVE_DATA = ./data

HIVE_SENTRY_DSN =

HIVE_PAYMENT_CONFIG=./payment_config.json

MONGO_HOST=hive-mongo
MONGO_PORT=27017

DID_INFO_DB_NAME=hive_manage_info

RCLONE_CONFIG_FILE_DIR=./.rclone

# hive node release
HIVE_VERSION=1.0.0
HIVE_COMMIT_HASH=279b15650a86b16dcba289e74a09290ff225c69a

Here the Hive node service uses the MainNet of ELA Chain and DID Sidechain. In this case, you will need a mnemonic to import the DID being published on MainNet of DID Sidechain already. While planning to deploy a Hive node working on TestNet, you must fill a mnemonic to import the DID being published on TestNet of DID Sidechain. Keep in mind that the resolver addresses for ELA chain and DID Sidechain should keep consistent with the ledger environment on which the DID has been published.

More advanced configuration available later

Now, the service entry-point of the Hive node would look like as:
http://YOUR-SERVER-IP:5000
You can set it up with a Nigix server as a gateway and enable the use of the https protocol to secure the communication between client and server. We will document a specific guiding article for this configuration later.

In the last, we will highly appreciate the click to star our repository of Hive Node at https://github.com/elastos/Elastos.NET.Hive.Node. Hope this time we can stand together for taking back the control rights of our data.

--

--