#!/sbin/openrc-run # Archipelago Bitcoin Node OS Backend name="Archipelago" description="Archipelago Bitcoin Node OS Backend Server" command="/usr/bin/archipelago-backend" command_user="archipelago:archipelago" command_background=true pidfile="/var/run/archipelago.pid" start_stop_daemon_args="--make-pidfile" # Working directory and environment directory="/var/lib/archipelago" export RUST_LOG="${RUST_LOG:-info}" export ARCHIPELAGO_DATA_DIR="/var/lib/archipelago" export ARCHIPELAGO_PORT="${ARCHIPELAGO_PORT:-8100}" depend() { need net need localmount after firewall use podman docker } start_pre() { # Ensure directories exist checkpath --directory --mode 0755 --owner archipelago:archipelago \ /var/lib/archipelago \ /var/lib/archipelago/apps \ /var/lib/archipelago/secrets \ /var/lib/archipelago/logs \ /var/lib/archipelago/backups # Wait for network to be fully ready local retries=30 while [ $retries -gt 0 ]; do if ping -c 1 -W 1 8.8.8.8 >/dev/null 2>&1; then einfo "Network is ready" return 0 fi retries=$((retries - 1)) sleep 1 done ewarn "Network may not be fully ready" return 0 } start_post() { einfo "Archipelago backend started" einfo "Access the UI at: http://$(hostname -I | awk '{print $1}'):8100" }