feat: Add production troubleshooting tools and remove eye icon from ActivityFeed
All checks were successful
Production Deployment (Zero Downtime) / deploy-production (push) Successful in 12m1s
All checks were successful
Production Deployment (Zero Downtime) / deploy-production (push) Successful in 12m1s
- Add diagnose-production.sh script for comprehensive production diagnostics - Add fix-production.sh script for automatic production issue resolution - Add PRODUCTION_TROUBLESHOOTING.md documentation with step-by-step guides - Remove eye icon from ActivityFeed header (keep only X button for minimize) - Improve error handling and network connectivity checks
This commit is contained in:
118
scripts/fix-production.sh
Executable file
118
scripts/fix-production.sh
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
# Quick fix script for production issues
|
||||
# Ensures proxy network exists and container is properly connected
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔧 Production Fix Script"
|
||||
echo "======================="
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
COMPOSE_FILE="docker-compose.production.yml"
|
||||
|
||||
# Check if proxy network exists
|
||||
echo "🌐 Checking proxy network..."
|
||||
if docker network ls | grep -q "proxy"; then
|
||||
echo -e "${GREEN}✅ 'proxy' network exists${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ 'proxy' network does not exist. Creating...${NC}"
|
||||
docker network create proxy || {
|
||||
echo -e "${RED}❌ Failed to create proxy network${NC}"
|
||||
echo "This might be because Nginx Proxy Manager hasn't created it yet."
|
||||
echo "Please ensure Nginx Proxy Manager is running and has created the 'proxy' network."
|
||||
exit 1
|
||||
}
|
||||
echo -e "${GREEN}✅ 'proxy' network created${NC}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check if container is running
|
||||
echo "📦 Checking container status..."
|
||||
CONTAINER_ID=$(docker ps -q -f "name=portfolio-app")
|
||||
if [ -z "$CONTAINER_ID" ]; then
|
||||
echo -e "${RED}❌ Container is not running${NC}"
|
||||
echo "Starting container..."
|
||||
docker compose -f $COMPOSE_FILE up -d
|
||||
echo "Waiting for container to start..."
|
||||
sleep 10
|
||||
else
|
||||
echo -e "${GREEN}✅ Container is running${NC}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check if container is connected to proxy network
|
||||
echo "🔗 Checking network connectivity..."
|
||||
if docker inspect portfolio-app --format='{{range $net, $conf := .NetworkSettings.Networks}}{{$net}} {{end}}' | grep -q "proxy"; then
|
||||
echo -e "${GREEN}✅ Container is connected to 'proxy' network${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Container is NOT connected to 'proxy' network${NC}"
|
||||
echo "Connecting container to proxy network..."
|
||||
|
||||
# Stop container
|
||||
docker compose -f $COMPOSE_FILE stop portfolio
|
||||
|
||||
# Connect to proxy network
|
||||
docker network connect proxy portfolio-app || {
|
||||
echo -e "${RED}❌ Failed to connect container to proxy network${NC}"
|
||||
echo "Trying to recreate container..."
|
||||
docker compose -f $COMPOSE_FILE up -d --force-recreate
|
||||
}
|
||||
|
||||
# Start container
|
||||
docker compose -f $COMPOSE_FILE start portfolio
|
||||
|
||||
echo -e "${GREEN}✅ Container recreated and connected to proxy network${NC}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Wait for health check
|
||||
echo "⏳ Waiting for container to be healthy..."
|
||||
for i in {1..30}; do
|
||||
HEALTH=$(docker inspect portfolio-app --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
|
||||
if [ "$HEALTH" == "healthy" ]; then
|
||||
echo -e "${GREEN}✅ Container is healthy${NC}"
|
||||
break
|
||||
fi
|
||||
if [ $i -eq 30 ]; then
|
||||
echo -e "${YELLOW}⚠️ Container health check timeout${NC}"
|
||||
echo "Container logs:"
|
||||
docker logs portfolio-app --tail=30
|
||||
else
|
||||
echo "Waiting... ($i/30)"
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
|
||||
# Test API endpoints
|
||||
echo "🧪 Testing API endpoints..."
|
||||
if docker exec portfolio-app curl -f -s --max-time 5 http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✅ Health endpoint is working${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Health endpoint is not working${NC}"
|
||||
echo "Container logs:"
|
||||
docker logs portfolio-app --tail=50
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo "📊 Summary:"
|
||||
echo "---------"
|
||||
echo -e "${GREEN}✅ Production fix completed${NC}"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Verify Nginx Proxy Manager configuration:"
|
||||
echo " - Forward Hostname/IP: portfolio-app"
|
||||
echo " - Forward Port: 3000"
|
||||
echo " - Ensure 'proxy' network is selected"
|
||||
echo ""
|
||||
echo "2. Test the website: https://dk0.dev"
|
||||
echo ""
|
||||
echo "3. If still having issues, run: ./scripts/diagnose-production.sh"
|
||||
Reference in New Issue
Block a user