networks: test-net: name: gitops-test-network volumes: forgejo-data: driver: local driver_opts: type: none o: bind device: ${PWD}/forgejo_data runner-data: driver: local driver_opts: type: none o: bind device: ${PWD}/runner_data services: # 1. FORGEJO forgejo: image: data.forgejo.org/forgejo/forgejo:9 container_name: forgejo networks: - test-net environment: - FORGEJO__SERVER__HTTP_PORT=3000 - FORGEJO__SERVER__ROOT_URL=http://forgejo:3000 - FORGEJO__ACTIONS__ENABLED=true - FORGEJO__PACKAGES__ENABLED=true - FORGEJO__PACKAGES__CONTAINER_ENABLED=true volumes: - forgejo-data:/data restart: always # 2. NGINX REVERSE PROXY nginx: image: nginx:alpine container_name: nginx-proxy networks: test-net: aliases: - registry.local ports: - "3005:443" - "3000:80" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx_ssl:/etc/nginx/ssl:ro restart: always # 3. FORGEJO RUNNER forgejo-runner: image: data.forgejo.org/forgejo/runner:9 container_name: forgejo-runner networks: - test-net user: "0:0" entrypoint: ["/bin/sh", "-c"] command: ["forgejo-runner daemon --config /data/runner-config.yml"] environment: - GITEA_INSTANCE_URL=http://forgejo:3000 - GITEA_REGISTRATION_TOKEN=z6xlwg3dSRYZ59zUxfrztDJasG6VkvulFyTwtJQS - GITEA_RUNNER_NAME=debian-local-runner - GITEA_RUNNER_LABELS=ubuntu-latest:docker://docker:24-cli,debian-stable:docker://docker:24-cli volumes: - /var/run/docker.sock:/var/run/docker.sock - runner-data:/data - ./runner-config.yaml:/data/runner-config.yml - ./kind_kubeconfig:/root/.kube depends_on: - forgejo - nginx restart: always # 4. KUBERNETES PLATFORM (K3s: Validiert die CA jetzt echt und regelkonform) k3s-cluster: image: rancher/k3s:v1.28.2-k3s1 container_name: local-k3s-platform networks: - test-net privileged: true tmpfs: - /run - /var/run ports: - "8443:6443" - "8080:80" environment: - K3S_KUBECONFIG_OUTPUT=/output/config - K3S_KUBECONFIG_MODE=666 volumes: - ./kind_kubeconfig:/output # Reicht das CA-Zertifikat an den von containerd gesuchten Standardpfad durch - ./nginx_ssl/nginx.crt:/etc/containerd/certs.d/registry.local/ca.crt:ro # DIE RETTUNG: Zwingt die Engine, das obige CA-File für registry.local zur echten Validierung zu nutzen! - ./registries.yaml:/etc/rancher/k3s/registries.yaml:ro command: server --disable traefik --egress-selector-mode=disabled restart: always # 5. AUTOMATISCHER KUBECONFIG-SYNCER (DIE BEST-PRACTICE-RETTUNG) sync-kubeconfig: image: alpine:latest container_name: sync-kubeconfig networks: - test-net volumes: - ./kind_kubeconfig:/output:ro - ./sync_kubeconfig.sh:/sync.sh:ro entrypoint: ["/bin/sh", "-c"] command: ["apk add --no-cache curl && /sync.sh"] depends_on: - k3s-cluster - forgejo