How do I use the SN updater on FreeBSD?

How do I use the SN updater? I finally decided that it should be mature enough and I’m lazy to update anymore so where do I find the instructions? I looked for them but I see only instructions for Watchtower. Can somebody point me to where I can find them?

@Alexey You have migrated me here but I am not using Linux and systemctl command doesn’t exist…
Does this mean that there are no instructions?

Sorry for that. You didn’t specify what OS are you using. The separate updater is exist only for Linux, BSD and Windows.
In Windows it’s installed with storagenode. So the alternative is only Linux or BSD :man_shrugging:
What’s your OS and what do you want to do?

Apologies, I didn’t know it had anything to do with the OS, I thought it was just a command, like with storagenode. I’m using FreeBSD, which is how, I assume, you are supporting TrueNAS, as it has been announced years ago and is touted as supported but there was never an app for it. Why is Windows version so simple and integrated, and has installer and non-Windows so manual and laborious?

I just want to use the updater to update the node, instead of doing it manually.

I do not have an instruction how to setup updater in freeBSD, but you need to setup storagenode as a service first (I think this could help: Chapter 12. Configuration and Tuning | FreeBSD Documentation Portal)
The storagenode-updater should be installed as service too.
It should have configuration options:

  • --config-dir point to the config file of storagenode;
  • --identity-dir point to the identity folder of storagenode;
  • --binary-location point to the folder where is storagenode binary located;
  • --service-name specified a service name of storagenode.

Specifying this to an updater seem to cause issues – as updater does not understand (and complains about) half of the parameters for storage node. I have omitted it; my rc script looks like so:

root@storj:~ # cat /etc/rc.d/storjupd
#!/bin/sh

# PROVIDE: storjupd
# REQUIRE: LOGIN FILESYSTEMS netwait
# KEYWORD: SHUTDOWN

. /etc/rc.subr

name=storjupd
rcvar=${name}_enable


load_rc_config $name
: ${storjupd_enable:=yes}
: ${storjupd_config_dir="/root/.local/share/storj/storagenode"}
: ${storjupd_identity_dir="/root/.local/share/storj/identity/storagenode"}
: ${storjupd_node_binary_location="/usr/local/bin/storagenode"}
: ${storjupd_node_service_name="storj"}

pidfile="/var/run/${name}.pid"
procname="/usr/local/bin/storagenode-updater"
command="/usr/sbin/daemon"
command_args="-f -H -o /var/log/${name}.log \
    -p ${pidfile} -u root ${procname} run \
    --identity-dir ${storjupd_identity_dir}\
    --binary-location ${storjupd_node_binary_location} \
    --service-name ${storjupd_node_service_name}"

# specifying this leads to issues. Is it needed?
#--config-dir ${storjupd_config_dir} 

run_rc_command "$1"

Along the same line, it seems to me that the updater should not need identity dir either – why would it need it? Its job is to check versions and update binary.

This is the output I get with the above script:

root@storj:~ # cat /var/log/storjupd.log
2022-07-24T21:57:53.463-0700	INFO	Running on version	{"Process": "storagenode-updater", "Service": "storagenode-updater", "Version": "v1.58.2"}
2022-07-24T21:57:53.464-0700	INFO	Downloading versions.	{"Process": "storagenode-updater", "Server Address": "https://version.storj.io"}
2022-07-24T21:57:53.685-0700	INFO	Current binary version	{"Process": "storagenode-updater", "Service": "storj", "Version": "v1.58.2"}
2022-07-24T21:57:53.685-0700	INFO	New version is being rolled out but hasn't made it to this node yet	{"Process": "storagenode-updater", "Service": "storj"}
2022-07-24T21:57:53.692-0700	INFO	Current binary version	{"Process": "storagenode-updater", "Service": "storagenode-updater", "Version": "v1.58.2"}
2022-07-24T21:57:53.693-0700	INFO	New version is being rolled out but hasn't made it to this node yet	{"Process": "storagenode-updater", "Service": "storagenode-updater"}

Anyway, for completeness, and to help fellow forum users avoid wasting time writing the rc script for Nth time from scratch, here is my storagenode script. It works in FreeBSD 13.1 jail (on TrueNAS 13.1 for that matter)

root@storj:~ # cat /etc/rc.d/storj
#!/bin/sh

# PROVIDE: storj
# REQUIRE: LOGIN FILESYSTEMS netwait
# KEYWORD: SHUTDOWN

. /etc/rc.subr

name=storj
rcvar=storj_enable


load_rc_config $name
: ${storj_enable:=yes}
: ${storj_msg="Nothing started."}
: ${storj_config_dir="/root/.local/share/storj/storagenode"}
: ${storj_identity_dir="/root/.local/share/storj/identity/storagenode"}

pidfile="/var/run/${name}.pid"
procname="/usr/local/bin/storagenode"
command="/usr/sbin/daemon"
command_args="-f -H -o /var/log/${name}.log \
    -p ${pidfile} -u root ${procname} run \
    --config-dir ${storj_config_dir} \
    --identity-dir ${storj_identity_dir}\
    --log.level info --log.output stdout"

required_dirs="/mnt/storj/blobs"

run_rc_command "$1"

Adjust the required_dirs to the correct mount point, and adjust netwait to ping relevant to your network address.

Snippet from /etc/rc.conf:

storj_enable="YES"
netwait_enable="YES"
netwait_ip=10.0.17.1
newsyslog_enable="YES"
storjupd_enable="YES"

While at it, here is the log rotator config:

root@storj:~ # cat /etc/newsyslog.conf.d/storj.conf
# $FreeBSD$
/var/log/storj.log                          600  20     *  @T00     J   /var/run/storj.pid
1 Like

Hello @arrogantrabbit ,
Welcome to the forum!

Yes, it warns about not recognized keys, but they are not errors and not fatal, so can be ignored. The config file is used by the updater mostly for purpose to take a location of the identity and an address of the version control service. Maybe also metrics service (if you agreed to send stats).
If you specified the identity location and other required parameters and do use a default version control service, I believe it’s safe to do not provide a config location to the updater.

1 Like

Fiddling with low-level workings of an operating system is an extremely complex and cumbersome task for a user. I don’t even know if an equivalent of this is viewable in Windows without the source code. I would need to learn the language that this is supposed to be written in (it doesn’t say what it is on this page, probably somewhere else), then learn how this part of the operating system works, then be able to understand these instructiosn and then I could attempt to do this. I would like to see an average Windows SNO do this in Windows - why is there an installer abstraction for them and not for non-Windows?

However, Linux and FreeBSD are Open Source and more friendly for Community participation. So you are welcome to write an installer for FreeBSD/TrueNAS.
We already have an installer for Linux (Debian-based): [Tech Preview] Linux Installer Part 2

The main problem of other OSes - no uniform installer, even within a Linux ecosystem there are at least two major package systems (but in reality - any distro have an own implementation). This is a nightmare to support all of them.

I’ve improved the scripts (fixed minor issues with restarting the daemon on failure) and posted them here: GitHub - arrogantrabbit/freebsd_storj_installer: Installer script for Store on FreeBSD, along with the installer script that will do all the work for you. Tested on FreeBSD 13.1-RELEASE jail.

3 Likes