Updated pasarguard script
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 34s
Check with kubeconform / lint (push) Successful in 24s
Auto-update README / Generate README and Create MR (push) Failing after 12m45s

This commit is contained in:
Ultradesu
2026-06-04 14:52:27 +03:00
parent 1212017945
commit 0a3430ea97
2 changed files with 53 additions and 24 deletions
+45 -22
View File
@@ -236,29 +236,52 @@ data:
cd /app cd /app
# Start main process in background write_xray_api_port() {
./main & API_PORT="$1"
MAIN_PID=$! case "$API_PORT" in
""|*[!0-9]*)
# Start continuous port monitoring in background return
;;
esac
CURRENT_PORT=""
if [ -f /shared/xray-api-port ]; then
CURRENT_PORT=$(cat /shared/xray-api-port)
fi
if [ "$API_PORT" != "$CURRENT_PORT" ]; then
echo "Found xray API port: $API_PORT"
echo -n "$API_PORT" > /shared/xray-api-port
fi
}
LOG_PIPE="/tmp/pasarguard-main.log"
rm -f "$LOG_PIPE"
mkfifo "$LOG_PIPE"
# Capture main logs so the Xray API listener is not confused with Xray's metrics listener.
{ {
sleep 10 # Wait for xray to start initially while IFS= read -r line; do
LAST_PORT="" echo "$line"
case "$line" in
while true; do *"transport/internet/tcp: listening TCP on 127.0.0.1:"*)
API_PORT=$(netstat -tlpn | grep xray | grep 127.0.0.1 | awk '{print $4}' | cut -d: -f2 | head -1) API_PORT=$(echo "$line" | sed -n 's/.*listening TCP on 127\.0\.0\.1:\([0-9][0-9]*\).*/\1/p')
if [ -n "$API_PORT" ] && [ "$API_PORT" != "$LAST_PORT" ]; then write_xray_api_port "$API_PORT"
echo "Found xray API port: $API_PORT" ;;
echo -n "$API_PORT" > /shared/xray-api-port esac
LAST_PORT="$API_PORT"
fi
sleep 5 # Check every 5 seconds
done done
} & } < "$LOG_PIPE" &
PORT_MONITOR_PID=$! LOG_READER_PID=$!
# Start main process in background
./main > "$LOG_PIPE" 2>&1 &
MAIN_PID=$!
# Wait for main process to finish # Wait for main process to finish
wait $MAIN_PID wait $MAIN_PID
MAIN_STATUS=$?
# Clean up port monitor
kill $PORT_MONITOR_PID 2>/dev/null # Clean up log reader
wait $LOG_READER_PID 2>/dev/null
rm -f "$LOG_PIPE"
exit $MAIN_STATUS
+8 -2
View File
@@ -116,14 +116,20 @@ spec:
- name: metrics - name: metrics
containerPort: 9550 containerPort: 9550
protocol: TCP protocol: TCP
livenessProbe: startupProbe:
httpGet: httpGet:
path: /scrape path: /scrape
port: metrics port: metrics
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 36
livenessProbe:
tcpSocket:
port: metrics
initialDelaySeconds: 60 initialDelaySeconds: 60
periodSeconds: 30 periodSeconds: 30
timeoutSeconds: 10 timeoutSeconds: 10
failureThreshold: 3 failureThreshold: 6
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /scrape path: /scrape