2.9 KiB
Gitea
Setup
The setup is fairly simple, we just need to write the compose file and load it into Dockge.
The compose file is:
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
depends_on:
gitea-db:
condition: service_healthy
restart: unless-stopped
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=gitea-db:5432
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=$DB_PASSWORD
volumes:
- /opt/appdata/gitea/data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/locatime:/etc/localtime:ro
ports:
- 2222:22
networks:
- default
- frontend-net
gitea-db:
image: postgres:16-alpine
container_name: gitea-db
restart: unless-stopped
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=$DB_PASSWORD
- POSTGRES_DB=gitea
volumes:
- /opt/appdata/gitea/db:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U gitea -d gitea
interval: 10s
timeout: 5s
retries: 5
networks:
- default
networks:
frontend-net:
external: true
We'll just have to set the $DB_PASSWORD env. variable. We could also use $DB_USER and $DB_NAME.
When starting this up in Dockge, it will create the necessary directories in your gitea stack.
Those directories will then be owned by root, however because gitea runs with UID:GID=1000:1000, ownership of those directories should be transfered to user:
sudo chown -R $USER:$USER /opt/appdata/gitea
chmod -R 775 /opt/appdata/gitea
Then start the containers via Dockge.
Once the containers (gitea and gitea-db) are up and running, you can access via whatever route you set up to access it.
For me, after starting the ingress stack cf ingress, it should be at gitea.pvdm.dev.
The first time you access it, you should be greated with the initialisation page to set up admin credentials and a few options.
We need to set a few options correctly:
- Database SSL should be set to
disable. ROOT_URLshould be set tohttps://gitea.pvdm.dev(or your domain for gitea). This ensures proper URL generation for external links, HTTPS clone URLs and callbacks.- Disable self-registration under "Server and Third-Party Service Settings", this is because the repo is for myself only and I don't want to manage external users. You may want to keep this active if you want people to be able to register accounts. If so, there are other settings to take into account.
- Disable "OpenID Sign-in", "Require Sign-In to View Pages" and "Require Sign-In for Sharing Links" to make gitea available to see for anyone with the link.
Make sure all other settings and credentials are set properly and install gitea.