Skywire mainet update for DIY
By: Mitja Gomboc
Tags: Skycoin, DIY, Systemd, Skywire, Armbian

Skywire mainet has been released so it is time to update your DIY Skywire miners.

Skywire hypervisor

Here is the latest code including building instructions on GitHub: https://github.com/SkycoinProject/skywire-mainnet

There are few simple steps to make the udate:

Stop and disable old Skywire services Update GO lang Build skywire-mainet Generate configuration files Setup startup services

1. Stop and disable old Skywire services

Stop node and manager. Usually only the first node is running skywire-manager. Also disable the services.

systemctl stop skywire-node.service

systemctl disable skywire-node.service systemctl stop skywire-manager.service

systemctl disable skywire-manager.service

2. Update GO lang

You can check current version with command:

go version

Depending on your board you may need 32 or 64 bit version of go lang. If you are using version provided from distribution you can update your system or uninstall go lang system packages and install manually.

ARM 64 bit version e.g. for Orange Pi boards

curl https://dl.google.com/go/go1.14.2.linux-arm64.tar.gz -o /root/go1.14.2.linux-arm64.tar.gz

or

ARM 32 bit version e.g. for Raspberry Pi boards

curl https://dl.google.com/go/go1.14.2.linux-armv6l.tar.gz -o /root/go1.14.2.linux-armv6l.tar.gz

If you have installed previous version than you have go folder in /usr/local

root@skywirenode:~# cd /usr/local/

root@skywirenode:/usr/local# ls

bin etc games go include lib man sbin share src

Remove it

rm -fr /usr/local/go

Install new version

root@skywirenode:~# tar xzvf /root/go1.14.2.linux-arm64.tar.gz -C /usr/local/

root@skywirenode:~# go version

go version go1.14.2 linux/arm64

If it is not working check your go profile: /etc/profile.d/go.sh

root@skywirenode:~# cat /etc/profile.d/go.sh

#!/bin/bash

export PATH=$PATH:/usr/local/go/bin

Re-login is required to reload the profiles.

Also verify your user (non root) has new go lang version.

mitja@skywirenode:~$ go version

go version go1.14.2 linux/arm64

3. Build skywire-mainet

This is just copy/paste from GitHub instructions.



mitja@skywirenode:~$ cd skywire-mainnet

mitja@skywirenode:~$ make build

mitja@skywirenode:~$ make install mitja@skywirenode:~$ git clone https://github.com/SkycoinProject/skywire-mainnet.git mitja@skywirenode:~$ cd skywire-mainnetmitja@skywirenode:~$ make buildmitja@skywirenode:~$ make install

4. Generate configuration files

Visor configuration (skywire node)

mitja@skywirenode:~/skywire-mainnet$ ./skywire-cli visor gen-config

[2020-04-26T08:00:11Z] INFO [skywire-cli]: No 'output' set; using default path: /home/mitja/skywire-mainnet/skywire-config.json

[2020-04-26T08:00:11Z] INFO [pathutil]: Wrote 1512 bytes to /home/mitja/skywire-mainnet/skywire-config.json

{

"version": "",

"key_pair": {

"public_key": "VISOR_PUBLIC_KEY",

"secret_key": ...

All public keys are in HEX format e.g.: 016c84d834037906926019c14561af0efd08f6766de4bfba770bd24bf575e48f1a

I suggest saving all your key pairs (public key and secret key) for all the visor nodes and for hypervisor manager. This is in case if you need to restore the nodes with same public keys. Keep in mind you can always generate new and update configurations accordingly.

Hypervisor configuration (skywire manager) you only need one for UI web interface.

mitja@skywirenode:~/skywire-mainnet$ ./hypervisor gen-config

[2020-04-26T08:04:42Z] INFO [hypervisor]: no 'output,o' flag is empty, using default path: /home/mitja/skywire-mainnet/hypervisor-config.json

[2020-04-26T08:04:42Z] INFO [pathutil]: Wrote 731 bytes to /home/mitja/skywire-mainnet/hypervisor-config.json

{

"public_key": "HYPERVISOR_PUBLIC_KEY",

"secret_key":...

To connect you visor to hypervisor you have to add a part of JSON configuration to your visor configuration (skywire-config.json).

Here is a JSON key you have to update:

"hypervisors": [],

Update this with your hypervisor public key JSON object:

"hypervisors": [

{

"public_key": "HYPERVISOR_PUBLIC_KEY",

"address": "127.0.0.1:7080"

}

],

Now you can test your configuration run in one terminal ./hypervisor and in another ./skywire-visor

Now you visor node should show up on uptime tracker (only your visors node public key shows up here, hypervisor is just a manager): https://uptime-tracker.skywire.skycoin.com/visors

This should run your visor node and hypervisor manager (accessible on your node IP address on port 8000 e.g. http://192.168.1.101:8000 use your hypervisor node IP here). If you are remote accessing via SSH you can always add a SSH tunnel and access from your network (http://localhost:8000).

Example PuTTY SSH tunnel setup e.g. 192.168.1.101 (replace with your hypervsior IP)

Stop your visor and hypervisor using Ctrl+C. As we will setup to run it as a service.

5. Setup startup services

Login as root or use sudo commands.

For Skywire visor service create file skywire-visor.service in folder /etc/systemd/system

Update username (mitja) with your username.

[Unit]

Description=Skywire mainnet skywire-visor

After=network.target [Service]

User=mitja

Group=mitja

WorkingDirectory=/home/mitja/skywire-mainnet

ExecStart=/home/mitja/skywire-mainnet/skywire-visor

KillMode=process

StandardOutput=syslog

StandardError=syslog

SyslogIdentifier=visor

Restart=on-failure

RestartSec=10 [Install]

WantedBy=multi-user.target

Run commands

systemctl daemon-reload

systemctl enable skywire-visor

systemctl start skywire-visor

Additional Hypervisor service. This is only running on one of the nodes or on dedicated node. Create file skywire-hypervisor.service in folder /etc/systemd/system

Keep in mind for claiming rewards for all 8 DIY nodes the FAQ states.

The Skywire Hypervisor must not be running at all times for the Skywire Visors to work properly. It simply serves as a UI access point to manage your visors

Here you can read more about it https://github.com/SkycoinProject/skywire-mainnet/wiki/Skywire-Mainnet-Update-FAQ

So it is advised to run in Hypervisor on dedicated node or your local machine.

Update username (mitja) with your username.

[Unit]

Description=Skywire mainnet hypervisor

After=network.target [Service]

User=mitja

Group=mitja

WorkingDirectory=/home/mitja/skywire-mainnet/

ExecStart=/home/mitja/skywire-mainnet/hypervisor

KillMode=process

StandardOutput=syslog

StandardError=syslog

SyslogIdentifier=hypervisor

Restart=on-failure

RestartSec=10 [Install]

WantedBy=multi-user.target

Run commands

systemctl daemon-reload

systemctl enable skywire-hypervisor

systemctl start skywire-hypervisor

Reboot the node and check that everything is running as expected.

Otherwise happy hacking and debugging. Usually I mess up the file paths or folder paths so double check everything is OK or try out commands from service scripts with copy/paste and also check service status: systemctl status skywire-visor or systemctl status skywire-hypervisor

Enjoy the Skycoin Skywire.