Raspberry Pi3 model B is a microcomputer for doing almost anything. Let's use it for installing storagenode for V3 of the Storj Network!
In this guide we presume that you have a Raspberry Pi 3, set up with Raspbian Stretch lite (without User Interface). To set up Raspbian lite, please refer to the official documentation here.
Set up your Pi to allow SSH (it will make your life a lot easier): https://www.raspberrypi.org/documentation/remote-access/ssh/
Note. If you want to enable SSH on headless Pi, you should place an empty
ssh file in the boot partition on your SD-card. This will enable the ssh daemon on your Pi after boot.
Connect to the RPi via ssh and follow the steps below.
Please use the
screen command to go further, this will enable you to still reconnect to a disconnected session using the
screen -x command after logging in via ssh.
sudo apt-get install screen screen
Mount your hard drive:
sudo fdisk /dev/sda
Enter until you exit out of the command
sudo mkfs.ext4 /dev/sda sudo mkdir /mnt/storagenode sudo mount /dev/sda /mnt/storagenode sudo nano /etc/fstab
Then add this line to the end:
/dev/sda /mnt/storagenode ext4 defaults 0 2
Ctrl-O and confirm saving, then exit with
sudo chown -R pi:pi /mnt/storagenode
Add cgroup memory support (to prevent OOM hang of your Pi):
sudo nano /boot/cmdline.txt
cgroup_enable=memory cgroup_memory=1 swapaccount=1 to the end of the line. The resulting string should look like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=XXXXXX-XX rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=memory cgroup_memory=1 swapaccount=1
Save the file (
Ctrl-X, confirm saving) and reboot:
Create your node Identity
You can create an identity directly on your Pi. It will take at least 24 hours. But you may prefer to create the identity on a more powerful desktop or laptop where identity creation would take a lot less time, and then move the identity files to the Pi.
Create a node Identity on your PI
Download the identity binary for the RPi: identity_linux_arm.zip
curl https://storj-v3-alpha-builds.storage.googleapis.com/3fa6e02-v0.15.4-go1.12.7/identity_linux_arm.zip -o identity_linux_arm.zip sudo apt-get install unzip unzip ~/identity_linux_arm.zip
Generate the Identity:
./identity_linux_arm create storagenode
Your identity will be generated here:
Create a node Identity on your desktop
Download the identity binary for your platform:
- Mac OS: identity_darwin_amd64.zip
- Linux: identity_linux_amd64.zip
- Windows 10 Pro: identity_windows_amd64.zip
Unpack the binary to the preferred folder. Let´s suppose it is your home folder.
Then generate the Identity (this example is for Windows ):
./identity_windows_amd64.exe create storagenode
Your Identity will be generated here:
Note. You can also specify to place the identiy files into another folder using the option
Sign your node Identity
./identity_windows_amd64.exe authorize storagenode firstname.lastname@example.org:ohihioHiohohIOhUyTUfyufVJHvufUyvJHvyFTYdhVJGionOoHib
email@example.com:ohihioHiohohIOhUyTUfyufVJHvufUyvJHvyFTYdhVJGionOoHib is your authorization token from your invitation email.
Note: You cannot authorize your identity if you have not received the invite email yet with your authentication token.
Note: The email address is a part of the auth token and should be copied including all characters.
Note: You can specify the identity folder with an
Copy your node Identity to the RPi
In case you generated and authorized your node Identity on a desktop/laptop computer instead of directly on the RPi to save time, you can copy it to the RPi afterward, as follows:
Copy the Identity to the RPi from Linux or Mac
Copy your node identity from your desktop to RPi: https://unix.stackexchange.com/questions/106480/how-to-copy-files-from-one-machine-to-another-using-ssh
Copy the Identity to the RPi from a Windows machine
Copy your node identity from your Windows machine to the RPi: https://unix.stackexchange.com/questions/92715/can-i-transfer-files-using-ssh
To install Docker on the RPi, be sure to use the following installation method:
curl -sSL https://get.docker.com | sh
Download Docker container with storagenode
docker pull storjlabs/storagenode:arm
In our example we will need to have port no. 28967 forwarded to our RPi. Use the steps for Linux OS from the article Need help port-forwarding? to perform port forwarding to your Raspberry Pi.
You can take a look at the https://www.noip.com/support/knowledgebase/install-ip-duc-onto-raspberry-pi/ article to learn how to install the noip software, if you have a dynamic public IP. Note that if you use the free version of noip, you will need to periodically renew it every month so it will continue working properly.
Please be sure to check that your port is open here: https://yougetsignal.com
Run a Docker container with storagenode
Example of Docker run:
WALLET: ethereum address for payments
ADDRESS: external IP address or the DDNS you configured and the port you opened on your router
Note: If you are using a custom port other than 28967, then you have to change the
BANDWIDTH: how much bandwidth you want to allocate to the Storj network (this should not exceed your bandwidth cap or, if your ISP does not have a cap, the total bandwidth you can actually provide considering your up- and download speeds)
STORAGE: how much disk space you want to allocate to the Storj network
/home/pi/.local/share/storj/identity/storagenode: the location of your identity files. You can copy the absolute path from the output of the identity command you ran earlier (second to last line below)
/mnt/storagenode: local directory where you want files to be stored on your hard drive for the network (last line below)
docker run -d --restart always -p 28967:28967 \ -e WALLET="0x0000…." \ -e EMAIL="firstname.lastname@example.org" \ -e ADDRESS="externaladdress:28967" \ -e BANDWIDTH="1TB" \ -e STORAGE="2TB" \
--log-opt max-size=50m \
--log-opt max-file=10 \ --mount type=bind,source=/home/pi/.local/share/storj/identity/storagenode,destination=/app/identity \
--mount type=bind,source=/mnt/storagenode,destination=/app/config \
--name storagenode storjlabs/storagenode:arm