💾 Archived View for wilw.capsule.town › notes › gitea.gmi captured on 2024-05-10 at 11:02:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

-=-=-=-=-=-=-

🏡 Home

Back to notes

Gitea

Last updated on 28 September 2022

Gitea [1] is a fantastic GitHub-like service for git remotes and for viewing code and git projects via a web-browser. One can join existing instances (such as Codeberg [2]), or self-host it.

1

2

I self-host a Gitea instance [3]. I use a `docker-compose.yml` file like the one below.

3

version: "3"

services:
  gitea:
    image: gitea/gitea:latest
    restart: unless-stopped
    environment:
      - USER_UID=1000
      - USER_GID=1000
    networks:
      - traefik_net
    volumes:
      - ./gitea_data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "22:22"
    expose:
      - 3000
    labels:
      - traefik.http.routers.gitea.rule=Host(`domain.com`)
      - traefik.http.routers.gitea.tls=true
      - traefik.http.routers.gitea.tls.certresolver=myresolver
      - traefik.http.services.gitea.loadbalancer.server.port=3000

networks:
  traefik_net:
    external: true

Change the domain at which you host the instance and setup the DNS/labels as described in the Traefik [4] note.

4

Then, bring the service up and navigate to it with a web-browser to complete the setup.

Notes

You may notice an additional Traefik label (the `loadbalancer.server.port`) not usually required. Since Gitea exposes a web interface (on port 3000) as well as the SSH git interface (on port 22), we need to tell Traefik to route web traffic to the correct port.

I map the SSH git port to port 22 on the host to make git syncing easier.

Backing-up

I recommend uisng the filesystem backup strategy described in the backups note [5] to back-up the `gitea_data/` directory.

5

Back to notes