Skip to content

LXC 107 - Forge

Container LXC hébergeant l'infrastructure GitOps : Forgejo (Git + CI/CD), runner Forgejo Actions et registry Zot.

Informations

Paramètre Valeur
ID 107
Nom forge
IP 192.168.1.107
RAM 2048 MB
Disk 30 GB (local-zfs)
Mount point /opt/docker/mnt/lxc-data/107-forge

Rôle dans l'infrastructure

LXC 107 est le cerveau GitOps de l'infrastructure :

  • Forgejo — héberge le monorepo homelab/infra (tous les docker-compose.yml des LXC)
  • Forgejo Runner — exécute les workflows CI/CD (deploy, Renovate)
  • Zot — registry Docker pull-through (Docker Hub, GHCR, lscr.io) pour tous les LXC + cache local

Voir Mise à jour Docker pour le fonctionnement complet du pipeline GitOps.

Applications hébergées

Application Image Port URL
Forgejo codeberg.org/forgejo/forgejo:15 3000 (HTTP), 2222 (SSH) git.ncls.ltd
Forgejo Runner code.forgejo.org/forgejo/runner:12 — (pas d'exposition)
Zot registry ghcr.io/project-zot/zot-linux-amd64:latest 5000 (HTTP) 192.168.1.107:5000 (interne uniquement)

Particularités

Forgejo — bypass Authelia

git.ncls.ltd est en mode bypass dans Authelia (pas de SSO). Forgejo gère sa propre authentification. Raison : l'API Git HTTP et les tokens PAT ne fonctionnent pas derrière un SSO one_factor.

Runner — user root

Le runner tourne avec user: root dans docker-compose pour accéder au socket Docker du LXC.

Zot — healthcheck désactivé

L'image Zot est distroless (aucun shell). Le healthcheck est désactivé dans docker-compose :

healthcheck:
  disable: true

107-forge exclu de l'auto-deploy

Le runner exécute ses jobs depuis l'intérieur de son propre container. Si deploy.yml redéployait 107-forge, il tuerait le runner en cours d'exécution.

Le workflow deploy.yml est configuré pour n'écouter que les paths 1[0-6][0-9]-*/docker-compose.yml, excluant 107-forge.

Procédure manuelle pour mettre à jour LXC 107 :

pct exec 107 -- bash -c 'cd /opt/docker && docker compose pull && docker compose up -d --remove-orphans'

Accès

# Console
pct enter 107

# Commandes distantes
pct exec 107 -- docker ps
pct exec 107 -- docker logs forgejo --tail 30
pct exec 107 -- docker logs forgejo-runner --tail 30

# Forgejo CLI (admin)
pct exec 107 -- docker exec forgejo forgejo admin user list

Configuration Forgejo

Élément Valeur
Admin nico (ID 1, admin@ncls.ltd)
Bot Renovate renovate-bot (ID 3, renovate-bot@ncls.ltd, non-admin)
Organisation homelab
Repo principal homelab/infra (monorepo compose)
Runner pve-runner, label ubuntu-latest

Secrets Forgejo Actions

Secret Usage
PROXMOX_SSH_KEY Clé ED25519 privée deploy key → root@192.168.1.21:authorized_keys
RENOVATE_TOKEN PAT renovate-bot — scopes write:repository, write:issue, read:organization, read:misc

Zot — Pull-through registries

{
  "http": { "address": "0.0.0.0", "port": "5000" },
  "extensions": {
    "sync": {
      "registries": [
        { "urls": ["https://registry-1.docker.io"], "onDemand": true, "prefix": "docker" },
        { "urls": ["https://ghcr.io"],              "onDemand": true, "prefix": "ghcr" },
        { "urls": ["https://lscr.io"],              "onDemand": true, "prefix": "lscr" }
      ]
    }
  }
}

Tous les LXC ont daemon.json avec registry-mirrors: ["http://192.168.1.107:5000"].

Sauvegarde

  • Snapshots LXC via PBS (quotidien, inclus dans vzdump)
  • Compose files et config versionnés dans homelab/infra (Forgejo)
  • stack.env (secrets LXC 100, 106) gitignorés — sauvegardés via backup-docker-configs.sh