Following the [Tech Preview] post below, here’s my method for standing up the Linux-native storagenode and storagenode-updater services on Ubuntu 20.04.
Prerequisites
- Create and authorize a Storj identity as per Storj Documentation.
- Install Ubuntu 20.04 server.
- Set up a static IP and configure port forwarding
- Set up an appropriate storage medium and mount to
/mnt/storagenode
. - Create a
storj-storagenode
system user:adduser --system --group --home /mnt/storagenode --no-create-home storj-storagenode
. - Move Storj identity into
/mnt/storagenode/identity
. - Set permissions:
chown -R storj-storagenode:storj-storagenode /mnt/storagenode
.
Download and Install v1.16.1 Binaries
I opted to install these in a dedicated directory /opt/storagenode
that is owned by the storj-storagenode
user rather than installing in /usr/local/bin
. Otherwise, the storagenode-updater
service below won’t be able to write to the folder to update the binary.
Run the following steps either as root
or using sudo
where appropriate.
wget https://github.com/storj/storj/releases/download/v1.16.1/storagenode_linux_amd64.zip
wget https://github.com/storj/storj/releases/download/v1.16.1/storagenode-updater_linux_amd64.zip
unzip storagenode_linux_amd64.zip
unzip storagenode-updater_linux_amd64.zip
chmod +x storagenode
chmod +x storagenode-updater
mkdir -p /opt/storagenode/bin
mv storagenode storagenode-updater /opt/storagenode/bin
chown -R storj-storagenode:storj-storagenode /opt/storagenode
If using a Raspberry Pi, ODroid, or other ARM devices, please select the appropriate binary for your system at the v1.16.1 Release Page.
Create SystemD service files
Run the following steps either as root
or using sudo
where appropriate.
Contents of /etc/systemd/system/storagenode.service
:
# This is a SystemD unit file for the Storage Node
# To configure:
# - Update the user and group that the service will run as (User & Group below)
# - Ensure that the Storage Node binary is in /usr/local/bin and is named storagenode (or edit the ExecStart line
# below to reflect the name and location of your binary
# - Ensure that you've run setup and have edited the configuration appropriately prior to starting the
# service with this script
# To use:
# - Place this file in /etc/systemd/system/ or wherever your SystemD unit files are stored
# - Run systemctl daemon-reload
# - To start run systemctl start storagenode
[Unit]
Description = Storage Node service
After = syslog.target network.target
[Service]
Type = simple
User = storj-storagenode
Group = storj-storagenode
ExecStart = /opt/storagenode/bin/storagenode run --config-dir "/mnt/storagenode/config"
Restart = always
NotifyAccess = main
[Install]
Alias = storagenode
WantedBy = multi-user.target
Contents of /etc/systemd/system/storagenode-updater.service
:
# To configure:
# - Update the user and group that the service will run as (User & Group below)
# - Ensure that the Storage Node binary is in /usr/local/bin and is named storagenode (or edit the ExecStart line
# below to reflect the name and location of your binary
# - Ensure that you've run setup and have edited the configuration appropriately prior to starting the
# service with this script
# To use:
# - Place this file in /etc/systemd/system/ or wherever your SystemD unit files are stored
# - Run systemctl daemon-reload
# - To start run systemctl start storagenode
[Unit]
Description = Storage Node Updater service
After = syslog.target network.target
[Service]
Type = simple
User = storj-storagenode
Group = storj-storagenode
ExecStart = /opt/storagenode/bin/storagenode-updater run --config-dir "/mnt/storagenode/config" --binary-location "/opt/storagenode/bin/storagenode" --service-name "storagenode"
Restart = always
NotifyAccess = main
[Install]
Alias = storagenode-updater
WantedBy = multi-user.target
Then run:
systemctl daemon-reload
First Run
Change to the new storj-storagenode
user.
# first become root if not already
sudo su -
# change to storj-storagenode user
su - storj-storagenode -s /bin/bash
To create the config.yaml
file.
/opt/storagenode/bin/storagenode setup --config-dir "/mnt/storagenode/config" --identity-dir "/mnt/storagenode/identity"
Edit the /mnt/storagenode/config/config.yaml
file and ensure the following parameters are set:
console.address: :14002 # to access the web dashboard from another machine
contact.external-address: "storj.example.com:28967"
operator.email: "email@example.com"
operator.wallet: "<wallet address>"
server.address: :28967
storage.allocated-disk-space: 1.00 TB
Exit from the storj-storagenode
user shell:
exit
Subsequent Runs
Run the following steps either as root
or using sudo
where appropriate.
Start the services using systemd.
systemctl start storagenode
systemctl start storagenode-updater
Ensure services are running without errors using:
journalctl -efu storagenode
# check, and then Ctrl-C to exit from the follow mode
journalctl -efu storagenode-updater
If all looks well, enable the systemd units for autostart:
systemctl enable storagenode
systemctl enable storagenode-updater
FUTURE TODO:
- Create a systemd unit to mount
/mnt/storage
instead of using/etc/fstab
and add that to theAfter=
line item instoragenode.service
. This will ensure that systemd manages the order of mounting the data prior to loading the service.