Skip to content

Commit

Permalink
Add Simple Install script (#532)
Browse files Browse the repository at this point in the history
* Add install scripts to install in simple ways.

* updated doc for install scripts
  • Loading branch information
xellos00 authored Dec 19, 2023
1 parent 31fa6b2 commit 92157b8
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ As validators, we provide tools for low-cost and low-effort node management for

## How to get started with VATZ
Check out the [Installation Guide](docs/installation.md) to install and start using VATZ.
- You can get started with simple scripts, Please check [install scripts instructions](script/simple_start_guide/readme.md)

## How to use **VATZ** CLIs
Refer to the [VATZ CLIs guide](docs/cli.md) to find available CLI arguments.
Expand Down
68 changes: 68 additions & 0 deletions script/simple_start_guide/default_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
vatz_protocol_info:
home_path: "~/.vatz"
protocol_identifier: "Validator Node:<protocol>"
port: 9090
health_checker_schedule:
- "0 1 * * *"
notification_info:
host_name: "hostname"
default_reminder_schedule:
- "*/30 * * * *"
dispatch_channels:
- channel: "discord"
secret: "webhook"
rpc_info:
enabled: true
address: "127.0.0.1"
grpc_port: 19090
http_port: 19091
monitoring_info:
prometheus:
enabled: true
address: "127.0.0.1"
port: 18080
plugins_infos:
default_verify_interval: 15
default_execute_interval: 30
default_plugin_name: "vatz-plugin"
plugins:
- plugin_name: "cpu_monitor"
plugin_address: "localhost"
plugin_port: 9001
executable_methods:
- method_name: "cpu_monitor"
- plugin_name: "mem_monitor"
plugin_address: "localhost"
plugin_port: 9002
executable_methods:
- method_name: "mem_monitor"
- plugin_name: "disk_monitor"
plugin_address: "localhost"
plugin_port: 9003
executable_methods:
- method_name: "disk_monitor"
- plugin_name: "node_block_sync"
plugin_address: "localhost"
plugin_port: 10001
executable_methods:
- method_name: "node_block_sync"
- plugin_name: "node_is_alived"
plugin_address: "localhost"
plugin_port: 10002
executable_methods:
- method_name: "node_is_alived"
- plugin_name: "node_peer_count"
plugin_address: "localhost"
plugin_port: 10003
executable_methods:
- method_name: "node_peer_count"
- plugin_name: "node_active_status"
plugin_address: "localhost"
plugin_port: 10004
executable_methods:
- method_name: "node_active_status"
- plugin_name: "node_governance_alarm"
plugin_address: "localhost"
plugin_port: 10005
executable_methods:
- method_name: "node_governance_alarm"
33 changes: 33 additions & 0 deletions script/simple_start_guide/install_vatz&official-plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e
set -v

DEFAULT_LOG_PATH=/var/log/vatz
DEFAULT_VATZ_PATH=/root/vatz

#Create vatz log folder
mkdir $DEFAULT_LOG_PATH

# Compile VATZ
cd DEFAULT_VATZ_PATH
make

## You will see binary named vatz

# Initialize VATZ
./vatz init

# Install vatz-plugin-sysutil
./vatz plugin install github.com/dsrvlabs/vatz-plugin-sysutil/plugins/cpu_monitor cpu_monitor
./vatz plugin install github.com/dsrvlabs/vatz-plugin-sysutil/plugins/mem_monitor mem_monitor
./vatz plugin install github.com/dsrvlabs/vatz-plugin-sysutil/plugins/disk_monitor disk_monitor

# Install vatz-plugin-cosmoshub
./vatz plugin install github.com/dsrvlabs/vatz-plugin-cosmoshub/plugins/node_block_sync node_block_sync
./vatz plugin install github.com/dsrvlabs/vatz-plugin-cosmoshub/plugins/node_is_alived node_is_alived
./vatz plugin install github.com/dsrvlabs/vatz-plugin-cosmoshub/plugins/node_peer_count node_peer_count
./vatz plugin install github.com/dsrvlabs/vatz-plugin-cosmoshub/plugins/node_active_status node_active_status
./vatz plugin install github.com/dsrvlabs/vatz-plugin-cosmoshub/plugins/node_governance_alarm node_governance_alarm

# Check plugin list
./vatz plugin list
37 changes: 37 additions & 0 deletions script/simple_start_guide/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# How to install VATZ & Vatz Official plugins with scripts
> Those following scripts helps user install VATZ in simple way to get started fast. <br>
> Please, be advised that you need to update several variable in scripts to match with your current setting such as cloned VATZ path.
## Here's simple instruction to get started
### 1. Go to script folder
- You can simply setup and run VATZ with following scripts.

### 2. install_vatz&official-plugins.sh
- Please, update to DEFAULT_VATZ_PATH to your vatz path and run this script to install vatz and vatz-official plugin.
```
bash install_vatz&official-plugins.sh
```

### 3. default_config.yaml
- Replace default.yaml with this file after execute `install_vatz&official-plugins.sh`.
- You must enter hostname and webhook or add more dispatchers such as telegram, pagerduty
- Change the port if necessary.
```
cp default_config.yaml /<vatz_path>/default.yaml
```

### 4. vatz_start.sh
- Running this script will run vatz and vatz-plugin-sei.
- The log is stored in `/var/log/vatz`.
- You can change the log path if necessary.
- Enter VALOPER_ADDRESS and VOTER_ADDRESS.
- Modify home path to your current setting.
```
bash vatz_start.sh
```

### 5. vatz_stop.sh
- Running this script will stop both vatz and vatz-official-plugin overall that is currently running.
```
bash vatz_stop.sh
```
35 changes: 35 additions & 0 deletions script/simple_start_guide/vatz_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e
set -v

VATZ_PATH=/root/vatz
LOG_PATH=/var/log/vatz

CPU_MONITOR_PORT=9001
MEM_MONITOR_PORT=9002
DISK_MONITOR_PORT=9003

NODE_BLOCK_SYNC_PORT=10001
NODE_IS_ALIVE_PORT=10002
NODE_PEER_COUNT_PORT=10003
NODE_ACTIVE_STATUS_PORT=10004
NODE_GOVERNANCE_ALARM_PORT=10005
VALOPER_ADDRESS=voloper_address
VOTER_ADDRESS=voter_address


cd $VATZ_PATH

./vatz plugin start --plugin cpu_monitor --args "-port $CPU_MONITOR_PORT" --log $LOG_PATH/cpu_monitor.logs
./vatz plugin start --plugin mem_monitor --args "-port $MEM_MONITOR_PORT" --log $LOG_PATH/mem_monitor.logs
./vatz plugin start --plugin disk_monitor --args "-port $DISK_MONITOR_PORT" --log $LOG_PATH/disk_monitor.logs

./vatz plugin start --plugin node_block_sync --args "-port $NODE_BLOCK_SYNC_PORT" --log $LOG_PATH/node_block_sync.logs
./vatz plugin start --plugin node_is_alived --args "-port $NODE_IS_ALIVE_PORT" --log $LOG_PATH/node_is_alived.logs
./vatz plugin start --plugin node_peer_count --args "-port $NODE_PEER_COUNT" --log $LOG_PATH/node_peer_count.logs
./vatz plugin start --plugin node_active_status --args "-port $NODE_ACTIVE_STATUS_PORT -valoperAddr $VOTER_ADDRESS" --log $LOG_PATH/node_active_status.logs
./vatz plugin start --plugin node_governance_alarm --args "-port $NODE_GOVERNANCE_ALARM_PORT -voterAddr $VOTER_ADDRESS" --log $LOG_PATH/node_governance_alarm.logs

./vatz start --config default.yaml >> /var/log/vatz/vatz.log 2>&1 &

echo "true"
75 changes: 75 additions & 0 deletions script/simple_start_guide/vatz_stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash
set -e
set -v

pid0=`pidof cpu_monitor`
pid1=`pidof mem_monitor`
pid2=`pidof disk_monitor`
pid3=`pidof node_block_sync`
pid4=`pidof node_is_alived`
pid5=`pidof node_peer_count`
pid6=`pidof node_active_status`
pid7=`pidof node_governance_alarm`
pid8=`pidof vatz`

# Kill process

kill -15 $pid6

# wait Kill process
sleep 1

while (( `lsof -p $pid0 | wc -l` > 0 ))
do
echo `lsof -p $pid0 | wc -l`
sleep 1
done
while (( `lsof -p $pid1 | wc -l` > 0 ))
do
echo `lsof -p $pid1 | wc -l`
sleep 1
done
while (( `lsof -p $pid2 | wc -l` > 0 ))
do
echo `lsof -p $pid2 | wc -l`
sleep 1
done
while (( `lsof -p $pid3 | wc -l` > 0 ))
do
echo `lsof -p $pid3 | wc -l`
sleep 1
done
while (( `lsof -p $pid4 | wc -l` > 0 ))
do
echo `lsof -p $pid4 | wc -l`
sleep 1
done
while (( `lsof -p $pid5 | wc -l` > 0 ))
do
echo `lsof -p $pid5 | wc -l`
sleep 1
done
while (( `lsof -p $pid6 | wc -l` > 0 ))
do
echo `lsof -p $pid6 | wc -l`
sleep 1
done
while (( `lsof -p $pid7 | wc -l` > 0 ))
do
echo `lsof -p $pid7 | wc -l`
sleep 1
done
while (( `lsof -p $pid8 | wc -l` > 0 ))
do
echo `lsof -p $pid8 | wc -l`
sleep 1
done
echo "seid $pid0 is killed."
echo "seid $pid1 is killed."
echo "seid $pid2 is killed."
echo "seid $pid3 is killed."
echo "seid $pid4 is killed."
echo "seid $pid5 is killed."
echo "seid $pid6 is killed."
echo "seid $pid7 is killed."
echo "seid $pid8 is killed."

0 comments on commit 92157b8

Please sign in to comment.