Gitea
Overview
Gitea is a lightweight, self-hosted Git service that provides repository management, issue tracking, and CI/CD integration through Woodpecker CI. This document covers the deployment and configuration of Gitea using Docker Compose with Traefik as a reverse proxy.
Service Details
Component | Value |
---|---|
URL | https://git.trymondo.com |
Main Image | gitea/gitea:1.23.7-rootless |
Database | PostgreSQL 17.4 |
Containers | gitea, gitea-db |
SSH Port | 2222 (via Traefik) |
Networks | gitea-net, traefik-net |
Time Zone | America/Denver |
Architecture
The deployment consists of:
- Gitea Server: The main application container running the Git service
- PostgreSQL Database: Persistent storage for all Gitea data
- Traefik Integration: Handles routing, SSL termination, and SSH proxying
Prerequisites
- Docker Engine (24.0+)
- Docker Compose v2
- Traefik reverse proxy configured and running
- External networks:
gitea-net
andtraefik-net
- SSH entrypoint configured in Traefik
- DNS configured for
git.trymondo.com
Deployment Configuration
Environment Variables
Create a .env
file with the following variables:
Never commit the .env
file to version control. Store passwords securely in a
password manager.
Docker Compose File
Network Configuration
Before deployment, ensure the required networks exist:
Deployment Instructions
-
Create the deployment directory:
-
Create the
docker-compose.yml
and.env
files: -
Deploy the service:
-
Verify the service is running:
Traefik Integration Details
HTTP Routing
Gitea’s web interface is available through HTTPS:
- Host Rule:
git.trymondo.com
- Entrypoint: websecure (HTTPS)
- TLS: Enabled with production certificate resolver
- Backend Port: 3000
SSH Routing
Git SSH operations are handled through Traefik’s TCP router:
- Rule: HostSNI(
*
) - accepts all hostnames for SSH - Entrypoint: ssh (TCP port typically 2222)
- Service: gitea-ssh
- Backend Port: 2222
Users will need to configure their Git client to use port 2222 for SSH
operations: git clone ssh://git@git.trymondo.com:2222/username/repo.git
Initial Configuration
After deploying Gitea, complete the setup through the web interface:
- Access
https://git.trymondo.com
in your browser - You’ll be redirected to the installation page
- Configure the following settings:
Database Settings
- Database Type: PostgreSQL (pre-configured)
- Host: db:5432 (pre-configured)
- Username: gitea (pre-configured)
- Password: [value from .env file] (pre-configured)
- Database Name: gitea (pre-configured)
Application General Settings
- Site Title: GitMondo (recommended)
- Repository Root Path: /var/lib/gitea/repositories (default)
- Git LFS Root Path: /var/lib/gitea/lfs (default)
- Run As Username: git (default)
- SSH Server Domain: git.trymondo.com
- SSH Server Port: 2222
- Gitea HTTP Listen Port: 3000 (default)
- Gitea Base URL: https://git.trymondo.com/
- Log Path: /var/lib/gitea/log (default)
Email Settings (Optional)
- SMTP Host: smtp.mailersend.net
- SMTP Port: 587
- From Email: info@trymondo.com
- SMTP Username: [your SMTP username]
- SMTP Password: [your SMTP password]
Administrator Account
- Create an initial administrator account with secure credentials
Maintenance
Backup Strategy
Back up Gitea regularly using the following steps:
-
Stop the Gitea container (keep the database running):
-
Back up volumes:
-
Restart Gitea:
Consider using Backrest to automate regular backups of Gitea’s volumes.
Updates
To update Gitea:
-
Update the image tag in
docker-compose.yml
-
Apply the update:
-
Check logs for any issues:
Troubleshooting
Database Connection Issues
If Gitea can’t connect to the database:
-
Verify PostgreSQL container is running:
-
Check database logs:
-
Test database connection:
SSH Connection Problems
If Git SSH operations fail:
-
Verify Traefik is properly routing SSH traffic:
-
Check Gitea’s SSH settings:
-
Verify user’s SSH configuration:
Monitoring
Gitea and its database have Diun labels for container update monitoring:
Additional Resources
- Official Gitea Documentation
- Gitea Container Documentation
- PostgreSQL Documentation
- Traefik TCP Routing Documentation
Integration with CI/CD
For CI/CD integration with Woodpecker CI, see the DevOps Stack documentation.
Was this page helpful?