bolt Valebyte VPS from $4/mo — NVMe, 60s deploy.

Get a VPS arrow_forward

Gitea on VPS: Installation, Configuration, and Maintenance

calendar_month June 09, 2026 schedule 22 min read visibility 21 views
person
Valebyte Team
Gitea on VPS: Installation, Configuration, and Maintenance

Gitea on VPS is a lightweight, open-source, and self-sufficient platform for hosting Git repositories, which can be efficiently installed, configured, and maintained on a Virtual Private Server (VPS) for complete control over your projects and data.

What is Gitea and why choose Gitea self-hosted on VPS?

In the world of software development, version control systems like Git have become an integral part of the workflow. They enable teams to collaborate efficiently, track code changes, and manage project versions. The most well-known platforms for hosting Git repositories – GitHub, GitLab, Bitbucket – provide powerful cloud solutions. However, these services do not always meet all requirements for privacy, security, or configuration flexibility, especially for corporate users or projects with specific licensing conditions.

This is where Gitea comes in – an open-source, lightweight, and self-sufficient service for hosting Git repositories, written in Go. It was developed as a fork of Gogs with the aim of providing more active development and greater functionality, while maintaining minimal system requirements. Choosing Gitea self-hosted on your own VPS provides developers and teams with an unprecedented level of control over their data, infrastructure, and workflows.

Key Advantages of Gitea

  • Lightweight and Performance: Gitea is written in Go, which makes it very fast and efficient. It consumes significantly fewer system resources compared to GitLab, allowing it to run even on modest VPS instances.
  • Easy Installation and Configuration: Thanks to minimal dependencies and a single executable file, Gitea installation is surprisingly simple, especially when using Docker.
  • Full Data Control: By hosting Gitea on your own VPS, you fully own all repository data, user data, and configurations. This is critically important for projects with high security and privacy requirements.
  • Flexibility and Customization: The open-source nature allows Gitea to be customized for specific needs, integrated with other tools, and adapted to unique workflows.
  • Functionality: Gitea offers all essential features required for project management: repositories, issue tracking, pull requests, wikis, repository migration, CI/CD integration, LDAP/OAuth support, and much more.
  • Community: An active and growing developer community contributes to the rapid development and support of the project.

Comparison with GitHub/GitLab and Use Cases

Unlike GitHub, which is a purely cloud-based solution, or GitLab, which offers both cloud and self-hosted versions (but the latter is much more resource-intensive), Gitea is ideally suited for the following scenarios:

  • Small and Medium Teams: For startups, small development departments, or freelancers who need a powerful yet economical tool.
  • Educational Institutions: For students and educators who need their own Git hosting without restrictions and high costs.
  • Internal Corporate Repositories: Companies that need to store source code within their own infrastructure to ensure security and compliance with regulatory requirements.
  • Development with Limited Resources: Projects running on a VPS with limited RAM and CPU, where GitLab would be too "heavy".
  • Experiments and Personal Projects: Developers who want to have their own Git server for personal projects, experiments, or learning.

Hosting Gitea on a server, especially on a VPS, gives you full control over the environment, allowing you to optimize performance and security according to your unique requirements. This makes Gitea an attractive choice for those who value independence and efficiency.

System Requirements for Installing Gitea on a Server

One of Gitea's key advantages is its modest resource consumption, making it an ideal candidate for deployment on virtual servers with limited specifications. However, for stable and comfortable operation, both minimum and recommended system requirements must be considered, especially if active use is planned.

Minimum and Recommended Configurations

Gitea requires relatively few resources to run, but the actual configuration will depend on the number of users, repositories, and the intensity of their use. Here are general recommendations:

Minimum Requirements (for 1-5 users, up to 10 repositories):

  • Processor (CPU): 1 vCPU (virtual core) with a clock speed of 1 GHz or higher.
  • Random Access Memory (RAM): 512 MB – 1 GB. If using SQLite as the DBMS, 512 MB might be sufficient. For PostgreSQL or MySQL/MariaDB, 1 GB is better.
  • Disk Space: 5 GB of free space. This will be enough for the operating system, Gitea, and a few small repositories.
  • Disk Type: HDD or SSD.

Recommended Requirements (for 5-20 users, up to 50 repositories, active development):

  • Processor (CPU): 2 vCPU with a clock speed of 2 GHz or higher.
  • Random Access Memory (RAM): 2 GB – 4 GB. This will ensure comfortable operation for Gitea, the database, and other system processes.
  • Disk Space: 20 GB – 50 GB of free space. This buffer is necessary for repository growth, logs, and backups.
  • Disk Type: NVMe SSD. Disk subsystem speed is critically important for Git operations, especially with large repositories or frequent clone/push operations.

Advanced Requirements (for more than 20 users, more than 50 repositories, CI/CD):

  • Processor (CPU): 4 vCPU or more.
  • Random Access Memory (RAM): 8 GB or more.
  • Disk Space: 100 GB or more.
  • Disk Type: NVMe SSD.

It's important to remember that these figures are approximate. Load can vary significantly depending on repository size, operation frequency, Git LFS usage, and integration with other services.

Choosing OS and Disk Subsystem

  • Operating System (OS): Gitea supports a wide range of operating systems. For VPS deployment, Linux distributions such as Ubuntu (LTS versions), Debian, CentOS/Rocky Linux are the most popular and recommended. They are well-documented, have an active community, and provide stability. These OSs are best suited for Gitea installation via Docker.
  • Database: Gitea can use several types of databases:
    • SQLite3: Ideal for small installations and personal projects. Easy to set up, does not require a separate DB server, but is less performant under high load.
    • PostgreSQL: Recommended for medium to large installations. Offers high performance, reliability, and extensive features.
    • MySQL/MariaDB: Also a good choice for medium to large installations, widely adopted and well-supported.
    • MS SQL Server: Supported, but less commonly used on Linux VPS.
    For most VPS deployments, especially when using Docker, SQLite or PostgreSQL are the most convenient options.
  • Disk Subsystem: This is often an underestimated but critically important component for Git server performance.
    • HDD: Slow, not recommended for active development.
    • SSD (SATA): Significantly faster than HDDs, suitable for small teams.
    • NVMe SSD: The fastest option. If your hosting provider, such as Valebyte.com, offers VPS with NVMe drives, this will be the best choice for Gitea, ensuring maximum speed for repository operations, especially when working with large files or frequent commits.

Choosing the right VPS configuration for Gitea VPS is key to its stable and efficient operation. Do not skimp on the disk subsystem and RAM if you expect active use.

Looking for a reliable server for your projects?

VPS from $10/month and dedicated servers from $9/month with NVMe, DDoS protection, and 24/7 support.

View offers →

Preparing VPS for Gitea Docker Installation

Before proceeding with Gitea installation, you need to prepare your VPS. This includes choosing a suitable hosting plan, updating the operating system, and installing Docker and Docker Compose. Using Docker significantly simplifies Gitea deployment by isolating its environment and streamlining dependency management.

Choosing a Suitable Valebyte.com VPS Plan

For Gitea VPS, it's important to choose a plan that matches your needs. Valebyte.com offers various VPS plans that can be optimal for Gitea.

Valebyte.com Plan vCPU RAM NVMe SSD Approx. Cost/month Recommended Gitea Usage
VPS Start 1 2 GB 20 GB from $5 Personal projects, small teams (up to 5 people)
VPS Pro 2 4 GB 50 GB from $10 Medium teams (5-20 people), active development
VPS Business 4 8 GB 100 GB from $20 Large teams (20+ people), with CI/CD, large repositories

For self-hosted Gitea on a VPS, we recommend choosing plans with NVMe SSDs, as disk subsystem speed significantly impacts the performance of Git repository operations. Also, consider opting for a self-managed VPS if you want full control over your server and its configuration.

Installing Docker and Docker Compose

After choosing and setting up your VPS (e.g., with Ubuntu 22.04 LTS), the first step is to update the system and install the necessary tools.

1. System Update:

Connect to your VPS via SSH and execute the commands to update packages:

sudo apt update
sudo apt upgrade -y

2. Install Docker Engine:

Install Docker by following the official documentation. This ensures you get the latest and most stable version.

# Remove old Docker versions (if any)
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt remove $pkg; done

# Add Docker's official GPG key
sudo apt update
sudo apt install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker Engine
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Add your user to the docker group to execute Docker commands without sudo (you will need to reconnect to SSH afterwards):

sudo usermod -aG docker $USER
newgrp docker

Verify that Docker is installed correctly:

docker run hello-world

You should see a welcome message from Docker.

3. Install Docker Compose (if not installed as a plugin):

If you installed Docker Engine using docker-compose-plugin, then docker compose is already available. If not, or if you prefer the older version, install it manually:

# Check for Docker Compose Plugin
docker compose version

# If the plugin is not installed, install Docker Compose standalone
sudo apt update
sudo apt install docker-compose -y

Ensure Docker Compose is installed:

docker-compose --version

Your VPS is now ready for Gitea Docker deployment.

rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

Step-by-Step Gitea Installation on VPS with Docker Compose

Using Docker Compose is the most convenient and recommended way to install Gitea on a VPS. It allows you to define all services (Gitea, database) and their configurations in a single file, simplifying management and scaling.

Creating the docker-compose.yml file

Create a directory for Gitea and inside it, the docker-compose.yml file. For example:

mkdir -p /opt/gitea
cd /opt/gitea
nano docker-compose.yml

Insert the following content. This example uses PostgreSQL as the database, but you can easily replace it with SQLite or MySQL/MariaDB by modifying the corresponding section.

version: "3"

services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    restart: always
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=your_gitea_db_password # Replace with a strong password
      - GITEA__server__ROOT_URL=https://git.yourdomain.com/ # Replace with your domain
      - GITEA__server__SSH_DOMAIN=git.yourdomain.com # Replace with your domain
      - GITEA__server__HTTP_PORT=3000
      - GITEA__webhook__ALLOWED_HOSTS=localhost,127.0.0.1
    volumes:
      - ./gitea_data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000" # Port for HTTP/HTTPS via reverse proxy
      - "2222:22"   # Port for SSH Git (can be changed)
    depends_on:
      - db

  db:
    image: postgres:15
    container_name: gitea_db
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=your_gitea_db_password # Replace with the same strong password
      - POSTGRES_DB=gitea
    volumes:
      - ./postgres_data:/var/lib/postgresql/data
    networks:
      - default

volumes:
  gitea_data:
  postgres_data:

networks:
  default:
    external: false

Important points for configuring docker-compose.yml:

  • USER_UID and USER_GID: It is recommended to set them to the UID/GID of your user on the host system (usually 1000) to avoid permission issues with files in volumes.
  • GITEA__database__PASSWD and POSTGRES_PASSWORD: ABSOLUTELY replace your_gitea_db_password with a strong, unique password.
  • GITEA__server__ROOT_URL and GITEA__server__SSH_DOMAIN: Replace git.yourdomain.com with the domain name or IP address of your VPS where Gitea will be accessible. If you plan to use Nginx/Caddy as a reverse proxy, this should be a domain.
  • Ports: 3000:3000 exposes the Gitea port inside the container to port 3000 of the host. 2222:22 exposes the Gitea SSH port to port 2222 of the host. You can change 2222 to any other free port to avoid conflicts with the system SSH server on port 22.
  • volumes:
    • ./gitea_data:/data: Saves all Gitea data (repositories, configurations, avatars) to the gitea_data directory on your host. This is critically important for data persistence when updating the container.
    • ./postgres_data:/var/lib/postgresql/data: Similarly, saves PostgreSQL data.

Starting and Initial Gitea Configuration

After saving the docker-compose.yml file, start the containers:

docker compose up -d

The -d command runs containers in the background. You can check the status of running containers:

docker compose ps

If everything went successfully, you should see both containers (gitea and gitea_db) in running status.

Now Gitea should be accessible at http://YOUR_VPS_IP:3000. Open this address in your browser.

Web Interface for Initial Setup:

Upon first access to Gitea, you will see the installation page. Most fields will already be pre-filled based on your environment variables in docker-compose.yml. Check and adjust if necessary:

  • Database Settings: Should be pre-filled from environment variables (PostgreSQL, host db:5432, user gitea, DB name gitea, password).
  • Gitea Basic Settings:
    • Repository Path: /data/git/repositories (inside the container, corresponds to ./gitea_data/git/repositories on the host).
    • Gitea Root Path: /data.
    • Gitea URL: https://git.yourdomain.com/ (or http://YOUR_VPS_IP:3000/ if without domain and HTTPS for now).
    • SSH Server Domain: git.yourdomain.com (or your VPS IP).
    • SSH Server Port: 2222 (or the one you specified in ports).
  • Administrator Settings: Create the first administrator. This will be your main account for managing Gitea. Fill in the username, password, and email address.

Click "Install Gitea". After the installation is complete, you will be automatically redirected to the login page. Log in with your administrator credentials.

Congratulations! Gitea installation is complete. You now have a working Git server on your VPS. The next step will be to configure a reverse proxy and HTTPS for secure access.

Configuring Reverse Proxy and HTTPS for Gitea

Direct access to Gitea on port 3000 via HTTP is not a secure or professional solution. To ensure security, use a domain name, and encrypt traffic, you need to configure a Reverse Proxy and HTTPS. We will consider Nginx and Caddy as reverse proxies, and for HTTPS, we will use Certbot with Let's Encrypt.

Configuring Nginx as a Reverse Proxy

Nginx is a powerful and popular web server that excels as a reverse proxy. It will accept requests on standard ports (80 for HTTP, 443 for HTTPS) and forward them to Gitea, running on port 3000 inside the Docker container.

1. Install Nginx:

sudo apt update
sudo apt install nginx -y

2. DNS Configuration:

Ensure that your domain (e.g., git.yourdomain.com) points to your VPS's IP address using an A-record in your DNS provider's settings.

3. Creating the Nginx Configuration File for Gitea:

Create a new configuration file for your domain:

sudo nano /etc/nginx/sites-available/gitea.conf

Insert the following configuration (without HTTPS for now):

server {
    listen 80;
    server_name git.yourdomain.com; # Replace with your domain

    client_max_body_size 50m; # For uploading large files

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location ~ /_next/static/ {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        expires 1y;
        add_header Cache-Control "public";
    }

    # For SSH over HTTP/HTTPS (if not using direct SSH on 2222)
    location /ssh/ {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
        proxy_read_timeout 3600s; # Increase timeout for SSH operations
        proxy_send_timeout 3600s;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Save and close the file (Ctrl+X, Y, Enter).

4. Activate Configuration and Restart Nginx:

Create a symbolic link to the file in sites-enabled and check Nginx syntax:

sudo ln -s /etc/nginx/sites-available/gitea.conf /etc/nginx/sites-enabled/
sudo nginx -t

If the syntax is OK, reload Nginx:

sudo systemctl reload nginx

Now Gitea should be accessible at http://git.yourdomain.com.

Securing HTTPS with Certbot (Let's Encrypt)

To ensure a secure connection (HTTPS), we will use free SSL/TLS certificates from Let's Encrypt via the Certbot utility.

1. Install Certbot:

sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

2. Obtain and Install SSL Certificate:

Certbot can automatically configure Nginx to use HTTPS:

sudo certbot --nginx -d git.yourdomain.com # Replace with your domain

Follow Certbot's instructions: enter your email, agree to the terms, and choose whether to redirect HTTP traffic to HTTPS (option "2: Redirect" is recommended).

Certbot will automatically update your /etc/nginx/sites-available/gitea.conf file, adding a section for HTTPS and SSL settings. Nginx will then be reloaded.

Now your Gitea is accessible at https://git.yourdomain.com with a secure connection.

Check automatic certificate renewal:

sudo certbot renew --dry-run

If the command runs without errors, automatic renewal is working.

Configuring Caddy as an Alternative

Caddy is a modern web server with automatic HTTPS support (via Let's Encrypt). It is significantly easier to configure than Nginx, as it manages certificates itself.

1. Install Caddy:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy -y

2. Caddyfile Configuration:

Create or edit the /etc/caddy/Caddyfile file:

sudo nano /etc/caddy/Caddyfile

Remove the default content and add:

git.yourdomain.com { # Replace with your domain
    reverse_proxy localhost:3000 {
        header_up Host {host}
        header_up X-Real-IP {remote_ip}
        header_up X-Forwarded-For {remote_ip}
        header_up X-Forwarded-Proto {scheme}
    }

    # For SSH over HTTP/HTTPS (if not using direct SSH on 2222)
    # This is a simplified configuration, may require refinement
    # @ssh {
    #     path /ssh/*
    # }
    # reverse_proxy @ssh localhost:3000 {
    #     header_up Host {host}
    #     header_up X-Real-IP {remote_ip}
    #     header_up X-Forwarded-For {remote_ip}
    #     header_up X-Forwarded-Proto {scheme}
    #     websocket
    # }
}

Save and close the file.

3. Check and Start Caddy:

sudo caddy validate
sudo systemctl reload caddy

Caddy will automatically obtain an SSL certificate for your domain and start proxying traffic to Gitea. This is a very convenient way to ensure secure access to your services on a VPS.

Gitea Maintenance: Backups, Updates, and Monitoring

Installing Gitea on a VPS is just the beginning. To ensure reliable and uninterrupted operation, regular maintenance, including backups, updates, and monitoring, is necessary. These steps are critically important for protecting your data and keeping the system up-to-date.

Gitea Data Backup Strategies

Backup is the most important aspect of maintaining any server. Loss of Git repository data can be catastrophic. For Gitea, three main components need to be backed up:

  1. Gitea Database: Contains information about users, repositories, issues, comments, etc.
  2. Gitea Data: Includes Git repositories, SSH keys, avatars, attachments, and other files stored in the /data directory (which is mounted as ./gitea_data on the host).
  3. Gitea Configuration File: app.ini (located in ./gitea_data/gitea/conf/app.ini).

Backup Methods:

  • Built-in Gitea Utility: Gitea comes with a convenient gitea dump command that creates an archive with all necessary data.
    # Execute inside the Gitea container
    docker exec -it gitea gitea dump

    This command will create a gitea-dump-YYYYMMDDHHMMSS.zip file in Gitea's working directory (/tmp inside the container, but when using Docker Compose with volumes, it might be accessible via the mounted volume). It is recommended to move this file to the host system and then to secure external storage.

    For automation, you can create a script on the host:

    #!/bin/bash
    DATE=$(date +%Y%m%d%H%M%S)
    BACKUP_DIR="/opt/gitea/backups"
    GITEA_DATA_DIR="/opt/gitea/gitea_data"
    DB_DATA_DIR="/opt/gitea/postgres_data" # Or wherever your DB data is
    
    mkdir -p $BACKUP_DIR
    
    echo "Stopping Gitea for consistent backup..."
    docker compose stop gitea
    
    echo "Dumping Gitea data..."
    docker exec gitea gitea dump -c /data/gitea/conf/app.ini -f /tmp/gitea-dump-$DATE.zip
    docker cp gitea:/tmp/gitea-dump-$DATE.zip $BACKUP_DIR/
    
    echo "Dumping PostgreSQL database..."
    docker exec gitea_db pg_dumpall -U gitea > $BACKUP_DIR/gitea_db_dump_$DATE.sql
    
    echo "Copying Gitea data directory..."
    # You can simply copy gitea_data and postgres_data, as they are already on the host
    cp -r $GITEA_DATA_DIR $BACKUP_DIR/gitea_data_$DATE
    cp -r $DB_DATA_DIR $BACKUP_DIR/postgres_data_$DATE
    
    echo "Starting Gitea..."
    docker compose start gitea
    
    echo "Cleaning up old backups (e.g., keep last 7 days)..."
    find $BACKUP_DIR -type f -name 'gitea-dump-*.zip' -mtime +7 -delete
    find $BACKUP_DIR -type f -name 'gitea_db_dump_*.sql' -mtime +7 -delete
    find $BACKUP_DIR -type d -name 'gitea_data_*' -mtime +7 -exec rm -rf {} +
    find $BACKUP_DIR -type d -name 'postgres_data_*' -mtime +7 -exec rm -rf {} +
    
    echo "Backup finished: $BACKUP_DIR/gitea-dump-$DATE.zip"

    This script should be added to cron for automatic execution. Don't forget to change paths and passwords. It's also important to back up the database separately, as gitea dump does not always include a full DB dump, especially for external DBMS.

  • VPS File System/Volume Snapshots: Many hosting providers, including Valebyte.com, offer the ability to create snapshots of the entire VPS or individual disk volumes. This is a quick way to make a full copy of the server's state, but it can be resource-intensive and not always suitable for frequent backups.
  • Rsync: For more granular control, you can use rsync to synchronize the gitea_data and postgres_data folders to a remote server or external storage.

Important: Always store backups off your VPS (e.g., on S3, Google Drive, another server) to avoid data loss if the primary server fails.

Gitea and Docker Container Update Process

Regular updates of Gitea and Docker images are important for receiving new features, bug fixes, and addressing security vulnerabilities.

Updating Gitea:

Since Gitea is running in Docker, updating is very simple:

  1. Create a backup: Always perform a full backup before updating.
  2. Stop the Gitea container:
    docker compose stop gitea
  3. Pull the new Gitea image:
    docker compose pull gitea

    This will download the latest version of the gitea/gitea:latest image.

  4. Start the Gitea container:
    docker compose up -d gitea

    Docker Compose will automatically create a new container with the new image, using the existing data volumes.

  5. Check the version: Go to the Gitea web interface and check the version at the bottom of the page.

Updating PostgreSQL Docker Image (or other DBMS):

Updating the database requires more caution, as there might be changes in the data schema. Always read the Gitea and database documentation before updating.

  1. Backup: Be sure to make a full backup of Gitea and the database.
  2. Stop all containers:
    docker compose down
  3. Modify docker-compose.yml: Update the PostgreSQL image tag (e.g., from postgres:15 to postgres:16).
  4. Pull the new image:
    docker compose pull db
  5. Start the containers:
    docker compose up -d
  6. Verify: Ensure that Gitea and the database are working correctly.

Important: When upgrading major database versions (e.g., PostgreSQL 15 to 16), data migration is often required, not just starting a new container with existing volumes. In such cases, it is recommended to use official migration methods or create a new DB container and import the old DB dump into it.

Performance Monitoring and Logging

For stable operation of Gitea on a server, monitoring is essential.

  • VPS Resource Monitoring: Use utilities like htop, glances, or top to monitor CPU, RAM, and disk usage on your VPS. If resources are consistently near 100%, a plan upgrade might be necessary.
  • Gitea Logs: Gitea logs are output to the container's standard output by default. You can view them with the command:
    docker compose logs gitea

    For more convenient viewing and filtering, you can use the -f (follow) option or redirect logs to a file.

  • Nginx/Caddy Logs: Check the logs of your reverse proxy (usually in /var/log/nginx/access.log and error.log for Nginx, or /var/log/caddy/access.log and error.log for Caddy) to identify access issues or errors.
  • Docker Monitoring: The docker stats command shows the current resource consumption of all running containers.

Regular monitoring helps identify potential problems before they become critical.

rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

Which VPS Config to Choose for Gitea VPS Under Real Load?

Choosing the right VPS configuration for Gitea VPS under real load is a balance between performance, cost, and scalability. Underestimating needs can lead to slow performance and team dissatisfaction, while overestimating can result in unnecessary expenses. Key factors influencing the choice include the number of users, repository size, frequency of Git operations, and the use of additional features (e.g., CI/CD).

Assessing Team and Project Needs

Before choosing a plan, answer the following questions:

  1. Number of Active Users: How many developers will be using Gitea simultaneously?
  2. Number and Size of Repositories: How many repositories are planned to be hosted? Will there be very large repositories among them (e.g., with graphics, video, or binary files requiring Git LFS)?
  3. Frequency of Git Operations: How often will pushes, pulls, and clones occur?
  4. CI/CD Usage: Do you plan to integrate Gitea with continuous integration/delivery systems (e.g., Jenkins, Drone CI) that will run on the same VPS or on separate servers?
  5. Expected Growth: How quickly will your team or the number of projects grow?

Based on these questions, the following VPS configurations from Valebyte.com can be recommended for Gitea installation:

Gitea Use Case vCPU RAM NVMe SSD Approx. Cost/month (Valebyte.com) Notes
Personal/Test (1-3 users, up to 10 repos, infrequent operations) 1 1-2 GB 20 GB from $5 SQLite DB, no CI/CD. Sufficient for learning and small projects.
Small Team (3-10 users, up to 30 repos, moderate activity) 2 2-4 GB 50 GB from $10 PostgreSQL/MariaDB, possibly light CI/CD. Good balance of price/performance.
Medium Team (10-25 users, up to 100 repos, high activity, CI/CD) 4 8-16 GB 100-200 GB from $20 PostgreSQL, active CI/CD. Recommended for professional development.
Large Team/Enterprise (25+ users, hundreds of repos, intensive CI/CD, Git LFS) 8+ 16-32 GB+ 200 GB+ from $40 (possibly a dedicated server) High-performance DB, dedicated resources. Consider dedicated servers for maximum performance and isolation.

Recommendations for Scaling and Optimization

Even with a properly chosen VPS, steps can be taken to optimize and prepare for scaling:

  • Use NVMe SSD: For Gitea, this is arguably the most important performance factor, especially when working with large repositories or frequent Git operations.
  • Choose KVM VPS: KVM virtualization provides better resource isolation and performance compared to OpenVZ.
  • Optimize the Database: If using PostgreSQL or MySQL, ensure they are configured for optimal performance. Check caching and buffering parameters.
  • Separate Services: For very large installations, consider hosting the Gitea database on a separate VPS or a managed DB service. This will reduce the load on the main Gitea server and simplify scaling.
  • Monitoring: Continuous monitoring of resources (CPU, RAM, disk I/O) will help you detect bottlenecks in advance and decide whether an upgrade is necessary.
  • Caching: Gitea supports caching various components. Ensure it is enabled and configured in app.ini.
  • Git LFS: If you work with large binary files, use Git LFS (Large File Storage). Gitea has built-in LFS support.

Remember that Gitea on a server, even a powerful one, requires attention to configuration. The right VPS choice and subsequent optimization will ensure the uninterrupted operation of your Git hosting. For those who want to delve deeper into the basics of server infrastructure, we recommend reading the article "What is a Server and a Dedicated Server: A Complete Guide for Beginners".

Conclusion

Gitea on VPS provides a powerful, flexible, and economical solution for self-hosted Git repositories, giving you full control over your projects and data. By following the step-by-step instructions for installation via Docker Compose, configuring secure access with Nginx/Caddy and HTTPS, and performing regular maintenance, you can create a reliable platform for your team. Choosing a suitable VPS plan from Valebyte.com with NVMe SSD will ensure high performance, and proper configuration planning for real-world load will guarantee stable Gitea operation in the long term.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Get started now →
support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.