lomavuokraus/forgejo/README.md
2025-12-11 22:13:19 +02:00

2 KiB
Raw Blame History

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.

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
    
  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.