GNAI-025: pin-fluxer-images.sh — löst alle compose-Images (inkl. ${FLUXER_*} -Defaults) per skopeo auf Digests auf; .env setzt FLUXER_REGISTRY nicht mehr doppelt
ci-static / secret-scan (push) Successful in 24s
ci-static / yamllint (push) Successful in 37s
ci-static / ansible-syntax (push) Successful in 33s
ci-static / markdown-links (push) Successful in 23s

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-11-29 04:01:54 +01:00
co-authored by Mistral Vibe
parent d2afd3bb94
commit 305dd924a9
6 changed files with 95 additions and 11 deletions
@@ -47,9 +47,7 @@ fluxer_stack_images:
- ghcr.io/fluxerapp/fluxer-gifs@sha256:a7916918e7b42a69dc06fb70349cde457d6fe7226a54bc52105e5ae6aa972c03
- ghcr.io/fluxerapp/fluxer-unfurl@sha256:0b6ba1e741925727fb09525de7ba3eedfba8b7d728f05f0ba58cd5794a8bf14f
- ghcr.io/fluxerapp/fluxer-push@sha256:3ef343963f67fdec385257d14c67bc640cfa678c22bca7e30edfba997e42e57a
# PENDING (Operator): Infra-Images der gepinnten compose pinnen — Tags aus der compose ablesen und digest-pinnen:
# postgres valkey nats-server meilisearch seaweedfs livekit-server
# Hinweis: fluxer-worker existiert nicht als eigenes Image (403); der Worker läuft aus dem fluxer-api-Image.
# Komplettiert durch scripts/pin-fluxer-images.sh (skopeo, Workstation, einmalig)
# Read-only access only; the agent inventory must never converge state.
fluxer_stack_start_allowed: false
@@ -47,9 +47,7 @@ fluxer_stack_images:
- ghcr.io/fluxerapp/fluxer-gifs@sha256:a7916918e7b42a69dc06fb70349cde457d6fe7226a54bc52105e5ae6aa972c03
- ghcr.io/fluxerapp/fluxer-unfurl@sha256:0b6ba1e741925727fb09525de7ba3eedfba8b7d728f05f0ba58cd5794a8bf14f
- ghcr.io/fluxerapp/fluxer-push@sha256:3ef343963f67fdec385257d14c67bc640cfa678c22bca7e30edfba997e42e57a
# PENDING (Operator): Infra-Images der gepinnten compose pinnen — Tags aus der compose ablesen und digest-pinnen:
# postgres valkey nats-server meilisearch seaweedfs livekit-server
# Hinweis: fluxer-worker existiert nicht als eigenes Image (403); der Worker läuft aus dem fluxer-api-Image.
# Komplettiert durch scripts/pin-fluxer-images.sh (skopeo, Workstation, einmalig)
# Bootstrap converges configuration but must not start the stack yet.
fluxer_stack_start_allowed: false
@@ -57,9 +57,7 @@ fluxer_stack_images:
- ghcr.io/fluxerapp/fluxer-gifs@sha256:a7916918e7b42a69dc06fb70349cde457d6fe7226a54bc52105e5ae6aa972c03
- ghcr.io/fluxerapp/fluxer-unfurl@sha256:0b6ba1e741925727fb09525de7ba3eedfba8b7d728f05f0ba58cd5794a8bf14f
- ghcr.io/fluxerapp/fluxer-push@sha256:3ef343963f67fdec385257d14c67bc640cfa678c22bca7e30edfba997e42e57a
# PENDING (Operator): Infra-Images der gepinnten compose pinnen — Tags aus der compose ablesen und digest-pinnen:
# postgres valkey nats-server meilisearch seaweedfs livekit-server
# Hinweis: fluxer-worker existiert nicht als eigenes Image (403); der Worker läuft aus dem fluxer-api-Image.
# Komplettiert durch scripts/pin-fluxer-images.sh (skopeo, Workstation, einmalig)
# The stack is started only on inventories with fluxer_stack_start_allowed.
fluxer_stack_start_allowed: true
@@ -13,8 +13,8 @@ FLUXER_PUBLIC_ORIGIN={{ fluxer_stack_public_scheme }}://{{ fluxer_stack_public_d
FLUXER_PUBLIC_ORIGIN={{ fluxer_stack_public_scheme }}://{{ fluxer_stack_public_domain }}:{{ fluxer_stack_public_port }}
{% endif %}
FLUXER_IMAGE_TAG={{ fluxer_stack_image_tag }}
FLUXER_REGISTRY={{ fluxer_stack_registry | regex_replace('/$', '') }}
FLUXER_REGISTRY_OWNER=fluxerapp
# FLUXER_REGISTRY / FLUXER_REGISTRY_OWNER bleiben auf den compose-Defaults
# (ghcr.io/fluxerapp) — gesetzt im Pin-Skript, nicht doppelt im .env.
# Internal service endpoints stay on the compose network (service DNS names).
FLUXER_KV_URL=redis://valkey:6379/0
@@ -15,3 +15,11 @@ The full commissioning sequence (key generation, SSH aliases, fingerprint
pinning, Ansible rebuild) is documented in
`docs/platform/proxmox-server/lxc/ct-117-fluxer/GNAI-025-PLAN_Fluxer-LXC.md`
Abschnitt 6 and `../ansible/README.md`.
- `pin-fluxer-images.sh` — workstation-side, one-time, **no passwords**:
downloads the pinned upstream compose (SHA-256-verified), expands every
`image:` ref (incl. `${FLUXER_*:-default}` templates) and resolves each to
its registry digest via `skopeo`, printing a ready-to-paste
`fluxer_stack_images:` YAML block for the three
`ansible/inventories/*/group_vars/fluxer_hosts.yml` (GNAI-025 Abschnitt 6,
Schritt 3). Requires `skopeo` and the repo control venv (`.venv`).
+82
View File
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Resolve every container image referenced by the pinned upstream Fluxer
# compose to its registry digest and print a ready-to-paste
# `fluxer_stack_images:` YAML block for the three inventories
# (inventories/*/group_vars/fluxer_hosts.yml). Run ONCE on the workstation
# (no passwords involved); requires: curl, sha256sum, skopeo, and the
# repository control venv (.venv, see ansible/README.md).
#
# Usage:
# sudo apt install -y skopeo # once
# bash proxmox/lxc/ct-117-fluxer/scripts/pin-fluxer-images.sh [commit]
#
# GNAI-025 Abschnitt 6, Schritt 3.
set -Eeuo pipefail
umask 077
readonly COMMIT="${1:-872ed5d0543317412e9d2a22a224fddd8089ce52}"
readonly EXPECTED_SHA256='d5558cd419c8d46bdc958064cb97f963d1ea793866414c025906ec15033512ed'
readonly COMPOSE_PATH='deploy/self-hosting/docker-compose.yml'
readonly COMPOSE_URL="https://raw.githubusercontent.com/fluxerapp/fluxer/${COMMIT}/${COMPOSE_PATH}"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
readonly PY="${REPO_ROOT}/.venv/bin/python"
[[ -x "$PY" ]] || { echo "missing $PY — build the control venv first (ansible/README.md)" >&2; exit 1; }
command -v curl >/dev/null || { echo 'curl missing' >&2; exit 1; }
command -v sha256sum >/dev/null || { echo 'sha256sum missing' >&2; exit 1; }
command -v skopeo >/dev/null || { echo 'skopeo missing — sudo apt install -y skopeo' >&2; exit 1; }
tmp="$(mktemp)"
trap 'rm -f "$tmp" "$tmp.refs"' EXIT
curl -fsSL "$COMPOSE_URL" -o "$tmp"
printf '%s %s\n' "$EXPECTED_SHA256" "$tmp" | sha256sum --check --status - \
|| { echo "SHA-256 mismatch for compose @ ${COMMIT} — do not pin from this file" >&2; exit 1; }
# Extract image refs (with ${VAR:-default} expansion) from the compose.
"$PY" - "$tmp" "$tmp.refs" <<'PYEOF'
import re, sys
import yaml
compose_file, out_file = sys.argv[1], sys.argv[2]
# Pure compose semantics: every ${VAR:-default} in the pinned compose carries
# its own default (FLUXER_REGISTRY defaults to ghcr.io/${OWNER:-fluxerapp}),
# so no variable is preset here — the expansion must match the untouched compose.
defaults = {}
def expand(value: str) -> str:
# innermost-first so nested defaults like ${A:-ghcr.io/${B:-fluxerapp}} resolve fully
pattern = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^{}]*))?\}")
for _ in range(10):
new = pattern.sub(
lambda m: defaults.get(m.group(1), m.group(2) if m.group(2) is not None else ""),
value,
)
if new == value:
if "${" in new:
raise SystemExit(f"could not fully expand: {value}")
return new
value = new
raise SystemExit(f"could not fully expand: {value}")
doc = yaml.safe_load(open(compose_file))
refs = set()
for service in (doc.get("services") or {}).values():
image = service.get("image")
if image:
refs.add(expand(str(image)))
with open(out_file, "w") as f:
for ref in sorted(refs):
f.write(ref + "\n")
print(f"{len(refs)} image refs in compose @ {sys.argv[1]}", file=sys.stderr)
PYEOF
echo "fluxer_stack_images:" >&2
while IFS= read -r ref; do
digest="$(skopeo inspect "docker://${ref}" --format '{{.Digest}}')"
printf ' - %s@%s\n' "$ref" "$digest"
done < "$tmp.refs"