-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Polkadot Wiki Migration] Using Systemd #46
Open
CrackTheCode016
wants to merge
7
commits into
master
Choose a base branch
from
bd-infra-systemd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
84c2fc6
add content
CrackTheCode016 71f8ac3
vale and links
CrackTheCode016 a884f72
corrects line breaks and spacing
dawnkelly09 c0ffc8d
Apply suggestions from code review
CrackTheCode016 8271cfe
address comments
CrackTheCode016 2cd1882
vale
CrackTheCode016 cda0d68
grammar and formatting updates
eshaben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
title: Onboarding | ||
nav: | ||
- index.md | ||
- run-validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
title: Running Validators | ||
nav: | ||
- index.md | ||
- using-systemd.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: Run a Validator | ||
description: TODO | ||
hide: | ||
- feedback | ||
template: subsection-index-page.html | ||
--- |
58 changes: 58 additions & 0 deletions
58
infrastructure/validators/onboarding/run-validator/using-systemd.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: Use Systemd | ||
description: Using a service manager, such as systemd to streamline the management of your Polkadot node as a process on your Linux host machine. | ||
--- | ||
|
||
You can run your validator as a [systemd](https://en.wikipedia.org/wiki/Systemd){target=\_blank} process so that it will automatically restart on server reboots or crashes (and helps to avoid getting [slashed](TODO:update-path){target=\_blank}). | ||
|
||
Before following this guide you should have already set up your validator by following the [How to Validate](TODO:update-path){target=\_blank} article. | ||
|
||
First create a new unit file called `polkadot-validator.service` in `/etc/systemd/system/`. | ||
|
||
```bash | ||
touch /etc/systemd/system/polkadot-validator.service | ||
``` | ||
|
||
In this unit file you will write the commands that you want to run on server boot / restart. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be better to use the systemd file from the repo: https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/scripts/packaging/polkadot.service this is also included in the .deb package when installing it through apt or similar |
||
|
||
``` | ||
[Unit] | ||
Description=Polkadot Validator | ||
|
||
[Service] | ||
ExecStart=PATH_TO_POLKADOT_BIN --validator --name SHOW_ON_TELEMETRY | ||
Restart=always | ||
RestartSec=120 | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
``` | ||
|
||
!!!warning | ||
It is recommended to delay the restart of a node with `RestartSec` in the case of node crashes. It's possible that when a node crashes, consensus votes in GRANDPA aren't persisted to disk. In this case, there is potential to equivocate when immediately restarting. What can happen is the node won't recognize votes that didn't make it to disk, and will then cast conflicting votes. Delaying the restart will allow the network to progress past potentially conflicting votes, at which point other nodes won't accept them. | ||
|
||
To enable this to start on booting your machine, run: | ||
|
||
```bash | ||
systemctl enable polkadot-validator.service | ||
``` | ||
|
||
Start it manually with: | ||
|
||
```bash | ||
systemctl start polkadot-validator.service | ||
``` | ||
|
||
You can check that it's working with: | ||
|
||
```bash | ||
systemctl status polkadot-validator.service | ||
``` | ||
|
||
You can tail the logs with [`journalctl`](https://www.freedesktop.org/software/systemd/man/latest/journalctl.html){target=\_blank} (a tool to print log entries from the `systemd` journal) like so: | ||
|
||
```bash | ||
journalctl -f -u polkadot-validator | ||
``` | ||
CrackTheCode016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Now, you can monitor and manage a Polkadot validator as you would any other service on your Linux host. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
fyi, in secure a node (PR #47), I have put a description.