From 04d31405cc2eef7f892da1233364812cfc014703 Mon Sep 17 00:00:00 2001 From: whitney Date: Mon, 2 Mar 2026 20:23:04 -0800 Subject: [PATCH] Fix gitea --- software-development/gitea/README.md | 22 +++++++------------ software-development/gitea/docker-compose.yml | 4 ++++ software-development/gitea/gitea.env.example | 4 ++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/software-development/gitea/README.md b/software-development/gitea/README.md index 397f7f7..9532a34 100644 --- a/software-development/gitea/README.md +++ b/software-development/gitea/README.md @@ -34,24 +34,18 @@ You can do that from the "Site Administration" view from the first admin user. 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: -- Add another entrypoint in `traefik.toml`: +Test with: ``` -entryPoints: - 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 +ssh -T -p 2222 git@git.whitney.rip ``` + 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. ### Running diff --git a/software-development/gitea/docker-compose.yml b/software-development/gitea/docker-compose.yml index e459500..eee03a5 100644 --- a/software-development/gitea/docker-compose.yml +++ b/software-development/gitea/docker-compose.yml @@ -25,6 +25,10 @@ services: - traefik.http.routers.gitea.tls=true - traefik.http.routers.gitea.tls.certresolver=lets-encrypt - 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: image: postgres:14 diff --git a/software-development/gitea/gitea.env.example b/software-development/gitea/gitea.env.example index 46c7596..1f796f2 100644 --- a/software-development/gitea/gitea.env.example +++ b/software-development/gitea/gitea.env.example @@ -2,6 +2,10 @@ USER_UID=1005 USER_GID=1007 GITEA__server__PROTOCOL=http 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__HOST=database:5432 GITEA__database__NAME=gitea