Skip to content

Self-Hosting Git Server: Forgejo on Debian Linux (Featherweight Go Engine, Actions CI/CD & Packages)

Created: 2026-11-06  ·  Last updated: 2026-11-14  ·  Nejat Hakan

Executive Summary: Forgejo is the community-governed, 100% open-source (GPLv3+) hard fork of Gitea stewarded under the non-profit Codeberg e.V. umbrella. Written in compiled Go, Forgejo delivers the core daily features of GitHub and GitLab—Git repositories, Pull Requests, Issue Boards, a built-in OCI Container / PyPI / Cargo / npm Package Registry, and GitHub-Actions-compatible CI/CD (Forgejo Actions)—while consuming just 80–140 MB of RAM (compared to GitLab CE's 3 GB+).

  • 100% Community Non-Profit (Codeberg)


    Free from corporate for-profit governance (Gitea Ltd.) or Enterprise paywalls—open-source under Codeberg e.V.

  • Single Go Binary, Low RAM


    Runs smoothly on a 1-vCPU VPS or Raspberry Pi 5 backed by PostgreSQL 17.

  • Forgejo Actions (.forgejo/workflows)


    Execute standard GitHub Actions YAML workflows locally on your own isolated forgejo-runner daemon.

  • Built-In Container & Package Registry


    Push Podman/Docker images, Python wheels, Rust crates, and Debian .deb packages directly to your Forgejo instance.


1. Forgejo vs. GitLab CE Comparison

Engineering Metric Forgejo (Go) GitLab CE (Ruby on Rails / Omnibus)
Idle RAM Consumption 80 MB – 140 MB 2,800 MB – 6,000 MB
Startup Time < 1 second 2 – 4 minutes
CI/CD Workflow Syntax Forgejo Actions (Compatible with GitHub Actions .yml) GitLab CI (.gitlab-ci.yml)
Built-in Package Registry Container (OCI), PyPI, Cargo, npm, Go, Debian, Generic Container (OCI), PyPI, npm, Maven, Terraform
Ideal Target Environment Homelabs, Raspberry Pi 5, small and medium teams, individual developers Large multi-department corporations (100+ engineers)
%%{init: {'flowchart': {'wrappingWidth': 350}}}%%
flowchart TB
    DEV["💻 Workstation<br/>git push (HTTPS / SSH)"]
    FORG["🔥 Forgejo Server (Go)<br/>127.0.0.1:3000<br/>(Git & OCI Registry)"]
    PG["🗄️ PostgreSQL 17<br/>Metadata, PRs & Issues"]
    RUN["🤖 Actions Runner<br/>Executes Workflows"]

    DEV ==> FORG
    FORG <--> PG
    FORG <-->|"CI Jobs"| RUN

2. Production compose.yaml (Forgejo + PostgreSQL 17)

Deploy the official codeberg.org/forgejo/forgejo image backed by PostgreSQL 17:

# File: /srv/containers/forgejo/compose.yaml
services:
  forgejo:
    image: codeberg.org/forgejo/forgejo:9
    container_name: forgejo
    depends_on:
      forgejo-db:
        condition: service_healthy
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:3000/tcp" # Web UI behind Reverse Proxy
      - "0.0.0.0:2222:22/tcp"     # Git SSH port
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - FORGEJO__database__DB_TYPE=postgres
      - FORGEJO__database__HOST=forgejo-db:5432
      - FORGEJO__database__NAME=forgejo
      - FORGEJO__database__USER=forgejo
      - FORGEJO__database__PASSWD=${FORGEJO_DB_PASSWORD}
      - FORGEJO__server__DOMAIN=git.nejat-hakan.de
      - FORGEJO__server__ROOT_URL=https://git.nejat-hakan.de/
      - FORGEJO__server__SSH_PORT=2222
      # Lock open public registration!
      - FORGEJO__service__DISABLE_REGISTRATION=true
      # Enable built-in Forgejo Actions CI/CD & Package Registry
      - FORGEJO__actions__ENABLED=true
      - FORGEJO__packages__ENABLED=true
    volumes:
      - /srv/containers/forgejo/data:/data:rw
      - /etc/localtime:/etc/localtime:ro

  forgejo-db:
    image: docker.io/library/postgres:17-bookworm
    container_name: forgejo-db
    restart: unless-stopped
    environment:
      - POSTGRES_USER=forgejo
      - POSTGRES_PASSWORD=${FORGEJO_DB_PASSWORD}
      - POSTGRES_DB=forgejo
    volumes:
      - /srv/containers/forgejo/postgres:/var/lib/postgresql/data:rw
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U forgejo -d forgejo"]
      interval: 10s
      timeout: 5s
      retries: 5

3. Automating CI/CD with Forgejo Actions (.forgejo/workflows/ci.yml)

Once your forgejo-runner is registered under Site Administration → Actions → Runners, drop a workflow file into any repository to run automated uv + pytest + mkdocs build --strict checks on every push:

# File: .forgejo/workflows/ci.yml
name: Quality Gate & MkDocs Build
on:
  push:
    branches: [main]
  pull_request:

jobs:
  verify:
    runs-on: docker
    container:
      image: python:3.12-slim-bookworm
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Install uv & Build MkDocs Strict
        run: |
          pip install mkdocs-material
          mkdocs build --strict

Where to Go Next

Pair your Forgejo server with Vikunja project boards, Vaultwarden secrets, and BorgBackup:

  • GitLab CE


    Compare lightweight Forgejo with full-scale GitLab Community Edition Omnibus.

    GitLab CE Guide

  • Vikunja Project Management


    Track project roadmaps and Kanban boards alongside your Forgejo repositories.

    Vikunja Guide

  • BorgBackup + Borgmatic


    Back up /srv/containers/forgejo and PostgreSQL dumps automatically to encrypted off-site storage.

    BorgBackup Guide