🔧 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:
@@ -114,38 +114,87 @@ jobs:
|
||||
MY_INFO_PASSWORD: ${{ secrets.MY_INFO_PASSWORD }}
|
||||
ADMIN_BASIC_AUTH: ${{ secrets.ADMIN_BASIC_AUTH }}
|
||||
|
||||
- name: Wait for container to be ready
|
||||
- name: Wait for containers to be ready
|
||||
run: |
|
||||
echo "⏳ Waiting for containers to be ready..."
|
||||
sleep 15
|
||||
sleep 20
|
||||
|
||||
# Check if all containers are running
|
||||
echo "📊 Checking container status..."
|
||||
docker compose -f docker-compose.zero-downtime.yml ps
|
||||
|
||||
# Wait for application containers to be healthy
|
||||
echo "🏥 Waiting for application containers to be healthy..."
|
||||
for i in {1..30}; do
|
||||
# Check if both app containers are healthy
|
||||
if docker exec portfolio-app-1 curl -f http://localhost:3000/api/health > /dev/null 2>&1 && \
|
||||
docker exec portfolio-app-2 curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
echo "✅ Both application containers are healthy!"
|
||||
break
|
||||
fi
|
||||
echo "⏳ Waiting for application containers... ($i/30)"
|
||||
sleep 3
|
||||
done
|
||||
|
||||
# Wait for nginx to be healthy
|
||||
for i in {1..30}; do
|
||||
echo "🌐 Waiting for nginx to be healthy..."
|
||||
for i in {1..20}; do
|
||||
if curl -f http://localhost/health > /dev/null 2>&1; then
|
||||
echo "✅ Nginx is healthy!"
|
||||
break
|
||||
fi
|
||||
echo "⏳ Waiting for nginx... ($i/30)"
|
||||
echo "⏳ Waiting for nginx... ($i/20)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Health check
|
||||
run: |
|
||||
echo "🔍 Running health checks..."
|
||||
echo "🔍 Running comprehensive health checks..."
|
||||
|
||||
# Check container status
|
||||
echo "📊 Container status:"
|
||||
docker compose -f docker-compose.zero-downtime.yml ps
|
||||
|
||||
# Check individual application containers
|
||||
echo "🏥 Checking individual application containers..."
|
||||
if docker exec portfolio-app-1 curl -f http://localhost:3000/api/health; then
|
||||
echo "✅ portfolio-app-1 health check passed!"
|
||||
else
|
||||
echo "❌ portfolio-app-1 health check failed!"
|
||||
docker logs portfolio-app-1 --tail=20
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if docker exec portfolio-app-2 curl -f http://localhost:3000/api/health; then
|
||||
echo "✅ portfolio-app-2 health check passed!"
|
||||
else
|
||||
echo "❌ portfolio-app-2 health check failed!"
|
||||
docker logs portfolio-app-2 --tail=20
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check nginx health
|
||||
if curl -f http://localhost/health; then
|
||||
echo "✅ Nginx health check passed!"
|
||||
else
|
||||
echo "❌ Nginx health check failed!"
|
||||
docker logs portfolio-nginx --tail=20
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check application health through nginx
|
||||
if curl -f http://localhost/api/health; then
|
||||
echo "✅ Application health check passed!"
|
||||
echo "✅ Application health check through nginx passed!"
|
||||
else
|
||||
echo "❌ Application health check failed!"
|
||||
echo "❌ Application health check through nginx failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check main page through nginx
|
||||
if curl -f http://localhost/ > /dev/null; then
|
||||
echo "✅ Main page is accessible through nginx!"
|
||||
else
|
||||
echo "❌ Main page is not accessible through nginx!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user