スタートアップサービスの作成
Dingoは、Go言語で書かれたCardanoブロックチェーンデータノードであり、Ouroboros Network Node-to-Nodeミニプロトコルファミリーを使用して、Cardanoブロックチェーン上のネットワーク通信に積極的に参加します。
⚠️ これは開発中のプロジェクトであり、現在活発に開発が進められています
このガイドでは、systemdサービスの設定方法について説明します。systemdサービスを使用してDingoノードを実行すると、コンピューターが再起動したときにDingoノードを自動的に再起動することで、稼働時間を最大化できます。以下の手順に従って始めましょう。
✅ このガイドは一般的なLinux環境を前提としています。必要に応じてコマンドとパスを調整してください。
ステップ1 - Dingoとdingo.yamlファイルの移動
Section titled “ステップ1 - Dingoとdingo.yamlファイルの移動”ベストプラクティス: Dingoを起動するためにsystemdを使用するため、Dingoバイナリを/usr/local/bin/に、dingo.yamlを/etc/dingo/ディレクトリに移動します。以下を実行してください:
⚠️ 以下のパスを調整してください。パスはクイックスタートガイドと
USER=testに基づいています。💡 ヒント: Dingoバイナリへのパスを見つけるには、Dingoバイナリディレクトリに移動し、
realpath dingoコマンドを実行します。
sudo mv /home/test/dingo/dingo /usr/local/bin/✅
which dingoを実行して、Dingoバイナリが移動されたことを確認できます
次に、/etc/dingo/ディレクトリを作成します:
sudo mkdir /etc/dingo/その後、dingo.yamlファイルを/etc/dingo/に移動します:
sudo mv /home/test/dingo/dingo.yaml /etc/dingo/ステップ2 - dingo.yamlファイルのパスを編集
Section titled “ステップ2 - dingo.yamlファイルのパスを編集”次に、dingo.yamlファイルを編集して、yamlを/etc/dingo/に移動したため、以下のパスを更新します。
以下のパスを編集する必要があります:cardanoConfig:、databasePath:、socketPath:、topology:。
✅ ユーザー名とディレクトリに一致する正しいパスに必要に応じて調整してください。
# Example config file for dingo# The values shown below correspond to the in-code defaults
# Public bind address for the Dingo serverbindAddr: "0.0.0.0"
# Path to the Cardano node configuration file## Can be overridden with the config environment variablecardanoConfig: "/home/test/dingo/config/cardano/preview/config.json"
# A directory which contains the ledger database filesdatabasePath: "/home/test/dingo/dingo"
# Path to the UNIX domain socket file used by the serversocketPath: "/home/test/dingo.socket"
# Name of the Cardano networknetwork: "preview"
# TLS certificate file path (for HTTPS)## Can be overridden with the TLS_CERT_FILE_PATH environment variabletlsCertFilePath: ""
# TLS key file path (for HTTPS)## Can be overridden with the TLS_KEY_FILE_PATH environment variabletlsKeyFilePath: ""
# Path to the topology configuration file for Cardano nodetopology: "/home/test/dingo/config/cardano/preview/topology.json"
# TCP port to bind for Prometheus metrics endpointmetricsPort: 12798
# Internal/private address to bind for listening for Ouroboros NtCprivateBindAddr: "127.0.0.1"
# TCP port to bind for listening for Ouroboros NtCprivatePort: 3002
# TCP port to bind for listening for Ouroboros NtN## Can be overridden with the port environment variablerelayPort: 3001
# TCP port to bind for listening for UTxO RPCutxorpcPort: 9090
# Ignore prior chain history and start from current tip (default: false)# This is experimental and may break — use with cautionintersectTip: false
# Maximum cache size in bytes used by BadgerDB for block/index cache# Default: 1073741824 (1 GB)badgerCacheSize: 1073741824
# Maximum total size (in bytes) of all transactions allowed in the mempool.# Transactions exceeding this limit will be rejected.# Default: 1048576 (1 MB)mempoolCapacity: 1048576ステップ3 - dingo.serviceユニット設定ファイルの作成
Section titled “ステップ3 - dingo.serviceユニット設定ファイルの作成”次に、systemdによって実行されるdingo.serviceユニット設定ファイル(「サービス」ファイル)を作成します。
⚠️ 以下の
User=行を調整してください。 クイックスタートガイドではユーザーtestを使用しました。これをあなたのユーザー名に調整してください。💡 ヒント:
echo $USERコマンドを実行してユーザー名を確認できます。
cat <<'ENDFILE' >> /tmp/dingo.service[Unit]Description=Dingo NodeAfter=network-online.target
[Service]Type=simpleRestart=on-failureRestartSec=10User=testExecStart=/usr/local/bin/dingoSyslogIdentifier=dingoTimeoutStopSec=3
[Install]WantedBy=multi-user.targetENDFILEステップ4 - dingo.serviceの移動
Section titled “ステップ4 - dingo.serviceの移動”dingo.serviceを/etc/systemd/system/に移動して、systemd経由で操作できるようにします:
sudo mv /tmp/dingo.service /etc/systemd/system/ステップ5 - サービスの有効化と開始
Section titled “ステップ5 - サービスの有効化と開始”次に、起動時にサービスが実行されるように有効化し、サービスを開始します:
sudo systemctl enable dingo.service次に:
sudo systemctl start dingo.serviceステップ6 - ステータスの確認
Section titled “ステップ6 - ステータスの確認”以下を実行して、dingo.serviceがアクティブであることを確認できます:
sudo systemctl status dingo.serviceエラーが発生した場合は、以下のコマンドを使用してエラーログを確認できます:
journalctl -u dingo.service