Files
aitbc/scripts/utils/check-aitbc-services.sh
aitbc 27993bee72
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 15s
Blockchain Synchronization Verification / sync-verification (push) Failing after 1s
CLI Tests / test-cli (push) Failing after 5s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 3s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 4s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 12s
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Documentation Validation / validate-docs (push) Successful in 11s
Documentation Validation / validate-policies-strict (push) Successful in 6s
Integration Tests / test-service-integration (push) Successful in 2m39s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Node Failover Simulation / failover-test (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 30s
Package Tests / Python package - aitbc-core (push) Successful in 14s
Package Tests / Python package - aitbc-crypto (push) Successful in 8s
Package Tests / Python package - aitbc-sdk (push) Successful in 9s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 7s
Package Tests / JavaScript package - aitbc-token (push) Successful in 19s
Python Tests / test-python (push) Successful in 14s
Security Scanning / security-scan (push) Failing after 31s
Deploy to Testnet / notify-deployment (push) Successful in 2s
Update documentation to reflect 12 atomic skills and current service ports
2026-05-02 14:38:19 +02:00

196 lines
6.5 KiB
Bash
Executable File

#!/bin/bash
# AITBC Service Location Diagnostic Script
# Shows exactly where each AITBC service is running
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_container() {
echo -e "${CYAN}[CONTAINER]${NC} $1"
}
print_local() {
echo -e "${CYAN}[LOCAL]${NC} $1"
}
print_status "AITBC Service Location Diagnostic"
# Get container IPs
containers=("aitbc" "aitbc1")
declare -A container_ips
for container in "${containers[@]}"; do
if incus info "$container" >/dev/null 2>&1; then
if incus info "$container" | grep -q "Status: RUNNING"; then
container_ip=$(incus exec "$container" -- ip addr show eth0 2>/dev/null | grep "inet " | awk '{print $2}' | cut -d/ -f1 || echo "N/A")
container_ips["$container"]="$container_ip"
fi
fi
done
# Check local services
print_local "Local AITBC Services:"
local_services=$(systemctl list-units --all | grep "aitbc-" | awk '{print $1}' | grep -v "not-found")
if [ -n "$local_services" ]; then
for service in $local_services; do
service_name=$(echo "$service" | sed 's/\.service$//')
if systemctl is-active --quiet "$service_name" 2>/dev/null; then
# Get port if possible
port_info=""
case $service_name in
*coordinator-api*) port_info=" (port 8001)" ;;
*wallet*) port_info=" (port 8002)" ;;
*blockchain*) port_info=" (port 8003)" ;;
esac
print_success "$service_name: RUNNING$port_info"
else
print_error "$service_name: NOT RUNNING"
fi
done
else
print_warning " No AITBC services found locally"
fi
echo ""
# Check container services
for container in "${containers[@]}"; do
if incus info "$container" >/dev/null 2>&1; then
if incus info "$container" | grep -q "Status: RUNNING"; then
container_ip="${container_ips[$container]}"
print_container "Container $container (IP: $container_ip):"
# Check common AITBC services in container
services=("aitbc-coordinator-api" "aitbc-wallet-daemon" "aitbc-blockchain-node")
for service in "${services[@]}"; do
if incus exec "$container" -- systemctl list-unit-files 2>/dev/null | grep -q "^${service}.service"; then
if incus exec "$container" -- systemctl is-active --quiet "$service" 2>/dev/null; then
# Get port if possible
port_info=""
case $service in
*coordinator-api*) port_info=" (port 8001)" ;;
*wallet*) port_info=" (port 8002)" ;;
*blockchain*) port_info=" (port 8003)" ;;
esac
print_success "$service: RUNNING$port_info"
else
print_error "$service: NOT RUNNING"
fi
else
print_warning " ⚠️ $service: NOT INSTALLED"
fi
done
else
print_error "Container $container: NOT RUNNING"
fi
else
print_error "Container $container: NOT FOUND"
fi
echo ""
done
# Port scan summary
print_status "Port Scan Summary:"
ports=("8001:Coordinator API" "8002:Wallet Daemon" "8003:Blockchain RPC" "8011:Coordinator API (alt)")
for port_info in "${ports[@]}"; do
port=$(echo "$port_info" | cut -d: -f1)
service_name=$(echo "$port_info" | cut -d: -f2)
if netstat -tlnp 2>/dev/null | grep -q ":$port "; then
process_info=$(netstat -tlnp 2>/dev/null | grep ":$port " | head -1)
pid=$(echo "$process_info" | awk '{print $7}' | cut -d/ -f1)
if [ -n "$pid" ] && [ "$pid" != "-" ]; then
print_success " ✅ Port $port ($service_name): LOCAL (PID $pid)"
else
print_success " ✅ Port $port ($service_name): LOCAL"
fi
else
# Check containers
found=false
for container in "${containers[@]}"; do
container_ip="${container_ips[$container]}"
if [ "$container_ip" != "N/A" ]; then
if timeout 2 bash -c "</dev/tcp/$container_ip/$port" 2>/dev/null; then
print_success " ✅ Port $port ($service_name): Container $container ($container_ip)"
found=true
break
fi
fi
done
if [ "$found" = false ]; then
print_error " ❌ Port $port ($service_name): NOT ACCESSIBLE"
fi
fi
done
echo ""
print_status "Health Check Summary:"
health_endpoints=(
"http://localhost:8001/health:Coordinator API"
"http://localhost:8002/health:Wallet Daemon"
"http://localhost:8003/health:Blockchain RPC"
)
for endpoint_info in "${health_endpoints[@]}"; do
url=$(echo "$endpoint_info" | cut -d: -f1-3)
service_name=$(echo "$endpoint_info" | cut -d: -f4)
if curl -s --max-time 3 "$url" >/dev/null 2>&1; then
print_success "$service_name: HEALTHY (LOCAL)"
else
# Check containers
found=false
for container in "${containers[@]}"; do
container_ip="${container_ips[$container]}"
if [ "$container_ip" != "N/A" ]; then
container_url="http://$container_ip:$(echo "$url" | cut -d: -f3)/health"
if curl -s --max-time 2 "$container_url" >/dev/null 2>&1; then
print_success "$service_name: HEALTHY (Container $container)"
found=true
break
fi
fi
done
if [ "$found" = false ]; then
print_error "$service_name: NOT RESPONDING"
fi
fi
done
echo ""
print_status "Quick Debug Commands:"
echo " - Check specific service: systemctl status <service-name>"
echo " - Check container service: incus exec <container> -- systemctl status <service-name>"
echo " - View service logs: journalctl -f -u <service-name>"
echo " - View container logs: incus exec <container> -- journalctl -f -u <service-name>"
echo " - Check port usage: netstat -tlnp | grep :800"