From 84c2fc6863a8df2c914e5de5099426e027c47a10 Mon Sep 17 00:00:00 2001 From: Bader Youssef Date: Thu, 19 Sep 2024 17:52:36 -0400 Subject: [PATCH] add content --- infrastructure/validators/onboarding/.pages | 1 + .../onboarding/run-validator/.pages | 4 ++ .../onboarding/run-validator/index.md | 7 ++ .../onboarding/run-validator/using-systemd.md | 64 +++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 infrastructure/validators/onboarding/run-validator/.pages create mode 100644 infrastructure/validators/onboarding/run-validator/index.md create mode 100644 infrastructure/validators/onboarding/run-validator/using-systemd.md diff --git a/infrastructure/validators/onboarding/.pages b/infrastructure/validators/onboarding/.pages index 43e478df6..b909980ad 100644 --- a/infrastructure/validators/onboarding/.pages +++ b/infrastructure/validators/onboarding/.pages @@ -1,3 +1,4 @@ title: Onboarding nav: - index.md + - run-validator diff --git a/infrastructure/validators/onboarding/run-validator/.pages b/infrastructure/validators/onboarding/run-validator/.pages new file mode 100644 index 000000000..40d2deec6 --- /dev/null +++ b/infrastructure/validators/onboarding/run-validator/.pages @@ -0,0 +1,4 @@ +title: Running Validators +nav: + - index.md + - using-systemd.md diff --git a/infrastructure/validators/onboarding/run-validator/index.md b/infrastructure/validators/onboarding/run-validator/index.md new file mode 100644 index 000000000..66669795b --- /dev/null +++ b/infrastructure/validators/onboarding/run-validator/index.md @@ -0,0 +1,7 @@ +--- +title: Run a Validator +description: TODO +hide: +- feedback +template: subsection-index-page.html +--- \ No newline at end of file diff --git a/infrastructure/validators/onboarding/run-validator/using-systemd.md b/infrastructure/validators/onboarding/run-validator/using-systemd.md new file mode 100644 index 000000000..a096091f0 --- /dev/null +++ b/infrastructure/validators/onboarding/run-validator/using-systemd.md @@ -0,0 +1,64 @@ +--- +title: Use Systemd +description: Using a service manager for your validator node. +--- + +You can run your validator as a [systemd](https://en.wikipedia.org/wiki/Systemd) process so that it +will automatically restart on server reboots or crashes (and helps to avoid getting +[slashed](../learn/learn-offenses.md)). + +Before following this guide you should have already set up your validator by following the +[How to validate](../learn/learn-validator.md) 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. + +``` +[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 will + not 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 will not accept them. + +To enable this to autostart on bootup 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` like so: + +```bash +journalctl -f -u polkadot-validator +```