Bilder lade reparuzert - evtl.
This commit is contained in:
78
debug-images.sh
Executable file
78
debug-images.sh
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "🔍 Debugging Bild-URLs im Development-Setup"
|
||||||
|
echo "==========================================="
|
||||||
|
|
||||||
|
# Check if containers are running
|
||||||
|
echo "📊 Container Status:"
|
||||||
|
docker compose -f docker-compose.development.yml ps
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔗 Testing API Endpoints:"
|
||||||
|
|
||||||
|
# Get server IP from .env.development
|
||||||
|
if [ -f .env.development ]; then
|
||||||
|
export $(cat .env.development | grep -v '^#' | xargs)
|
||||||
|
echo "Server IP: $HOST_IP"
|
||||||
|
else
|
||||||
|
echo "❌ .env.development not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test backend health
|
||||||
|
echo ""
|
||||||
|
echo "🩺 Backend Health Check:"
|
||||||
|
curl -s "http://$HOST_IP:3001/api/health" | head -100
|
||||||
|
|
||||||
|
# Test if any recipes exist
|
||||||
|
echo ""
|
||||||
|
echo "📋 Testing Recipe API:"
|
||||||
|
curl -s "http://$HOST_IP:3001/api/recipes?limit=1" | head -200
|
||||||
|
|
||||||
|
# Test image serving
|
||||||
|
echo ""
|
||||||
|
echo "🖼️ Testing Image Serving:"
|
||||||
|
echo "Checking upload directory structure..."
|
||||||
|
|
||||||
|
# Check if upload directory exists
|
||||||
|
if [ -d "./upload" ]; then
|
||||||
|
echo "✅ Upload directory found:"
|
||||||
|
ls -la ./upload/ | head -10
|
||||||
|
|
||||||
|
# Find a test image
|
||||||
|
TEST_IMAGE=$(find ./upload -name "*.jpg" | head -1)
|
||||||
|
if [ -n "$TEST_IMAGE" ]; then
|
||||||
|
# Remove ./upload/ prefix for API path
|
||||||
|
RELATIVE_PATH=${TEST_IMAGE#./upload/}
|
||||||
|
echo ""
|
||||||
|
echo "🧪 Testing image URL: $RELATIVE_PATH"
|
||||||
|
echo "Full URL: http://$HOST_IP:3001/api/images/serve/$RELATIVE_PATH"
|
||||||
|
|
||||||
|
# Test the image URL
|
||||||
|
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://$HOST_IP:3001/api/images/serve/$RELATIVE_PATH")
|
||||||
|
echo "HTTP Status: $HTTP_STATUS"
|
||||||
|
|
||||||
|
if [ "$HTTP_STATUS" = "200" ]; then
|
||||||
|
echo "✅ Image serving works!"
|
||||||
|
else
|
||||||
|
echo "❌ Image serving failed"
|
||||||
|
echo "Testing with curl -v for more details:"
|
||||||
|
curl -v "http://$HOST_IP:3001/api/images/serve/$RELATIVE_PATH" 2>&1 | head -20
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ No JPG images found in upload directory"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ Upload directory not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔧 Container Upload Directory Check:"
|
||||||
|
docker compose -f docker-compose.development.yml exec backend ls -la /app/uploads/ 2>/dev/null || echo "Could not access backend container"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "📋 Useful Debug Commands:"
|
||||||
|
echo " Backend logs: docker compose -f docker-compose.development.yml logs backend"
|
||||||
|
echo " Frontend logs: docker compose -f docker-compose.development.yml logs frontend"
|
||||||
|
echo " Backend shell: docker compose -f docker-compose.development.yml exec backend sh"
|
||||||
|
echo " Test specific image: curl -v http://$HOST_IP:3001/api/images/serve/R001/R001_0.jpg"
|
||||||
@@ -148,6 +148,7 @@ export const imageApi = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getImageUrl: (imagePath: string): string => {
|
getImageUrl: (imagePath: string): string => {
|
||||||
|
// Use the same dynamic API base URL logic for images
|
||||||
return `${API_BASE_URL}/images/serve/${imagePath}`;
|
return `${API_BASE_URL}/images/serve/${imagePath}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
31
rebuild-frontend.sh
Executable file
31
rebuild-frontend.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🔄 Rebuilding Frontend with fixed image URLs"
|
||||||
|
echo "============================================="
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
if [ -f .env.development ]; then
|
||||||
|
export $(cat .env.development | grep -v '^#' | xargs)
|
||||||
|
else
|
||||||
|
echo "❌ Error: .env.development file not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🏗️ Rebuilding frontend..."
|
||||||
|
docker compose -f docker-compose.development.yml build frontend
|
||||||
|
|
||||||
|
echo "🔄 Restarting frontend..."
|
||||||
|
docker compose -f docker-compose.development.yml restart frontend
|
||||||
|
|
||||||
|
echo "⏳ Waiting for frontend to be ready..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "✅ Frontend rebuild completed!"
|
||||||
|
echo ""
|
||||||
|
echo "🌐 Test URLs:"
|
||||||
|
echo " Frontend: http://$HOST_IP:3000"
|
||||||
|
echo " Backend API: http://$HOST_IP:3001/api"
|
||||||
|
echo ""
|
||||||
|
echo "🔍 Debug images:"
|
||||||
|
echo " ./debug-images.sh"
|
||||||
@@ -126,6 +126,8 @@ services:
|
|||||||
- "0.0.0.0:3001:3001"
|
- "0.0.0.0:3001:3001"
|
||||||
volumes:
|
volumes:
|
||||||
- uploads_dev_data:/app/uploads
|
- uploads_dev_data:/app/uploads
|
||||||
|
# Mount existing uploads from host for development
|
||||||
|
- ./upload:/app/uploads:ro
|
||||||
# Development: Mount source code for hot reload
|
# Development: Mount source code for hot reload
|
||||||
- ./nodejs-version/backend/src:/app/src:ro
|
- ./nodejs-version/backend/src:/app/src:ro
|
||||||
- ./nodejs-version/backend/prisma:/app/prisma:ro
|
- ./nodejs-version/backend/prisma:/app/prisma:ro
|
||||||
|
|||||||
BIN
uploads/.DS_Store
vendored
BIN
uploads/.DS_Store
vendored
Binary file not shown.
Reference in New Issue
Block a user