Forgejo
Forgejo is a community-driven, self-hosted Git forge — a soft fork of Gitea focused on sustainability, independence, and community governance. It provides Git repository hosting, issue tracking, pull requests, code review, CI/CD via Forgejo Actions (GitHub Actions compatible), container registry, package registry, and a wiki per repository. This stack deploys Forgejo 8 backed by PostgreSQL 16 for reliable data storage. Forgejo is lightweight and can run on minimal hardware while supporting thousands of repositories and users. It supports SSH access for Git operations, OAuth2/OpenID Connect authentication, webhooks, and an extensive API compatible with the Gitea ecosystem. After deployment, access the web UI on port 3000 to complete the installation wizard and create your admin account.
Services Inclus
forgejo
codeberg.org/forgejo/forgejo:8
Variables d'Environnement :
postgres
postgres:16-alpine
Variables d'Environnement :
YAML Généré
# Generated by ComposeHub (composehub.dev)
name: forgejo
services:
forgejo:
image: codeberg.org/forgejo/forgejo:8
restart: always
ports:
- 3000:3000
- 2222:22
volumes:
- forgejo_data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
USER_UID: ${USER_UID:-1000}
USER_GID: ${USER_GID:-1000}
FORGEJO__database__DB_TYPE: postgres
FORGEJO__database__HOST: postgres:5432
FORGEJO__database__NAME: ${POSTGRES_DB:-forgejo}
FORGEJO__database__USER: ${POSTGRES_USER:-forgejo}
FORGEJO__database__PASSWD: ${POSTGRES_PASSWORD:-changeme}
FORGEJO__server__ROOT_URL: ${ROOT_URL:-http://localhost:3000}
FORGEJO__server__SSH_PORT: ${SSH_PORT:-2222}
FORGEJO__server__SSH_LISTEN_PORT: "22"
networks:
- forgejo
depends_on:
postgres:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:3000/api/v1/version || exit 1
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "2.00"
memory: 1024M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composehub.description: Forgejo Git forge — code hosting, CI/CD, and project management
postgres:
image: postgres:16-alpine
restart: always
volumes:
- forgejo_db:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${POSTGRES_DB:-forgejo}
POSTGRES_USER: ${POSTGRES_USER:-forgejo}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
networks:
- forgejo
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${POSTGRES_USER:-forgejo} -d ${POSTGRES_DB:-forgejo}
interval: 5s
timeout: 5s
retries: 10
start_period: 30s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composehub.description: PostgreSQL 16 database for Forgejo
networks:
forgejo:
driver: bridge
volumes:
forgejo_data:
driver: local
forgejo_db:
driver: local
Informations Rapides
- Services
- 2
- Réseaux
- 1
- Volumes
- 2
Quand l'Utiliser
Ce modèle est idéal pour mettre en place un environnement forgejo Tous les services sont préconfigurés avec des healthchecks, des limites de ressources et des valeurs par défaut raisonnables. Personnalisez les variables d'environnement avant de déployer en production.
Conseils
- Changez tous les mots de passe par défaut avant le déploiement
- Vérifiez les limites de ressources pour votre matériel
- Ajoutez un reverse proxy pour le HTTPS en production
- Configurez des stratégies de sauvegarde pour les volumes de données