fix: Gitea Traefik routing and connection pool optimization
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled

- Remove middleware reference from Gitea Traefik labels (caused routing issues)
- Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s)
- Add explicit service reference in Traefik labels
- Fix intermittent 504 timeouts by improving PostgreSQL connection handling

Fixes Gitea unreachability via git.michaelschiemer.de
This commit is contained in:
2025-11-09 14:46:15 +01:00
parent 85c369e846
commit 36ef2a1e2c
1366 changed files with 104925 additions and 28719 deletions

View File

@@ -0,0 +1,230 @@
#!/bin/bash
# Test Pipeline Prerequisites
# Prüft alle Voraussetzungen für CI/CD Pipeline Tests
set -euo pipefail
echo "=========================================="
echo "CI/CD Pipeline Prerequisites Check"
echo "=========================================="
echo ""
ERRORS=0
WARNINGS=0
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
check_pass() {
echo -e "${GREEN}${NC} $1"
}
check_fail() {
echo -e "${RED}${NC} $1"
((ERRORS++))
}
check_warn() {
echo -e "${YELLOW}${NC} $1"
((WARNINGS++))
}
# 1. Check Gitea Runner
echo "1. Checking Gitea Runner..."
if [ -d "deployment/gitea-runner" ]; then
cd deployment/gitea-runner
if docker compose ps 2>/dev/null | grep -q "gitea-runner.*Up"; then
check_pass "Gitea Runner container is running"
else
check_fail "Gitea Runner container is not running"
echo " Run: cd deployment/gitea-runner && docker compose up -d"
fi
if docker compose ps 2>/dev/null | grep -q "gitea-runner-dind.*Up"; then
check_pass "Gitea Runner DinD container is running"
else
check_fail "Gitea Runner DinD container is not running"
fi
if [ -f "data/.runner" ]; then
check_pass "Gitea Runner is registered (data/.runner exists)"
else
check_warn "Gitea Runner may not be registered (data/.runner missing)"
echo " Run: ./register.sh"
fi
cd - > /dev/null
else
check_fail "deployment/gitea-runner directory not found"
fi
echo ""
# 2. Check Workflow Files
echo "2. Checking Workflow Files..."
if [ -f ".gitea/workflows/build-image.yml" ]; then
check_pass "build-image.yml workflow exists"
else
check_fail ".gitea/workflows/build-image.yml not found"
fi
if [ -f ".gitea/workflows/manual-deploy.yml" ]; then
check_pass "manual-deploy.yml workflow exists"
else
check_warn ".gitea/workflows/manual-deploy.yml not found (optional)"
fi
echo ""
# 3. Check Ansible Playbooks
echo "3. Checking Ansible Playbooks..."
ANSIBLE_PLAYBOOKS=(
"deployment/ansible/playbooks/deploy-application-code.yml"
"deployment/ansible/playbooks/install-composer-dependencies.yml"
"deployment/ansible/playbooks/deploy-image.yml"
"deployment/ansible/playbooks/backup.yml"
)
for playbook in "${ANSIBLE_PLAYBOOKS[@]}"; do
if [ -f "$playbook" ]; then
check_pass "$(basename $playbook) exists"
else
check_fail "$playbook not found"
fi
done
echo ""
# 4. Check Ansible Inventory
echo "4. Checking Ansible Inventory..."
if [ -f "deployment/ansible/inventory/production.yml" ]; then
check_pass "Ansible inventory file exists"
else
check_fail "deployment/ansible/inventory/production.yml not found"
fi
echo ""
# 5. Check Docker Compose Files
echo "5. Checking Docker Compose Files..."
if [ -f "deployment/stacks/production/docker-compose.base.yml" ]; then
check_pass "Production docker-compose.base.yml exists"
else
check_fail "Production docker-compose.base.yml not found"
fi
if [ -f "deployment/stacks/production/docker-compose.production.yml" ]; then
check_pass "Production docker-compose.production.yml exists"
else
check_fail "Production docker-compose.production.yml not found"
fi
if [ -f "deployment/stacks/staging/docker-compose.base.yml" ]; then
check_pass "Staging docker-compose.base.yml exists"
else
check_warn "Staging docker-compose.base.yml not found (optional for staging tests)"
fi
echo ""
# 6. Check Dockerfile
echo "6. Checking Dockerfile..."
if [ -f "Dockerfile.production" ]; then
check_pass "Dockerfile.production exists"
else
check_fail "Dockerfile.production not found"
fi
echo ""
# 7. Check SSH Key (if exists locally)
echo "7. Checking SSH Configuration..."
if [ -f "$HOME/.ssh/production" ] || [ -f "$HOME/.ssh/id_rsa" ] || [ -f "$HOME/.ssh/id_ed25519" ]; then
check_pass "SSH key found (local check only)"
echo " Note: SSH_PRIVATE_KEY secret must be configured in Gitea"
else
check_warn "No SSH key found locally (may be configured in Gitea secrets)"
fi
echo ""
# 8. Check Registry Access (if possible)
echo "8. Checking Docker Registry Access..."
REGISTRY="registry.michaelschiemer.de"
if command -v curl >/dev/null 2>&1; then
if curl -s -k --connect-timeout 5 "https://${REGISTRY}/v2/" >/dev/null 2>&1 || \
curl -s --connect-timeout 5 "http://94.16.110.151:5000/v2/" >/dev/null 2>&1; then
check_pass "Docker Registry is accessible"
else
check_warn "Docker Registry may not be accessible (check network/firewall)"
fi
else
check_warn "curl not available, skipping registry check"
fi
echo ""
# 9. Check Git Repository
echo "9. Checking Git Repository..."
if git remote get-url origin 2>/dev/null | grep -q "git.michaelschiemer.de"; then
check_pass "Git remote points to Gitea"
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
echo " Remote: $REMOTE_URL"
else
check_warn "Git remote may not point to Gitea"
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "not configured")
echo " Remote: $REMOTE_URL"
fi
# Check for staging and main branches
if git show-ref --verify --quiet refs/heads/staging 2>/dev/null; then
check_pass "staging branch exists locally"
else
check_warn "staging branch not found locally (may need to fetch)"
fi
if git show-ref --verify --quiet refs/heads/main 2>/dev/null; then
check_pass "main branch exists locally"
else
check_warn "main branch not found locally (may need to fetch)"
fi
echo ""
# Summary
echo "=========================================="
echo "Summary"
echo "=========================================="
if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then
echo -e "${GREEN}✓ All checks passed!${NC}"
echo ""
echo "Next steps:"
echo "1. Verify Gitea Secrets are configured:"
echo " https://git.michaelschiemer.de/michael/michaelschiemer/settings/secrets/actions"
echo ""
echo "2. Test Staging Pipeline:"
echo " git checkout staging"
echo " echo '# Test' >> README.md"
echo " git commit -m 'test: CI/CD pipeline'"
echo " git push origin staging"
echo ""
echo "3. Monitor Pipeline:"
echo " https://git.michaelschiemer.de/michael/michaelschiemer/actions"
exit 0
elif [ $ERRORS -eq 0 ]; then
echo -e "${YELLOW}⚠ Checks passed with warnings${NC}"
echo " Warnings: $WARNINGS"
echo ""
echo "Review warnings above and proceed with testing."
exit 0
else
echo -e "${RED}✗ Checks failed${NC}"
echo " Errors: $ERRORS"
echo " Warnings: $WARNINGS"
echo ""
echo "Please fix the errors above before testing the pipeline."
exit 1
fi