Zum Inhalt

Gitea role

Deploy Gitea, a lightweight self-hosted Git service, with PostgreSQL database and email integration via Mailpit.

Usage

Configure Gitea database credentials in your inventory:

1
2
# vars/main.yml
gitea_pg_password: your_secure_database_password

Include the role in your playbook:

1
2
3
4
# playbooks/proxmox/deploy_docker_base.yml
- hosts: docker_base
  roles:
    - role: gitea

The role provides these tags: - gitea-install - Deploy Gitea with PostgreSQL and configuration - gitea-uninstall - Remove Gitea containers and volumes

Docs

Deploy Gitea to your Docker host:

1
ansible-playbook -i inventory/hosts.yml playbooks/proxmox/deploy_docker_base.yml --tags gitea-install

Remove Gitea installation:

1
ansible-playbook -i inventory/hosts.yml playbooks/proxmox/deploy_docker_base.yml --tags gitea-uninstall

Configuration Details

The role deploys Gitea v1.25 (rootless) with: - Image: gitea/gitea:1.25-rootless (enhanced security) - Database: PostgreSQL 17 Alpine - Traefik Integration: Automatic HTTPS via Traefik reverse proxy - SSH Access: Exposed on port 2222 for Git operations - Email: Configured with Mailpit for email notifications - Persistent Storage: Separate volumes for data, config, and database

Architecture

The deployment consists of two containers: 1. gitea - Main application container (rootless for security) 2. gitea_db (db17) - PostgreSQL 17 database

Accessing Gitea

After deployment, Gitea is available at: - Web UI: https://gitea.rwcloud.ch - SSH Clone: ssh://git@gitea.rwcloud.ch:2222/user/repo.git

On first access, complete the installation wizard (database is pre-configured).

Email Configuration

The role automatically configures Mailpit integration: - SMTP Server: mailpit.rwcloud.ch:1025 - From Address: gitea@rwcloud.ch - Protocol: SMTP (no authentication)

This allows Gitea to send registration emails, notifications, and password resets.

SSH Configuration

Git operations via SSH are available on port 2222:

1
git clone ssh://git@gitea.rwcloud.ch:2222/username/repository.git

Storage

Three volumes are created: - data - Git repositories and application data - config - Gitea configuration files - postgres17 - PostgreSQL database data

Post-Deployment

The role automatically: 1. Removes deprecated HOST config from mailer section 2. Restarts Gitea to apply configuration changes