Deployment guide

Host Forgejo on your own VPS

Deploy on a VPS Cloud →

Self-hosting7 min read

Host Forgejo on your own VPS

Forgejo is the community fork of Gitea, driven by Codeberg e.V. and placed under nonprofit governance. It aims to be a truly sovereign, federatable Git forge with no commercial dependency. Here is how to deploy it on your VPS with Docker, a reverse proxy and an SSL certificate, and what sets it apart from Gitea.

Why choose Forgejo for your self-hosted forge

Forgejo was born in 2022 out of a disagreement over the governance of Gitea, which had come under the control of a company. The project is now maintained by a nonprofit association and is progressing toward a decentralized forge capable of federation via ActivityPub — the goal being that a repository on one instance can interact with an issue opened from another instance. For anyone who values the longevity and independence of their tooling, Forgejo offers the same technical qualities as Gitea (lightweight, fast, low consumption) while guaranteeing a fully community-driven license and governance. It is the reference forge of Codeberg, which proves its ability to hold up under production load.

Concrete benefits of a self-hosted Forgejo

  • Nonprofit association governance: no risk of a commercial pivot of the project.
  • Forgejo Actions, compatible with the syntax of GitHub Actions workflows, with no third-party service.
  • Painless migration from Gitea: same database and data volume format.
  • ActivityPub federation being rolled out to interconnect instances.
  • Lightweight footprint identical to Gitea: ideal on a modest VPS.
  • 100% free software, with no paid enterprise edition or restricted feature.

Hardware and software prerequisites

Like Gitea, Forgejo is extremely lean. A VPS with 2 vCPU and 2 GB of RAM handles a team of 10 to 20 developers effortlessly; move up to 4 GB if you run Forgejo Actions with runners that compile locally. Reserve 20 to 40 GB of SSD for repositories and history. You need Docker and Docker Compose, a git.yourdomain.com subdomain with an A record to the VPS IP, and a port distinct from the system port 22 for repository SSH (for example 2222).

Deploy Forgejo with Docker and SSL

01

Initialize the environment

Over SSH on the VPS, install Docker and the Compose plugin, then create /opt/forgejo. Plan for a data subfolder that will contain repositories, configuration and avatars, mounted as a volume to withstand updates.

02

Write the docker-compose.yml

Use the official image codeberg.org/forgejo/forgejo:latest. Add a postgres:16 service for the database. Mount ./data:/data, set USER_UID/USER_GID to 1000 and publish Forgejo's SSH on the host with "2222:22", keeping port 3000 internal.

03

Start the stack

Run docker compose up -d, then watch docker compose logs -f forgejo until you see the HTTP server listening on port 3000 and the database responding.

04

Set up the reverse proxy and SSL

With Caddy: git.yourdomain.com { reverse_proxy localhost:3000 }, the Let's Encrypt certificate is handled automatically. With Traefik or Nginx, proxy to 127.0.0.1:3000 and enable HTTP/2 as well as HTTP-to-HTTPS redirection.

05

Configure the instance

Go to https://git.yourdomain.com, fill in the PostgreSQL host (db:5432), the HTTPS base URL and the external SSH port 2222. Create the administrator account and disable self-registration for a private instance.

06

Connect a Forgejo Actions runner

Retrieve the registration token from the administration, then start a forgejo-runner container pointing to your instance. Validate with a minimal .forgejo/workflows/ci.yml workflow that runs echo ok.

If you are migrating from an existing Gitea instance, Forgejo reads the same data volume and the same database directly: stop Gitea, back up, replace the image with Forgejo's in the docker-compose.yml, then restart. The Forgejo version must be compatible with the Gitea version in use — check the version correspondence table before the switch to avoid a one-way schema migration. Always take a snapshot of the VPS before the operation.

Forgejo versus Gitea

CriterionForgejoGitea
GovernanceNonprofit association (Codeberg e.V.)Commercial company
License / model100% free, no enterprise editionOpen source with a commercial Gitea Cloud edition
Built-in CI/CDForgejo Actions (GitHub Actions compatible)Gitea Actions (GitHub Actions compatible)
FederationActivityPub in active developmentNot a priority
RAM consumptionVery low (~200-300 MB)Very low (~200-300 MB)
Cross migrationReads the Gitea volume and databaseOrigin of the fork
Docker imagecodeberg.org/forgejo/forgejogitea/gitea
Typical use caseSovereignty and community longevityGeneral-purpose forge with possible managed services

Host your sovereign Forgejo forge on a ServOrbit Cloud VPS

With a Cloud VPS delivered with Docker ready to use, set up Forgejo and its CI/CD runner in a few commands. You keep full control of your code and your data.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.