fix: populate tor-hostnames dir in first-boot for backend onion discovery
Backend reads onion addresses from /var/lib/archipelago/tor-hostnames/. This dir was never created on fresh installs, breaking connect wallet and tor address display. Now copies from system Tor hidden service dirs. Also fixed log() function ordering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7d35827acb
commit
b3a3d3f9a8
@ -32,12 +32,14 @@ SCRIPT_DIR_FBC="$(cd "$(dirname "$0")" && pwd)"
|
||||
TARGET_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
[ -z "$TARGET_IP" ] && TARGET_IP="127.0.0.1"
|
||||
|
||||
log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $*" | tee -a "$LOG"; }
|
||||
|
||||
# Ensure Tor is running for hidden services (LND connect, Electrumx, etc.)
|
||||
if ! systemctl is-active tor >/dev/null 2>&1; then
|
||||
log "Starting Tor..."
|
||||
systemctl enable tor 2>/dev/null || true
|
||||
systemctl start tor 2>/dev/null || true
|
||||
sleep 3
|
||||
sleep 5
|
||||
if systemctl is-active tor >/dev/null 2>&1; then
|
||||
log " Tor started successfully"
|
||||
else
|
||||
@ -45,7 +47,19 @@ if ! systemctl is-active tor >/dev/null 2>&1; then
|
||||
fi
|
||||
fi
|
||||
|
||||
log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $*" | tee -a "$LOG"; }
|
||||
# Populate tor-hostnames directory so the backend can read onion addresses
|
||||
# The backend reads from /var/lib/archipelago/tor-hostnames/{service} at startup
|
||||
TOR_HOSTNAMES="/var/lib/archipelago/tor-hostnames"
|
||||
mkdir -p "$TOR_HOSTNAMES"
|
||||
for svc in archipelago bitcoin lnd electrumx btcpay mempool fedimint; do
|
||||
for dir in /var/lib/tor/hidden_service_${svc}; do
|
||||
if [ -f "$dir/hostname" ]; then
|
||||
cp "$dir/hostname" "$TOR_HOSTNAMES/$svc" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
done
|
||||
chown -R archipelago:archipelago "$TOR_HOSTNAMES" 2>/dev/null
|
||||
log "Tor hostnames populated: $(ls $TOR_HOSTNAMES 2>/dev/null | tr '\n' ' ')"
|
||||
|
||||
# Wait for a container to be healthy (accepting connections)
|
||||
wait_for_container() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user