Maintain validator uptime with systemd or Docker
Validators should be online as much as possible. If you're running your validator on a cloud server, or if you want your validator to automatically start running when the host machine restarts, consider running your client software as a background service through either Docker or systemd.
This may be overkill for at-home stakers who use the prysm.sh
script to run Prysm. To those users, we recommend keeping it simple by occasionally checking the status of your validator. See Check Software Status to learn more.
Docker
You can use Docker to run your beacon node and validators as background services. See Install with Docker. You can monitor and view your running Docker containers using docker ps
.
Systemd (Linux)
Linux systems allow for easy running of services in the background through a daemon process called systemd. You can follow the tutorial posted by Digital Ocean on setting up systemd services.
You can run your beacon node with the following systemd configuration, where you can modify some of the fields and flags to your liking. Assuming your prysm.sh script is at /home/prysm/prysm.sh
.
[Unit]
Description=Prysm Beacon chain daemon
After=network-online.target
[Service]
ExecStart=/home/prysm/prysm.sh beacon-chain
Restart=on-failure
User=YOUR_USER
[Install]
WantedBy=default.target
You can also run your validator client in systemd using the following configuration.
[Unit]
Description=Prysm Validator daemon
After=network-online.target
Wants=prysm-beacon.service
[Service]
ExecStart=/home/prysm/prysm.sh validator --wallet-dir DIR/TO/prysm-wallet-v2 --wallet-password-file DIR/TO/YOUR_PASSWORDFILE --graffiti YOUR_GRAFFITI
Restart=on-failure
User=YOUR_USER
[Install]
WantedBy=default.target