-
Notifications
You must be signed in to change notification settings - Fork 63
Skywire Systemd Service
This guide assumes that you have read and understood the readme.md and installed Skywire using one of the several guides on this wiki.
This guide also asumes that you've installed skywire on an armbian image and have the $GOPATH
set to /root/go
or it is installed on a raspberry image and have the $GOPATH
set to /home/pi/go
This guide outlines the necessary steps to add the Skywire software to the systemd services so that it automatically starts at boot. This way you don't have to manually start the manager & node processes each time you reboot your boards.
- Installed Skywire Software on the board and image of your choice.
- Stop the current skywire node and manager processes (if they are already running).
- Disable the currently autostart scripts that you are using (if you are using).
To install skywire check our Github page or use one fo the DIY Skywire guides.
If you are already running skywire manager and node processes you'll need to stop them as follows:
pgrep -x "manager"
This will show you the PID number, so to kill it
Setting up the Systemd service for executing Skywire at boot.
If you already installed skywire on your board and set the environment variables in .bashrc
file youll need to comment them because the official systemd services use a special file for them, so start by typing:
nano /root/.bashrc
Find the following lines and comment them by writting #
in the begining of each line, like:
#export GOROOT=/usr/local/go
#export GOPATH=$HOME/go
#export GOBIN=$GOPATH/bin
#export PATH=$PATH:$GOBIN
In order to have the systemd service files we need to pull the latest update from github, so type:
cd /root/go/src/github.com/skycoin/skywire/
git reset --hard
git pull origin master
Verify that you have the systemd service files by typing:
ls -al static/script/upgrade/
And you should see the folowing followings:
drwxr-xr-x 2 root root 4096 Dec 20 09:38 data
-rwxr-xr-x 1 root root 35429 Dec 20 09:38 one_time_upgrade
-rw-r--r-- 1 root root 4308 Dec 20 09:38 README.md
If you DON'T SEE those files do the followings. Delete the skywire folder and clone it again by typing:
cd ..
rm -rf skywire/
git clone https://github.com/skycoin/skywire.git
cd skywire/cmd/
go install -v ./...
If you DO SEE those files continue with the update:
cd cmd/
go install -v ./...
cd /etc/default
ln -s /root/go/src/github.com/skycoin/skywire/static/script/skywire.defaults skywire
nano /etc/default/skywire
Now change this part of the file as follows:
# Default variables for the entire skywire work, this needs to be in
# the environment to make it work properly
# IP of the manager, by default 192.168.0.2
# if you use a custom IP set just change the manager IP
# here to apply it system wide.
- MANAGER_IP=192.168.0.2 - Change the IP with your manager IP
# Go related variables
GOROOT=/usr/local/go
- GOPATH=/usr/local/skywire/go - Replace with your actual GOPATH like ${HOME}/go
- PATH="/usr/local/go/bin:/usr/local/skywire/go/bin:${PATH}" - Replace with ${GOROOT}/bin:${GOPATH}/bin:${PATH}
# Runtime variables
- HOME=/root - Move in "Go related variables"
TMP_DIR=/tmp/skywire-info
In the end it should look like this but pay attention to your MANAGER_IP
, this is just an example and you should put your manager's node IP:
# Default variables for the entire skywire work, this needs to be in
# the environment to make it work properly
# IP of the manager, by default 192.168.0.2
# if you use a custom IP set just change the manager IP
# here to apply it system wide.
MANAGER_IP=192.168.2.2
# Go related variables
HOME=/root
GOROOT=/usr/local/go
GOPATH=${HOME}/go
PATH=${GOROOT}/bin:${GOPATH}/bin:${PATH}
# Runtime variables
TMP_DIR=/tmp/skywire-info
Press CTRL+x
then type y
and press ENTER
key to save and exit.
source /etc/default/skywire
Copy the manager service file only on the manager board
cp -r /root/go/src/github.com/skycoin/skywire/static/script/upgrade/data/skywire-manager.service /etc/systemd/system/
Copy the node service file on all boards
cp -r /root/go/src/github.com/skycoin/skywire/static/script/upgrade/data/skywire-node.service /etc/systemd/system/
nano /etc/systemd/system/skywire-manager.service
Now change this part of the file as follows:
...
[Service]
Type=oneshot
- ExecStart=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script/manager_start - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
- ExecStop=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script/stop - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
RemainAfterExit=yes
...
In the end it should look like this but pay attention to your path where go
is located:
...
[Service]
Type=oneshot
ExecStart=/root/go/src/github.com/skycoin/skywire/static/script/manager_start
ExecStop=/root/go/src/github.com/skycoin/skywire/static/script/stop
RemainAfterExit=yes
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
nano /etc/systemd/system/skywire-node.service
Now change this part of the file as follows:
...
[Service]
Type=oneshot
- ExecStart=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script/node_start - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
- ExecStop=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script/stop - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
RemainAfterExit=yes
...
In the end it should look like this but pay attention to your path where go
is located:
...
[Service]
Type=oneshot
ExecStart=/root/go/src/github.com/skycoin/skywire/static/script/node_start
ExecStop=/root/go/src/github.com/skycoin/skywire/static/script/stop
RemainAfterExit=yes
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
Reload the deamon and enable the systemd manager service only on the manager board by typing:
systemctl daemon-reload
systemctl enable skywire-manager.service
Reload the deamon and enable the systemd node service on all boards by typing:
systemctl daemon-reload
systemctl enable skywire-node.service
nano /root/go/src/github.com/skycoin/skywire/static/script/manager_start
Now change this part of the file as follows:
...
# local vars
- SKYWIRE_UNIX_SCRIPTS=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
...
In the end it should look like this but pay attention to your path where go
is located:
...
# local vars
SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
nano /root/go/src/github.com/skycoin/skywire/static/script/node_start
Now change this part of the file as follows:
...
# local vars
- SKYWIRE_UNIX_SCRIPTS=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
...
In the end it should look like this but pay attention to your path where go
is located:
...
# local vars
SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
The start
service file:
nano /root/go/src/github.com/skycoin/skywire/static/script/start
Now change this part of the file as follows:
...
# local vars
- SKYWIRE_UNIX_SCRIPTS=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
...
In the end it should look like this but pay attention to your path where go
is located:
...
# local vars
SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
The stop
service file
nano /root/go/src/github.com/skycoin/skywire/static/script/stop
Now change this part of the file as follows:
...
# local vars
- SKYWIRE_UNIX_SCRIPTS=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
...
In the end it should look like this but pay attention to your path where go
is located:
...
# local vars
SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
The update
service file
nano /root/go/src/github.com/skycoin/skywire/static/script/update
Now change this part of the file as follows:
...
# local vars
- SKYWIRE_UNIX_SCRIPTS=/usr/local/skywire/go/src/github.com/skycoin/skywire/static/script - Replace `/usr/local/skywire` with the folder where is `go` located like `/root`
...
In the end it should look like this but pay attention to your path where go
is located:
...
# local vars
SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script
...
Press CTRL+x
then type y
and press ENTER
key to save and exit.
- Skywire Testnet Rules
- Skywire Authentication System User Guide
- Skywire Whitelisting System User Guide
- Official Skyminer Guide
- Testnet Discovery Address Change Instructions
- Skywire Installation Guide
- Skyflash User Guide
- Networking guide for the official router
- Official Skyminer - Wiring
- Public Key Backup
- Skywire Rasberry Pi Installation Guide
- Skywire Systemd Service
- Skywire Manager Web Interface
- Online Status Verification User Guide
- Skywire SSH User Guide
- Skywire SOCKS5 Proxy User Guide
- Single Board Computer WiFi Hotspot
- HTTP Proxy Service with Skywire VPN
- Setting Up Multiple Virtual Machines with Skywire VPN
- Tunnel exit node traffic through VPN
- Connecting Skynodes to your own OpenVPN Server
- Change startup delay of node processes using an automated script
- Change DNS of the official images
- Automated restart script
- Automated poweroff script
- Automated restart of node app
- Automated reboot if the network connections drops off