Galactrum Sentinel

Sentinel is an autonomous agent used for persisting, processing and automating Galactrum governance objects and tasks. Sentinel is an application written in Python that binds to a local Galactrum daemon on each masternode. Simply put, Sentinel runs in the background every minute and reports the status of your masternode to the network.

NOTE: If you used the automated masternode install script, Sentinel should already be installed on your VPS. By default it is located at /home/masternode/sentinel.

Installation Prerequisites

Make sure Python version 2.7.X or above is installed:

python --version

If python is not a valid command, check to see if python3 is, in which case your Python is version 3 and you are good to proceed.

Update the system packages and ensure virtualenv is installed:

sudo apt-get update
sudo apt-get -y install python-virtualenv


Make sure the local Galactrum daemon running is at least version 1.2.1 (1020101):

galactrum-cli getinfo | grep version

Install Sentinel

Clone the Sentinel repository and install Python dependencies:

git clone https://github.com/galactrum/sentinel.git && cd sentinel
virtualenv ./venv
./venv/bin/pip install -r requirements.txt

Configuring Sentinel

An alternative (non-default) path to the galactrum.conf file can be specified in sentinel.conf:

galactrum_conf=/PATH/galactrum.conf

Test the Configuration

Test the configuration by running all tests from the Sentinel folder you cloned into:

./venv/bin/py.test ./test

With all the tests passing, you can now set up a Cron job to automate Sentinel.

Setting Up Cron

Set up a crontab entry to call Sentinel every minute:

crontab -e

In the crontab editor, add the line below, replacing home/USERNAME/sentinel with the path where you cloned sentinel.

* * * * * cd /home/USERNAME/sentinel && ./venv/bin/python bin/sentinel.py >/dev/null 2>&1

Troubleshooting

To view debug output, set the SENTINEL_DEBUG environment variable to anything non-zero, then run the script manually:

SENTINEL_DEBUG=1
./venv/bin/python bin/sentinel.py

Contributing

To contribute a patch, the workflow is as follows:

  • Fork repository
  • Create topic branch
  • Commit patches

In general commits should be atomic and diffs should be easy to read. For this reason do not mix any formatting fixes or code moves with actual code changes.

Commit messages should be verbose by default, consisting of a short subject line (50 chars max), a blank line and detailed explanatory text as separate paragraph(s); unless the title alone is self-explanatory (like “Corrected typo in main.cpp”) then a single title line is sufficient. Commit messages should be helpful to people reading your code in the future, so explain the reasoning for your decisions.

×

Subscribe

The latest tutorials sent straight to your inbox.