From 8555d77d8771f0ccc95036a27bd8daf86e7b15fa Mon Sep 17 00:00:00 2001 From: "David M. Klein" <4+leander19961@noreply.localhost> Date: Thu, 27 Aug 2026 13:47:35 +0200 Subject: [PATCH] Dateien nach "/" hochladen --- .env-example | 76 +++++++++++++++++++++++++++++++++ docker-compose.yml | 35 +++++++++++++++ packages.yaml | 103 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 .env-example create mode 100644 docker-compose.yml create mode 100644 packages.yaml diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..16809a7 --- /dev/null +++ b/.env-example @@ -0,0 +1,76 @@ +# Copy this file to .env. docker-compose.yml loads it via env_file for both +# containers, and docker compose itself also uses it to resolve ${VAR} +# references inside docker-compose.yml (e.g. NGINX_PORT). + +# ============================================================================ +# Where packages.yaml comes from +# ============================================================================ + +# Option A: local file, bind-mounted into the syncer container. Uncomment +# the "../packages.yaml:/config/packages.yaml:ro" volume line under the +# syncer service in docker-compose.yml, leave SOURCES_GIT_REPO empty below, +# and set SOURCES_YAML_FILE to the absolute in-container mount path +# (/config/packages.yaml) to match. +SOURCES_GIT_REPO=https://gitea.leanderserver.de/leander19961/dnf-repo-test +SOURCES_GIT_BRANCH=main +SOURCES_YAML_FILE=packages.yaml + +# Option B (default here): pull the list from git instead. Set +# SOURCES_GIT_REPO, and SOURCES_YAML_FILE to the path of the YAML file +# *inside* that git repo (relative), e.g.: +# SOURCES_GIT_REPO=https://git.example.com/infra/rpm-sources.git +# SOURCES_GIT_BRANCH=main +# SOURCES_YAML_FILE=packages.yaml +# (the local bind mount from Option A is then simply unused.) + +# ============================================================================ +# Paths inside the syncer container +# ============================================================================ +# These map to the volumes defined in docker-compose.yml - only change them +# if you also change the corresponding volume mounts. +WORK_DIR=/var/cache/rpm-mirror-sync +REPO_BASE_DIR=/srv/repo +CLIENT_REPO_DIR=/srv/repo/client-repos + +# ============================================================================ +# Client-facing URL +# ============================================================================ +# Public URL under which the nginx container serves the repo. Used to +# generate the .repo files under /repo/client-repos/. Point this at +# wherever the host running nginx is reachable from your AlmaLinux clients +# (should match NGINX_PORT below). +CLIENT_BASE_URL=http://repo.leanderserver.de/repo + +# ============================================================================ +# repoids of AlmaLinux's own repos inside the syncer container +# ============================================================================ +# Check with: docker compose exec syncer dnf repolist +ALMA_REPO_IDS=baseos appstream extras crb + +# ============================================================================ +# Sync schedule +# ============================================================================ +# How often (seconds) the syncer container re-syncs. 3600 = hourly. +SYNC_INTERVAL_SECONDS=3600 +# Set to "true" to sync once and exit instead of looping (e.g. if you'd +# rather trigger this container from an external scheduler). +RUN_ONCE=false + +# ============================================================================ +# Mirror signing key +# ============================================================================ +# Identity used for the ONE GPG key the mirror signs every mirrored package +# with (regardless of how many upstream sources there are). Generated once +# on first run - together with a revocation certificate - and reused +# forever. Both live under GPG_HOME on the sync-cache volume, so don't run +# "docker compose down -v" unless you're fine with clients having to +# re-trust a brand new key afterwards. +GPG_HOME=/var/cache/rpm-mirror-sync/gnupg +GPG_KEY_NAME=RPM Mirror +GPG_KEY_EMAIL=rpm-mirror@example.local + +# ============================================================================ +# Ports +# ============================================================================ +# Host port nginx publishes the repo on. +NGINX_PORT=8081 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7127e41 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +services: + syncer: + build: + # Kontext ist das Repo-Root (eine Ebene ueber dieser Datei), damit der + # Dockerfile-Pfad zur tatsaechlichen Verzeichnisstruktur passt. + dockerfile: docker/syncer/Dockerfile + image: rpm-mirror-syncer:latest + container_name: rpm-mirror-syncer + restart: unless-stopped + env_file: + - .env + volumes: + # Oeffentliche Repo-Daten, read-write. Der Syncer legt darin pkgs/ an. + - repo-data:/srv/repo + # Geklonte packages.yaml und Lockfile - ueberlebt ein Recreate. + - sync-cache:/var/cache/rpm-mirror-sync + # Lokale packages.yaml statt Git. Wenn gemountet, hat sie Vorrang und + # CONFIG_REPO_URL wird nicht mehr gebraucht. + #- ../packages.yaml:/config/packages.yaml:ro + + nginx: + image: nginx:alpine + container_name: rpm-mirror-nginx + restart: unless-stopped + depends_on: + - syncer + ports: + - "${NGINX_PORT:-8080}:80" + volumes: + - repo-data:/usr/share/nginx/html/repo:ro + - ./docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro + +volumes: + repo-data: + sync-cache: \ No newline at end of file diff --git a/packages.yaml b/packages.yaml new file mode 100644 index 0000000..0f82781 --- /dev/null +++ b/packages.yaml @@ -0,0 +1,103 @@ +# Kuratierte Paketliste fuer den Unternehmens-Mirror. +# +# Ein Paket kann entweder als reiner String stehen (dann wird der +# Paketname als Anzeigename und die Upstream-Summary uebernommen) oder als +# Mapping mit eigenen AppStream-Metadaten. + +appstream: + # Muss eindeutig sein. Kollidiert der Origin mit dem einer Distribution + # ("almalinux"), ueberschreiben sich die Icon-Caches auf den Clients. + # APPSTREAM_ORIGIN aus der .env hat Vorrang vor diesem Wert. + origin: firmen-repo + # Praefix fuer generierte AppStream-IDs: . + id_prefix: de.firma.repo + + defaults: + icon: applications-development + categories: + - Development + note: >- + Bereitgestellt über das Unternehmens-Repo der IT-Abteilung. + Fragen und Paketwünsche bitte an den IT-Service-Desk. + developer: "IT-Abteilung" + homepage: https://wiki.firma.intern/it/software-repo + +sources: + # ------------------------------------------------------------------ + # dotnet liegt bereits in AlmaLinux AppStream, das auf jedem Client + # aktiviert ist. Es waere Verschwendung, die RPMs zu spiegeln - wir + # wollen nur steuern, WAS davon in Discover auftaucht. + # + # metadata_only: true laedt deshalb kein einziges RPM herunter und + # steuert ausschliesslich AppStream-Sichtbarkeit bei. Die Installation + # loest dnf auf dem Client ganz normal aus AlmaLinux AppStream auf. + # ------------------------------------------------------------------ + - name: alma-dotnet + baseurl: https://repo.almalinux.org/almalinux/10/AppStream/x86_64/os/ + gpgkey: https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-10 + metadata_only: true + packages: + - name: dotnet-sdk-8.0 + display_name: ".NET SDK 8.0 (LTS)" + summary: "SDK zum Entwickeln und Bauen von .NET-8-Anwendungen" + description: | + Enthält das dotnet-CLI, die Build-Tools und die Runtime für + .NET 8. Diese Version ist der unterstützte LTS-Stand. + + Projekte legen ihre SDK-Version in der global.json fest. + binary: dotnet + keywords: [dotnet, csharp, netcore, sdk] + homepage: https://dotnet.microsoft.com/ + + - name: dotnet-runtime-8.0 + display_name: ".NET Runtime 8.0 (LTS)" + summary: "Laufzeitumgebung zum Ausführen von .NET-8-Anwendungen" + # "binary:" macht daraus eine console-application statt eines + # generic-Bauteils - siehe Hinweis zu appstream.defaults weiter + # unten, warum das fuer die Sichtbarkeit in Discover wichtig ist. + # dotnet-runtime bringt /usr/bin/dotnet nicht selbst mit (das + # kommt ueber die dotnet-host-Abhaengigkeit), stellt es aber nach + # der Installation genauso bereit. + binary: dotnet + keywords: [dotnet, runtime] + + - name: dotnet-sdk-9.0 + display_name: ".NET SDK 9.0" + summary: "SDK zum Entwickeln und Bauen von .NET-9-Anwendungen" + binary: dotnet + keywords: [dotnet, csharp, sdk] + + - name: dotnet-runtime-9.0 + display_name: ".NET Runtime 9.0" + summary: "Laufzeitumgebung zum Ausführen von .NET-9-Anwendungen" + binary: dotnet + keywords: [dotnet, runtime] + + - name: dotnet-sdk-10.0 + display_name: ".NET SDK 10.0" + binary: dotnet + keywords: [dotnet, csharp, sdk] + + - name: dotnet-runtime-10.0 + display_name: ".NET Runtime 10.0" + binary: dotnet + keywords: [dotnet, runtime] + + # ------------------------------------------------------------------ + # Echtes Fremd-Repo: RPMs werden gespiegelt, gegen den Microsoft-Key + # geprueft und mit dem Mirror-Key neu signiert. Abhaengigkeiten, die + # AlmaLinux ohnehin liefert, werden verworfen. + # ------------------------------------------------------------------ + #- name: vscode + # baseurl: https://packages.microsoft.com/yumrepos/vscode + # gpgkey: https://packages.microsoft.com/keys/microsoft.asc + # packages: + # - name: code + # display_name: "Visual Studio Code" + # summary: "Quelltexteditor mit Debugging und Git-Integration" + # # Bringt ein echtes .desktop-File mit, taucht damit auch beim + # # Stoebern und in den Kategorien auf - nicht nur in der Suche. + # type: desktop-application + # desktop_id: code.desktop + # categories: [Development, IDE] + # keywords: [editor, ide, vscode] \ No newline at end of file