Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIY Miner - A complete guide for Hardware/Software configuration
#1
Information 
PREREQUISITES PRIOR STARTING

A network topology well defined that you want to use (IPs {(subnet, gateway...)(static, DHCP on MAC...)}, Hostnames...)


I. Hardware Configuration

Depending on the hardware you bought you should consider the folowing configuration steps taken into account in the following chapter of this guide:

 - Hardware inventory of my setup
 - Power and connecting all components to a power source
 - Networking and connecting all components to networking hardware
 - Processing boards and SD cards

First lets start with the hardware that ive choose for my miner, you can choose any hardware you want to build one see the link at the end of this guide for components lists of others.
So my hardware:

I.1. Hardware inventory of my setup
I.1.1. Power supply and power related components
 - Power supply unit 5V20A - PSU (1 pcs.)
 - DC Power cable Male plug 4.0x1.7mm - DC Power Cable (8 pcs.)
 - Rocker Switch Fused Power Socket 10A - Rocker Switch (1 pcs.)
 - Y Power cable (the socket may differ from each country) something like this one can be found in electrical store - Y Power Cable (1pcs.)
 - I dont know how you call them be in my country we call them slippers, like here in the photo - Slippers but be carefull when you buy the slippers to match the PSU "-V" hole ( 7 normal slippers and 5 ISOLAED SLIPPERS)
 - Standoff spacers M3 30mm - Standoff Spacers ( at least 36 pcs. to connect the boards and think of how much will you need for the frame fitting)
 - And some good old wires from a power cable which you dont use anymore

I.1.2. Rack case (miner frame)
 - It depends on everyones choice on how they want to doit. Some aluminium struts t-slot are needed, stand-off spacers and some plexiglass but as ive said it depends on your construction you will have to mesure all the parts and build one that would fit all the components in it. I will not talk about this know because everyone should doit alone.

I.1.3. Networking components
 - Ive used the Tp-Link TL-WR1043ND Wireless Router which is a good candidate for openwrt and a 16 port gigabit switch like D-Link DGS-1016D (find them in your local stores, one of each ive used)
 - Network cables, ive used cat6 flat cables which are good for a gigabit connection but also cat7 can be used (9 or 10pcs. see the networking WAN cabling). Ive used as length 0.25m cables

I.1.4. Processing boards and SD cards
 - As processing boards ive used the Orange Pi Prime (bought them with 29$ from aliexpress now you wont find this anymore, search the internet for them and cheap they must be, ive used 8 boards)
 - Micro SDHC cards of 16Gb (8pcs.) - Micro SDHC cards

I.2. Power and connecting all components to a power source

NOTICE: Before beginning check first the power cables colour convention in your country. Bellow is an example:

   

I.2.1. Components preparation
I.2.1.1. DC Power cable Male plug 4.0x1.7mm

Connect 4 neutral wires (white/black) of 4 DC power cables in one slipper with a plier.
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

Connect 4 load wires (red) of the same 4 DC power cables in one slipper with the plier
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

Repeat the same steps for the other 4 DC power cables.

I.2.1.2. Rocker Switch

Make a bridge between the Load tabs like in the picture attached bellow with a good wire from an old power cable and two isolated slippers.
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

Make a wire with an isolated slipper in one end, which will be connected to the Neutral tab of the switch, and on the other end of the wire put a normal slipper that will be later connected to the PSU. For the moment connect it only on the rocker Neutral tab.
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

Make a wire with an isolated slipper in one end, which will be connected to the Load2 tab of the switch, and on the other end of the wire put a normal slipper that will be later connected to the PSU. For the moment connect it only on the rocker Load2 tab.
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

Make a wire with an isolated slipper in one end, which will be connected to the Ground tab of the switch, and on the other end of the wire put a normal slipper that will be later connected to the PSU. For the moment connect it only on the rocker Ground tab.
(Peel the plastic on the wire not to much just to touch the metal from the slippers and dont go over the isolation of it. Insert it in the slipper and squeeze firmly with a plier)

[Image: Rocker_Switch_Wiring.jpg]


NOTICE: Use isolated slippers where ive wrote because there is always a risk of electrocution!!!!!!!!!!!

I.2.2. Connect components to power supply
I.2.2.1. Connect Rocker Switch to PSU

Connect the Load end with the normal slipper to the Load terminal of the PSU marked with L.

Connect the Neutral end with the normal slipper to the Neutral terminal of the PSU marked with N.

Connect the Ground end with the normal slipper to the Ground terminal of the PSU marked with grounding sign.

I.2.2.2. Connect the DC cables to the PSU

Connect the first batch of 4 Neutral wires (white/black) of the DC power cables that are bound to one slipper to one of the Neutral output of the PSU matked with -V.

Connect the first batch of 4 Load wires (red/brown) of the DC power cables that are bound to one slipper to one of the Load output of the PSU matked with +V.

Repeat the steps for the second batch of DC power cables and connect them to the remaining Load and Neutral outputs.

I.2.2.3. Connect power plug to rocker switch and 16 port switch

Connect one end of the Y power cable to the Rocker Switch (VERIFY FIRST THAT THE ROCKER SWITCH IS TURNED OFF) and the other end to the 16 port switch. Connect the Y power cable to a power outlet
The router ive connected separately to a power outlet

NOTICE: The boards will be connected later one by one because we i did not use any dc power distributor with switch button for each board!!!!!!!!

I.3. Networking and connecting all components to networking hardware
I.3.1. Connect each board

Connect each board to the 16 port switch with one ethernet cat6 cable. Ive conncted the boards on the first eight ports of the switch.

I.3.2. Switch uplink

Connect the 16 port switch to the router on which the OpenWrt will be installed with an uplink cable fom the last port on the switch to the fisrt port on the router "1".
Ive observed that if i connect two uplinks the boards and router are going nuts, you could try and see if not just connect only one uplink. In my case i had two miners with two switches each with two uplinks and they went nuts so i can not really say that with two uplinks wont work, try.

I.3.3.  Router WAN connection

Here comes the tricky part because we have two scenarios:

 - First is if you dont intend to use the same router for giving internet to the rest of the electronics that are connected to your router that you have now then you should connect the OpenWrt router to the one that you have through the WAN port. So connect the 10th ethernet cable to the WAN port of the OpenWrt router (TP-Link WR1043ND) to one of the ports on the router that you have in this moment. For SW configuration see the Networking Software configuration chapter.

 - Second scenario will be if you intend to use the TP-Link router also for your own use not only for the miner than you wont need the 10th cable, you just need to plug in the WAN port of the TP-Link router the cable on which you receive the internet. The SW configuration see the Networking Software configuration chapter.

I.4. Processing boards

Connect all the processing boards between them with the standoff spacers just to have it like a cluster.
The processing boards will be plugged one by one after the SD card of each is flashed. We do this just because i didnt bought any DC power distribution board with individual power switch for each board.
This process will be covered and explained later in the software chapter.

II. Software Configuration
II.1. Network SW Configuration
II.1.1. Network SW Prerequisites

Download and install PUTTY for Windows x86 or x64 from here x64 version or x86 version (Mac OS has a terminal similar to putty so there is no need to download)
Download the OpenWRT software for the WR1043ND router from here: WR1043ND v4 OpenWRT (v4 only for other versions than 4 check here

II.1.2. Install OpenWRT on TP-Link WR1043ND v4

Connect your laptop with an ethernet cable to one of the LAN ports of the TP-Link router.
Power up the TP-Link WR1043ND. 
After it powers up and you have an IP assigned on your laptop, open a web browser page and go to 192.168.0.1
Write the default username and password when asked which are admin/admin.
Go on the left side to "System Tools -> Firmware Upgrade".
Click on "Choose file" and select the downloaded firmware from chapter II.1.1.
Select "Upgrade" and wait till its finished.

II.1.3. Configure OpenWRT
II.1.3.1. Install LUCI the web interface of OpenWRT

After the firmware upgrade has finished on the TP-Link router on a:
 - Windows laptop open the PuTTY and connect through SSH on 192.168.1.1 IP (which is the default IP of OpenWRT), when asked for user write "root", by default there is no password.
 - Mac OS to start the Terminal, go to your Mac's Applications folder -> click on the Utilities folder -> then click on Terminal and write in the Terminal "ssh root@192.168.1.1"

After you connect on the OpenWRT router issue the following commands:

Code:
opkg update
opkg install luci
reboot

After it reboots you will be able to see the installed web interface if you open a web browser on 192.168.1.1. You can login with user "root" and no password is set at this moment.

II.1.3.1.
II.1.3.2. 
II.1.2.3. OpenWRT Security configuration
II.2. Processing boards software configuration
II.2.1. Micro SD flashing SW prerequisites and installation
II.2.1.1. Rufus/Etcher
II.2.1.1.1. Rufus for Windows

Download the portable version of Rufus from here Rufus 2.18 Portable on your computer in a folder you will be using for flashing of the SD cards.

II.2.1.1.2. Etcher for Mac OS
(Never tested)

Download Etcher for Mac OS from here Etcher for Mac OS on your Mac and follow these steps to install it  we will be using it later.

II.2.1.2. Armbian

Download the Armbian version for Orange Pi Prime from here Armbian Ubuntu Server to the folder youll be using for the card flashing. This is the CLI version with no desktop interface. 
For other version go here and search Armbian Download.

II.2.2. Flashing the Micro SD cards
II.2.2.1 Flash card using Rufus

Insert your card in the computer (maybe an adapter is needed from SD to Micro SD).
Open the Rufus exe file downloaded earlier, you should see the card in Rufus as MBR Partition.....
Leave all defaults just change from "Free DOS" to "DD Image".
Click on the icon which resembles a CD drive next to "DD Image".
Select in the window that opened the Armbian img file downloaded earlier from the location youve downloaded adn select open.
Click on "Start" and accept the aknowledgment of erasing your card in the pop up that appeared.
Wait till it finished and click on "Close"
You can find also videos on YouTube on this topic.

II.2.2.2. Flash card using Etcher
(Never tested)

In addition to Etcher you also need Keka. The Armbian images are compressed .7z type files. Keka will allow you to unzip the image file.
Download it from http://www.kekaosx.com/en/
Open the .dmg and drag it into the Applications folder. Open Keka. click through the prompts
Open a Finder window. Locate the Armbian image you downloaded earlier. Double-click it to extract.
By default a folder will be created and unzip the files there.
Open Etcher. 
Browse for the image file, select it and then click Flash to create the SD card.

Also you can follow the video provided earlier for downloading and installing Etcher for Mac OS for flashing.

II.2.3. Powering up the board and network discovery
II.2.3.2. Inserting the card and Power

Insert the micro SD card into the Orange Pi than insert one DC power cable that weve talked about in Hardware.
Switch ON the Rocker Switch from Hardware.

II.2.4. Network Configuration

Connect from your laptop with an ethernet cable directly into the 16 port switch where the Orange Pi's are connected.
Logon the OpenWRT router web interface IP, navigate to "Network --> DHCP and DNS".
Scroll down to "Active DHCP Leases" and you will see your first Orange Pi, note in a document the "Hostname", "IPv4-Address" and "MAC-Address".
Scroll more down to "Static Leases" and paste in the corresponding fields the information you've noted in the document: "Hostname","IPv4-Address" and "MAC-Address" like in the picture bellow.

   

After adding all the informations select "Save and Apply"
Now the router will know that the board with the MAC address youve specified will allways give you the same IP that youve set.

II.2.5. Initial configuration of Armbian

On Windows open a PuTTY SSH connection to the first board on the IP that you set earlier, like bellow example:

   

On Mac OS open a Terminal and connect to the board by issuing the following command:

Code:
ssh root@192.168.1.200

After oppening the putty/terminal you will be prompted for an user (Windows), password (Mac), default user is "root" with default password "1234".

Code:
login: root
password: 1234


First thing after logging in you will be prompted to change the password, first enter the default password "1234" after he will ask you to enter a new password, twice.

Code:
change password
"(current) UNIX password:1234 - the default
Enter new UNIX password:<your_new_password> - your new password
Retype new UNIX password:<your_new_password> - retype your new password "


Now, after the new password was set you will be prompted to create a user too, enter the name of a user you want to create like "user". Then enter a password for him twice like bellow example:

Code:
Please provide a username (eg. your forename): user
"Enter new UNIX password:<your_user_password>
Retype new UNIX password:<your_user_password>"


Hit Enter key for four times, when asked if you want to save write "y" and press again the Enter key.

Now update the Armbian by issuing the following commands:

Code:
sudo apt update   # wait until its finished
sudo apt upgrade  # You will be asked to confirm so type "Y" and hit Enter
 
OBS: If you receive an error that "/var/lib/dpkg/" is locked, type the following commands

Code:
sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

OPTIONAL - Armbian monitor web interface
armbianmonitor -r (Optional for monitoring temp, cpu, ram... from web interface)

Repeat the steps from II.2.3. to II.2.5. including for all boards one by one but omit to switch ON the Rocker Switch otherwise you will cut off the power from the first board. 

II.2.6. Go installation and configuration

Login with putty or terminal on the first board with "root" user and type in the following commands:

Code:
cd
curl -oL https://dl.google.com/go/go1.11.2.linux-arm64.tar.gz # Wait for completion
cd /usr/local/
tar xzvf /root/go1.11.2.linux-arm64.tar.gz                                                  # Wait for completion
ln -s /usr/local/go/bin/go /usr/local/bin/go
ln -s /usr/local/go/bin/godoc /usr/local/bin/godoc
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
mkdir -p $HOME/go
mkdir -p $HOME/go/bin
mkdir -p $HOME/go/src
mkdir -p $HOME/go/pkg

Now edit the .bashrc file like bellow, type:

Code:
cd ~
vi .bashrc

# Press "i" to edit and write:
# Go to the bottom of the file and add the following lines:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

# To save the file press "ESC" then write ":wq!"
# After saving the file write the following command:

source ~/.bashrc


II.2.7. Skywire installation and configuration

II.2.7.1. Skywire Install

Still logged in type the following commands to install Skywire:

Code:
mkdir -p $GOPATH/src/github.com/skycoin
cd $GOPATH/src/github.com/skycoin
git clone https://github.com/skycoin/skywire.git # Wait for completion
cd $GOPATH/src/github.com/skycoin/skywire/cmd
go install ./...                                 # Wait for completion

II.2.7.2. Skywire Manager Service

Create the manager service  (do this only on the manager board):

Code:
cd /etc/systemd/system
vi skymanager.service

# Add the following lines then save and exit. Don't leave any space at the begining or the end, copy from including "[Unit]" till "WantedBy..." including
# Type "i" to be able to write
# To save and exit press "ESC" key, type ":wq" and press "ENTER" key

[Unit]
Description=Skywire Manager
After=network.target

[Service]
WorkingDirectory=/root/go/bin
Environment="GOPATH=/root/go" "GOBIN=$GOPATH/bin"
ExecStart=/root/go/bin/manager -web-dir /root/go/src/github.com/skycoin/skywire/static/skywire-manager
ExecStop=kill
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target


# To save and exit press "ESC" key, type ":wq" and press "ENTER" key
# Reload the daemon and enable the skymanager.service by:

systemctl daemon-reload
systemctl enable skymanager.service

# Start the skymanager.service by:

systemctl start skymanager.service

You can check if the Manager works by opening a web browser and typing your IP and port 8000, like this "192.168.1.200:8000".

II.2.7.3. Skywire Node Service

Now create the node service (do this on all boards including the manager):

Code:
cd /etc/systemd/system
vi skynode.service

# Add the following lines then save and exit
# Type "i" to be able to write
# To save and exit press "ESC" key, type ":wq" and press "ENTER" key
# Replace "ip_of_manager" with your manager ip

[Unit]
Description=Skywire Node
After=network.target

[Service]
WorkingDirectory=/root/go/bin
Environment="GOPATH=/root/go" "GOBIN=$GOPATH/bin"
ExecStart=/root/go/bin/node -connect-manager -manager-address ip_of_manager:5998 -manager-web ip_of_manager:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001
ExecStop=kill
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target


# To save and exit press "ESC" key, type ":wq" and press "ENTER" key
# Reload the daemon and enable the skynode.service by:

systemctl daemon-reload
systemctl enable skynode.service

# Start the skynode.service by:

systemctl start skynode.service

Now you should see the node in the manager's web interface opened earlier.

II.2.7.2.4. Skywire Services Usage

By using these services the manager and/or node processes will start once the board is booted.
Having the manager an node set as services you can always stop, start, restart or view the status like:

Code:
systemctl stop skynode.service     # used to stop the node process (also the skymanager.service can be used instead of skynode.service)
systemctl start skynode.service    # used to start the node process if its not started
systemctl restart skynode.service  # used if you want to restart the node process even if its already started or stopped
systemctl status skynode.service   # used to show the status of the node process if it's started or not


II.3. Security configurations on the boards
[-] The following 7 users say Thank You to asxtree for this post:
  • Bobbyhchrist, Craael, DBASQL, edoardocoen, renanrodriguezfranco, serggioc, skyguy
2
1
Reply
#2
Here and some enhancements to the Mac instructions.

In addition to Etcher you also need Keka. The Armbian images are compressed .7z type files. Keka will allow you to unzip the image file.
Download it from http://www.kekaosx.com/en/
Open the .dmg and drag it into the Applications folder. Open Keka. click through the prompts
Open a Finder window. Locate the Armbian image you downloaded earlier. Double-click it to extract.
By default a folder will be created and unzip the files there.
Open Etcher.
Browse for the image file.
Armbian_5.38_Orangepizeroplus_Ubuntu_xenial_next_4.14.14.img
select it and then click Flash to create the SD card.
Reply
#3
(02-28-2018, 06:16 PM)Bobbyhchrist Wrote: Here and some enhancements to the Mac instructions.

In addition to Etcher you also need Keka. The Armbian images are compressed .7z type files. Keka will allow you to unzip the image file.
Download it from http://www.kekaosx.com/en/
Open the .dmg and drag it into the Applications folder. Open Keka. click through the prompts
Open a Finder window. Locate the Armbian image you downloaded earlier. Double-click it to extract.
By default a folder will be created and unzip the files there.
Open Etcher.
Browse for the image file.
Armbian_5.38_Orangepizeroplus_Ubuntu_xenial_next_4.14.14.img
select it and then click Flash to create the SD card.

Thank you, ive added it
[-] The following 3 users say Thank You to asxtree for this post:
  • edoardocoen, Lancek, skyguy
Reply
#4
Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!
Reply
#5
(05-25-2018, 07:32 PM)PostmanNL Wrote: Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!

Added, check the guide
Reply
#6
(07-15-2018, 08:01 AM)asxtree Wrote:
(05-25-2018, 07:32 PM)PostmanNL Wrote: Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!

Added, check the guide

After going through this process, the Skywire Manager online portal isn't accepting my old password - any idea why this might be?

Thanks!
Reply
#7
(08-17-2018, 12:40 PM)Joeh Wrote:
(07-15-2018, 08:01 AM)asxtree Wrote:
(05-25-2018, 07:32 PM)PostmanNL Wrote: Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!

Added, check the guide

After going through this process, the Skywire Manager online portal isn't accepting my old password - any idea why this might be?

Thanks!

Is it defaulting to the original 1234 password? Connect to the monitor node with ssh and type "mount" followed by Enter

Check that your primary partition isn't "ro" for read-only
Reply
#8
(08-17-2018, 06:41 PM)skyguy Wrote:
(08-17-2018, 12:40 PM)Joeh Wrote:
(07-15-2018, 08:01 AM)asxtree Wrote:
(05-25-2018, 07:32 PM)PostmanNL Wrote: Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!

Added, check the guide

After going through this process, the Skywire Manager online portal isn't accepting my old password - any idea why this might be?

Thanks!

Is it defaulting to the original 1234 password? Connect to the monitor node with ssh and type "mount" followed by Enter

Check that your primary partition isn't "ro" for read-only

Indeed it is defaulting to the original password, that was it, thanks!
Reply
#9
(08-17-2018, 12:40 PM)Joeh Wrote:
(07-15-2018, 08:01 AM)asxtree Wrote:
(05-25-2018, 07:32 PM)PostmanNL Wrote: Thank you for this helpful article. You're saying: "#sh startup# TBD". Any idea when this will be done? I cannot find a method to add the skyminer startup command to startup of the node. Tried with systemd, crontab, etc... no luck!

Added, check the guide

After going through this process, the Skywire Manager online portal isn't accepting my old password - any idea why this might be?

Thanks!

It created a new .skywire folder with new keys so you'll have the default password and new keys in the manager.
I think it creates the new .skywire folder in GOPATH/bin/.skywire and the old one should be in /root so you can copy or move the old ones in the new folder and youll be ok. 
Something like this:

Code:
systemctl stop skynode.service
systemctl stop skymanager.service

cd
mkdir -p $GOPATH/bin/.old
mv $GOPATH/bin/.skywire/* $GOPATH/bin/.old/
cp -rp .skywire/* $GOPATH/bin/.skywire/


systemctl start skynode.service
systemctl start skymanager.service

Youll move the newly created in the .old folder and copy the old ones where they should be.
Reply
#10
I had problems with services, after "systemctl start skymanager.service" or "systemctl start skynode.service", I get "Failed to start skynode.service: Unit skynode.service is not loaded properly: Exec format error. See system logs and 'systemctl status skynode.service' for details.". after " journalctl -u skymanager.service" it says " /etc/systemd/system/skymanager.service:9: Executable path is not absolute: kill".

So if you have this problem, just run:

Manager service:

Code:
cd /home/${USER}
touch skywire_managerStop
echo "#!/bin/bash" >> /home/${USER}/skywire_managerStop
echo "kill -9 $(ps aux | grep '[.]/manager')" >> /home/${USER}/skywire_managerStop
chmod +x skywire_managerStop
cd /etc/systemd/system
rm skymanager.service
touch skymanager.service
echo "[Unit]" >> /etc/systemd/system/skymanager.service
echo "Description=Skywire Manager" >> /etc/systemd/system/skymanager.service
echo "After=network.target" >> /etc/systemd/system/skymanager.service
echo "" >> /etc/systemd/system/skymanager.service
echo "[Service]" >> /etc/systemd/system/skymanager.service
echo "WorkingDirectory=/root/go/bin" >> /etc/systemd/system/skymanager.service
echo "Environment=\"GOPATH=/root/go\" \"GOBIN=\$GOPATH/bin\"" >> /etc/systemd/system/skymanager.service
echo "ExecStart=/root/go/bin/manager -web-dir /root/go/src/github.com/skycoin/skywire/static/skywire-manager" >> /etc/systemd/system/skymanager.service
echo "ExecStop=/home/\${USER}/skywire_managerStop" >> /etc/systemd/system/skymanager.service
echo "Restart=on-failure" >> /etc/systemd/system/skymanager.service
echo "RestartSec=10" >> /etc/systemd/system/skymanager.service
echo "" >> /etc/systemd/system/skymanager.service
echo "[Install]" >> /etc/systemd/system/skymanager.service
echo "WantedBy=multi-user.target" >> /etc/systemd/system/skymanager.service
systemctl daemon-reload
systemctl enable skymanager.service
systemctl start skymanager.service

Nodes service:
Code:
read -p "What's your manager IP [type for example "192.168.0.101", no spaces]?" manIP
cd /home/${USER}
touch skywire_nodeStop
echo "#!/bin/bash" >> /home/${USER}/skywire_nodeStop
echo "kill -9 $(ps aux | grep '[.]/node')" >> /home/${USER}/skywire_nodeStop
chmod +x skywire_nodeStop
cd /etc/systemd/system
rm skynode.service
touch skynode.service
echo "[Unit]" >> /etc/systemd/system/skynode.service
echo "Description=Skywire Node" >> /etc/systemd/system/skynode.service
echo "After=network.target" >> /etc/systemd/system/skynode.service
echo "" >> /etc/systemd/system/skynode.service
echo "[Service]" >> /etc/systemd/system/skynode.service
echo "WorkingDirectory=/root/go/bin" >> /etc/systemd/system/skynode.service
echo "Environment=\"GOPATH=/root/go\" \"GOBIN=\$GOPATH/bin\"" >> /etc/systemd/system/skynode.service
echo "ExecStart=/root/go/bin/node -connect-manager -manager-address $manIP:5998 -manager-web $manIP:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001" >> /etc/systemd/system/skynode.service
echo "ExecStop=/home/${USER}/skywire_nodeStop" >> /etc/systemd/system/skynode.service
echo "Restart=on-failure" >> /etc/systemd/system/skynode.service
echo "RestartSec=10" >> /etc/systemd/system/skynode.service
echo "" >> /etc/systemd/system/skynode.service
echo "[Install]" >> /etc/systemd/system/skynode.service
echo "WantedBy=multi-user.target" >> /etc/systemd/system/skynode.service
systemctl daemon-reload
systemctl enable skynode.service
systemctl start skynode.service
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)