Install a Node - Separate the Installation Process

Need clarification, as I tried to install a node and have been waiting days for the node block to initialize up to latest block on TestNet. Then after 10 days for some unknown reason the systemctl service for algorand somehow resets itself, restarts itself, and changes the service file back to use -d /var/lib/algorand

Now I have all of the set of algorand node files in 2 directories.

  1. /var/lib/algorand
  2. /var/lib/algorand/node/

I used the Red Hat distribution centos env section and edited the system service file (Probably wrong way) for -d to be /var/lib/algorand/node/testnetdata and set ALGORAND_DATA env var.

sudo -u algorand -E -s
cd /var/lib/algorand/
add to end of file
vi .bashrc
export ALGORAND_DATA=“$HOME/node/testnetdata”
export PATH=“$HOME/node:$PATH”

All I want is for this to be easy to read and easy to do.

  1. To make it easier for everyone. Can you please split up this documentation link

to be 5 separate webpages.
webpage 1. Requirements to install a node - Hardware
webpage 2. Installation with a package manager for Debian based distributions
webpage 3. Installation with a package manager for Red Hat based distributions
webpage 4. Installing on Linux using wget (these not verified, but should work)
webpage 5. Installation with the updater script for Mac

Then each webpage have the same sections but specific to the env:
Section 1. Explain the entire initialization process and how to know it’s done syncing.
Section 2. Explain user algorand and algod and using sudo -u algorand -E -s with another user i.e. algodev
Section 3. Add algodev user permissions file to /etc/sudoers.d/
Section 3. Installing the Devtools
Section 4. Start Node
Section 5. Installing algod as a systemd service
Section 6. How to use Catchup
Section 7. How to use goal as different user, i.e. algodev, when using systemctl start algorand
Section 8 How to edit systemctl service template and switch Testnet to Mainnet, etc.

I’m fine with /usr/bin having algod and goal

  • how do I use goal to check status if I’m algodev user and using systemctl start algorand which was started as root. For example:

su -l algodev
cd /home/algodev/
/usr/bin/sudo -u algorand -E -s goal node status -w 6000 -d /var/lib/algorand/node/testnetdata

  • how do I use goal node catchup when running node with systemctl start algorand

wget https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/betanet/latest.catchpoint
wget https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/testnet/latest.catchpoint
wget https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/mainnet/latest.catchpoint

vi latest.catchpoint

sudo -u algorand -E -s goal node catchup <CATCHPOINT_TOKEN> -d /var/lib/algorand/node/testnetdata

Since systemctl is running node as a service, can I even use goal node catchup?

Another question I have, is if I installed with Red Hat package manager, how do I do an update when using systemctl? anything like yum update. When using the systemctl service approach, should I never use update.sh script. This copies all files, sames as an install, but to cwd. I like the update script as that’s how I first start to use algorand and running node with goal commands.

Another question I have, is in the algorand@.service.template (which isn’t included, or I can’t find it, when installing using Red Hat package manager, can we add this as part of Red Hat package manager install?) can the notes in the template file be explicit. Instead of asterisk can it be algorand and so I’m not giving access to any service to the algo user just algorand service to algo user.

Another question, I have, is can we suppress the amount of writes to the node log file during an initialization. Just a guess, but once this log file gets to be really big it slows the initialization down much so. Just an idea. My asumption is using a catchup can’t be done before an initialization is complete.

To allow the update script (which runs as the algo user) to manipulate
the algorand systemd service, the following lines need to be added to
/etc/sudoers (using visudo):

algo ALL=(ALL) NOPASSWD: /usr/bin/systemctl start *
algo ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop *
algo ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart *
algo ALL=(ALL) NOPASSWD: /usr/bin/systemctl status *

I would be happy spending my time reviewing these new separate Install a Node webpages answering every possible question and providing feedback… than getting stuck over and over guessing on what I did wrong and how to figure out how to do it right.

After further looking into, I am understanding the systemctl flow. The comments about update script should be separate topic as my original intentions are to use systemctl service algorand with Red Hat based distribution which already installs for you the service.

The update script is for installing on Linux using wget which doesn’t preinstall the service.

So back to further looking into systemctl flow, the Template unit algorand@.service is the file to edit and then copy to algorand.service. The systemctl manager may refresh at anytime the Instance unit (algorand.service file) so make sure changes are done in Template unit.

Template unit is /lib/systemd/system/algorand@.service
Instance unit is /lib/systemd/system/algorand.service

After changes to Template unit, I hardcoded the -d /var/lib/algorand/node/testnetdata, just do a copy algorand@.service algorand.service as root in /lib/systemd/system/

Interesting to note is, since the service is run as algorand user, these 2 files are cloned to the /usr/lib/systemd/system/ dir so the algorand user can be called to run the service.

ls -l /lib/systemd/system/algorand*
-rw-r–r–. 1 root root 458 Jan 22 17:32 /lib/systemd/system/algorand.service
-rw-r–r–. 1 root root 1276 Jan 22 17:29 /lib/systemd/system/algorand@.service

ls -l /usr/lib/systemd/system/algorand*
-rw-r–r–. 1 root root 458 Jan 22 17:32 /usr/lib/systemd/system/algorand.service
-rw-r–r–. 1 root root 1276 Jan 22 17:29 /usr/lib/systemd/system/algorand@.service

The one question I still have after reading link below is since algorand@.service uses the %I, which is %i: This references the instance name, and algorand@.service doesn’t have an instance name, i.e. algorand@-var-lib-algorand-node-testnetdata.service, (instance name is escaped -var-lib-algorand-node-testnetdata) I assume the user, algorand user’s $HOME path is assumed and so defaults to start in the /var/lib/algorand dir. That was my mistake. I changed the instance unit file, systemctl did a refresh of some sort, and reloaded Template units to Instance units and then ran using -d /var/lib/algorand/ dir.

Below is how I plan to change service in Template unit file for TestNet to MainNet.

[Service]
ExecStart=/usr/bin/algod -d /var/lib/algorand/node/testnetdata
## ExecStart=/usr/bin/algod -d /var/lib/algorand/node/mainnetdata
## ExecStart=/usr/bin/algod -d %I

Still need to look into - if goal commands for catchup can work when using systemctl start algorand

sudo -u algorand -E -s goal node catchup <CATCHPOINT_TOKEN> -d /var/lib/algorand/node/testnetdata

as I know I can do a sudo -u algorand -E -s goal node status -d /var/lib/algorand/node/testnetdata as a different user and it works.

i believe the most easy way to run the algorand nodes is in the kubernetes… AlgorandNodes/kubernetes at main · scholtz/AlgorandNodes · GitHub

Thanks for the feedback!

We’d be happy if you could make a pull request there to make those changes:

Working on this, will have something by tomorrow.

Install a Node
Install a Node on Debian based distributions
Install a Node on Red Hat based distributions
Install a Node on Other Linux
Install a Node on a Mac 
Configure algod as a systemd service 
Configure node to use Telemetry 
Sync node using Fast Catchup 
Switching Networks - BetaNet, TestNet, MainNet
1 Like

Ok, just uploaded to github and did a pull request.

2 Likes