Phala UPS guard
Check: GitHub - l00k/phala-ups-guard
This tools monitors UPS state.
If something is wrong with line power and UPS is switched to battery power supply - tool starts procedure.
NOTE:
Currently Phala uses mining rounds mechanism. It may change in future according to:
Requirements
- HID compatible UPS
- apcupsd package
- node.js v12+
Additional for remote deployment
- PHP >= 7.2
- Composer
Usage
There are 2 ways of using this tool
- You can copy few files and manually configure everything
- or you can use deployer to configure everything
Manual
- Copy file
dist/main.js
to<dest>/main.js
- Configure nodes and accounts in
<dest>/config.json
(check configuration section) - Run with
node ./main.js
Using deployer
- Install dependencies
git clone https://github.com/l00k/phala-ups-guard.git
cd phala-ups-guard
composer install
npm ci
- Configure nodes and accounts in
(...)/phala-ups-guard/config.json
- Configure host in
(...)/phala-ups-guard/hosts.yaml
- Deploy -
my-ups-guard
is hostname fromhosts.yaml
php ./vendor/bin/dep guard:deploy my-ups-guard
Configuration
Guard configuration (config.json)
You can use config.dist.json
as a template.
{
"nodes": [
{ "url": "wss://poc4.phala.network/ws" },
{ "url": "http://127.0.0.1:9933" }
],
"accounts": [
{
"name": "Miner 01",
"privateKey": "abc def ghi abc def ghi abc def ghi abc def ghi"
},
{
"name": "Miner 02",
"privateKey": "abc def ghi abc def ghi abc def ghi abc def ghi"
}
]
}
nodes
- list of Phala nodes
nodes[idx].url
- node URL - it can WebSocket or RPC HTTP server
accounts
- list of managed accounts
accounts[idx].name
- account name for logging purpose
accounts[idx].privateKey
- mnemonic / private key of account
Hosts for deployment (hosts.yaml)
You can use hosts.dist.yaml
as a template.
my-ups-guard:
hostname: 123.45.67.89
port: 22
user: root
deploy_path: '/srv/guard'
my-ups-guard
- deployer host identifier
<host>.hostname
- IP address of your node
<host>.port
- self explanatory
<host>.user
- root or other user which has access to sudo
command (without password - google “visudo nopasswd”)
<host>.deploy_path
- directory where all scripts will be placed