diff options
| -rw-r--r-- | README.md | 191 |
1 files changed, 7 insertions, 184 deletions
@@ -1,6 +1,9 @@ -# CGit - Dockerized Git Web Interface +# cgit - Dockerized cgit Git Web Interface -This repository contains a customized version of [cgit](https://git.zx2c4.com/cgit/about/) - a fast web interface for Git repositories, optimized for Docker deployment with Lighttpd and Gitea integration. +This repository contains a customized version of +[cgit](https://git.zx2c4.com/cgit/about/) - a fast web interface for Git +repositories, optimized for Docker deployment with Lighttpd and Gitea +integration. ## 🎯 Key Features @@ -13,16 +16,11 @@ This repository contains a customized version of [cgit](https://git.zx2c4.com/cg ## 🚀 Installation & Usage -### Prerequisites -- Docker and Docker Compose -- Git repositories in `repos/` directory -- Optional: Gitea or similar Git backend on port 3000 - ### Quick Start (Production) ```bash # Clone repository -git clone <repository-url> +git clone https://git.bktus.com/pub/cgit.git cd cgit # Initialize Git submodules @@ -34,166 +32,6 @@ docker-compose up -d Access the cgit interface at `http://localhost:8080` -### Development Mode - -```bash -# Use development Dockerfile -docker-compose -f docker-compose.dev.yaml up -d - -# Follow logs -docker-compose -f docker-compose.dev.yaml logs -f - -# Rebuild after changes -docker-compose -f docker-compose.dev.yaml up -d --build -``` - -Changes to Lua scripts and filters take effect immediately in development mode. - -### Building from Source - -```bash -# Build cgit locally -make NO_REGEX=NeedsStartEnd LUA_PKGCONFIG=lua5.4 -j$(nproc) - -# Install -sudo make install -``` - -## ⚙️ Configuration - -### Repository Settings (`cgitrc`) - -Key configuration options: - -```ini -# Repository directory -scan-path=/repositories - -# Cache settings (0 = disabled for development) -cache-size=0 - -# Enable commit graph visualization -enable-commit-graph=1 - -# Syntax highlighting filter -source-filter=/usr/lib/cgit/filters/syntax-highlighting.sh - -# About page formatting (Markdown, RST, etc.) -about-filter=/usr/lib/cgit/filters/about-formatting.sh - -# Clone URL template -clone-url=https://git.bktus.com/$CGIT_REPO_URL.git - -# Statistics -max-stats=year - -# Display local time instead of UTC -local-time=1 -``` - -### Repository List (`cgitrepos`) - -Define individual repositories in `/etc/cgitrepos`: - -```ini -repo.url=project-name -repo.path=/repositories/project-name.git -repo.desc=Project description -repo.owner=Owner Name -``` - -### Lighttpd Proxy Architecture - -Git HTTP requests (clone/fetch) are automatically proxied to the backend: - -``` -Client → Lighttpd (Port 80) → Gitea/Backend (Port 3000) -``` - -**Features:** -- Read access via cgit interface -- Write access via backend server -- Seamless integration with Gitea/GitLab/etc. -- Method restriction (GET/POST only) -- URL normalization and lowercase enforcement - -### URL Normalization - -The system automatically handles URL normalization: - -1. **Lua Redirect** (`redirect_lower_url.lua`): Converts uppercase URLs to lowercase -2. **Clone URL Normalization**: All generated clone URLs are lowercase -3. **Query String Preservation**: Redirects maintain query parameters - -Example: -``` -/GpgFrontend/about → 301 Redirect → /gpgfrontend/about -``` - -## 🔧 Development - -### Filter Customization - -Filters are located in `filters/`: -- `syntax-highlighting.sh`: Code highlighting with inline CSS -- `about-formatting.sh`: README/documentation formatting -- `email-gravatar.py`: Gravatar avatar integration -- `commit-links.sh`: Commit message link generation - -### Lua Scripts - -Lua scripts in `lua/`: -- `redirect_lower_url.lua`: URL normalization and lowercase redirect - -### Adding New Filters - -1. Create filter script in `filters/` -2. Make it executable: `chmod +x filters/your-filter.sh` -3. Configure in `cgitrc`: - ```ini - source-filter=/usr/lib/cgit/filters/your-filter.sh - ``` - -## 📁 Directory Structure - -``` -cgit/ -├── cgit.c # Main program (modified) -├── cgit.css # Stylesheet -├── cgitrc # Main configuration (customized) -├── cgitrepos # Repository list -├── Dockerfile # Production image (Alpine-based) -├── Dockerfile.dev # Development image (Ubuntu-based) -├── docker-compose.yaml # Production setup -├── docker-compose.dev.yaml # Development setup -├── lighttpd.conf # Web server config (with proxy) -├── filters/ # Filter scripts -│ ├── syntax-highlighting.sh -│ ├── about-formatting.sh -│ └── ... -├── lua/ # Lua extensions -│ └── redirect_lower_url.lua -├── repos/ # Git repositories -├── git/ # Git submodule (v2.46.0) -└── .github/ - └── workflows/ # CI/CD workflows -``` - -## 🐛 Known Limitations - -- Cache disabled in current configuration (development mode) -- Proxy only handles GET/POST requests -- Backend server must be accessible on configured port -- URL normalization is case-insensitive (by design) - -## � CI/CD - -The repository includes a GitHub Actions workflow: -- Automated Docker image builds -- Reusable `docker-build` workflow -- Registry configuration via secrets -- Multi-architecture support (optional) - ## 📚 Additional Resources - **Original cgit Documentation**: See `README.cgit` @@ -203,19 +41,4 @@ The repository includes a GitHub Actions workflow: ## 📝 License -CGit is licensed under the GNU General Public License v2. See `COPYING` for details. - -## 👤 Author - -**Modifications by Saturneric** -- Docker deployment optimization -- Gitea proxy integration -- URL normalization system -- CI/CD pipeline -- Enhanced syntax highlighting - ---- - -**Root Title**: Git Repos of Saturneric -**Root Description**: Hosting opensource projects related to Saturneric -**Clone URL**: `https://git.bktus.com/$CGIT_REPO_URL.git` +cgit is licensed under the GNU General Public License v2. See `COPYING` for details. |
