🔧 Implement deployment fixes and enhance Gitea workflows
- Created `DEPLOYMENT-FIXES.md` to document issues and solutions for Gitea Actions.
- Fixed Dockerfile path for standalone build.
- Enhanced `gitea-deploy.sh` with improved environment variable handling and extended health check timeouts.
- Introduced `gitea-deploy-simple.sh` for simplified deployments without database dependencies.
- Updated Next.js configuration to resolve build issues.
- Improved health check logic and error handling across all Gitea workflows.
✅ These changes enhance deployment reliability and provide better debugging information.
This commit is contained in:
@@ -222,12 +222,64 @@ jobs:
|
||||
|
||||
- name: Wait for container to be ready
|
||||
run: |
|
||||
sleep 10
|
||||
timeout 60 bash -c 'until curl -f http://localhost:3000/api/health; do sleep 2; done'
|
||||
echo "⏳ Waiting for container to be ready..."
|
||||
sleep 15
|
||||
|
||||
# Check if container is actually running
|
||||
if ! docker ps --filter "name=portfolio-app" --format "{{.Names}}" | grep -q "portfolio-app"; then
|
||||
echo "❌ Container failed to start"
|
||||
echo "Container logs:"
|
||||
docker logs portfolio-app --tail=50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wait for health check with better error handling
|
||||
echo "🏥 Performing health check..."
|
||||
for i in {1..40}; do
|
||||
if curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
echo "✅ Application is healthy!"
|
||||
break
|
||||
fi
|
||||
|
||||
# Check if container is still running
|
||||
if ! docker ps --filter "name=portfolio-app" --format "{{.Names}}" | grep -q "portfolio-app"; then
|
||||
echo "❌ Container stopped during health check"
|
||||
echo "Container logs:"
|
||||
docker logs portfolio-app --tail=50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "⏳ Health check attempt $i/40..."
|
||||
sleep 3
|
||||
done
|
||||
|
||||
# Final health check
|
||||
if ! curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
echo "❌ Health check timeout"
|
||||
echo "Container logs:"
|
||||
docker logs portfolio-app --tail=100
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Health check
|
||||
run: |
|
||||
echo "🔍 Final health verification..."
|
||||
|
||||
# Check container status
|
||||
docker ps --filter "name=portfolio-app" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
|
||||
# Test health endpoint
|
||||
curl -f http://localhost:3000/api/health
|
||||
echo ""
|
||||
|
||||
# Test main page
|
||||
if curl -f http://localhost:3000/ > /dev/null; then
|
||||
echo "✅ Main page is accessible"
|
||||
else
|
||||
echo "❌ Main page is not accessible"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Deployment successful!"
|
||||
|
||||
- name: Cleanup old images
|
||||
|
||||
Reference in New Issue
Block a user