Thread Rating:
  • 7 Vote(s) - 4.71 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Raspberry Pi Sky Miner Setup for noobs - TESTNET READY
#1
Wink 
Here's how to set up Skywire on a cluster of Raspberry Pi 3's.



Equipment
  • 8 x Raspberry Pi 3 Model B
  • 1 x 16 port Gigabit Switch (Tp-Link TL-SG1016D). You only need 8 LAN + 1 WAN, but they're so cheap I just went for 16.
  • 1 x 10 port USB Power Supply. There's a difference between a 'usb hub' and 'power supply'. EDIT: While the Raspberry Pi documentation recommends a power supply of 2.5A, there will be no peripherals connected and as such we only need around 1.3A. The Anker unit supplies 12A total, or 1.5A per Rpi. The alternative is to setup a dedicated PSU (Power Supply Unit) similar to the official SkyMiner.
  • 8 x 1ft Micro USB cables
  • 16 x Aluminium Heatsinks (1 small, 1 large per Rpi)
  • 8 x 1ft Cat6 Ethernet cables
  • 8 x MicroSDHC card A1 98mbps, 16GB. If budget permits, get faster and larger capacity.
  • 2 x Raspberry Pi mounting racks. I found a 10 pi rack in Australia but can only find a 4 rack on Amazon.
This will work using any router with a spare LAN port. I’m using an existing Belkin F9J1002v1, but will eventual upgrade to an OpenWRT compatible router. I'm also using Windows 10.

Everything you need (except the router) can be found here: http://a.co/fwKAiWV

[Image: IMG_0061.jpg] [Image: IMG_0060.jpg]

Download and Install the following:

- SD Card Formatter - https://www.sdcard.org/downloads/formatt...index.html
- Win32 Disk Imager - https://sourceforge.net/projects/win32diskimager/
- Putty - https://www.chiark.greenend.org.uk/~sgta...atest.html

Install Operating System

You have two options in this guide:

1. Install the pre-configured Raspian-skywire image:
       - http://bit.ly/skywire-raspian-image
                  - 879MB - Test Net Ready
       - Go, Git and Skywire pre-installed. 
       - Skywire auto start scripts (attached below for reference)
       - Easy setup for any number of nodes (8, 16, 44, 128...). 

2. Install a fresh image of Raspbian Stretch Lite:
       - https://www.raspberrypi.org/downloads/raspbian/
       - Need to install all software manually
       - No autostart scripts


Option 1 (recommended for complete noobs)

- Insert the micro SD card into PC and format using the SD Card Formatter.
- Open Win32 Disk Imager and select the rasbpian_skywire.img file, the SD card, then click 'Write'. Once the flash and validation is complete, you may see windows popping up saying that you need to format your micro SD card. Just click cancel to all.
- Safely eject the micro SD card from your pc.
- Repeat steps for all of the micro SD cards.

1. Hardware Configuration

- Connect the switch to a LAN port on your router.
- Assemble the Rpi rack and hook up the ethernet cables connected to the switch.
- Insert SD cards into each Rpi.
- Plug in USB power cables and switch on the USB power hub.

2. Remote Access via SSH
- In a web browser, type in your router's I.P address (google your router’s model number to find it, or use the command prompt ‘ipconfig’ and look for the default gateway). Find the DHCP client list which should look something like this:

[Image: Router_Manager_DHCP_Client_list.png]

- This list will show you all the devices connected to your network. You should see all of your nodes listed as 'raspberrypi' and an IP address assigned to each. Put these in a spreadsheet for easy reference later.

- Open Putty, type in the IP address of your node under Host Name and click Open. Click yes on the pop-up security alert. 
- A terminal will open asking for your node's login details. The default login details are:
    o   username: pi
    o   password: raspberry

[Image: Rpi_login_screen.png]


3. Configure Network Settings
For each of your Rpi's run through the following steps. I find it easier to have a Putty session open for each node at the same time and run through the steps concurrently. You can copy the below commands and paste them onto the command line by right clicking anywhere in the open Putty session.

[Image: Rpi_sessions.png]
- Enter the following on the command line to download and install updates to the operating system:
Code:
sudo apt-get -y update
sudo apt-get -y upgrade

- Enter the following to begin configuring your Rpi
Code:
sudo raspi-config
- A screen will pop up with a list of options. Navigate through the menus using your keyboard. The only items we need to change are the user password and Hostname:
         1 Change User Password: You will be prompted to enter a new password twice. Please note the characters will not show on the screen.
         2 Network options à Hostname: A suggested naming convention is rpi01, rpi02…rpi08.

[Image: Capture.png]
- Finish & Reboot. Ignore the “Server unexpectedly closed network connection” error.
- Right click the Putty window title bar and click ‘Restart session’. Log in (username: pi) with your new password.

Setup Static IP Addresses

Setup static IP addresses for your nodes. All nodes will be automatically assigned IP's via DHCP, but it's beneficial to manually define static IP's to ensure consistency. 

If you have an OpenWRT router you can configure the Static IP through the router manager page. Otherwise:

- Enter the following at the command line to open a file editor:
Code:
sudo nano /etc/dhcpcd.conf

-Add the following at the end of the file, making sure to update the IP address to match your network.
Code:
interface eth0
static ip_address=192.168.1.XX/24   #Where 'XX' is a device address as per the table above. E.g 192.168.2.101
static routers=192.168.2.1   #Change to your router's IP address obtained above
static domain_name_servers=8.8.8.8  
- It should look like this:
 
[Image: Static_IP_address.png]

- Press crtl-X, then Y to save and press enter to return back to the command line. 

- Reboot for the changes to take effect:
Code:
sudo reboot

4. Configure Skyminer 
The remaining steps only need to be completed on your Manager Node. You can dedicate any node to be your Manager, but I typically use the first node (.101). All the other nodes (secondary nodes) will connect to the Manager and you'll be able to see them listed on one interface screen.

- Close all Putty sessions. Open a new putty session using the IP of the node you wish to use as the Manager (in my case it is 192.168.2.101).
- We need to compile a list of the Static IP’s (created in the previous step) to allow the nodes to communicate with each other. Type the following command:
Code:
sudo nano ips.txt

- A file editor will open with a pre-populated list. List only your secondary node static IP addresses (not your Manager Node!) which you created earlier. Make sure there are no blank lines after the last item in your list. When done press Ctrl-X, and Y to exit.

[Image: secondary_ip_address_file.png]

- Type the following to open a file editor:
Code:
sudo nano startsecond.sh

- Update the following line by replacing 'manager_node_ip' with your actual Manager’s IP address (e.g. 192.168.2.101 or whatever you chose yours to be). Do not change anything else:
Code:
nohup ./node -connect-manager -manager-address manager_node_ip:5998 -manager-web manager_node_ip:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 &  
Ctrl-X, and Y to exit.

-The next line of code will do a bunch of things to complete the setup process... configure SSH keys between all of your nodes, update your Manager’s new Static IP address (if you changed it), and turn on the ‘auto start on boot’ function for all nodes and reboot:
Code:
./skyminer_engage.sh
-For each node you will be prompted to confirm you wish to continue, type yes and enter your password.
 
- Wait 60 seconds for the nodes to boot and go to 'http://manager_node_ip:8000' (making sure to replace manager_node_ip with your Manager’s actual IP) in a web browser. 
- Change the password and you will see your all your nodes in the list.
- Close the Putty session.


Option 2 (Manual)

Follow the same steps as Option 1, until you get to 3. Configure skyminer. The only exception being that you should flash the clean version of Raspbian Stretch Lite and enable SSH using this guide:

https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0

Boot and Configure Node

- Remove previous version of Go and install version 1.10.2
Code:
sudo apt-get remove golang
sudo apt autoremove
wget https://dl.google.com/go/go1.10.2.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.10.2.linux-armv6l.tar.gz

- Create new Go directories
Code:
cd
mkdir go
mkdir go/bin
mkdir go/src

- Update environmental variables
Code:
sudo nano ~/.profile
 
-A file editor will open. Scroll to the bottom and enter the following:
Code:
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
- Press crtl-X, then Y to save and press enter to return back to the command line. 

- Confirm Go installation and Install Git
Code:
source ~/.profile
go version
sudo apt-get -y install git

Install and Run Skywire

- Download and Install Skywire Software
Code:
mkdir -p $GOPATH/src/github.com/skycoin
cd $GOPATH/src/github.com/skycoin
git clone https://github.com/skycoin/skywire.git
cd $GOPATH/src/github.com/skycoin/skywire/cmd
go install ./...

For Manager Node

- Run Skywire
Code:
cd $GOPATH/bin
nohup ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager &
cd $GOPATH/bin
nohup ./node -connect-manager -manager-address :5998 -manager-web :8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 &

- Go to 'http://primary_node_ip:8000' in a web browse, where 'primary_node_ip' is your primary node's IP e.g. 192.168.2.101:8000
- Login to Skywire. The default password is '1234'.
- If all went well, you should see your primary node listed.
- Start the setup of the next Rpi.

For Secondary Nodes

- Run Skywire on your secondary node by entering the two lines of code below. Make sure to substitute the 'manager_node_ip' with your actually Manager's IP address in this command:
Code:
cd $GOPATH/bin
nohup ./node -connect-manager -manager-address manager_node_ip:5998 -manager-web manager_node_ip:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 &

- Go to 'http://manager_node_ip:8000' in a web browser and check to see if the secondary node is online.
- Start the setup of the next Rpi.


.zip   Raspi-Skywire Scripts.zip (Size: 2.86 KB / Downloads: 109)


Good luck!
[-] The following 15 users say Thank You to adhaelon for this post:
  • absent111, andremon, BigOokie, FalconeDistrict, I Am You, jaghoon, kenkonious, Lancek, Matto, nomarski, RGhadamian, shokunin, skyguy, Victoria, zan
Reply
#2
Perfect timing my pi's arriving next week. Thanks Man.
Reply
#3
Excellent, Thanks for this!
Reply
#4
is this card ok https://www.amazon.de/Samsung-Speicherka...%2Ba1&th=1 ?

Also I found https://www.amazon.com/dp/B00OJ79UK6/?ta...17-20&th=1 cheaper power supply what do you think?
Reply
#5
thanks for this guide!
What if I only want to try it on one pi because my upload speed is very low. anything significant change?
Also, I was under the impression that skynodes won't work without a openwrt router. I guess I'm mistaken?
Reply
#6
Hi,


I have the same setup with the raspberry pi's but my pi's wont go on only the light of the power supply and without it it goes on what am i doing wrong here.

Regards,

Joey
Reply
#7
(03-02-2018, 10:29 AM)Jkei Wrote: is this card ok https://www.amazon.de/Samsung-Speicherka...%2Ba1&th=1 ?

Also I found https://www.amazon.com/dp/B00OJ79UK6/?ta...17-20&th=1 cheaper power supply what do you think?

Yes, that card will work fine. It's hard to say if it's worth spending more money on larger storage capacity but it can't hurt. And if you only go with the 16gb, you can always upgrade later.

The power supply also looks ok. The key thing to look out for is that each port gets 2.4A.. which it does.

(03-06-2018, 09:59 PM)dee_el_hugely Wrote: thanks for this guide!
What if I only want to try it on one pi because my upload speed is very low.  anything significant change?
Also, I was under the impression that skynodes won't work without a openwrt router.  I guess I'm mistaken?

No changes to the guide if only using one node. Just set it up as the primary node and you'll be fine. Even with a slow upload speed, I'd suggest setting up at least 2 nodes for the fun of it. I only get 20mbs down and 10 up but I've got 8!

Using an Openwrt router is recommend because it adds additional security, but is not required to operate a skywire node. It might become a requirement, but not sure at this stage.

(03-09-2018, 09:55 AM)Mr.Corver Wrote: Hi,


I have the same setup with the raspberry pi's but my pi's wont go on only the light of the power supply and without it it goes on what am i doing wrong here.

Regards,

Joey

Did you plug the screen in before turning the pi on? The screen won't work if you plug it in after turning the power on.
Reply
#8
hey, just wanted to first say thanks!

I do want to clarify a concern on the power supply.
The one you are using seems to be rated for 12amps total...I'm worried later down the line if that is sufficient enough since that only leaves 1.5amps per board which doesn't give much flexibility.
I'm thinking you can get away with it under minimal load/peripherals.

The official miner looks to use a 20amp (100watt) supply which i would think should be what to aim for for an 8 node cluster.
thoughts?
Reply
#9
I guess it's better to but Raspberry Pi 3 Model B+ instead of B?
Reply
#10
(03-14-2018, 08:51 PM)jaghoon Wrote: hey, just wanted to first say thanks!

I do want to clarify a concern on the power supply.
The one you are using seems to be rated for 12amps total...I'm worried later down the line if that is sufficient enough since that only leaves 1.5amps per board which doesn't give much flexibility.
I'm thinking you can get away with it under minimal load/peripherals.

The official miner looks to use a 20amp (100watt) supply which i would think should be  what to aim for for an 8 node cluster.
thoughts?

Thanks for pointing this out. Yes the power supply is definitely not future proof. I'm confident that 1.5A is adequate, but will struggle if we need to start adding peripherals. (Rpi documentation - https://www.raspberrypi.org/help/faqs/#powerReqs)

So I'm happy for now, but the more I read about the SPO project and the potential for adding storage devices to nodes, the more I'm leaning towards a dedicated PSU setup (similar to the official miner, or this https://oroboro.com/compact-16-node-rasp...i-cluster/) Also makes it a whole lot easier to expand quickly.

(03-15-2018, 09:50 PM)Jkei Wrote: I guess it's better to but Raspberry Pi 3 Model B+ instead of B?

Sorry, yes I have the B+ model. Don't use the original B model, it uses standard size SD cards and power consumption is not as good.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)