A monitoring application for Chainflip nodes.
- All chains are monitored for
Health
andSync Status
- Chainflip node version is monitored
- Kubernetes pod restarts are monitored
- Kubernetes pod logs of all chains are aggregated
- Reputation is monitored
- Penalties are monitored
- Chain observations are monitored
Client | Chain |
---|---|
Bitcoin | Bitcoin (BTC) |
Ethereum | Ethereum (ETH), Arbitrum (ARB) |
Polkadot | Polkadot (DOT), Chainflip (FLIP) |
Solana | Solana (SOL) |
Key | Required | Description |
---|---|---|
NODE_ENV | No | Set to production , if you want to run the application in production. |
BETTERSTACK_API_KEY | No | BetterStack API key, see here. |
LOGS_SOURCE_TOKEN | No | BetterStack Logs source token, see here. |
CRON_SCHEDULE | No | Cron schedule to adjust how often the nodes are monitored (e.g. 0 */3 * * * * for every 3min). |
NETWORK | No | Set to testnet if you want to run on Perseverance Testnet (default: mainnet ). |
CHAINFLIP_NODE_ADDRESS | Yes | Public SS58 address of your Chainflip node (cF... ). |
NODE_ENDPOINT_CHAINFLIP | Yes | Chainflip node endpoint (e.g. http://chainflip.chainflip:9944). |
NODE_ENDPOINT_BITCOIN | No | Bitcoin node endpoint (e.g. http://flip:[email protected]:8332). |
NODE_ENDPOINT_ETHEREUM | No | Ethereum node endpoint (e.g. http://ethereum.chainflip:8545). |
NODE_ENDPOINT_POLKADOT | No | Polkadot node endpoint (e.g. http://polkadot.chainflip:9944). |
NODE_ENDPOINT_ARBITRUM | No | Arbitrum node endpoint (e.g. http://arbitrum.chainflip:8545). |
NODE_ENDPOINT_SOLANA | No | Solana node endpoint (e.g. http://solana.chainflip:8899). |
If you want to skip the monitoring of a non-required node endpoint, simply remove the specific environment variable (e.g. NODE_ENDPOINT_BITCOIN
).
Set all environment variables in k8s-deployment.yaml
and deploy the application:
kubectl create -f k8s-deployment.yaml
Remove the application from the Kubernetes cluster:
kubectl delete -f k8s-deployment.yaml
You can access all metrics via the /metrics
endpoint. To scrape these metrics with your Prometheus instance, add the following job to your prometheus.yaml
configuration:
scrape_configs:
- job_name: 'flipr'
static_configs:
- targets: ['flipr.chainflip']
node
(v16.17): Install it via NVMyarn
: Install it vianpm install -g yarn
Clone this repository to your machine and run:
cd flipr
yarn install
yarn build
Open a new service file in an editor with root permissions:
sudo vi /etc/systemd/system/flipr.service
Copy and paste the following content:
[Unit]
Description=Flipr
[Service]
Restart=always
RestartSec=10
Environment="NODE_ENV=production"
Environment="BETTERSTACK_API_KEY=XXX"
Environment="LOGS_SOURCE_TOKEN=XXX"
Environment="CRON_SCHEDULE=0 */3 * * * *"
Environment="NETWORK=mainnet"
Environment="CHAINFLIP_NODE_ADDRESS=cFXXX"
Environment="NODE_ENDPOINT_CHAINFLIP=http://localhost:9944"
Environment="NODE_ENDPOINT_BITCOIN=XXX"
Environment="NODE_ENDPOINT_ETHEREUM=XXX"
Environment="NODE_ENDPOINT_POLKADOT=XXX"
Environment="NODE_ENDPOINT_ARBITRUM=XXX"
Environment="NODE_ENDPOINT_SOLANA=XXX"
ExecStart=NODE_INSTALLATION_PATH DIRECTORY_PATH/dist/main.js
[Install]
WantedBy=multi-user.target
Set all required environment variables and replace:
NODE_INSTALLATION_PATH
: Path to yournode
binaryDIRECTORY_PATH
: Path to the this project directory
Replace the environment variables with your environment variables.
After creating the service file, inform systemd of the new service:
sudo systemctl daemon-reload
To make sure the service starts on boot:
sudo systemctl enable flipr
sudo systemctl start flipr
You can check the status of your service at any time with:
sudo systemctl status flipr
If you want to monitor the application logs:
sudo journalctl -f -u flipr
This will show real-time logs of the flipr service.
If you need to stop or restart the service:
sudo systemctl stop flipr
sudo systemctl restart flipr
If you want to upgrade to a new version:
cd flipr
git pull
yarn build
sudo systemctl restart flipr
Install all the required dependencies from package.json
:
yarn install
Compile .ts
to .js
:
yarn build
Run via node.js
:
yarn start
BetterStack Uptime is used for alerting and incident management.
- Heartbeats are sent for
Health
andSync Status
of the nodes - Missed heartbeats create incidents
- Kubernetes pod restarts create incidents
- Low reputation create incidents
- Penalties create incidents
- Outdated Chainflip node versions creates incidents
Sign up at betterstack.com and follow the docs to get the API key.
BetterStack Logs is used for log manangement and dashboard visualization.
- Flipr forwards its own logs
- k8s
error
andwarn
logs are also forwarded
Sign up at betterstack.com and follow the docs to get a source token for the platform JavaScript • Node.js
.
MIT License
Copyright (c) 2024 Sour Capital Pte. Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.