Skip to content

Conversation

@bricerisingalgorand
Copy link
Contributor

Summary

Right now a system.json file is not created when setting up systemd through the setup-systemd.sh script. Therefore, users aren't letting their nodes know that the algod process will be managed with systemd. This change has the setup-systemd.sh script download the systemd system.json file and lets the user know they need to copy that into any systemd managed data directory.

Test Plan

I ran the script on a raspberry pi and saw that it worked.

algobarb
algobarb previously approved these changes Jul 28, 2021
Copy link
Contributor

@algobarb algobarb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2021

Codecov Report

Merging #2651 (a5c3faf) into master (434b98f) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2651   +/-   ##
=======================================
  Coverage   47.04%   47.04%           
=======================================
  Files         349      349           
  Lines       55814    55814           
=======================================
  Hits        26256    26256           
+ Misses      26608    26607    -1     
- Partials     2950     2951    +1     
Impacted Files Coverage Δ
cmd/goal/node.go 10.51% <0.00%> (ø)
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
network/requestTracker.go 70.25% <0.00%> (-0.87%) ⬇️
ledger/acctupdates.go 62.30% <0.00%> (ø)
network/wsPeer.go 74.93% <0.00%> (+0.27%) ⬆️
catchup/service.go 70.12% <0.00%> (+0.77%) ⬆️
ledger/blockqueue.go 85.05% <0.00%> (+4.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 434b98f...a5c3faf. Read the comment docs.

onetechnical
onetechnical previously approved these changes Jul 28, 2021
Copy link
Contributor

@onetechnical onetechnical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentative approval; Will's comment on pointing to docs is interesting, and Jack's suggestion to remove the system.json file on stopping is also intriguing, so would be open to either/both those improvements.

algojack
algojack previously approved these changes Jul 28, 2021
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
egieseke
egieseke previously approved these changes Jul 29, 2021
Copy link
Contributor

@egieseke egieseke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@bricerisingalgorand
Copy link
Contributor Author

I think deleting the system.json might be a good idea, but it depends on the purpose we have in mind for it. If it’s meant to only reserve certain interactions with the node after every start that makes sense, but if it’s meant to always restrict the node in some instances it wouldn’t. We may want to consider that design decision more before we make it.

I think Will is right that we should refer to the docs instead of giving prescriptive feedback here though, so I just committed that change 👍

Copy link
Contributor

@onetechnical onetechnical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; did you run it / does it work?

@bricerisingalgorand
Copy link
Contributor Author

Yep, I made sure the file gets created, doesn't get edited when it exists and here are the goal messages

pi@raspberrypi:~ $ ./goal node stop
This node is using systemd and should be managed with systemctl. For additional information refer to https://developer.algorand.org/docs/run-a-node/setup/install/#installing-algod-as-a-systemd-service
pi@raspberrypi:~ $ ./goal node start
This node is using systemd and should be managed with systemctl. For additional information refer to https://developer.algorand.org/docs/run-a-node/setup/install/#installing-algod-as-a-systemd-service
pi@raspberrypi:~ $ ./goal node restart
This node is using systemd and should be managed with systemctl. For additional information refer to https://developer.algorand.org/docs/run-a-node/setup/install/#installing-algod-as-a-systemd-service

Copy link
Contributor

@algobarb algobarb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output that Brice posted looks good.

Copy link
Contributor

@egieseke egieseke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one comment about the message.

errorNodeFailGenToken = "Cannot generate API token: %s"
errorNodeCreation = "Error during node creation: %v"
errorNodeManagedBySystemd = "This node is managed by systemd, you must run the following command to make your desired state change to your node:\n\nsystemctl %s algorand.service"
errorNodeManagedBySystemd = "This node is using systemd and should be managed with systemctl. For additional information refer to https://developer.algorand.org/docs/run-a-node/setup/install/#installing-algod-as-a-systemd-service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly add "Detected system.json file in the data directory, this node is using systemd and should be ..."

@algojohnlee algojohnlee merged commit 0d4b5bb into algorand:master Jul 29, 2021
algojack pushed a commit that referenced this pull request Jul 29, 2021
Right now a system.json file is not created when setting up systemd through the setup-systemd.sh script. Therefore, users aren't letting their nodes know that the algod process will be managed with systemd. This change modifies the systemd configuration file to create the system.json file in the data directory.
@tsachiherman
Copy link
Contributor

@bricerisingalgorand - I'm not a bit fan of providing exact documentation links inside the binary since the documentation links could change over time, forcing us to update the codebase for no good reason.
regardless of that, while changing the error string you forgot to change the corresponding expect test, which is testing against that string. ( admittedly, the expect tests are currently disabled, since they were causing random build failures )

@bricerisingalgorand
Copy link
Contributor Author

@bricerisingalgorand - I'm not a bit fan of providing exact documentation links inside the binary since the documentation links could change over time, forcing us to update the codebase for no good reason.
regardless of that, while changing the error string you forgot to change the corresponding expect test, which is testing against that string. ( admittedly, the expect tests are currently disabled, since they were causing random build failures )

Oh shoot, thanks I'll fix that. Also I can change the error message back to a suggested systemctl command if that's better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants