Skywire Armbian OrangePi Prime

Check IP in DHCP server (on router) and login with PuTTY use default armbian username/password: root/1234

login as: root
root@192.168.1.4's password:
You are required to change your password immediately (root enforced)
  ___                               ____  _   ____       _
 / _ \ _ __ __ _ _ __   __ _  ___  |  _ \(_) |  _ \ _ __(_)_ __ ___   ___
| | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | |_) | '__| | '_ ` _ \ / _ \
| |_| | | | (_| | | | | (_| |  __/ |  __/| | |  __/| |  | | | | | | |  __/
 \___/|_|  \__,_|_| |_|\__, |\___| |_|   |_| |_|   |_|  |_|_| |_| |_|\___|
                       |___/

Welcome to ARMBIAN 5.50 user-built Ubuntu 16.04.4 LTS 4.14.52-sunxi64
System load:   0.06 0.15 0.07   Up time:       3 min
Memory usage:  4 % of 2002MB    IP:            192.168.1.4
Usage of /:    3% of 30G

New to Armbian? Check the documentation first: https://docs.armbian.com
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:


Thank you for choosing Armbian! Support: www.armbian.com

Creating a new user account. Press <Ctrl-C> to abort

Please provide a username (eg. your forename): mitjag
Trying to add user mitjag
Adding user `mitjag' ...
Adding new group `mitjag' (1000) ...
Adding new user `mitjag' (1000) with group `mitjag' ...
Creating home directory `/home/mitjag' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for mitjag
Enter the new value, or press ENTER for the default
        Full Name []: Mitja
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n]

Dear Mitja, your account mitjag has been created and is sudo enabled.
Please use this account for your daily work from now on.

root@orangepiprime:~#

Update OS packages

apt-get update
apt-get upgrade

Download and install GO lang

wget https://dl.google.com/go/go1.10.2.linux-arm64.tar.gz

tar -C /usr/local -xzf go1.10.2.linux-arm64.tar.gz

Create profile for GO binaries and add GO bin path

root@orangepiprime:~# cd /etc/profile.d/
root@orangepiprime:/etc/profile.d# vi go.sh
root@orangepiprime:/etc/profile.d# cat go.sh
#!/bin/bash
export PATH=$PATH:/usr/local/go/bin
root@orangepiprime:/etc/profile.d#

Update hostname

root@orangepiprime:/etc/profile.d# cd /etc/
root@orangepiprime:~# cat /etc/hostname
orangepiprime1
root@orangepiprime:~#

Reboot and login as non root user

Test if go path is ok, check version

mitjag@orangepiprime1:~$ go version
go version go1.10.2 linux/arm64
mitjag@orangepiprime1:~$

Check if git installed

mitjag@orangepiprime1:~$ git version
git version 2.7.4
mitjag@orangepiprime1:~$

Create user bash profile for GOPATH and GOBIN env variables

mitjag@orangepiprime1:~$ vi .bash_profile
mitjag@orangepiprime1:~$ cat .bash_profile
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
mitjag@orangepiprime1:~$

Relogin to reload profile

Install Skywire following instructions from github

mitjag@orangepiprime1:~$ mkdir -p $GOPATH/src/github.com/skycoin
mitjag@orangepiprime1:~$ cd $GOPATH/src/github.com/skycoin
mitjag@orangepiprime1:~/go/src/github.com/skycoin$ git clone https://github.com/skycoin/skywire.git
Cloning into 'skywire'...
remote: Counting objects: 4876, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 4876 (delta 3), reused 19 (delta 3), pack-reused 4851
Receiving objects: 100% (4876/4876), 24.90 MiB | 1.14 MiB/s, done.
Resolving deltas: 100% (1500/1500), done.
Checking connectivity... done.
mitjag@orangepiprime1:~/go/src/github.com/skycoin$ cd $GOPATH/src/github.com/skycoin/skywire/cmd
mitjag@orangepiprime1:~/go/src/github.com/skycoin/skywire/cmd$ go install ./...

Install tmux to detach from running process

sudo apt install tmux

Test run Skywire manager and node:

mitjag@orangepiprime1:~/go/src/github.com/skycoin/skywire/cmd$ cd $GOPATH/bin
mitjag@orangepiprime1:~/go/bin$ ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager

mitjag@orangepiprime1:~/go/src/github.com/skycoin/skywire/cmd$ cd $GOPATH/bin
mitjag@orangepiprime1:~/go/bin$ ./node -connect-manager -manager-address 127.0.0.1:5998 -manager-web 127.0.0.1:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001

If runing node on secondary board run node with IP from manager

./node -connect-manager -manager-address 192.168.1.12:5998 -manager-web 192.168.1.12:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001

Validate if ports are listening (8000 is manager port)

mitjag@orangepiprime1:~/go/src/github.com/skycoin/skywire/cmd$ netstat -tnlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::8000                 :::*                    LISTEN      18954/manager
tcp6       0      0 :::5000                 :::*                    LISTEN      18969/node
tcp6       0      0 :::5998                 :::*                    LISTEN      18954/manager

Now you can connect to your manager with browser http://MANAGER_IP:8000 and login with password 1234

To run Skywire manager and node as a service. There is only one Skywire manager required per cluster.

Set up profile for Go path.

root@orangepiprime:/etc/profile.d# pwd
/etc/profile.d
root@orangepiprime:/etc/profile.d# ls
activate_psd_user.sh  bash_completion.sh  check_first_login_reboot.sh  check_first_login.sh  go.sh  ssh-title.sh
root@orangepiprime:/etc/profile.d# ll
total 36
drwxr-xr-x  2 root root 4096 Apr 17 18:12 ./
drwxr-xr-x 93 root root 4096 Apr 17 18:02 ../
-rw-r--r--  1 root root  705 Apr  3 19:14 activate_psd_user.sh
-rw-r--r--  1 root root  663 May 18  2016 bash_completion.sh
-rw-r--r--  1 root root  212 Apr  3 19:14 check_first_login_reboot.sh
-rw-r--r--  1 root root 6012 Apr  3 19:14 check_first_login.sh
-rw-r--r--  1 root root  122 Apr 17 18:12 go.sh
-rw-r--r--  1 root root  174 Apr  3 19:14 ssh-title.sh
root@orangepiprime:/etc/profile.d# cat go.sh
#!/bin/bash
export PATH=$PATH:/usr/local/go/bin
#export GOBIN=$GOPATH/bin
export GOPATH=/root/go
export GOBIN=$GOPATH/bin
root@orangepiprime:/etc/profile.d#

Create service units for manager and node.

root@orangepiprime:/etc/systemd/system# cat skywire-manager.service
[Unit]
Description=Skywire Manager
After=network.target

[Service]
User=mitjag
Group=mitjag
WorkingDirectory=/root/go/bin
ExecStart=/root/go/bin/manager -web-dir /root/go/src/github.com/skycoin/skywire/static/skywire-manager
KillMode=process
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=manager

[Install]
WantedBy=multi-user.target
root@orangepiprime:/etc/systemd/system#

Replace 192.168.1.12 with your manager IP.

root@orangepiprime:/etc/systemd/system# cat skywire-node.service
[Unit]
Description=Skywire Node
After=network.target

[Service]
User=mitjag
Group=mitjag
WorkingDirectory=/home/mitjag/go/bin
ExecStart=/home/mitjag/go/bin/node -connect-manager -manager-address 192.168.1.12:5998 -manager-web 192.168.1.12:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001
KillMode=process
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=manager
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
root@orangepiprime:/etc/systemd/system#

Reload and enable services.

root@orangepiprime:/etc/systemd/system# systemctl daemon-reload
root@orangepiprime:/etc/systemd/system# systemctl enable skywire-manager.service
root@orangepiprime:/etc/systemd/system# systemctl enable skywire-node.service