Restarting the Validator
By default, when you set up a full node, the Validator container will wait for the following conditions to be met:
- The Consensus client is up and synced.
- Wait for 1 Epoch at least (using the
validator-blockerservice of the
You can set the number of epochs to wait using the flag
--wait-epoch <number> on the generate command, the default value is 1.
After that, the Validator container will launch.
Restarting a Validator
If for any reason your setup is restarted, the
validator will not start automatically. You will need to run it manually,
because otherwise, it will not wait for the above conditions to be met, therefore, the restart might cause some slashing issues.
You need to restart the validator manually; if you instead configure the docker compose service to restart automatically, this can incur severe penalties for your node.
If the docker daemon restarts (due to a machine reboot, for example), the docker compose services with a restart policy will
restart, but the
depends_on policy won’t retake effect. The
depends_on policy only takes effect after a docker compose
up (for the reboot case). This means the Validator can’t set a restart policy until we run
up after a reboot
for it to now incur in any slashing.
Solution (Only for Unix-based systems)
To solve this problem, we found two workarounds:
- Create a
- Create a
Both of those solutions will run after a reboot and will run the
docker compose up validator command.
You can use the following steps to automatically run
docker compose up validator when your machine restarts:
- Create a systemd service file with the following content:
Description=Validator Restart Service
ExecStart=/usr/local/bin/docker compose up -d validator
/path/to/docker-compose/file with the actual path to your
docker-compose.yml file. You may also need to adjust the
ExecStart path if your
docker binary is located elsewhere.
- Save the file as
- Reload the systemd daemon:
sudo systemctl daemon-reload
- Enable the service to start automatically at boot:
sudo systemctl enable validator-restart.service
- Start the service:
sudo systemctl start validator-restart.service
- After completing these steps,
docker compose up validatorwill automatically run when your machine restarts. You can check the status of the service with:
sudo systemctl status validator-restart.service
If you need to stop the service, you can use the following command:
sudo systemctl stop validator-restart.service
To create a cron job that automatically runs
docker compose up validator on system reboot, you should first create a shell script
that runs the necessary commands, and then set up a cron job to execute the script at system startup.
Here's how to do it:
- Create a shell script:
Open a terminal and navigate to the directory where your
docker-compose.ymlfile is located. Then, create a new shell script file:
- Open the file with a text editor:
- Add the following content to the script:
# Change to the directory containing the docker-compose.yml file
# Load environment variables, if any
# Start the Docker Compose service
docker compose up -d validator
Replace /path/to/your/docker-compose/directory with the actual path of the directory containing your
file. Save and exit the text editor.
- Make the script executable:
chmod +x start-docker-compose.sh
- Set up a cron job:
Run the following command to edit the system-wide crontab file:
sudo crontab -e
Add the following line at the end of the file:
/path/to/your/script/directory with the actual path of the directory containing your
start-docker-compose.sh script. Save and exit the text editor.
Now, the cron job will automatically run
docker compose up -d validator on system reboot.