Skip to content

tfgrid-studio/tfgrid-gitea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

TFGrid Gitea

License GitHub stars GitHub issues

Self-hosted Git service with web interface - perfect for AI agent repositories and collaborative development on ThreeFold Grid.

Overview

TFGrid Gitea provides a lightweight, self-hosted Git service with a clean web interface. Ideal for:

  • AI Agent repositories - Store code generated by tfgrid-ai-agent
  • Private repos - Keep your code secure on your infrastructure
  • Team collaboration - Built-in issue tracking and pull requests
  • Gateway integration - Access via example.com/gitea

Features

  • 🔒 Self-hosted - Your code, your infrastructure
  • 🌐 Web Interface - GitHub-like UI for browsing repos
  • 🔑 User Management - Multiple users and organizations
  • 📝 Issues & PRs - Built-in project management
  • 🔗 API Access - RESTful API for automation
  • 🪶 Lightweight - Runs on 2 cores, 2GB RAM

Quick Start

Deploy Standalone

# Deploy Gitea on single VM
tfgrid-compose up tfgrid-gitea

# Get the IP address
tfgrid-compose address tfgrid-gitea

# Access at: http://<vm-ip>:3000

Deploy with Gateway (Recommended)

# Deploy AI + Gateway + Gitea stack
tfgrid-compose up ai-gateway-stack --domain example.com

# Access at: https://example.com/gitea

Connect to VM

# SSH to Gitea VM
tfgrid-compose ssh tfgrid-gitea

# Check service status
systemctl status gitea

# View logs
journalctl -u gitea -f

Configuration

Default credentials:

  • Username: gitadmin
  • Password: changeme123
  • Email: admin@localhost

⚠️ Change the password immediately after first login!

Custom Configuration

Set environment variables before deployment:

export GITEA_ADMIN_USER=myadmin
export GITEA_ADMIN_PASSWORD=mysecurepassword
export GITEA_ADMIN_EMAIL=admin@example.com
export GITEA_DOMAIN=example.com

tfgrid-compose up tfgrid-gitea

Structure

tfgrid-gitea/
├── tfgrid-compose.yaml      # Deployment manifest
├── deployment/              # Deployment hooks
│   ├── setup.sh             # Install Gitea
│   ├── configure.sh         # Configure service
│   └── healthcheck.sh       # Verify deployment
└── README.md                # This file

Requirements

Minimum:

  • 2 CPU cores
  • 2 GB RAM
  • 25 GB disk

Recommended:

  • 2 CPU cores
  • 4 GB RAM
  • 50 GB disk

Integration with tfgrid-ai-stack

tfgrid-ai-stack provides seamless integration with automatic Git repository creation:

# Deploy complete AI + Git environment
tfgrid-compose up tfgrid-ai-stack

# Create project (automatically creates Gitea repo)
tfgrid-compose create "my-website"

# View in web interface
# Access: http://your-ip/git/tfgrid-ai-agent/my-website/

Standalone Usage

For manual integration with tfgrid-ai-agent:

# Configure git to use your Gitea
git config --global user.name "AI Agent"
git config --global user.email "ai@example.com"

# Create project and push to Gitea
ai-agent create "my-website"
cd my-website
git remote add origin http://your-gitea-ip/username/my-website.git
git push -u origin main

API Access

Gitea provides a full RESTful API:

# Create repository via API
curl -X POST "http://example.com/gitea/api/v1/user/repos" \
  -H "Authorization: token YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"new-repo","private":false}'

# List repositories
curl "http://example.com/gitea/api/v1/user/repos" \
  -H "Authorization: token YOUR_TOKEN"

Generate token: Settings → Applications → Generate New Token

Gateway Integration

When deployed behind tfgrid-gateway, Gitea is automatically proxied:

# Gateway automatically configures:
location /gitea {
    proxy_pass http://gitea-vm:3000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}

Access at: https://example.com/gitea

Troubleshooting

Service not starting

# Check service status
systemctl status gitea

# Check logs
journalctl -u gitea -f

# Restart service
systemctl restart gitea

Can't access web interface

# Check if port is listening
netstat -tuln | grep 3000

# Check firewall
ufw status

# Test local connection
curl http://localhost:3000

Database issues

# Check database file
ls -lh /var/lib/gitea/data/gitea.db

# Check permissions
ls -ld /var/lib/gitea/data

Links

Security

  • Change default admin password immediately
  • Use strong passwords
  • Enable 2FA (Settings → Security)
  • Regular backups of /var/lib/gitea/data/
  • Keep Gitea updated

Backup

# Backup Gitea data
tar -czf gitea-backup.tar.gz /var/lib/gitea/data /etc/gitea

# Restore
tar -xzf gitea-backup.tar.gz -C /
systemctl restart gitea

License

Apache 2.0 License - See LICENSE file

Copyright 2025 ThreeFold

Support

Releases

No releases published

Packages

No packages published

Languages