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 installation and service management.

  • Docker: Docker and Docker Compose must be installed on the host system.

  • Timezone: The system timezone should be set to Europe/Moscow.

  • Ports:

  • 3000: Internal application port (HTTP).

  • 222: SSH port for Gitea services.

  • 443: External HTTPS access via proxy.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain 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, configuration, and proxy management:

  • /opt/gitea: Contains the Docker Compose deployment file.

  • /srv/gitea: Main data directory for Gitea.

  • /root/nginx: Configuration directory for the Nginx reverse proxy.

  • /data/nginx/user_conf.d: Directory containing Nginx configuration files and SSL certificates.

Application installation process

The application is deployed using a combination of system configuration and Docker Compose:

  1. System Preparation: The host system's timezone is synchronized to Europe/Moscow by linking /etc/localtime to the appropriate zoneinfo file.

  2. Directory Creation:

  3. A directory for Gitea deployment is created at /opt/gitea.

  4. A data storage directory is initialized at /srv/gitea with root ownership.

  5. Docker Deployment: The application is deployed using a Docker Compose file located at /opt/gitea/docker-compose.yml. This service runs Gitea version 1.22.2.

  6. Proxy Configuration: An Nginx reverse proxy container is configured to handle SSL termination and route traffic from the external domain to the internal application port.

Access Rights and Security

  • User Permissions: The Gitea data directory /srv/gitea is owned by root.

  • Container Isolation: The Gitea service runs within a dedicated Docker network named gitea.

  • Proxy Security: Nginx acts as a reverse proxy, forwarding traffic from port 443 to the internal container on port 3000.

Databases

Gitea is configured to use an internal database mechanism (standard for Gitea Docker deployments) with data persisted in /srv/gitea:/data.

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 (Internal HTTP)

  • 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 (Certbot)

  • 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, perform the following steps:

  1. Navigate to the installation directory:

    cd /opt/gitea
    

  2. Pull the latest images and restart the container:

    docker compose pull && docker compose up -d
    

Location of configuration files and data

  • Gitea Data: /srv/gitea

  • Nginx Configuration: /data/nginx/user_conf.d/gitea{Server_ID_from_Invapi}.hostkey.in.conf

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

Available ports for connection

Port Service Protocol
443 Web Interface (HTTPS) TCP
222 Gitea SSH TCP
3000 Internal Application API 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 ×