Fix gitea

This commit is contained in:
whitney 2026-03-02 20:23:04 -08:00
parent 6930ee3b7c
commit 04d31405cc
3 changed files with 16 additions and 14 deletions

View File

@ -34,24 +34,18 @@ You can do that from the "Site Administration" view from the first admin user.
6. Configure SSH 6. Configure SSH
**Note: This is probably not worth pursuing and I've given up on it. The following has only sort of worked for me.** Via Traefik (TCP passthrough on port 2222):
- The `gitea` entrypoint on `:2222` is defined in `traefik.toml`.
- TCP router labels in `docker-compose.yml` forward port 2222 → container port 22.
- `SSH_DOMAIN` and `SSH_PORT=2222` in `gitea.env` tell Gitea what to advertise in clone URLs.
Via Traefik: Test with:
- Add another entrypoint in `traefik.toml`:
``` ```
entryPoints: ssh -T -p 2222 git@git.whitney.rip
gitea:
address: ":2222"
```
- Configure similar traefik labels to what we normally do for containers:
```
- traefik.tcp.routers.gitea_ssh.rule=HostSNI(`*`)
- traefik.tcp.routers.gitea_ssh.entrypoints=ssh
- traefik.tcp.routers.gitea_ssh.service=gitea_ssh
- traefik.tcp.services.gitea_ssh.loadbalancer.server.port=22
``` ```
7. Handle user authentication like you'd do on Github by generating new ssh keys and adding them to the SSH Keys section. 7. Handle user authentication like you'd do on Github by generating new ssh keys and adding them to the SSH Keys section.
Settings > SSH/GPG Keys > Manage SSH Keys Settings > SSH/GPG Keys > Manage SSH Keys
Now should also be able to clone with SSH. Now should also be able to clone with SSH.
### Running ### Running

View File

@ -25,6 +25,10 @@ services:
- traefik.http.routers.gitea.tls=true - traefik.http.routers.gitea.tls=true
- traefik.http.routers.gitea.tls.certresolver=lets-encrypt - traefik.http.routers.gitea.tls.certresolver=lets-encrypt
- traefik.http.services.gitea.loadbalancer.server.port=3000 - traefik.http.services.gitea.loadbalancer.server.port=3000
- traefik.tcp.routers.gitea-ssh.rule=HostSNI(`*`)
- traefik.tcp.routers.gitea-ssh.entrypoints=gitea
- traefik.tcp.routers.gitea-ssh.service=gitea-ssh-svc
- traefik.tcp.services.gitea-ssh-svc.loadbalancer.server.port=2222
database: database:
image: postgres:14 image: postgres:14

View File

@ -2,6 +2,10 @@ USER_UID=1005
USER_GID=1007 USER_GID=1007
GITEA__server__PROTOCOL=http GITEA__server__PROTOCOL=http
GITEA__server__ROOT_URL=https://git.example.com GITEA__server__ROOT_URL=https://git.example.com
GITEA__server__SSH_DOMAIN=git.example.com
GITEA__server__START_SSH_SERVER=true
GITEA__server__SSH_LISTEN_PORT=2222
GITEA__server__SSH_PORT=2222
GITEA__database__DB_TYPE=postgres GITEA__database__DB_TYPE=postgres
GITEA__database__HOST=database:5432 GITEA__database__HOST=database:5432
GITEA__database__NAME=gitea GITEA__database__NAME=gitea