# Forgejo Forgejo is a self-hosted Git service (fork of Gitea) with built-in CI/CD Actions. ## References - [Forgejo Documentation](https://forgejo.org/docs/) - [Forgejo Actions](https://forgejo.org/docs/latest/user/actions/) ## Setup ### DNS Set a CNAME record for `git.cryodev.xyz` pointing to your main domain. ### Configuration ```nix # hosts/cryodev-main/services/forgejo.nix { config, ... }: { services.forgejo = { enable = true; settings = { server = { DOMAIN = "git.cryodev.xyz"; ROOT_URL = "https://git.cryodev.xyz"; }; mailer = { ENABLED = true; FROM = "forgejo@cryodev.xyz"; }; }; }; } ``` ## Forgejo Runner The runner executes CI/CD pipelines defined in `.forgejo/workflows/`. ### Get Runner Token 1. Go to Forgejo Admin Panel 2. Navigate to Actions > Runners 3. Create a new runner and copy the token ### Add to Secrets ```bash sops hosts/cryodev-main/secrets.yaml ``` ```yaml forgejo-runner: token: "your-runner-token" ``` ### Configuration ```nix { sops.secrets."forgejo-runner/token" = { }; services.gitea-actions-runner = { instances.default = { enable = true; url = "https://git.cryodev.xyz"; tokenFile = config.sops.secrets."forgejo-runner/token".path; labels = [ "ubuntu-latest:docker://node:20" ]; }; }; } ``` ## CI/CD Workflows CI runs on every push to `main` via Forgejo Actions: 1. **flake-check** -- validates the flake 2. **build-hosts** -- builds all host configurations Deployment is handled by **Comin** (pull-based), not by CI. See [CD documentation](../deployment/cd.md) for details. ## Administration ### Create Admin User ```bash forgejo admin user create \ --username \ --email @ \ --password \ --admin ``` ### Reset User Password ```bash sudo -u forgejo forgejo admin user change-password \ --username USER \ --password NEWPASS ``` ## Troubleshooting ### Check Service Status ```bash sudo systemctl status forgejo sudo systemctl status gitea-runner-default ``` ### View Logs ```bash sudo journalctl -u forgejo -f sudo journalctl -u gitea-runner-default -f ``` ### Database Issues Forgejo uses SQLite by default. Database location: ```bash ls -la /var/lib/forgejo/data/ ```