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:
-
System Preparation: The host system's timezone is synchronized to
Europe/Moscowby linking/etc/localtimeto the appropriate zoneinfo file. -
Directory Creation:
-
A directory for Gitea deployment is created at
/opt/gitea. -
A data storage directory is initialized at
/srv/giteawithrootownership. -
Docker Deployment: The application is deployed using a Docker Compose file located at
/opt/gitea/docker-compose.yml. This service runs Gitea version1.22.2. -
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/giteais owned byroot. -
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
443to the internal container on port3000.
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:
-
Restart Policy:
unless-stopped
Application Update Instructions¶
To update the Gitea application, perform the following steps:
-
Navigate to the installation directory:
-
Pull the latest images and restart the container:
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:
To stop the application: