ITGOIT - Wiki

Gitea

cd /home/myusername/docker
mkdir -p gitea/data/gitea/public/assets/css && cd gitea && mkdir actrunner && cd "$_" && touch act-config.yml && cd ..

nano docker-compose.yml

services:
  db:
    image: postgres:latest
		container_name: gitea-postgresql
		restart: unless-stopped
    environment:
      POSTGRES_DB: gitea
      POSTGRES_USER: gitea
      POSTGRES_PASSWORD: gitea!
    volumes:
      - ./db:/var/lib/postgresql/data
    
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    restart: unless-stopped
    environment:
      USER_UID: 1000
      USER_GID: 1000
      GITEA__database__DB_TYPE: postgres
      GITEA__database__HOST: db
      GITEA__database__NAME: gitea
      GITEA__database__USER: gitea
      GITEA__database__PASSWD: gitea!
    volumes:
      - ./data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 8223:3000
      - 8224:22 # Optional for SSH Access
    depends_on:
      - db

  actrunner:
    image: gitea/act_runner:latest
    container_name: gitea-act-runner
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./actrunner/data:/data  
      - ./actrunner/act-config.yml:/act-config.yml
    environment:
      GITEA_RUNNER_NAME: gitea-act-runner
      GITEA_INSTANCE_URL: http://localhost:8223
      GITEA_RUNNER_REGISTRATION_TOKEN: insert_registration_token_here
docker compose up -d

actrunner registration token

  1. Go to: Site Administration -> Actions -> Runners

  2. Click on: Create new Runner

  3. Copy and paste the REGISTRATION TOKEN into docker-compose.yml at actrunner replace the insert_registration_token_here

docker compose up -d

Configure themes

cd /home/myusername/docker/gitea/conf
nano app.ini

Insert the following lines at the bottom:

[ui]
THEMES = github, my-custom-theme
DEFAULT_THEME = github

Download the following theme file:

theme-github.css

Upload the file to:

cd /home/myusername/docker/gitea/public/assets/css

Custom Gitea homepage

cd /home/myusername/docker/gitea/data/gitea
mkdir templates && cd "$_"

Download and Import the following files into the templates folder

home.tmpl
home-private.tmpl

Custom Gitea Login/Register page

cd /home/myusername/docker/gitea/data/gitea/public/assets/css

Download and Import the following css file into the css folder

extender.css

cd /home/myusername/docker/gitea/data/gitea/templates
mkdir -p user/auth && cd "$_"

Download and Import the following files into the auth folder

link_account.tmpl
signup.tmpl
signin.tmpl

Custom login auth flow background

  1. Go to: Admin interface -> Flows & Stages -> Flows

  2. Edit default-authentication-flow

  3. Click on Appearance settings and upload a custom Background image

Configure mail server (optional)

cd /home/myusername/docker/gitea/data/gitea/conf
nano app.ini
[mailer]
ENABLED        = true
FROM           = [email protected]
MAILER_TYPE    = smtp
SMTP_ADDR      = mail.DOMAIN.COM
SMTP_PORT      = 587
IS_TLS_ENABLED = false
USER           = [email protected]
PASSWD         = REPLACE_WITH_YOUR_EMAIL_PASSWORD

Configure Gitea with Authentik

  1. Go to: Admin interface > Applications > Providers
  2. Click on: Create
  3. Select: OAuth2/OpenID Provider then click Next
  4. Insert the following settings then click on Finish:

Make sure to save the Client ID and Client Secret because you need it later

  1. Go to: Admin interface > Applications > Applications
  2. Click on: Create
  3. Insert the following settings then click on Create:
  1. Go to: Admin interface > Applications > Providers
  2. Click on Gitea

Make sure to save the OpenID Configuration URL because you need it later

Setup inside gitea

  1. Go to: Site Administration > Identity & Access > Authentication Sources
  2. Click on Add Authentication Source
  3. Insert the following settings then click on Add Authentication Source

Alternatives