Back to articles
Technology Insight

Self-Hosting a Lightweight GitHub Alternative: A Comprehensive Guide to Gitea and Drone CI on 1GB RAM VPS

May 28, 2026

Introduction: The Case for Lightweight Self-Hosting

In an era where data sovereignty and cost-efficiency are paramount, developers are increasingly looking for ways to move away from centralized platforms. While GitHub and GitLab offer robust features, they can be restrictive or resource-intensive. For a developer or a small startup operating on a budget, running a full GitLab instance on a 1GB RAM VPS is nearly impossible. This is where the combination of Gitea and Drone CI becomes a game-changer.

Gitea is a painless, self-hosted Git service written in Go, designed to be incredibly lightweight while maintaining a user interface familiar to any GitHub user. When paired with Drone CI—a container-native continuous delivery platform—you create a seamless pipeline that automates testing and deployment without exhausting your server's resources. This post provides a technical roadmap for setting up this 'Power Duo' on a modest 1GB RAM VPS.

Why Gitea and Drone CI?

Before diving into the installation, it is essential to understand why this specific stack is the gold standard for low-resource environments.

  • Minimal Resource Footprint: Gitea can run comfortably on as little as 512MB of RAM, leaving plenty of room for the OS and Drone runners.
  • Single Binary Simplicity: Both tools are highly portable and easy to maintain.
  • Docker-Native: Drone CI uses Docker containers for every step of the pipeline, ensuring environment consistency.
  • Familiarity: The UI of Gitea is heavily inspired by GitHub, reducing the learning curve for your team.

Prerequisites and Environment Setup

To follow this guide, you will need a VPS with at least 1GB of RAM (though 2GB is recommended for smoother builds), a Linux distribution (Ubuntu 22.04 LTS is preferred), and a registered domain name pointed to your server's IP address.

1. Installing Docker and Docker Compose

Since we are aiming for a clean and isolated setup, we will use Docker Compose to manage our services. Begin by updating your system and installing the Docker engine:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y

Once installed, ensure the Docker service is running and enabled to start on boot: sudo systemctl enable --now docker.

Deploying Gitea: Your Private Code Vault

We will create a directory structure to keep our configuration organized. Create a folder named git-stack and a docker-compose.yml file inside it.

The Docker Compose Configuration

The following configuration defines our Gitea service using SQLite as the database to keep memory usage at an absolute minimum.

version: "3"
services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

Run docker-compose up -d to start Gitea. You can then access the setup page at http://your-server-ip:3000. During the initial configuration, ensure you set the SSH Port to 222 and the Gitea Base URL to your domain name.

Integrating Drone CI: Automating the Workflow

Drone CI operates in two parts: the Server (which manages the UI and database) and the Runner (which executes the build jobs). To connect Drone to Gitea, you must first create an OAuth2 Application in Gitea's settings.

Creating the OAuth2 App

  1. Navigate to Gitea -> Settings -> Applications.
  2. Enter "Drone" as the Application Name.
  3. Set the Redirect URI to [https://drone.yourdomain.com/login](https://drone.yourdomain.com/login).
  4. Save and copy the Client ID and Client Secret.

Configuring Drone Server

Add the Drone service to your docker-compose.yml. You will need to provide the OAuth credentials gathered in the previous step. Note that we use RPC Secrets to allow the Runner to communicate securely with the Server.

Optimizing for 1GB RAM

Running CI/CD on limited memory requires strategic optimization. Here are three critical steps to ensure your VPS doesn't crash during a build:

1. Enable Swap Space

On a 1GB RAM system, a swap file is non-negotiable. It acts as a safety net when physical memory is exhausted. We recommend a 2GB swap file:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

2. Limit Concurrent Jobs

In the Drone Runner configuration, set DRONE_RUNNER_CAPACITY=1. This prevents the server from attempting to run multiple builds simultaneously, which would almost certainly trigger the Linux OOM (Out of Memory) Killer.

3. Use Lightweight Docker Images

In your .drone.yml pipeline files, always opt for Alpine-based images or 'slim' variants for your build steps. For example, use node:alpine instead of node:latest to save hundreds of megabytes of disk space and memory during the pull and execution phases.

Setting up a Reverse Proxy with Nginx

To secure your installation with SSL (via Let's Encrypt), you should use Nginx as a reverse proxy. This allows you to access Gitea and Drone via standard HTTPS (port 443) rather than obscure ports like 3000.

Install Nginx and Certbot, then create a configuration block for each subdomain. Ensure you include proxy_set_header directives to pass the correct host and protocol information to the Docker containers, which is vital for OAuth redirects to work correctly.

Conclusion: Enterprise Power on a Budget

By following this guide, you have successfully transformed a low-cost VPS into a professional-grade development hub. Gitea provides a robust, fast, and familiar Git interface, while Drone CI ensures that every commit is tested and ready for production. This setup not only saves costs but also gives you complete control over your source code and CI/CD pipelines.

Self-hosting is a journey of continuous improvement. As your projects grow, the modular nature of Docker allows you to easily scale this stack to a larger server, but for now, you have one of the most efficient Git infrastructures available today.

Self-Hosting a Lightweight GitHub Alternative: A Comprehensive Guide to Gitea and Drone CI on 1GB RAM VPS | DPTCloud