Skip to content

Commit c9806ed

Browse files
Fix Soroban external URL and improve PandoTx configuration
Major improvements to Soroban and PandoTx functionality: • Replace soroban-announce boolean with union type for cleaner UX • PandoTx Process option now only appears when Soroban announce is enabled • Add dynamic hostname loading for Soroban external URLs • Fix empty external URL logs during startup • Improve health check robustness (300s timeout, 30 retries) • Add .onion suffix handling for hostname files • Fix Docker entrypoint hostname file creation • Remove static hostname reading that failed before Tor startup Resolves issues with confusing UI, empty URLs, and startup timing problems.
1 parent d13b171 commit c9806ed

File tree

4 files changed

+56
-33
lines changed

4 files changed

+56
-33
lines changed

check-soroban.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ if [ "$SOROBAN_ANNOUNCE" == "on" ]; then
3939
exit 61
4040
fi
4141

42+
# Add .onion suffix if missing
43+
if [[ "$ONION_HOSTNAME" != *.onion ]]; then
44+
ONION_HOSTNAME="${ONION_HOSTNAME}.onion"
45+
fi
46+
4247
# Try to reach the RPC endpoint through the onion service
4348
RPC_API_URL="http://${ONION_HOSTNAME}/rpc"
4449
SOROBAN_ANNOUNCE_KEY=$([[ "$COMMON_BTC_NETWORK" == "testnet" ]] && echo "$SOROBAN_ANNOUNCE_KEY_TEST" || echo "$SOROBAN_ANNOUNCE_KEY_MAIN")
4550

46-
if ! curl -s -f --max-time 15 --retry 1 --retry-delay 5 \
51+
if ! curl -s -f --max-time 300 --retry 30 --retry-delay 10 \
4752
-X POST -H 'Content-Type: application/json' \
4853
-d "{ \"jsonrpc\": \"2.0\", \"id\": 42, \"method\":\"directory.List\", \"params\": [{ \"Name\": \"$SOROBAN_ANNOUNCE_KEY\"}] }" \
4954
--proxy socks5h://localhost:9050 "$RPC_API_URL" > /dev/null 2>&1; then

config.env

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,18 @@ export EXPLORER_INSTALL=on
6767

6868
# Soroban configuration
6969
export SOROBAN_INSTALL=on
70-
export SOROBAN_ANNOUNCE=$(yq e '.soroban-announce' /root/start9/config.yaml | sed 's/true/on/; s/false/off/')
70+
SOROBAN_ANNOUNCE_CONFIG=$(yq e '.soroban-announce' /root/start9/config.yaml)
71+
if [ "$SOROBAN_ANNOUNCE_CONFIG" == "enabled" ]; then
72+
export SOROBAN_ANNOUNCE=on
73+
# PandoTx Process is only available when Soroban announce is enabled
74+
export NODE_PANDOTX_PROCESS=$(yq e '.soroban-announce.pandotx-process' /root/start9/config.yaml | sed 's/true/on/; s/false/off/')
75+
else
76+
export SOROBAN_ANNOUNCE=off
77+
export NODE_PANDOTX_PROCESS=off
78+
fi
7179

72-
# PandoTx configuration
80+
# PandoTx configuration (push is always available)
7381
export NODE_PANDOTX_PUSH=$(yq e '.pandotx-push' /root/start9/config.yaml | sed 's/true/on/; s/false/off/')
74-
export NODE_PANDOTX_PROCESS=$(yq e '.pandotx-process' /root/start9/config.yaml | sed 's/true/on/; s/false/off/')
7582
export NODE_PANDOTX_NB_RETRIES=$(yq e '.pandotx-retries' /root/start9/config.yaml)
7683
export NODE_PANDOTX_FALLBACK_MODE=$(yq e '.pandotx-fallback-mode' /root/start9/config.yaml)
7784

docker_entrypoint.sh

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -133,42 +133,40 @@ data:
133133
masked: true
134134
EOF
135135

136-
# Start node
137-
if [ "$COMMON_BTC_NETWORK" = "testnet" ]; then
138-
cp /home/node/app/static/admin/conf/index-testnet.js /home/node/app/static/admin/conf/index.js
139-
ln -sf /etc/nginx/sites-available/testnet.conf /etc/nginx/sites-enabled/dojo.conf
140-
else
141-
cp /home/node/app/static/admin/conf/index-mainnet.js /home/node/app/static/admin/conf/index.js
142-
ln -sf /etc/nginx/sites-available/mainnet.conf /etc/nginx/sites-enabled/dojo.conf
143-
fi
144-
145-
/home/node/app/wait-for-it.sh 127.0.0.1:3306 --timeout=720 --strict -- pm2-runtime -u node --raw /home/node/app/pm2.config.cjs &
146-
backend_process=$!
147-
148-
# Start nginx
149-
/home/node/app/wait-for-it.sh 127.0.0.1:8080 --timeout=720 --strict -- nginx &
150-
frontend_process=$!
151-
152136
# Start Soroban if enabled
153137
if [ "$SOROBAN_INSTALL" == "on" ]; then
154138
echo "Starting Soroban service..."
155139

156140
# Create Soroban onion directory if announce is enabled
157141
if [ "$SOROBAN_ANNOUNCE" == "on" ]; then
142+
# Create and set up Tor directory for Soroban
158143
mkdir -p /var/lib/tor/hsv3soroban
159-
echo "soroban$(date +%s).onion" > /var/lib/tor/hsv3soroban/hostname
144+
# Create empty hostname file that Tor will populate when ready
145+
touch /var/lib/tor/hsv3soroban/hostname
146+
chown -R soroban:soroban /var/lib/tor/hsv3soroban
147+
chmod 755 /var/lib/tor/hsv3soroban
148+
chmod 644 /var/lib/tor/hsv3soroban/hostname
160149
fi
161150

162151
# Start Soroban as the soroban user
163152
su -s /bin/bash soroban -c '/usr/local/bin/soroban-restart.sh' &
164153
soroban_process=$!
165154
echo "Soroban started with PID: $soroban_process"
155+
166156
else
167157
echo "Soroban is disabled (SOROBAN_INSTALL=$SOROBAN_INSTALL)"
168158
soroban_process=""
169159
fi
170160

171-
echo 'All processes initalized'
161+
# Start node services
162+
/home/node/app/wait-for-it.sh 127.0.0.1:3306 --timeout=720 --strict -- pm2-runtime -u node --raw /home/node/app/pm2.config.cjs &
163+
backend_process=$!
164+
165+
# Start nginx
166+
/home/node/app/wait-for-it.sh 127.0.0.1:8080 --timeout=720 --strict -- nginx &
167+
frontend_process=$!
168+
169+
echo 'All processes initialized'
172170

173171
# SIGTERM HANDLING
174172
trap _term SIGTERM

scripts/procedures/getConfig.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,31 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
139139
},
140140
},
141141
"soroban-announce": {
142-
"type": "boolean",
142+
"type": "union",
143143
"name": "Soroban Network Announce",
144-
"description": "Announce this node to the Soroban network (allows processing others' transactions)",
145-
"nullable": false,
146-
"default": false,
144+
"description": "Configure Soroban network participation",
145+
"tag": {
146+
"id": "enabled",
147+
"name": "Soroban Network Announce",
148+
"variant-names": {
149+
"disabled": "Disabled",
150+
"enabled": "Enabled"
151+
},
152+
"description": "Enable to participate in the Soroban network"
153+
},
154+
"default": "disabled",
155+
"variants": {
156+
"disabled": {},
157+
"enabled": {
158+
"pandotx-process": {
159+
"type": "boolean",
160+
"name": "PandoTx Process",
161+
"description": "Process and relay transactions from other Soroban nodes",
162+
"nullable": false,
163+
"default": false
164+
}
165+
}
166+
}
147167
},
148168
"pandotx-push": {
149169
"type": "boolean",
@@ -152,13 +172,6 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
152172
"nullable": false,
153173
"default": true,
154174
},
155-
"pandotx-process": {
156-
"type": "boolean",
157-
"name": "PandoTx Process",
158-
"description": "Process and relay transactions from other Soroban nodes (requires Network Announce)",
159-
"nullable": false,
160-
"default": false,
161-
},
162175
"pandotx-retries": {
163176
"type": "number",
164177
"name": "PandoTx Retries",

0 commit comments

Comments
 (0)