Skip to content
Live $100 credit at signup, up to $300 total Offer ends December 31, 2026 Get started →

Forgejo

Forgejo is a self-hosted Git forge, maintained as a community-driven fork of Gitea. It bundles repository hosting, pull requests, issue tracking, packages, and CI actions into a single Go binary that runs well on modest hardware. This image ships the Forgejo LTS line, which is released every April and supported for about 15 months.

ComponentVersion
Forgejo15.0.3 (LTS)
PostgreSQL18
DockerLatest stable
Ubuntu24.04 LTS

Forgejo runs with PostgreSQL as a Docker Compose stack. The web UI is served on port 3000 and Git over SSH on port 2222, which leaves the VM’s own SSH daemon on port 22.

ResourceMinimumRecommended
vCPU12
RAM1 GB2 GB
Storage20 GB40 GB

These values are optional during marketplace deployment. Leave a password field blank to have a secure random value generated automatically.

VariableDescription
FORGEJO_ADMIN_PASSWORDPassword for the initial zadmin account
FORGEJO_DB_PASSWORDPassword for the forgejo PostgreSQL user
FORGEJO_DOMAINPublic hostname used in clone URLs, defaults to the VM’s IP
ssh ubuntu@<your-vm-ip>

On the first boot, a setup script generates the database password, starts Forgejo and PostgreSQL with Docker Compose, and creates the administrator account. This takes 1-2 minutes. Track progress:

journalctl -u forgejo-first-boot.service -f

The login message (MOTD) confirms when Forgejo is ready and prints the admin credentials.

The credentials are also written to a root-only file:

sudo cat /etc/forgejo/credentials.txt

Open a browser and navigate to:

http://<your-vm-ip>:3000

Sign in as zadmin with the generated password. The web installer is locked, so the instance is configured from the moment it boots.

Add your public key under Settings → SSH / GPG Keys, then clone using port 2222:

git clone ssh://git@<your-vm-ip>:2222/<owner>/<repo>.git

Forgejo and PostgreSQL run as a Docker Compose stack in /opt/forgejo.

# Check status
cd /opt/forgejo && docker compose ps
# Restart
cd /opt/forgejo && docker compose restart
# View logs
cd /opt/forgejo && docker compose logs -f server

Repository data lives in /opt/forgejo/data/forgejo and the database in /opt/forgejo/data/postgres. Configuration is generated at /opt/forgejo/data/forgejo/gitea/conf/app.ini, and most settings accept overrides through FORGEJO__section__KEY environment variables in the compose file.

Ports 3000 (HTTP) and 2222 (Git over SSH) are open on the VM’s network interface. UFW is enabled and allows those ports plus SSH (port 22).

Each VM generates its own SECRET_KEY and INTERNAL_TOKEN the first time Forgejo starts, so no two deployments share encryption secrets.

To restrict access to a specific IP:

sudo ufw delete allow 3000/tcp
sudo ufw allow from <trusted-ip> to any port 3000

For production use, point a DNS record at the VM and front Forgejo with TLS via a reverse proxy (Caddy, nginx, or Traefik), then set FORGEJO_DOMAIN so clone URLs match.

Last updated: