Skip to content

btbf/block-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPO Block Notify

Notify block mint results and Next Block Schedule to any message platform.

Block status Notify

Next schedule Notify

Supported languages

Japanese, English, Portuguese, Spanish, French, Korean, Thai, and Vietnamese

Supported platforms

LINE / Discord / Slack / Telegram

Setup

English Ver.

0.Prerequisites

1.Install Dependent Programs

Update OS Packages

sudo apt update && sudo apt upgrade -y

Check python version

python3 -V

Python 3.10 over

If you have Python 3.9 or lower, please use this tool to update.

cd
wget https://raw.githubusercontent.com/btbf/spojapanguild/master/scripts/pythonUpdate.sh
chmod +x pythonUpdate.sh
./pythonUpdate.sh

Install dependencies

sudo apt install -y build-essential libssl-dev libffi-dev python3-dev python3-pip python3-testresources
pip3 install watchdog pytz python-dateutil requests discordwebhook slackweb i18nice

Download the executable script and configuration file

bn_release="$(curl -s https://api.github.com/repos/btbf/block-notify/releases/latest | jq -r '.tag_name')"
wget https://github.com/btbf/block-notify/archive/refs/tags/${bn_release}.tar.gz -P $NODE_HOME/scripts
cd $NODE_HOME/scripts
tar zxvf ${bn_release}.tar.gz block-notify-${bn_release}/block_notify.py block-notify-${bn_release}/config.ini block-notify-${bn_release}/i18n/ 
mv block-notify-${bn_release} block-notify
rm ${bn_release}.tar.gz

How to use

Editing Configuration Files

cd block-notify
nano config.ini
item Valus usage
pool_ticker ex.) SJG pool ticker name
notify_language english:en
japanese:ja
Portuguese:pt
French:fr
Spanish:es
notification language
notify_timezone Asia/Tokyo
Timezone List
Specify yourTimezone
notify_platform Line
Discord
Slack
Telegram
Specify the platform to be notified
(Multiple designations are invalid.)
notify_level All:All
Other Confirm:ExceptCofirm
Only Miss:OnlyMissed
Set notification level
nextepoch_leader_date Only Summary:SummaryOnly
Summary and date:SummaryDate
Notification of next epoch schedule date/time
If you do not want the list of next epoch schedule dates to flow to notifications, please include SummaryOnly.
line_notify_token Line notify token id Enter Line Notify token
discord_webhook_url discord_webhook_url Enter discord_webhook_url
slack_webhook_url slack web hookurl Enter slack web hookurl
telegram_token Telegram API Token Enter Telegram API Token
telegram_id Telegram Chat id Enter Telegram Chat id
node_home ex.)/home/usr/cnode Enter 'node_home' Directory Path
guild_db_dir ex.)%(node_home)s/guild-db/blocklog/ Enter the path to guild-db
Do not change %(node_home)s as it is a variable
shelley_genesis ex.)%(node_home)s/files/shelley-genesis.json Enter the file path for shelley_genesis
Do not change %(node_home)s as it is a variable
byron_genesis ex.)%(node_home)s/files/byron-genesis.json Enter the file path for byron_genesis
Do not change %(node_home)s as it is a variable

Configure the service file

cat > $NODE_HOME/service/cnode-blocknotify.service << EOF 
# file: /etc/systemd/system/cnode-blocknotify.service

[Unit]
Description=Cardano Node - SPO Blocknotify
BindsTo=cnode-cncli-sync.service
After=cnode-cncli-sync.service

[Service]
Type=simple
User=$(whoami)
WorkingDirectory=${NODE_HOME}/scripts/block-notify
ExecStart=/bin/bash -c 'cd ${NODE_HOME}/scripts/block-notify/ && python3 -u block_notify.py'
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cnode-blocknotify

[Install]
WantedBy=cnode-cncli-sync.service
EOF
sudo cp $NODE_HOME/service/cnode-blocknotify.service /etc/systemd/system/cnode-blocknotify.service
sudo chmod 644 /etc/systemd/system/cnode-blocknotify.service
sudo systemctl daemon-reload
sudo systemctl enable cnode-blocknotify.service

Activate SPO BlockNotify

sudo systemctl start cnode-blocknotify.service

Add an alias for checking logs to the environment variable

echo alias blocknotify='"journalctl --no-hostname -u cnode-blocknotify -f"' >> $HOME/.bashrc

Environment variable reloading

source $HOME/.bashrc

Startup Confirmation

blocknotify

The following indications are fine.

[xxx] SPO Block Notify has been started.

日本語 Ver.

0.前提条件

1.依存プログラムをインストールする**

Python環境をセットアップする

パッケージを更新する

sudo apt update && sudo apt upgrade -y

pythonバージョンを確認する

python3 -V

Python 3.10以上

Python 3.9以下の場合こちらのツールでアップデートしてください

cd
wget https://raw.githubusercontent.com/btbf/spojapanguild/master/scripts/pythonUpdate.sh
chmod +x pythonUpdate.sh
./pythonUpdate.sh

依存関係をインストールする

sudo apt install -y build-essential libssl-dev libffi-dev python3-dev python3-pip python3-testresources
pip3 install watchdog pytz python-dateutil requests discordwebhook slackweb i18nice

実行スクリプトと設定ファイルをダウンロードする

bn_release="$(curl -s https://api.github.com/repos/btbf/block-notify/releases/latest | jq -r '.tag_name')"
wget https://github.com/btbf/block-notify/archive/refs/tags/${bn_release}.tar.gz -P $NODE_HOME/scripts
cd $NODE_HOME/scripts
tar zxvf ${bn_release}.tar.gz block-notify-${bn_release}/block_notify.py block-notify-${bn_release}/config.ini block-notify-${bn_release}/i18n/ 
mv block-notify-${bn_release} block-notify
rm ${bn_release}.tar.gz

使い方

設定ファイルの編集

cd block-notify
nano config.ini
項目 使用用途
pool_ticker ex.) SJG プールティッカー名を入力する
notify_language 英語:en
日本語:ja
ポルトガル語:pt
フランス語:fr
スペイン語:es
通知言語を入力する
notify_timezone Asia/Tokyo
タイムゾーン一覧
お住いのタイムゾーンを指定する
notify_platform Line
Discord
Slack
Telegram
通知先プラットフォームを指定する
(複数指定は無効)
notify_level 全て:All
Confirm以外:ExceptCofirm
Missのみ:OnlyMissed
通知基準を設定する
nextepoch_leader_date 概要のみ:SummaryOnly
概要と日付:SummaryDate
次エポックスケジュール日時の通知有無
次エポックスケジュール日付一覧を通知に流したくない場合はSummaryOnlyを記載してください
line_notify_token LINE設定の(8)で発行したトークンID Line Notifyトークンを入力する
discord_webhook_url Discord設定の(7)で発行したウェブフックURL DiscordウェブフックURLを入力する
slack_webhook_url Slack設定の(4)で発行したWebhook URL SlackウェブフックURLを入力する
telegram_token Telegram設定の(5)で発行したAPIトークン Telegram APIトークンを入力する
telegram_id Telegram設定の(9)で表示されたChat id Telegram ChatIDを入力する
node_home ex.)/home/usr/cnode node_homeディレクトリパスを入力する
guild_db_dir ex.)%(node_home)s/guild-db/blocklog/ guild-dbのパスを入力する
%(node_home)sは変数のため変更しないでください
shelley_genesis ex.)%(node_home)s/files/shelley-genesis.json shelley_genesisのファイルパスを入力する
%(node_home)sは変数のため変更しないでください
byron_genesis ex.)%(node_home)s/files/byron-genesis.json byron_genesisのファイルパスを入力する
%(node_home)sは変数のため変更しないでください

サービスファイルを設定する

cat > $NODE_HOME/service/cnode-blocknotify.service << EOF 
# file: /etc/systemd/system/cnode-blocknotify.service

[Unit]
Description=Cardano Node - SPO Blocknotify
BindsTo=cnode-cncli-sync.service
After=cnode-cncli-sync.service

[Service]
Type=simple
User=$(whoami)
WorkingDirectory=${NODE_HOME}/scripts/block-notify
ExecStart=/bin/bash -c 'cd ${NODE_HOME}/scripts/block-notify/ && python3 -u block_notify.py'
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cnode-blocknotify

[Install]
WantedBy=cnode-cncli-sync.service
EOF
sudo cp $NODE_HOME/service/cnode-blocknotify.service /etc/systemd/system/cnode-blocknotify.service
sudo chmod 644 /etc/systemd/system/cnode-blocknotify.service
sudo systemctl daemon-reload
sudo systemctl enable cnode-blocknotify.service

SPO BlockNotifyを起動する

sudo systemctl start cnode-blocknotify.service

環境変数にログ確認用エイリアスを追加する

echo alias blocknotify='"journalctl --no-hostname -u cnode-blocknotify -f"' >> $HOME/.bashrc

環境変数再読み込み

source $HOME/.bashrc

起動確認

blocknotify

以下の表示なら正常です。

[xxx] ブロック生成ステータス通知を起動しました

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages