codenuk_backend_mine/GIT_INTEGRATION_FIX.md
2025-10-10 08:56:39 +05:30

3.5 KiB

Git Integration Service Fix - Build #27 Failure

🚨 Issue Summary

The git-integration service is failing with permission errors when trying to create the /app/git-repos/diffs directory. This is happening because the volume mount from the host doesn't have the correct ownership for the container user.

🔧 Root Cause

  • Error: EACCES: permission denied, mkdir '/app/git-repos/diffs'
  • Cause: Host directory /home/ubuntu/codenuk-backend-live/git-repos doesn't exist or has wrong ownership
  • Container User: git-integration (UID 1001)
  • Required: Directory must be owned by UID 1001 to match container user

🚀 IMMEDIATE FIX - Run on Server

SSH to your server and run the fix script:

# SSH to the server
ssh ubuntu@160.187.166.39

# Navigate to the project directory
cd /home/ubuntu/codenuk-backend-live

# Run the fix script
./scripts/server-fix-git-integration.sh

📋 Manual Fix Steps (if script doesn't work)

If the automated script fails, run these commands manually:

# 1. Stop the failing service
docker compose stop git-integration
docker compose rm -f git-integration

# 2. Create directories with proper permissions
mkdir -p git-repos/diffs
sudo chown -R 1001:1001 git-repos/
chmod -R 755 git-repos/

# 3. Verify permissions
ls -la git-repos/

# 4. Rebuild and restart service
docker compose build --no-cache git-integration
docker compose up -d git-integration

# 5. Check service status
docker compose ps git-integration
docker compose logs git-integration

🔍 Verification Steps

After running the fix, verify the service is working:

# Check service status
docker compose ps git-integration

# Check service health
curl http://localhost:8012/health

# Check logs for any errors
docker compose logs --tail=50 git-integration

📊 Expected Results

After the fix, you should see:

  • git-integration service status: Up
  • Health check returns HTTP 200
  • No permission errors in logs
  • Service starts successfully

🛠️ What Was Fixed

1. Updated Dockerfile (services/git-integration/Dockerfile)

  • Added better error handling in entrypoint script
  • Added logging to show permission fix attempts
  • Uses su-exec to properly switch users after fixing permissions

2. Created Fix Scripts

  • scripts/server-fix-git-integration.sh: Comprehensive server-side fix
  • scripts/setup-git-repos-directories.sh: Simple directory setup
  • scripts/fix-git-integration-deployment.sh: Full deployment fix

3. Directory Structure

/home/ubuntu/codenuk-backend-live/
├── git-repos/           # Owner: 1001:1001, Permissions: 755
│   └── diffs/          # Owner: 1001:1001, Permissions: 755
└── docker-compose.yml

🚨 If Still Failing

If the service still fails after running the fix:

  1. Check Docker logs:

    docker compose logs git-integration
    
  2. Check directory permissions:

    ls -la git-repos/
    stat git-repos/diffs/
    
  3. Verify container user:

    docker compose exec git-integration id
    
  4. Check volume mount:

    docker compose exec git-integration ls -la /app/git-repos/
    

📞 Support

If you continue to experience issues:

  1. Run the verification steps above
  2. Collect the output from all commands
  3. Check the Jenkins build logs at: http://160.187.166.94:8080/job/codenuk-backend-live/27/console

Last Updated: October 2, 2025
Build: #27
Status: Fix Ready