dpl/scripts/node-onboarding/install-node.sh

22 lines
1.1 KiB
Bash

#!/bin/bash
set -euo pipefail
# Credential files are installed separately with mode 0600.
[[ $(id -u) == 0 ]] || exit 1
[[ -s /etc/dpl-node/config.yml && -s /etc/dpl-node/secret.env ]] || { echo 'Private node configuration missing'; exit 1; }
if ss -lntH '( sport = :24443 )' | grep -q .; then
echo 'Port 24443 already in use; inspect before deployment'; exit 1
fi
systemctl is-active --quiet XrayR
install -d -m 755 /opt/dpl-node
install -d -m 700 /var/lib/dpl-node /var/lib/dpl-node/kernel
curl --fail --location --silent --show-error \
https://github.com/cedar2025/Xboard-Node/releases/download/v1.13/xboard-node-linux-amd64 \
-o /opt/dpl-node/xboard-node.new
echo '55bf71fa9d9f2048d3255ae7c0af929a41897ca7743f6ead34132a6ca4c79043 /opt/dpl-node/xboard-node.new' | sha256sum --check
chmod 755 /opt/dpl-node/xboard-node.new
mv /opt/dpl-node/xboard-node.new /opt/dpl-node/xboard-node
/opt/dpl-node/xboard-node -v
install -m 644 "$(dirname "$0")/dpl-node.service" /etc/systemd/system/dpl-node.service
systemctl daemon-reload
echo 'Binary and independent unit installed. Obtain certificate before starting.'