First stack mirrored 1:1 from /opt/ai-apps/forgejo/ on the server. Includes docker-compose.yml (forgejo + postgres 16), .env.example template (NO real secrets), backup.sh (nightly pg_dump + tar), plus Agent.md and README.md. Known gotchas documented in Agent.md: - Volume mount on /data not /var/lib/gitea - SSH port 2222 in container (system sshd occupies 22) - OIDC config lives in DB table login_source, not app.ini Refs OP#1119
63 lines
2.5 KiB
Markdown
63 lines
2.5 KiB
Markdown
# Forgejo — Self-Hosted Git
|
|
|
|
**Live:** https://code.sdda.eu
|
|
**Git SSH:** `ssh://git@code.sdda.eu:222/<user>/<repo>.git`
|
|
|
|
## Was ist das?
|
|
Unser selbst-gehostetes Git-Hosting, basierend auf [Forgejo](https://forgejo.org/) — einem non-profit Community-Fork von Gitea, gesteuert von Codeberg e.V. Hier leben Code, Infrastructure-as-Code (wie dieses Repo!), Dokumentation und alle künftigen internen Tools.
|
|
|
|
## Schnelles Setup auf neuem Host
|
|
|
|
```bash
|
|
# Vorausgesetzt: Traefik mit Let's Encrypt läuft bereits, DNS ist gesetzt,
|
|
# Authentik OIDC-Provider ist konfiguriert (Client-ID + Secret bereit)
|
|
|
|
cp .env.example .env
|
|
# Secrets generieren
|
|
sed -i '' -e "s|<openssl rand -hex 32>|$(openssl rand -hex 32)|g" .env # macOS
|
|
# ODER: sed -i -e "s|...|...|g" .env auf Linux
|
|
# SMTP + OIDC Credentials manuell eintragen
|
|
|
|
docker compose up -d
|
|
sleep 30
|
|
|
|
# Admin-Fallback anlegen
|
|
docker exec -u git forgejo forgejo admin user create \
|
|
--username admin-local \
|
|
--email admin-local@sdda.eu \
|
|
--password "<strong-password>" \
|
|
--admin --must-change-password=false
|
|
|
|
# OIDC einrichten
|
|
docker exec -u git forgejo forgejo admin auth add-oauth \
|
|
--name authentik \
|
|
--provider openidConnect \
|
|
--key "<CLIENT_ID>" \
|
|
--secret "<CLIENT_SECRET>" \
|
|
--auto-discover-url "https://welcome.sdda.eu/application/o/forgejo/.well-known/openid-configuration" \
|
|
--scopes "openid profile email" \
|
|
--skip-local-2fa
|
|
|
|
# admin-local sperren (Notfall-Reserve)
|
|
docker exec forgejo-db psql -U forgejo -d forgejo \
|
|
-c "UPDATE \"user\" SET prohibit_login = true WHERE lower_name = 'admin-local';"
|
|
```
|
|
|
|
## Zugang
|
|
- **Normal (empfohlen):** Via Authentik OIDC. `code.sdda.eu/user/login` → "Anmelden mit authentik" — oder direkt aus dem Authentik-Dashboard (Silent SSO).
|
|
- **Voraussetzung:** Mitglied der Authentik-Gruppe `forgejo-users`
|
|
- **Emergency-Fallback:** `admin-local` User (in Runbook, nicht hier)
|
|
|
|
## Files in diesem Ordner
|
|
- `docker-compose.yml` — Stack-Definition
|
|
- `.env.example` — Template, **niemals echte `.env` committen**
|
|
- `backup.sh` — Nightly-Backup-Script (pg_dump + tar)
|
|
- `Agent.md` — AI-Briefing für Sessions an diesem Stack
|
|
- `README.md` — diese Datei
|
|
|
|
## Live vs. Repo
|
|
Dieses Repo ist die **versionierte Wahrheit** des Stacks. Wenn du auf ai-apps eine Änderung machst (z.B. `docker-compose.yml` anpasst), **bitte auch hier einchecken**. Andernfalls driftet das Repo vom Server weg und verliert seinen Wert.
|
|
|
|
## OpenProject
|
|
- M7.1 — Forgejo Deployment mit Authentik SSO (abgeschlossen)
|
|
- M7.2 — Repo initialisiert (dieser Commit)
|