Initial commit
Some checks failed
CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
CI/CD Pipeline / Policy Validation (push) Has been cancelled
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-firm-connectors) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-forms) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-hmrc) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ingestion) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-normalize-map) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ocr) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-indexer) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-reason) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rpa) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (ui-review) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (ui-review) (push) Has been cancelled
CI/CD Pipeline / Generate SBOM (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Notifications (push) Has been cancelled
Some checks failed
CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
CI/CD Pipeline / Policy Validation (push) Has been cancelled
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-firm-connectors) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-forms) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-hmrc) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ingestion) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-normalize-map) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-ocr) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-indexer) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-reason) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (svc-rpa) (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (ui-review) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-coverage) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-extract) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-kg) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (svc-rag-retriever) (push) Has been cancelled
CI/CD Pipeline / Security Scanning (ui-review) (push) Has been cancelled
CI/CD Pipeline / Generate SBOM (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Notifications (push) Has been cancelled
This commit is contained in:
152
scripts/fix-gitea-upload-limit.sh
Executable file
152
scripts/fix-gitea-upload-limit.sh
Executable file
@@ -0,0 +1,152 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to fix Gitea upload size limits for large Docker images
|
||||
# Run this on the remote server: ssh deploy@141.136.35.199
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== Gitea Registry Upload Limit Fix ==="
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Step 1: Check if Gitea is running
|
||||
echo -e "${YELLOW}Step 1: Checking Gitea status...${NC}"
|
||||
if docker ps | grep -q gitea-server; then
|
||||
echo -e "${GREEN}✓ Gitea is running${NC}"
|
||||
GITEA_CONTAINER=$(docker ps --filter "name=gitea" --format "{{.Names}}" | head -1)
|
||||
echo " Container: $GITEA_CONTAINER"
|
||||
else
|
||||
echo -e "${RED}✗ Gitea is not running!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 2: Check if Traefik is running
|
||||
echo -e "\n${YELLOW}Step 2: Checking Traefik status...${NC}"
|
||||
if docker ps | grep -q traefik; then
|
||||
echo -e "${GREEN}✓ Traefik is running${NC}"
|
||||
TRAEFIK_CONTAINER=$(docker ps --filter "name=traefik" --format "{{.Names}}" | head -1)
|
||||
echo " Container: $TRAEFIK_CONTAINER"
|
||||
HAS_TRAEFIK=true
|
||||
else
|
||||
echo -e "${YELLOW}⚠ Traefik is not running (may not be needed)${NC}"
|
||||
HAS_TRAEFIK=false
|
||||
fi
|
||||
|
||||
# Step 3: Find Traefik config directory
|
||||
if [ "$HAS_TRAEFIK" = true ]; then
|
||||
echo -e "\n${YELLOW}Step 3: Finding Traefik configuration...${NC}"
|
||||
|
||||
# Try to find Traefik config mount
|
||||
TRAEFIK_CONFIG=$(docker inspect $TRAEFIK_CONTAINER | grep -A 1 '"Destination": "/etc/traefik"' | grep Source | cut -d'"' -f4 || echo "")
|
||||
|
||||
if [ -z "$TRAEFIK_CONFIG" ]; then
|
||||
TRAEFIK_CONFIG="/opt/traefik/config"
|
||||
echo -e "${YELLOW} Using default: $TRAEFIK_CONFIG${NC}"
|
||||
else
|
||||
echo -e "${GREEN} Found: $TRAEFIK_CONFIG${NC}"
|
||||
fi
|
||||
|
||||
# Create config directory if it doesn't exist
|
||||
sudo mkdir -p "$TRAEFIK_CONFIG"
|
||||
|
||||
# Step 4: Create Traefik middleware for large uploads
|
||||
echo -e "\n${YELLOW}Step 4: Creating Traefik middleware...${NC}"
|
||||
|
||||
sudo tee "$TRAEFIK_CONFIG/gitea-large-upload.yml" > /dev/null << 'EOF'
|
||||
http:
|
||||
middlewares:
|
||||
gitea-large-upload:
|
||||
buffering:
|
||||
maxRequestBodyBytes: 5368709120 # 5GB
|
||||
memRequestBodyBytes: 104857600 # 100MB in memory
|
||||
maxResponseBodyBytes: 5368709120 # 5GB
|
||||
memResponseBodyBytes: 104857600 # 100MB in memory
|
||||
retryExpression: "IsNetworkError() && Attempts() < 3"
|
||||
EOF
|
||||
|
||||
echo -e "${GREEN}✓ Created $TRAEFIK_CONFIG/gitea-large-upload.yml${NC}"
|
||||
|
||||
# Step 5: Restart Traefik
|
||||
echo -e "\n${YELLOW}Step 5: Restarting Traefik...${NC}"
|
||||
docker restart $TRAEFIK_CONTAINER
|
||||
sleep 3
|
||||
echo -e "${GREEN}✓ Traefik restarted${NC}"
|
||||
fi
|
||||
|
||||
# Step 6: Update Gitea configuration
|
||||
echo -e "\n${YELLOW}Step 6: Updating Gitea configuration...${NC}"
|
||||
|
||||
# Backup current config
|
||||
docker exec $GITEA_CONTAINER cp /data/gitea/conf/app.ini /data/gitea/conf/app.ini.backup
|
||||
echo -e "${GREEN}✓ Backed up app.ini${NC}"
|
||||
|
||||
# Check if settings already exist
|
||||
if docker exec $GITEA_CONTAINER grep -q "LFS_MAX_FILE_SIZE" /data/gitea/conf/app.ini; then
|
||||
echo -e "${YELLOW} LFS_MAX_FILE_SIZE already configured${NC}"
|
||||
else
|
||||
# Add LFS_MAX_FILE_SIZE to [server] section
|
||||
docker exec $GITEA_CONTAINER sh -c 'echo "LFS_MAX_FILE_SIZE = 5368709120" >> /data/gitea/conf/app.ini'
|
||||
echo -e "${GREEN}✓ Added LFS_MAX_FILE_SIZE${NC}"
|
||||
fi
|
||||
|
||||
# Check if packages section exists
|
||||
if docker exec $GITEA_CONTAINER grep -q "\[packages\]" /data/gitea/conf/app.ini; then
|
||||
echo -e "${YELLOW} [packages] section already exists${NC}"
|
||||
else
|
||||
# Add packages section
|
||||
docker exec $GITEA_CONTAINER sh -c 'cat >> /data/gitea/conf/app.ini << EOF
|
||||
|
||||
[packages]
|
||||
ENABLED = true
|
||||
CHUNKED_UPLOAD_PATH = /data/gitea/tmp/package-upload
|
||||
EOF'
|
||||
echo -e "${GREEN}✓ Added [packages] section${NC}"
|
||||
fi
|
||||
|
||||
# Step 7: Restart Gitea
|
||||
echo -e "\n${YELLOW}Step 7: Restarting Gitea...${NC}"
|
||||
docker restart $GITEA_CONTAINER
|
||||
sleep 5
|
||||
echo -e "${GREEN}✓ Gitea restarted${NC}"
|
||||
|
||||
# Step 8: Test registry endpoint
|
||||
echo -e "\n${YELLOW}Step 8: Testing registry endpoint...${NC}"
|
||||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://gitea.harkon.co.uk/v2/)
|
||||
|
||||
if [ "$RESPONSE" = "401" ] || [ "$RESPONSE" = "200" ]; then
|
||||
echo -e "${GREEN}✓ Registry is accessible (HTTP $RESPONSE)${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Registry returned HTTP $RESPONSE${NC}"
|
||||
fi
|
||||
|
||||
# Step 9: Summary
|
||||
echo -e "\n${GREEN}=== Configuration Complete ===${NC}"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Log in to Gitea registry:"
|
||||
echo " docker login gitea.harkon.co.uk"
|
||||
echo ""
|
||||
echo "2. Test with a small image:"
|
||||
echo " docker pull alpine:latest"
|
||||
echo " docker tag alpine:latest gitea.harkon.co.uk/harkon/test:latest"
|
||||
echo " docker push gitea.harkon.co.uk/harkon/test:latest"
|
||||
echo ""
|
||||
echo "3. If successful, build and push base-ml:"
|
||||
echo " cd /home/deploy/ai-tax-agent"
|
||||
echo " docker build -f infra/docker/base-ml.Dockerfile -t gitea.harkon.co.uk/harkon/base-ml:v1.0.1 ."
|
||||
echo " docker push gitea.harkon.co.uk/harkon/base-ml:v1.0.1"
|
||||
echo ""
|
||||
|
||||
if [ "$HAS_TRAEFIK" = true ]; then
|
||||
echo -e "${YELLOW}⚠ IMPORTANT: You need to add this label to your Gitea container:${NC}"
|
||||
echo " traefik.http.routers.gitea.middlewares=gitea-large-upload@file"
|
||||
echo ""
|
||||
echo " Add it to your Gitea docker-compose.yml and restart:"
|
||||
echo " docker-compose up -d gitea"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user