Hornet Node (Chrysalis)

Hornet Installation


1. Create user

Code
sudo useradd -s /bin/bash -m hornet


2. Install packages

Code
sudo apt update && sudo apt install build-essential git snapd -y


3. Install go-package

Code
sudo snap install go --classic


4. Clone the hornet repository

Code
git clone https://github.com/gohornet/hornet.git /var/lib/hornet


5. Change directory to hornet

Code
cd /var/lib/hornet


6. Change git branch

Code
git checkout develop


7. Build hornet file

Code
go build -o hornet


8. Change file/folder owner permissions

Code
sudo chown -R hornet:hornet /var/lib/hornet


9. Download service template file

Code
sudo wget https://raw.githubusercontent.com/tanglebay/tutorials/master/hornet-chrysalis/hornet.service -O /lib/systemd/system/hornet.service 


10. Reload the system daemon

Code
sudo systemctl daemon-reload


11. Enable the hornet service

Code
sudo systemctl enable hornet


12. Generate salt/hash for the dashboard authentication

Code
./hornet tool pwdhash

copy the salt and the hash into the config (and change the user name)

Code
nano config_chrysalis_testnet.json
Code
  "dashboard": {
    "bindAddress": "localhost:8081",
    "auth": {
      "sessionTimeoutInMinutes": 4320,
      "username": "admin",
      "passwordHash": "0000000000000000000000000000000000000000000000000000000000000000",
      "passwordSalt": "0000000000000000000000000000000000000000000000000000000000000000"
    }
  },


13. (Optional) Edit Peering.json

Code
sudo nano peering.json

Add your neighbors into the peering.json

Alternatively, the neighbors can be added via the dashboard, so there is no need to edit peering.json.

Install reverse proxy with SSL

To access the Dashboard over a secure SSL connection, you need a reverse proxy. In this step, we will do the setup for this.

It is important that port 80 is enabled to the outside world so that we can apply for a free SSL certificate using Letencrypt.


1. Update packages and install needed packages

Code
sudo apt update && sudo apt install apache2-utils software-properties-common certbot python3-certbot-nginx -y


2. Request the certificate with the help of Certbot at LetEncrypt. At domain.tld you have to replace it with your own domain (which points to the IP address of your server).

Code
sudo certbot --nginx -d domain.tld

First you have to enter your email address, this is required and should be set accordingly. Afterwards you have to accept the conditions with A and in the last step you want to receive your own e-mail information, so you choose N there.


3. Download certificate template and replace existing one

Code
sudo rm -rf /etc/nginx/sites-enabled/default && sudo wget https://raw.githubusercontent.com/tanglebay/tutorials/master/hornet-chrysalis/nginx.template -O /etc/nginx/sites-enabled/default


4. Open & edit configuration file

Code
sudo nano /etc/nginx/sites-enabled/default

Here you have to press the key combination ALT + R for the search-replace function. Then enter domain.tld for the search and then your domain for the replace. Then select A (All) to replace all entries directly. Finally save the configuration file.


5. Restart reverse proxy

Code
sudo systemctl restart 

Now you can access your dashboard from your domain!

Update Hornet


1. Stop the hornet node

Code
sudo systemctl stop hornet


2. Update your Hornet node (you must run this command with the Hornet user sudo su hornet!)

Code
curl -sL https://raw.githubusercontent.com/tanglebay/tutorials/master/hornet-chrysalis/update-hornet.sh | bash -


2.1 (OPTIONAL) If you want to keep your database and configuration, you can do this with the following command

Code
curl -sL https://raw.githubusercontent.com/tanglebay/tutorials/master/hornet-chrysalis/update-hornet.sh | bash -s -- -noreset


3. (OPTIONAL) Copy needed configuration data from the backup into the new configuration file. The files can be found in the following directory:

Code
nano /var/lib/hornet/backup


4. Start your hornet node

Code
sudo systemctl start hornet