Files
TimeTracker/scripts/test-docker-network.sh
Dries Peeters 8a378b7078 feat(clients,license,db): add client management, enhanced DB init, and tests
- Clients: add model, routes, and templates
  - app/models/client.py
  - app/routes/clients.py
  - templates/clients/{create,edit,list,view}.html
  - docs/CLIENT_MANAGEMENT_README.md
- Database: add enhanced init/verify scripts, migrations, and docs
  - docker/{init-database-enhanced.py,start-enhanced.py,verify-database.py}
  - docs/ENHANCED_DATABASE_STARTUP.md
  - migrations/{add_analytics_column.sql,add_analytics_setting.py,migrate_to_client_model.py}
- Scripts: add version manager and docker network test helpers
  - scripts/version-manager.{bat,ps1,py,sh}
  - scripts/test-docker-network.{bat,sh}
  - docs/VERSION_MANAGEMENT.md
- UI: tweak base stylesheet
  - app/static/base.css
- Tests: add client system test
  - test_client_system.py
2025-09-01 11:34:45 +02:00

78 lines
2.5 KiB
Bash

#!/bin/bash
# Test Docker Network Connectivity
# This script helps debug Docker network issues
echo "=== Docker Network Connectivity Test ==="
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "Error: Docker is not running"
exit 1
fi
# Get Docker host IP
echo "Docker Host Information:"
if command -v docker-machine &> /dev/null; then
DOCKER_HOST_IP=$(docker-machine ip default 2>/dev/null || echo "localhost")
else
DOCKER_HOST_IP="localhost"
fi
echo " - Docker Host IP: $DOCKER_HOST_IP"
# Check running containers
echo -e "\nRunning Containers:"
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# Test port 8082 (license server)
echo -e "\nTesting License Server Port (8082):"
if nc -z localhost 8082 2>/dev/null; then
echo " ✓ Port 8082 is open on localhost"
else
echo " ✗ Port 8082 is not open on localhost"
fi
# Test from host to host.docker.internal
echo -e "\nTesting host.docker.internal from host:"
if ping -c 1 host.docker.internal >/dev/null 2>&1; then
echo " ✓ Can reach host.docker.internal from host"
HOST_DOCKER_IP=$(ping -c 1 host.docker.internal | grep "PING" | sed 's/.*(\([^)]*\)).*/\1/')
echo " - Resolved to IP: $HOST_DOCKER_IP"
else
echo " ✗ Cannot reach host.docker.internal from host"
fi
# Test network connectivity from within a container
echo -e "\nTesting network from within container:"
if docker ps | grep -q timetracker-app; then
echo " - Testing from timetracker-app container:"
docker exec timetracker-app ping -c 1 host.docker.internal >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo " ✓ Container can reach host.docker.internal"
else
echo " ✗ Container cannot reach host.docker.internal"
fi
# Get container IP
CONTAINER_IP=$(docker exec timetracker-app hostname -I | awk '{print $1}')
echo " - Container IP: $CONTAINER_IP"
else
echo " - timetracker-app container not running"
fi
# Show Docker network information
echo -e "\nDocker Networks:"
docker network ls
# Show detailed network info for default bridge
echo -e "\nDefault Bridge Network Details:"
docker network inspect bridge 2>/dev/null | grep -A 10 -B 5 "Containers"
echo -e "\n=== End Network Test ==="
echo ""
echo "If you're having connectivity issues:"
echo "1. Make sure your license server is running on port 8082"
echo "2. Check if the license server is accessible from the host"
echo "3. Verify Docker network configuration"
echo "4. Consider using Docker service names instead of host.docker.internal"