lomavuokraus/forgejo
Tero Halla-aho be0b194737
Some checks are pending
CI / checks (push) Waiting to run
Move Forgejo SSH to port 2223 and document conflicts
2025-12-11 22:16:18 +02:00
..
docker-compose.yml Move Forgejo SSH to port 2223 and document conflicts 2025-12-11 22:16:18 +02:00
README.md Move Forgejo SSH to port 2223 and document conflicts 2025-12-11 22:16:18 +02:00

Forgejo on halla-aho.net

Lightweight Git hosting + CI with Forgejo (Gitea fork) behind Apache on halla-aho.net.

Whats included

  • Docker Compose for Forgejo + SSH and an Actions runner (forgejo/docker-compose.yml).
  • Apache vhost snippet (added to default-ssl.conf) to reverse-proxy git.halla-aho.net to the Forgejo container on port 3200.
  • SSH for git is exposed on host port 2223 (mapped to container 22); change in compose if that port is taken.

Prereqs

  • Docker installed on halla-aho.net.
  • SSLMate certs for git.halla-aho.net placed on the host (paths referenced in default-ssl.conf).
  • A DNS record for git.halla-aho.net pointing to the server.

Deploy Forgejo

  1. Create host dirs for data:
    sudo mkdir -p /srv/forgejo/data /srv/forgejo/runner
    sudo chown -R $USER:$USER /srv/forgejo
    
  2. Start the Forgejo service:
    docker compose -f forgejo/docker-compose.yml up -d forgejo
    
    • If port 2223 is already in use, edit forgejo/docker-compose.yml (ports: and FORGEJO__SERVER__SSH_PORT) to another free port, then rerun the command.
  3. Configure Apache (already added to default-ssl.conf):
    • VirtualHost git.halla-aho.net:9443 proxies to http://127.0.0.1:3200/.
    • TLS files: /etc/apache2/ssl/git.halla-aho.net.{crt,key,chain.crt} (update if different).
    • Enable the site and reload Apache.
  4. Finish setup in the UI at https://git.halla-aho.net/:
    • Create the admin user.
    • Configure SMTP in the admin UI (Mail settings).
    • Set ROOT_URL/SSH_DOMAIN if you change ports/domains.

Register the Actions runner

  1. In Forgejo, create a runner registration token (Site Admin → Runners).
  2. Register the runner (writes /srv/forgejo/runner/config.yaml):
    docker compose -f forgejo/docker-compose.yml run --rm runner \
      forgejo-runner register \
      --instance https://git.halla-aho.net \
      --token <REGISTRATION_TOKEN> \
      --name halla-runner \
      --labels docker \
      --config /data/config.yaml
    
  3. Start the runner:
    docker compose -f forgejo/docker-compose.yml up -d runner
    

CI workflow for this repo

  • Add workflows under .forgejo/workflows/.
  • Example included: ci.yml runs npm install + lint + type-check + format check on push/PR using the docker runner label.