Skip to content

Commit 9f3c5c8

Browse files
committed
add more error handling to x-ray daemon setup
1 parent 4308746 commit 9f3c5c8

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

.github/workflows/release-udp-exporter.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,50 @@ jobs:
4040
}
4141
}' > xray-daemon-config.json
4242
43-
# Start X-Ray daemon with a unique log file
43+
# Make sure xray is executable
44+
chmod +x ./xray
45+
46+
# Create logs directory
4447
mkdir -p daemon-logs
48+
49+
# Start X-Ray daemon
4550
./xray -o -n us-west-2 -c xray-daemon-config.json > daemon-logs/xray-daemon.log 2>&1 &
46-
echo "X-Ray daemon started with PID $!"
51+
XRAY_PID=$!
52+
echo "X-Ray daemon started with PID $XRAY_PID"
53+
54+
# Wait for daemon to be ready
55+
echo "Waiting for X-Ray daemon to start..."
56+
sleep 5
57+
58+
# Check if process is still running
59+
if ps -p $XRAY_PID > /dev/null; then
60+
echo "✅ X-Ray daemon process is running"
61+
else
62+
echo "❌ X-Ray daemon process is not running"
63+
echo "Log contents:"
64+
cat daemon-logs/xray-daemon.log
65+
exit 1
66+
fi
4767
48-
# Wait a bit for the daemon to start
49-
sleep 3
68+
# Try to connect to the daemon
69+
if nc -zv 127.0.0.1 2000 2>&1; then
70+
echo "✅ Successfully connected to X-Ray daemon on port 2000"
71+
else
72+
echo "❌ Cannot connect to X-Ray daemon on port 2000"
73+
echo "Log contents:"
74+
cat daemon-logs/xray-daemon.log
75+
exit 1
76+
fi
77+
78+
# Extra verification with curl (might not work depending on daemon setup)
79+
if curl -s http://localhost:2000/GetDaemonVersion; then
80+
echo "✅ X-Ray daemon API responded"
81+
else
82+
echo "ℹ️ X-Ray daemon doesn't support API or not ready yet"
83+
# Don't exit with error as this might not be reliable
84+
fi
5085
51-
# Verify daemon is running
52-
ps aux | grep xray
53-
curl -s http://localhost:2000/GetDaemonVersion
86+
echo "X-Ray daemon setup completed"
5487
5588
- name: Setup validation app
5689
run: |

0 commit comments

Comments
 (0)