Skip to content

Deployment Overview of Gitea on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Ubuntu

  • Privileges: Root or sudo access is required for package installation and directory management.

  • Ports:

  • 443/TCP: External HTTPS traffic via Nginx proxy.

  • 3000/TCP: Internal Gitea web interface.

  • 222/TCP: SSH service for Git operations.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a subdomain generated based on the server ID.

Parameter Value
Prefix gitea
Domain hostkey.in
Full template gitea{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The following directories are used for application data, configurations, and proxy management:

  • /opt/gitea: Application deployment directory containing the Docker Compose configuration.

  • /srv/gitea: Persistent storage for Gitea data (repositories, users, etc.).

  • /root/nginx: Directory containing the Nginx reverse proxy configuration files.

  • /data/nginx/user_conf.d: Configuration directory for Nginx site definitions and SSL management.

Application installation process

The application is deployed using a combination of package management and Docker Compose:

  1. System Preparation: The system updates its package cache and installs docker and docker-compose.

  2. Directory Creation: The deployment creates /opt/gitea for service orchestration and /srv/gitea for persistent data storage.

  3. Environment Setup: The system timezone is set to Europe/Moscow by synchronizing /etc/localtime with the zone information.

  4. Container Orchestration: Gitea is deployed using a Docker Compose file located at /opt/gitea/docker-compose.yml.

Access Rights and Security

  • User Permissions: The Gitea data directory (/srv/gitea) is owned by the root user with 0755 permissions.

  • Container User: The Gitea container runs with internal UID/GID 1000.

  • Firewall: Access is restricted to specific ports: HTTPS (443) via the proxy and SSH (222) for Git operations.

Databases

Gitea uses an integrated database mechanism within its container. Data persistence is maintained by mounting the host directory /srv/gitea to the container's /data path.

Docker Containers and Their Deployment

The deployment consists of two primary containers:

Gitea Server

  • Image: gitea/gitea:1.22.2

  • Container Name: gitea

  • Ports:

  • 3000 -> 3000 (Web Interface)

  • 222 -> 22 (SSH)

  • Volumes:

  • /srv/gitea:/data

  • /etc/timezone:/etc/timezone:ro

  • /etc/localtime:/etc/localtime:ro

  • Environment Variables:

  • USER_UID=1000

  • USER_GID=1000

  • Restart Policy: always

Nginx Proxy (SSL Management)

  • Image: jonasal/nginx-certbot:latest

  • Network Mode: host

  • Volumes:

  • nginx_secrets:/etc/letsencrypt

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d

  • Environment Variables:

  • [email protected]

  • Restart Policy: unless-stopped

Application Update Instructions

To update the Gitea application, navigate to the deployment directory and pull the latest specified version:

cd /opt/gitea
docker compose pull && docker compose up -d

Location of configuration files and data

  • Gitea Configuration & Data: /srv/gitea

  • Docker Compose File: /opt/gitea/docker-compose.yml

  • Nginx Proxy Configs: /data/nginx/user_conf.d/

Available ports for connection

Service Port Protocol
Web Interface (HTTPS) 443 TCP
Gitea SSH 222 TCP
Internal Web (Localhost) 3000 TCP

Starting and Stopping the application

The application is managed via Docker Compose.

To start the application:

cd /opt/gitea
docker compose up -d

To stop the application:

cd /opt/gitea
docker compose down

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×