Experimental gui.
This commit is contained in:
39
experimental/daemon/tests/integration/debug-container.sh
Executable file
39
experimental/daemon/tests/integration/debug-container.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🐳 Starting wild-cloud-central debug container..."
|
||||
|
||||
# Build the Docker image if it doesn't exist
|
||||
if ! docker images | grep -q wild-cloud-central-test; then
|
||||
echo "🔨 Building Docker image..."
|
||||
docker build -t wild-cloud-central-test .
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🔧 Starting container with shell access..."
|
||||
echo ""
|
||||
echo "📍 Access points:"
|
||||
echo " - Management UI: http://localhost:9080"
|
||||
echo " - API directly: http://localhost:9081"
|
||||
echo ""
|
||||
echo "💡 Inside the container you can:"
|
||||
echo " - Start services manually: /test-installation.sh"
|
||||
echo " - Check logs: journalctl or service status"
|
||||
echo " - Test APIs: curl http://localhost:5055/api/v1/health"
|
||||
echo " - Modify config: nano /etc/wild-cloud-central/config.yaml"
|
||||
echo " - View web files: ls /var/www/html/wild-central/"
|
||||
echo ""
|
||||
|
||||
# Run container with shell access
|
||||
docker run --rm -it \
|
||||
-p 127.0.0.1:9081:5055 \
|
||||
-p 127.0.0.1:9080:80 \
|
||||
-p 127.0.0.1:9053:53/udp \
|
||||
-p 127.0.0.1:9067:67/udp \
|
||||
-p 127.0.0.1:9069:69/udp \
|
||||
--cap-add=NET_ADMIN \
|
||||
--cap-add=NET_BIND_SERVICE \
|
||||
--name wild-central-debug \
|
||||
wild-cloud-central-test \
|
||||
/bin/bash
|
69
experimental/daemon/tests/integration/start-background.sh
Executable file
69
experimental/daemon/tests/integration/start-background.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting wild-cloud-central in background..."
|
||||
|
||||
# Build the Docker image if it doesn't exist
|
||||
if ! docker images | grep -q wild-cloud-central-test; then
|
||||
echo "🔨 Building Docker image..."
|
||||
docker build -t wild-cloud-central-test .
|
||||
fi
|
||||
|
||||
# Stop any existing container
|
||||
docker rm -f wild-central-bg 2>/dev/null || true
|
||||
|
||||
echo "🌐 Starting services in background..."
|
||||
|
||||
# Start container in background
|
||||
docker run -d \
|
||||
--name wild-central-bg \
|
||||
-p 127.0.0.1:9081:5055 \
|
||||
-p 127.0.0.1:9080:80 \
|
||||
-p 127.0.0.1:9053:53/udp \
|
||||
-p 127.0.0.1:9067:67/udp \
|
||||
-p 127.0.0.1:9069:69/udp \
|
||||
--cap-add=NET_ADMIN \
|
||||
--cap-add=NET_BIND_SERVICE \
|
||||
wild-cloud-central-test \
|
||||
/bin/bash -c '
|
||||
# Start nginx
|
||||
nginx &
|
||||
|
||||
# Start dnsmasq
|
||||
dnsmasq --keep-in-foreground --log-facility=- &
|
||||
|
||||
# Start wild-cloud-central
|
||||
/usr/bin/wild-cloud-central &
|
||||
|
||||
# Wait indefinitely
|
||||
tail -f /dev/null
|
||||
'
|
||||
|
||||
echo "⏳ Waiting for services to start..."
|
||||
sleep 5
|
||||
|
||||
# Test if services are running
|
||||
if curl -s http://localhost:9081/api/v1/health > /dev/null 2>&1; then
|
||||
echo "✅ Services started successfully!"
|
||||
echo ""
|
||||
echo "📍 Access points (localhost only):"
|
||||
echo " - Management UI: http://localhost:9080"
|
||||
echo " - API: http://localhost:9081/api/v1/health"
|
||||
echo " - DNS: localhost:9053 (for testing)"
|
||||
echo " - DHCP: localhost:9067 (for testing)"
|
||||
echo " - TFTP: localhost:9069 (for testing)"
|
||||
echo ""
|
||||
echo "🔧 Container management:"
|
||||
echo " - View logs: docker logs wild-central-bg"
|
||||
echo " - Stop services: docker stop wild-central-bg"
|
||||
echo " - Remove container: docker rm wild-central-bg"
|
||||
echo ""
|
||||
echo "💡 Test commands:"
|
||||
echo " curl http://localhost:9081/api/v1/health"
|
||||
echo " dig @localhost -p 9053 wildcloud.local"
|
||||
echo " curl http://localhost:9081/api/v1/dnsmasq/config"
|
||||
else
|
||||
echo "❌ Services failed to start. Check logs with: docker logs wild-central-bg"
|
||||
exit 1
|
||||
fi
|
92
experimental/daemon/tests/integration/start-interactive.sh
Executable file
92
experimental/daemon/tests/integration/start-interactive.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting wild-cloud-central for interactive testing..."
|
||||
|
||||
# Build the Docker image if it doesn't exist
|
||||
if ! docker images | grep -q wild-cloud-central-test; then
|
||||
echo "🔨 Building Docker image..."
|
||||
docker build -t wild-cloud-central-test .
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🌐 Starting services... This will take a few seconds."
|
||||
echo ""
|
||||
echo "📍 Access points:"
|
||||
echo " - Management UI: http://localhost:9080"
|
||||
echo " - API directly: http://localhost:9081"
|
||||
echo " - Health check: http://localhost:9081/api/v1/health"
|
||||
echo ""
|
||||
echo "🔧 Available API endpoints:"
|
||||
echo " - GET /api/v1/health"
|
||||
echo " - GET /api/v1/config"
|
||||
echo " - PUT /api/v1/config"
|
||||
echo " - GET /api/v1/dnsmasq/config"
|
||||
echo " - POST /api/v1/dnsmasq/restart"
|
||||
echo " - POST /api/v1/pxe/assets"
|
||||
echo ""
|
||||
echo "💡 Example commands to try:"
|
||||
echo " curl http://localhost:9081/api/v1/health"
|
||||
echo " curl http://localhost:9081/api/v1/config"
|
||||
echo " curl http://localhost:9081/api/v1/dnsmasq/config"
|
||||
echo " curl -X POST http://localhost:9081/api/v1/pxe/assets"
|
||||
echo ""
|
||||
echo "🛑 Press Ctrl+C to stop all services"
|
||||
echo ""
|
||||
|
||||
# Create a custom startup script that keeps services running
|
||||
docker run --rm -it \
|
||||
-p 127.0.0.1:9081:5055 \
|
||||
-p 127.0.0.1:9080:80 \
|
||||
-p 127.0.0.1:9053:53/udp \
|
||||
-p 127.0.0.1:9067:67/udp \
|
||||
-p 127.0.0.1:9069:69/udp \
|
||||
--cap-add=NET_ADMIN \
|
||||
--cap-add=NET_BIND_SERVICE \
|
||||
--name wild-central-interactive \
|
||||
wild-cloud-central-test \
|
||||
/bin/bash -c '
|
||||
echo "🔧 Starting all services..."
|
||||
|
||||
# Start nginx
|
||||
nginx &
|
||||
NGINX_PID=$!
|
||||
|
||||
# Start dnsmasq
|
||||
dnsmasq --keep-in-foreground --log-facility=- &
|
||||
DNSMASQ_PID=$!
|
||||
|
||||
# Start wild-cloud-central
|
||||
/usr/bin/wild-cloud-central &
|
||||
SERVICE_PID=$!
|
||||
|
||||
# Wait for services to start
|
||||
sleep 3
|
||||
|
||||
echo "✅ All services started!"
|
||||
echo " - nginx (PID: $NGINX_PID)"
|
||||
echo " - dnsmasq (PID: $DNSMASQ_PID)"
|
||||
echo " - wild-cloud-central (PID: $SERVICE_PID)"
|
||||
echo ""
|
||||
echo "🌐 Services are now available:"
|
||||
echo " - Web UI: http://localhost:9080"
|
||||
echo " - API: http://localhost:9081"
|
||||
echo ""
|
||||
|
||||
# Function to handle shutdown
|
||||
shutdown() {
|
||||
echo ""
|
||||
echo "🛑 Shutting down services..."
|
||||
kill $SERVICE_PID $DNSMASQ_PID $NGINX_PID 2>/dev/null || true
|
||||
echo "✅ Shutdown complete."
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Set up signal handlers
|
||||
trap shutdown SIGTERM SIGINT
|
||||
|
||||
# Keep container running and wait for signals
|
||||
echo "✨ Container is ready! Press Ctrl+C to stop."
|
||||
wait
|
||||
'
|
11
experimental/daemon/tests/integration/stop-background.sh
Executable file
11
experimental/daemon/tests/integration/stop-background.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🛑 Stopping wild-cloud-central background services..."
|
||||
|
||||
if docker ps | grep -q wild-central-bg; then
|
||||
docker stop wild-central-bg
|
||||
docker rm wild-central-bg
|
||||
echo "✅ Services stopped and container removed."
|
||||
else
|
||||
echo "ℹ️ No background services running."
|
||||
fi
|
20
experimental/daemon/tests/integration/test-docker.sh
Executable file
20
experimental/daemon/tests/integration/test-docker.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧪 Testing wild-cloud-central Docker installation..."
|
||||
|
||||
# Change to project root directory
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
# Build the Docker image
|
||||
echo "🔨 Building Docker image..."
|
||||
docker build -t wild-cloud-central-test .
|
||||
|
||||
# Run the container to test installation
|
||||
echo "🚀 Running installation test..."
|
||||
echo "Access points after container starts:"
|
||||
echo " - Management UI: http://localhost:9080"
|
||||
echo " - API directly: http://localhost:9055"
|
||||
echo ""
|
||||
docker run --rm -p 9055:5055 -p 9080:80 wild-cloud-central-test
|
146
experimental/daemon/tests/test-installation.sh
Executable file
146
experimental/daemon/tests/test-installation.sh
Executable file
@@ -0,0 +1,146 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Testing wild-cloud-central installation..."
|
||||
|
||||
# Verify the binary was installed
|
||||
echo "✅ Checking binary installation..."
|
||||
if [ -f "/usr/bin/wild-cloud-central" ]; then
|
||||
echo " Binary installed at /usr/bin/wild-cloud-central"
|
||||
else
|
||||
echo "❌ Binary not found at /usr/bin/wild-cloud-central"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify config was installed
|
||||
echo "✅ Checking configuration..."
|
||||
if [ -f "/etc/wild-cloud-central/config.yaml" ]; then
|
||||
echo " Config installed at /etc/wild-cloud-central/config.yaml"
|
||||
else
|
||||
echo "❌ Config not found at /etc/wild-cloud-central/config.yaml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify systemd service file was installed
|
||||
echo "✅ Checking systemd service..."
|
||||
if [ -f "/etc/systemd/system/wild-cloud-central.service" ]; then
|
||||
echo " Service file installed at /etc/systemd/system/wild-cloud-central.service"
|
||||
else
|
||||
echo "❌ Service file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify nginx config was installed
|
||||
echo "✅ Checking nginx configuration..."
|
||||
if [ -f "/etc/nginx/sites-available/wild-central" ]; then
|
||||
echo " Nginx config installed at /etc/nginx/sites-available/wild-central"
|
||||
# Enable the site for testing
|
||||
ln -sf /etc/nginx/sites-available/wild-central /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
else
|
||||
echo "❌ Nginx config not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify web assets were installed
|
||||
echo "✅ Checking web assets..."
|
||||
if [ -f "/var/www/html/wild-central/index.html" ]; then
|
||||
echo " Web assets installed at /var/www/html/wild-central/"
|
||||
else
|
||||
echo "❌ Web assets not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start nginx (simulating systemd)
|
||||
echo "🔧 Starting nginx..."
|
||||
nginx &
|
||||
NGINX_PID=$!
|
||||
|
||||
# Start dnsmasq (simulating systemd)
|
||||
echo "🔧 Starting dnsmasq..."
|
||||
dnsmasq --keep-in-foreground --log-facility=- &
|
||||
DNSMASQ_PID=$!
|
||||
|
||||
# Start wild-cloud-central service (simulating systemd)
|
||||
echo "🔧 Starting wild-cloud-central service..."
|
||||
/usr/bin/wild-cloud-central &
|
||||
SERVICE_PID=$!
|
||||
|
||||
# Wait for service to start
|
||||
echo "⏳ Waiting for services to start..."
|
||||
sleep 5
|
||||
|
||||
# Test health endpoint
|
||||
echo "🩺 Testing health endpoint..."
|
||||
if curl -s http://localhost:5055/api/v1/health | grep -q "healthy"; then
|
||||
echo " ✅ Health check passed"
|
||||
else
|
||||
echo " ❌ Health check failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test configuration endpoint
|
||||
echo "🔧 Testing configuration endpoint..."
|
||||
CONFIG_RESPONSE=$(curl -s http://localhost:5055/api/v1/config)
|
||||
if echo "$CONFIG_RESPONSE" | grep -q "Server"; then
|
||||
echo " ✅ Configuration endpoint working"
|
||||
else
|
||||
echo " ❌ Configuration endpoint failed"
|
||||
echo " Response: $CONFIG_RESPONSE"
|
||||
echo " Checking if service is still running..."
|
||||
if kill -0 $SERVICE_PID 2>/dev/null; then
|
||||
echo " Service is running"
|
||||
else
|
||||
echo " Service has died"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test dnsmasq config generation
|
||||
echo "🔧 Testing dnsmasq config generation..."
|
||||
if curl -s http://localhost:5055/api/v1/dnsmasq/config | grep -q "interface"; then
|
||||
echo " ✅ Dnsmasq config generation working"
|
||||
else
|
||||
echo " ❌ Dnsmasq config generation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test web interface accessibility (through nginx)
|
||||
echo "🌐 Testing web interface..."
|
||||
if curl -s http://localhost:80/ | grep -q "Wild Cloud Central"; then
|
||||
echo " ✅ Web interface accessible through nginx"
|
||||
else
|
||||
echo " ❌ Web interface not accessible"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 All installation tests passed!"
|
||||
echo ""
|
||||
echo "Services running:"
|
||||
echo " - wild-cloud-central: http://localhost:5055"
|
||||
echo " - Web interface: http://localhost:80"
|
||||
echo " - API health: http://localhost:5055/api/v1/health"
|
||||
echo ""
|
||||
echo "Installation simulation successful! 🚀"
|
||||
|
||||
# Keep services running for manual testing
|
||||
echo "Services will continue running. Press Ctrl+C to stop."
|
||||
|
||||
# Function to handle shutdown
|
||||
shutdown() {
|
||||
echo ""
|
||||
echo "🛑 Shutting down services..."
|
||||
kill $SERVICE_PID 2>/dev/null || true
|
||||
kill $DNSMASQ_PID 2>/dev/null || true
|
||||
kill $NGINX_PID 2>/dev/null || true
|
||||
echo "Shutdown complete."
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Set up signal handlers
|
||||
trap shutdown SIGTERM SIGINT
|
||||
|
||||
# Wait for signals
|
||||
wait
|
Reference in New Issue
Block a user