Showcasing Forgejo self hosting utilizing Docker and Kamal
  • Ruby 65.8%
  • Shell 31.9%
  • Dockerfile 2.3%
Find a file
arndttouby 9df8d8da87 Upgrade Forgejo 15.0.6 -> 15.0.9, Basis-Image auf Digest
Security: 15.0.8 (Announcement #59) und 15.0.9 (#60) schliessen je eine
Critical-RCE (Template-Generierung, ApplyDiffPatch), einen Token-Scope-Bypass,
den Zugriff auf Anhaenge von Draft-Releases und eine OpenID-CSRF.
Einzige Migration seit 15.0.6 stammt aus 15.0.7. Cooldown erfuellt (17.09.).

Vorgaenger: localhost:5556/arndttouby/forgejo@sha256:c79287ce6499ebcc3020614f98712bde45c588c7cfb765816608396073fd3ea7

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:32:52 +02:00
.kamal Remove obsolete comments 2025-04-09 14:54:33 +02:00
config kamal-proxy auf v0.10.0 pinnen 2026-09-08 10:27:26 +02:00
.dockerignore project initialisation 2025-04-08 16:07:59 +02:00
.gitignore project initialisation 2025-04-08 16:07:59 +02:00
docker-compose.yml project initialisation 2025-04-08 16:07:59 +02:00
Dockerfile Upgrade Forgejo 15.0.6 -> 15.0.9, Basis-Image auf Digest 2026-09-24 14:32:52 +02:00
README.de.md docs: veralteten Versionshinweis in den READMEs entfernen 2026-08-07 16:30:31 +02:00
README.md docs: veralteten Versionshinweis in den READMEs entfernen 2026-08-07 16:30:31 +02:00

Forgejo with Kamal

A reference setup for self-hosting Forgejo using Docker and Kamal.

Deutsch

Overview

This repository demonstrates how to deploy a Forgejo instance with Kamal, including:

  • Forgejo git server with PostgreSQL backend
  • Kamal deployment with automatic SSL via kamal-proxy
  • Docker Compose alternative for local development
  • Secret management via Kamal's password manager adapter

Structure

├── Dockerfile              # Based on codeberg.org/forgejo/forgejo (version pinned there)
├── config/
│   └── deploy.yml          # Kamal deployment configuration
├── docker-compose.yml      # Local development setup
└── .kamal/
    ├── hooks/              # Sample Kamal hooks
    └── secrets             # Secret adapter configuration

Prerequisites

  • A Linux server (tested on ARM64/aarch64)
  • Docker installed on the server
  • Kamal installed locally
  • A domain with DNS pointing to the server
  • A password manager supported by Kamal (e.g. LastPass, 1Password, Bitwarden)

Deployment with Kamal

  1. Clone this repository
  2. Adjust config/deploy.yml:
    • Set your server IP under servers.web.hosts
    • Set your domain under proxy.host
    • Configure environment variables as needed
  3. Set up .env with your password manager adapter and account
  4. Store your secrets in the password manager
  5. Deploy:
kamal setup    # First deployment (provisions server)
kamal deploy   # Subsequent deployments

Local Development

For local development without Kamal:

cp .env.example .env   # Configure database credentials
docker compose up -d

Forgejo will be available at http://localhost:3000.

Configuration

Forgejo is configured via environment variables using the FORGEJO__section__key pattern. Key settings in config/deploy.yml:

Variable Purpose
FORGEJO__database__DB_TYPE Database type (postgres)
FORGEJO__database__HOST Database hostname
FORGEJO__repository__ENABLE_PUSH_CREATE_USER Allow push-to-create repos
FORGEJO__security__GLOBAL_TWO_FACTOR_REQUIREMENT Enforce 2FA for all users
FORGEJO__oauth2_client__ENABLE_AUTO_REGISTRATION Auto-register OAuth2 users

See Forgejo Configuration Cheat Sheet for all options.

References