-
Notifications
You must be signed in to change notification settings - Fork 523
Update systemd-setup.sh to install system.json #2651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update systemd-setup.sh to install system.json #2651
Conversation
algobarb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
66d1c05 to
a4a18c8
Compare
Co-authored-by: John Lee <john@onetechnical.com>
…and/go-algorand into brice/installSystemJson
onetechnical
left a comment
There was a problem hiding this 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.
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
cf94b5d
egieseke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
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 👍 |
…and/go-algorand into brice/installSystemJson
onetechnical
left a comment
There was a problem hiding this 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?
|
Yep, I made sure the file gets created, doesn't get edited when it exists and here are the goal messages |
algobarb
left a comment
There was a problem hiding this 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.
egieseke
left a comment
There was a problem hiding this 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" |
There was a problem hiding this comment.
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 ..."
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.
|
@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. |
Oh shoot, thanks I'll fix that. Also I can change the error message back to a suggested systemctl command if that's better |
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.