diff --git a/gpuk b/gpuk index ad32dee..df8bce4 100644 --- a/gpuk +++ b/gpuk @@ -52,6 +52,13 @@ MACHINE_ID_FILE="${GPUK_MACHINE_ID_FILE:-$ETC_DIR/machine-id}" WORKER_ENV="$ETC_DIR/worker.env" SERVICE_NAME="gpu-kitchen-worker" UNIT_DEST="${GPUK_UNIT_DEST:-/etc/systemd/system/$SERVICE_NAME.service}" +RETIRE_SERVICE="$SERVICE_NAME-retirement" +RETIRE_UNIT="$(dirname "$UNIT_DEST")/$RETIRE_SERVICE.service" +RETIRE_TIMER="$(dirname "$UNIT_DEST")/$RETIRE_SERVICE.timer" +RETIRE_PENDING="$ETC_DIR/beta-retirement-pending" +RETIRE_STATE="$ETC_DIR/beta-retirement-state" +# Outside ETC_DIR: purge must not replace the inode used to serialize lifecycle commands. +LIFECYCLE_LOCK="$ETC_DIR.lifecycle.lock" # Where to download the binary from when no --binary is given. GPUK_RELEASE_BASE="${GPUK_RELEASE_BASE:-}" @@ -66,6 +73,67 @@ need_root() { die "this command must run as root (use sudo)" } +# Keep cleanup and installation mutually exclusive. An update can restart systemd +# while holding this lock, so ExecStopPost cleanup must never wait for it. +# FD 9 survives the verified CLI self-reexec. Reuse only that exact lock inode. +lifecycle_lock() { # optional: nonblocking + command -v flock >/dev/null 2>&1 || die "flock is required to manage this installation" + if [ "$(readlink /proc/$$/fd/9 2>/dev/null || true)" != "$LIFECYCLE_LOCK" ]; then + [ ! -L "$LIFECYCLE_LOCK" ] || die "refusing a symlink for the installation lock" + exec 9>>"$LIFECYCLE_LOCK" + chmod 0600 "$LIFECYCLE_LOCK" + fi + if [ "${1:-}" = "nonblocking" ]; then + flock -n 9 || return 1 + else + flock -x 9 || die "cannot lock this installation" + fi + trap 'rm -f "$BIN_DEST.new" "$BIN_DEST.new.minisig" "$CLI_DEST.new"; [ -z "$CHANNEL_DOC" ] || rm -f "$CHANNEL_DOC"' EXIT +} + +# Only run this on the verified download (or an explicitly supplied local build), +# before replacing files or changing the manifest. A rejected candidate is removed. +check_candidate_release() { # binary, optional temporary file to remove + _release_status=0 + GPUK_MANIFEST_PATH="$MANIFEST" "$1" check-release || _release_status=$? + if [ "$_release_status" -eq 0 ]; then + _candidate_expiry=$("$1" --beta-expiry) || _release_status=1 + case "$_candidate_expiry" in + 0) ;; # Normal and development releases have no calendar gate. + "$((0xce8c74e7 ^ 0xa5c39e17))") + # Independent installer checkpoint: compare a UTC calendar value, not + # the worker's epoch representation. The source constants stay encoded. + _release_now=$(date -u +%Y%m%d%H%M%S) || _release_status=1 + case "$_release_now" in + ''|*[!0-9]*) _release_status=1 ;; + *) + if [ "${#_release_now}" -ne 14 ]; then + _release_status=1 + elif [ "$_release_status" -eq 0 ] && [ "$_release_now" -ge "$((7843927165021 + 12426192064979))" ]; then + # A local clock contradicting authenticated release time blocks + # installation, but is never proof that permits deletion. + _release_status=79 + fi + ;; + esac + ;; + *) _release_status=1 ;; + esac + fi + if [ "$_release_status" -ne 0 ]; then + [ -z "${2:-}" ] || rm -f "$2" "$2.minisig" + if [ "$_release_status" -eq 78 ]; then + echo "gpuk: this beta has expired. Install the current release." >&2 + exit 78 + fi + if [ "$_release_status" -eq 79 ]; then + echo "gpuk: release time could not be confirmed. Try again when online." >&2 + exit 79 + fi + die "the release check failed; nothing has been installed" + fi +} + # ── JSON helpers (controlled inputs: paths + identifiers) ────────────────────── json_str() { printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g'; } @@ -119,7 +187,9 @@ start_daemon() { install_binary() { # [local-path] if [ -n "${1:-}" ]; then [ -f "$1" ] || die "binary not found: $1" - install -m 0755 "$1" "$BIN_DEST" + install -m 0755 "$1" "$BIN_DEST.new" + check_candidate_release "$BIN_DEST.new" "$BIN_DEST.new" + mv "$BIN_DEST.new" "$BIN_DEST" echo "==> installed $BIN_DEST from $1" elif [ -n "$GPUK_RELEASE_BASE" ]; then command -v curl >/dev/null || die "curl is required to download the binary" @@ -142,8 +212,10 @@ install_binary() { # [local-path] echo "==> signature verified" fi chmod 0755 "$BIN_DEST.new" + check_candidate_release "$BIN_DEST.new" "$BIN_DEST.new" mv "$BIN_DEST.new" "$BIN_DEST" elif [ -x "$BIN_DEST" ]; then + check_candidate_release "$BIN_DEST" echo "==> reusing existing $BIN_DEST" else die "no binary: pass --binary or set GPUK_RELEASE_BASE=" @@ -164,6 +236,169 @@ install_cli() { gen_secret() { head -c 32 /dev/urandom | base64 | tr '+/' '-_' | tr -d '='; } +# BEGIN GENERATED INTERNET REACHABILITY — tools/gen-install-reachability.mjs from deployments/install/reachability.sh.in and packages/contracts/data/public-address-ranges.json; DO NOT EDIT +# Whether the Internet reaches this machine, one finding per line: +# public a public IPv4 on an interface (the controller listens there) +# ipv6 a global IPv6: reported only, nothing listens on IPv6 +# cloud a public IPv4 the cloud metadata service maps 1:1 to it +# unknown no `ip` nor `hostname -I` to read the addresses +# The ranges come from packages/contracts/data/public-address-ranges.json, the controller's +# own definition too. GPUK_CLOUD_METADATA_URL is a test seam. +reach_classify() { # stdin: "
[/prefix]" lines + awk ' + function v4int(a, o, n, i, x) { + n = split(a, o, ".") + if (n != 4) return -1 + x = 0 + for (i = 1; i <= 4; i++) { + if (o[i] !~ /^[0-9]+$/ || o[i] + 0 > 255) return -1 + x = x * 256 + o[i] + } + return x + } + function hexval(h, i, c, x) { + x = 0 + for (i = 1; i <= length(h); i++) { + c = index("0123456789abcdef", substr(h, i, 1)) + if (c == 0) return -1 + x = x * 16 + c - 1 + } + return x + } + function v6head32(a, h, n, h1, h2) { + n = split(tolower(a), h, ":") + if (n < 3 || h[1] == "" || length(h[1]) > 4 || length(h[2]) > 4) return -1 + h1 = hexval(h[1]) + h2 = (h[2] == "") ? 0 : hexval(h[2]) + if (h1 < 0 || h2 < 0) return -1 + return h1 * 65536 + h2 + } + function v4public(a, x) { + x = v4int(a) + if (x < 0) return 0 + if (x >= 0 && x <= 16777215) return 0 # 0.0.0.0/8 this network + if (x >= 167772160 && x <= 184549375) return 0 # 10.0.0.0/8 private + if (x >= 1681915904 && x <= 1686110207) return 0 # 100.64.0.0/10 CGNAT + if (x >= 2130706432 && x <= 2147483647) return 0 # 127.0.0.0/8 loopback + if (x >= 2851995648 && x <= 2852061183) return 0 # 169.254.0.0/16 link local + if (x >= 2886729728 && x <= 2887778303) return 0 # 172.16.0.0/12 private + if (x >= 3221225472 && x <= 3221225727) return 0 # 192.0.0.0/24 IETF protocol assignments + if (x >= 3221225984 && x <= 3221226239) return 0 # 192.0.2.0/24 documentation + if (x >= 3232235520 && x <= 3232301055) return 0 # 192.168.0.0/16 private + if (x >= 3323068416 && x <= 3323199487) return 0 # 198.18.0.0/15 benchmarking + if (x >= 3325256704 && x <= 3325256959) return 0 # 198.51.100.0/24 documentation + if (x >= 3405803776 && x <= 3405804031) return 0 # 203.0.113.0/24 documentation + if (x >= 3758096384 && x <= 4294967295) return 0 # 224.0.0.0/3 multicast and reserved + return 1 + } + function v6global(a, x) { + x = v6head32(a) + if (x < 0) return 0 + if (x < 536870912 || x > 1073741823) return 0 # outside 2000::/3 + if (x >= 536939960 && x <= 536939960) return 0 # 2001:db8::/32 documentation + return 1 + } + { + addr = $3; sub(/\/.*/, "", addr) + if ($2 == "inet" && v4public(addr)) print "public", addr, $1 + else if ($2 == "inet6" && v6global(addr)) print "ipv6", addr, $1 + else if ($2 == "cloud" && v4public(addr)) print "cloud", addr + }' +} + +reach_cloud_ipv4() { # a public IPv4 from AWS, Google Cloud or Azure metadata, or nothing + command -v curl >/dev/null 2>&1 || return 0 + _md="${GPUK_CLOUD_METADATA_URL:-http://169.254.169.254}" + curl -s -o /dev/null --connect-timeout 1 -m 1 "$_md/" 2>/dev/null || return 0 + _tok=$(curl -sf --connect-timeout 1 -m 1 -X PUT \ + -H 'X-aws-ec2-metadata-token-ttl-seconds: 60' "$_md/latest/api/token" 2>/dev/null) || _tok="" + if [ -n "$_tok" ]; then + _ip=$(curl -sf -m 1 -H "X-aws-ec2-metadata-token: $_tok" \ + "$_md/latest/meta-data/public-ipv4" 2>/dev/null) || _ip="" + else + _ip=$(curl -sf -m 1 "$_md/latest/meta-data/public-ipv4" 2>/dev/null) || _ip="" + fi + [ -n "$_ip" ] || _ip=$(curl -sf -m 1 -H 'Metadata-Flavor: Google' \ + "$_md/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" 2>/dev/null) || _ip="" + [ -n "$_ip" ] || _ip=$(curl -sf -m 1 -H 'Metadata: true' \ + "$_md/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2021-02-01&format=text" 2>/dev/null) || _ip="" + case "$_ip" in + *[!0-9.]*|"") return 0 ;; + esac + printf '%s\n' "$_ip" +} + +reach_findings() { + if command -v ip >/dev/null 2>&1; then + ip -o addr show 2>/dev/null | awk '{ print $2, $3, $4 }' | reach_classify + elif _reach_h=$(hostname -I 2>/dev/null); then + for _a in $_reach_h; do + case "$_a" in *:*) echo "- inet6 $_a" ;; *) echo "- inet $_a" ;; esac + done | reach_classify + else + echo "unknown" + fi + _cloud=$(reach_cloud_ipv4) + [ -z "$_cloud" ] || echo "- cloud $_cloud" | reach_classify +} + +# Why the Home lab profile is refused (INS-89), or nothing. $1 = reach_findings output. +homelab_refusal_reason() { + _why=$(printf '%s\n' "$1" | awk ' + $1 == "public" { print "This machine is reachable from the Internet: it has the public address " $2 " on " $3 "."; exit } + $1 == "cloud" { print "This machine is reachable from the Internet: its cloud provider gives it the public address " $2 "."; exit } + $1 == "unknown" { print "GPU Kitchen cannot read the addresses of this machine (no ip or hostname command), so it cannot tell whether the Internet reaches it."; exit }') + [ -n "$_why" ] || return 0 + echo "$_why The Home lab profile lets anyone who reaches it in without signing in, so it is not allowed here. Use --profile small-team (control from this machine only), --profile managed-network (sign-in required) or --profile public (sign-in, behind a TLS reverse proxy)." +} + +# The first public IPv4 of this machine, for the controller ([INS-93]); nothing when none. +# $1 = reach_findings output. +public_ipv4_of() { + printf '%s\n' "$1" | awk '$1 == "public" || $1 == "cloud" { print $2; exit }' +} + +# A global IPv6 address of this machine (INS-92): reported, never refused. $1 = findings. +global_ipv6_note() { + _v6=$(printf '%s\n' "$1" | awk '$1 == "ipv6" { print $2 " on " $3; exit }') + [ -z "$_v6" ] || echo "This machine has the global IPv6 address $_v6. GPU Kitchen listens on IPv4 only, so the Internet does not reach it there." +} +# END GENERATED INTERNET REACHABILITY + +# [INS-87] The Docker bridge gateway: the host address apps on this machine reach as +# host.docker.internal, and the one the proxy binds under `public`. GPUK_DOCKER_GATEWAY +# overrides; then the daemon's own host-gateway-ip (INS-95: host.docker.internal +# resolves there, whatever the bridge); then the default bridge's gateway; Docker's +# default bridge address is the last fallback, named in a warning. +docker_bridge_gateway() { + _gw="${GPUK_DOCKER_GATEWAY:-}" + [ -n "$_gw" ] || _gw=$(sed -n 's/.*"host-gateway-ips\{0,1\}"[[:space:]]*:[[:space:]]*\[\{0,1\}[[:space:]]*"\([0-9.]*\)".*/\1/p' \ + "${GPUK_DOCKER_DAEMON_JSON:-/etc/docker/daemon.json}" 2>/dev/null | head -1) + [ -n "$_gw" ] || _gw=$(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}' 2>/dev/null || true) + case "$_gw" in + *[!0-9.]* | "") echo "==> warning: the Docker bridge address could not be read; using 172.17.0.1 (set GPUK_DOCKER_GATEWAY to change it)" >&2; _gw="172.17.0.1" ;; + esac + printf '%s' "$_gw" +} + +# [INS-84] True when Docker relays every published connection through docker-proxy, +# which then hides the client behind the bridge gateway: rootless Docker, or a +# daemon running with iptables off (daemon.json or the dockerd command line). +docker_relays_every_client() { + command -v docker >/dev/null 2>&1 || return 1 + case "$(docker info --format '{{json .SecurityOptions}}' 2>/dev/null)" in + *rootless*) return 0 ;; + esac + grep -Eq '"iptables"[[:space:]]*:[[:space:]]*false' "${GPUK_DOCKER_DAEMON_JSON:-/etc/docker/daemon.json}" 2>/dev/null \ + && return 0 + for _dpid in $(pidof dockerd 2>/dev/null); do + case " $(tr '\0' ' ' < "/proc/$_dpid/cmdline" 2>/dev/null) " in + *" --iptables=false "* | *" --iptables false "*) return 0 ;; + esac + done + return 1 +} + # The host ports a leftover app container is reached on ("ui mtls inference"), # read off the container itself with the precedence the controller applies # (core/published-ports.ts): host networking moves the listeners (GPUK_PORT, @@ -276,6 +511,14 @@ prepare_claim_key() { # generator injects the Rust lock-contention exit code here too, so the binary # and systemd restart policy cannot silently drift apart. write_unit() { + # Normal releases retain their short stop grace. Only a stamped beta needs + # enough time for its bounded retirement cleanup after the daemon exits. + _stop_timeout=15 + _restart_delay=2 + if [ "$("$BIN_DEST" --beta-expiry 2>/dev/null || true)" = "$((0xce8c74e7 ^ 0xa5c39e17))" ]; then + _stop_timeout=180 + _restart_delay=60 + fi # BEGIN GENERATED WORKER SYSTEMD UNIT cat > "$UNIT_DEST" < "$RETIRE_UNIT" < "$RETIRE_TIMER" < "$DATA_ROOT/caddy/Caddyfile" < note: $_note" + fi + fi + + PROXY_GATEWAY="" + if [ "$MODE" = "controller" ] && [ "$PROFILE" = "public" ]; then + PROXY_GATEWAY=$(docker_bridge_gateway) + fi + if [ "$DRY_RUN" -eq 1 ]; then case "$MODE:$PROFILE" in controller:homelab|controller:small-team) ;; @@ -571,6 +922,7 @@ cmd_install() { fi need_root + lifecycle_lock install_binary "$BIN_SRC" install_cli @@ -662,6 +1014,7 @@ cmd_install() { start_daemon echo "==> $SERVICE_NAME enabled and started" echo + rm -f "$ETC_DIR/beta-retired" echo "Done. The worker daemon is running${ENROLL_TOKEN:+ and enrolled}." echo " Status : gpuk status Logs: gpuk logs" hint_existing_caches "$CACHE_DIR" @@ -691,6 +1044,7 @@ cmd_install() { GPUK_MANIFEST_PATH="$MANIFEST" "$BIN_DEST" apply \ || die "the app container did not come up — the [worker] lines above say why (a [controller] FATAL line names the component and the fix). Full container logs: gpuk logs" echo + rm -f "$ETC_DIR/beta-retired" echo "Done. The worker daemon is running and the app container is up." echo " Status : gpuk status App logs: gpuk logs Daemon: journalctl -u $SERVICE_NAME" hint_existing_caches "$CACHE_DIR" @@ -718,7 +1072,7 @@ JSON # fresh render no longer carries it (a profile change drops GPUK_HSTS); any other # key was pushed by the controller and is kept. Keep this list in step with # render_controller_manifest. -INSTALL_ENV_KEYS="NODE_ENV,TZ,GPUK_CLUSTER,GPUK_SELF_ENROLL_FILE,NODE_DISPLAY_NAME,HF_HOME,GPUK_DATA_ROOT,GPUK_INSTALL_PROFILE,GPUK_HSTS,GPUK_SESSION_COOKIE_SECURE,GPUK_BOOTSTRAP_MUST_CHANGE,BACKEND_DOCKER_NETWORK,GPUK_PORT,GPUK_PUBLIC_PORT,GPUK_MTLS_PORT,GPUK_PUBLIC_MTLS_PORT,GPUK_PROXY_PUBLIC_PORT" +INSTALL_ENV_KEYS="NODE_ENV,TZ,GPUK_CLUSTER,GPUK_SELF_ENROLL_FILE,NODE_DISPLAY_NAME,HF_HOME,GPUK_DATA_ROOT,GPUK_INSTALL_PROFILE,GPUK_HSTS,GPUK_SESSION_COOKIE_SECURE,GPUK_BOOTSTRAP_MUST_CHANGE,BACKEND_DOCKER_NETWORK,GPUK_PORT,GPUK_PUBLIC_PORT,GPUK_MTLS_PORT,GPUK_PUBLIC_MTLS_PORT,GPUK_PROXY_PUBLIC_PORT,GPUK_UI_BIND,GPUK_PROXY_PUBLIC_URL,GPUK_DOMAIN,GPUK_ALLOWED_HOSTS,GPUK_TRUST_PROXY,GPUK_TRUSTED_PROXY_CIDRS,GPUK_ACCEPT_SOURCE_CIDRS,GPUK_HOST_PUBLIC_IPV4" # Write the manifest — or, when one exists, MERGE into it (INS-03). Re-running the # installer is the update path, and the manifest is not ours alone: since the first @@ -774,6 +1128,8 @@ render_controller_manifest() { HOST_TZ=$(host_timezone) [ -z "$HOST_TZ" ] || EXTRA_ENV="$EXTRA_ENV,\"TZ\":\"$(json_str "$HOST_TZ")\"" [ -z "$PROFILE" ] || EXTRA_ENV="$EXTRA_ENV,\"GPUK_INSTALL_PROFILE\":\"$(json_str "$PROFILE")\"" + [ -z "${HOST_PUBLIC_IPV4:-}" ] \ + || EXTRA_ENV="$EXTRA_ENV,\"GPUK_HOST_PUBLIC_IPV4\":\"$(json_str "$HOST_PUBLIC_IPV4")\"" if [ "$PROFILE" = "public" ]; then EXTRA_ENV="$EXTRA_ENV,\"GPUK_HSTS\":\"true\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_SESSION_COOKIE_SECURE\":\"true\"" @@ -782,10 +1138,34 @@ render_controller_manifest() { # under `enforced`, so the operator's own name must be a known host of the install # before the wizard can load through it — whatever the profile. SEC-15: that name # is served through a reverse proxy, whose X-Forwarded-For carries the real client. + # [INS-85] [PRX-97] The same front serves inference.$DOMAIN: the proxy container must read + # its X-Forwarded-For too (loopback is its only trusted hop), or every client is + # 127.0.0.1 to source bindings, IP affinity and usage. + # [INS-87] Under `public` the proxy binds the Docker bridge gateway only, and the TLS + # front dials it there: that gateway is then the proxy's trusted hop, and the address + # tools are given is https://$DOMAIN/v1. + PROXY_ENV_JSON="" + PROXY_ADDR_JSON="" + if [ "$PROFILE" = "public" ]; then + PROXY_ADDR_JSON=", + \"listenAddress\": \"$(json_str "$PROXY_GATEWAY")\"" + fi + # [PRX-133] Under `public` the proxy also keeps only connections from this machine and + # its Docker bridges: a neighbour routing to the bridge address is closed at accept. + PROXY_ENV="" + [ "$PROFILE" != "public" ] || PROXY_ENV="\"GPUK_ACCEPT_SOURCE_CIDRS\": \"127.0.0.0/8,bridges\"" if [ -n "$DOMAIN" ]; then + EXTRA_ENV="$EXTRA_ENV,\"GPUK_DOMAIN\":\"$(json_str "$DOMAIN")\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_ALLOWED_HOSTS\":\"$(json_str "$DOMAIN")\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_TRUST_PROXY\":\"true\"" + PROXY_ENV="${PROXY_ENV:+$PROXY_ENV, }\"GPUK_TRUST_PROXY\": \"true\"" + if [ "$PROFILE" = "public" ]; then + EXTRA_ENV="$EXTRA_ENV,\"GPUK_PROXY_PUBLIC_URL\":\"https://$(json_str "$DOMAIN")/v1\"" + PROXY_ENV="$PROXY_ENV, \"GPUK_TRUSTED_PROXY_CIDRS\": \"$(json_str "$PROXY_GATEWAY")/32\"" + fi fi + [ -z "$PROXY_ENV" ] || PROXY_ENV_JSON=", + \"env\": { $PROXY_ENV }" BOOTSTRAP_SECRET_JSON="" if [ -s "$BOOTSTRAP_PASSWORD_FILE" ]; then EXTRA_ENV="$EXTRA_ENV,\"GPUK_BOOTSTRAP_MUST_CHANGE\":\"1\"" @@ -807,15 +1187,23 @@ render_controller_manifest() { # network in both modes (PRX-84) and binds it itself — proxy.listenPort, which the # daemon turns into the proxy's GPUK_LISTEN_ADDR. GPUK_PROXY_PUBLIC_PORT is what the # backend shows (core/cluster-settings.ts proxyPublicPort). + # [INS-83] Under `public` the plain-HTTP UI port answers on this machine's loopback + # only: the TLS front on the host is the one way in, so a password never crosses + # the Internet in clear by http://:. The mTLS port stays on every + # interface — workers pin the controller CA and must reach it directly. PORTS_JSON="{}" + LOOPBACK_JSON="" if [ "$NETWORK" = "host" ]; then EXTRA_ENV="$EXTRA_ENV,\"GPUK_PORT\":\"$(json_str "$HTTP_PORT")\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_MTLS_PORT\":\"$(json_str "$MTLS_PORT")\"" + [ "$PROFILE" != "public" ] || EXTRA_ENV="$EXTRA_ENV,\"GPUK_UI_BIND\":\"127.0.0.1\"" else EXTRA_ENV="$EXTRA_ENV,\"GPUK_PORT\":\"8080\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_PUBLIC_PORT\":\"$(json_str "$HTTP_PORT")\"" EXTRA_ENV="$EXTRA_ENV,\"GPUK_PUBLIC_MTLS_PORT\":\"$(json_str "$MTLS_PORT")\"" PORTS_JSON="{\"8080\":$HTTP_PORT,\"8443\":$MTLS_PORT}" + [ "$PROFILE" != "public" ] || LOOPBACK_JSON=" + \"loopbackPorts\": [\"8080\"]," fi EXTRA_ENV="$EXTRA_ENV,\"GPUK_PROXY_PUBLIC_PORT\":\"$(json_str "$INFERENCE_PORT")\"" @@ -831,7 +1219,7 @@ render_controller_manifest() { "restartPolicy": "unless-stopped", "dataRoot": "$(json_str "$DATA_ROOT")", "cacheDisks": $CACHE_JSON, - "ports": $PORTS_JSON, + "ports": $PORTS_JSON,$LOOPBACK_JSON "env": { "NODE_ENV": "production", "GPUK_CLUSTER": "$(json_str "$CLUSTER")", @@ -845,7 +1233,7 @@ render_controller_manifest() { }, "proxy": { "containerName": "gpu-kitchen-proxy", - "listenPort": $INFERENCE_PORT + "listenPort": $INFERENCE_PORT$PROXY_ADDR_JSON$PROXY_ENV_JSON } } JSON @@ -865,6 +1253,10 @@ proxy_container_name() { printf '%s' "${_pcn:-gpu-kitchen-proxy}" } +manifest_env_value() { # $1 = key of a string field of the manifest + sed -n "s/.*\"$1\"[[:space:]]*:[[:space:]]*\"\([^\"]*\)\".*/\1/p" "$MANIFEST" 2>/dev/null | head -1 +} + manifest_data_root() { sed -n 's/.*"dataRoot"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$MANIFEST" 2>/dev/null | head -1 } @@ -1026,17 +1418,45 @@ channel_version() { channel_field "$CHANNEL_DOC" version } +# [OPS-10] [OPS-102] After a cold stop: start the daemon, then bring the app container back by +# applying the manifest, as `gpuk apply` does. Starting the daemon alone does not: it does not +# re-create the app container, and Docker never restarts a container that was stopped by hand +# (unless-stopped) — a real installation stayed down after `gpuk backup`. +restart_controller() { + systemctl start "$SERVICE_NAME" || return 1 + GPUK_MANIFEST_PATH="$MANIFEST" "$BIN_DEST" apply >/dev/null +} + # ── backup ───────────────────────────────────────────────────────────────────── # OPS-10: the embedded Postgres is only backed up COLD — hot-copying pgdata with # a file tool is forbidden (torn pages). Order matters: stop the DAEMON first # (its reconciler would immediately restart a stopped app container), then the -# container, snapshot, and restarting the service re-applies the manifest. +# container, snapshot, then restart_controller brings both back. # An install on an external DATABASE_URL is refused here: gpuk only owns the # embedded pgdata — back the real database up with pg_dump/backup-compose.sh. # The finished directory still has to be copied to encrypted off-host storage, # next to the recovery set (OPS-04/OPS-05: ENCRYPTION_KEY above all). cmd_backup() { need_root + lifecycle_lock + # [OPS-90] --offsite: once published, the archive goes off this host through the command + # named in $ETC_DIR/offsite.env (offsite-restic.sh, which reads its settings there too). + _offsite=0 + _out="" + for _a in "$@"; do + case "$_a" in + --offsite) _offsite=1 ;; + -*) die "unknown backup option: $_a" ;; + *) _out="$_a" ;; + esac + done + _offsite_env="$ETC_DIR/offsite.env" + _offsite_cmd="" + if [ "$_offsite" -eq 1 ]; then + [ -f "$_offsite_env" ] || die "--offsite needs $_offsite_env (GPUK_BACKUP_OFFSITE_CMD and the GPUK_OFFSITE_* settings)" + _offsite_cmd=$(sed -n "s/^GPUK_BACKUP_OFFSITE_CMD=//p" "$_offsite_env" | tail -n 1 | tr -d "'") + [ -x "$_offsite_cmd" ] || die "GPUK_BACKUP_OFFSITE_CMD in $_offsite_env is not an executable: '$_offsite_cmd'" + fi _img=$(manifest_image) [ -n "$_img" ] || die "this is a worker node — no controller data to back up here" if grep -q '"DATABASE_URL"' "$MANIFEST" 2>/dev/null; then @@ -1047,7 +1467,7 @@ cmd_backup() { [ -d "$_root/pgdata" ] || die "no embedded pgdata under $_root — nothing to snapshot" command -v sha256sum >/dev/null 2>&1 || die "sha256sum is required" - _out="${1:-$_root/backups/$(date -u +%Y%m%dT%H%M%SZ)}" + _out="${_out:-$_root/backups/$(date -u +%Y%m%dT%H%M%SZ)}" [ -e "$_out" ] && die "refusing to overwrite existing $_out" mkdir -p "$(dirname "$_out")" _tmp="$_out.partial" @@ -1056,7 +1476,7 @@ cmd_backup() { _cn=$(container_name) echo "==> Stopping $SERVICE_NAME (its reconciler would restart the container mid-snapshot)..." systemctl stop "$SERVICE_NAME" || die "could not stop $SERVICE_NAME" - _restart_daemon() { systemctl start "$SERVICE_NAME" 2>/dev/null || true; } + _restart_daemon() { restart_controller 2>/dev/null || true; } trap _restart_daemon EXIT if [ -n "$_cn" ]; then echo "==> Stopping $_cn (cold snapshot — OPS-10)..." @@ -1082,16 +1502,158 @@ cmd_backup() { chmod 0700 "$_tmp" mv "$_tmp" "$_out" - echo "==> Restarting $SERVICE_NAME (re-applies the manifest, container included)..." - systemctl start "$SERVICE_NAME" || die "could not restart $SERVICE_NAME — start it manually" + echo "==> Restarting $SERVICE_NAME and the app container..." trap - EXIT + restart_controller || die "could not restart GPU Kitchen — run: sudo gpuk apply" echo "backup: $_out" + if [ "$_offsite" -eq 1 ]; then + echo "==> Copying $_out off this host..." + GPUK_OFFSITE_ENV="$_offsite_env" "$_offsite_cmd" "$_out" \ + || die "the off-site copy of $_out failed: the archive is on this host only" + echo "Off-site copy done. Keep the recovery set off this host too" + echo "(ENCRYPTION_KEY above all — without it the data is unrecoverable, OPS-04)." + return 0 + fi echo "Copy it to encrypted OFF-HOST storage together with the recovery set" echo "(ENCRYPTION_KEY above all — without it the data is unrecoverable, OPS-04)." echo "A physical pgdata restore requires the same Postgres major and a throwaway" echo "host rehearsal first (OPS-10)." } +# ── carry-over ───────────────────────────────────────────────────────────────── +# [OPS-100] [OPS-101] [OPS-102] Copies the recipes, templates, benchmarks, evaluations and baskets of a +# backup into THIS installation's database — what a reinstall on a new database baseline would +# otherwise lose. Not a restore (OPS-09): the live database is never dropped or replaced; it +# receives those rows, with the engines, models and GPU configs they use, in one transaction. +# The work is the image's own (deployments/controller/carry-over.sh: reset-db's table list and +# rules), in a one-off container of the installed image, the controller stopped as for a backup. +CARRY_OVER_SCRIPT=/usr/local/lib/gpuk-controller/carry-over/carry-over.sh +CARRY_OVER_CONTAINER=gpu-kitchen-carry-over + +# Prints the SHA256SUMS line of one file, named as `sha256sum -c` reads it from its folder. +checksum_line() { # $1 = folder, $2 = file name + while read -r _sum _name; do + case "$_name" in + "$2"|"./$2"|"*$2"|"*./$2") printf '%s %s\n' "$_sum" "$2" ;; + esac + done <"$1/SHA256SUMS" +} + +cmd_carry_over() { + need_root + lifecycle_lock + _archive="" + _replace="" + for _a in "$@"; do + case "$_a" in + --replace) _replace=--replace ;; + -*) die "unknown carry-over option: $_a" ;; + *) [ -z "$_archive" ] || die "carry-over takes one backup"; _archive="$_a" ;; + esac + done + [ -n "$_archive" ] || die "name the backup: gpuk carry-over [--replace]" + _img=$(manifest_image) + [ -n "$_img" ] || die "this is a worker node — recipes and benchmarks live on the controller" + if grep -q '"DATABASE_URL"' "$MANIFEST" 2>/dev/null; then + die "this install uses an external DATABASE_URL — gpuk carry-over only writes into the embedded database" + fi + _root=$(manifest_data_root) + [ -n "$_root" ] || die "no dataRoot in $MANIFEST" + _pgdata=$(manifest_env GPUK_PGDATA) + _pgdata="${_pgdata:-$_root/pgdata}" + [ -s "$_pgdata/PG_VERSION" ] || die "no database yet under $_pgdata — start GPU Kitchen once first" + command -v sha256sum >/dev/null 2>&1 || die "sha256sum is required" + + # The archive: a `gpuk backup` folder, a Compose backup folder, or one pg_dump -Fc file. + if [ -d "$_archive" ]; then + _dir=$(cd "$_archive" && pwd) + if [ -f "$_dir/backup-manifest.json" ] && [ -f "$_dir/pgdata.tar.gz" ]; then + grep -q '"kind": *"cold-pgdata-snapshot"' "$_dir/backup-manifest.json" \ + || die "$_dir/backup-manifest.json does not describe a gpuk backup" + _kind=pgdata + _file=pgdata.tar.gz + elif [ -f "$_dir/manifest.env" ] && [ -f "$_dir/backend.dump" ]; then + grep -qx 'format=gpuk-compose-backup-v1' "$_dir/manifest.env" \ + || die "$_dir/manifest.env does not describe a Compose backup" + _kind=dump + _file=backend.dump + else + die "$_dir is neither a gpuk backup (pgdata.tar.gz) nor a Compose backup (backend.dump)" + fi + [ -f "$_dir/SHA256SUMS" ] || die "$_dir has no SHA256SUMS: refusing a backup that cannot be checked" + elif [ -f "$_archive" ]; then + _dir=$(cd "$(dirname "$_archive")" && pwd) + _file=$(basename "$_archive") + _kind=dump + else + die "no backup at $_archive" + fi + _sum="" + [ ! -f "$_dir/SHA256SUMS" ] || _sum=$(checksum_line "$_dir" "$_file") + if [ -n "$_sum" ]; then + (cd "$_dir" && printf '%s\n' "$_sum" | sha256sum -c --quiet -) >/dev/null 2>&1 \ + || die "$_dir/$_file does not match its SHA256SUMS: refusing it" + echo "==> $_file matches its checksum." + else + [ "$_kind" = dump ] && [ ! -f "$_dir/backup-manifest.json" ] && [ ! -f "$_dir/manifest.env" ] \ + || die "$_dir/SHA256SUMS does not list $_file: refusing a backup that cannot be checked" + echo "==> No checksum next to $_file: PostgreSQL checks the archive as it reads it." + fi + + docker image inspect "$_img" >/dev/null 2>&1 \ + || die "the image $_img is not on this host: run 'gpuk apply' first" + docker run --rm --network none --entrypoint /bin/sh "$_img" -c "test -x $CARRY_OVER_SCRIPT" \ + >/dev/null 2>&1 || die "this release cannot carry a backup over: update GPU Kitchen first (gpuk update)" + + _work="$_root/carry-over.$(date -u +%Y%m%dT%H%M%SZ)" + [ ! -e "$_work" ] || die "refusing to reuse existing $_work" + _cn=$(container_name) + echo "==> Stopping $SERVICE_NAME (its reconciler would restart the container during the copy)..." + systemctl stop "$SERVICE_NAME" || die "could not stop $SERVICE_NAME" + _carry_over_cleanup() { + docker rm -f "$CARRY_OVER_CONTAINER" >/dev/null 2>&1 || true + rm -rf "$_work" + restart_controller 2>/dev/null \ + || echo "gpuk: GPU Kitchen did not restart — run: sudo gpuk apply" >&2 + } + trap _carry_over_cleanup EXIT + if [ -n "$_cn" ]; then + echo "==> Stopping $_cn..." + docker stop "$_cn" >/dev/null 2>&1 || true + case "$(docker inspect -f '{{.State.Status}}' "$_cn" 2>/dev/null || echo absent)" in + running) die "container $_cn is still running — refusing to open its database twice" ;; + esac + fi + # Traversable, not listable: the copy's server runs as the image's postgres user. + mkdir -m 0711 "$_work" + _mount="" + if [ "$_kind" = pgdata ]; then + echo "==> Unpacking the backup..." + tar -C "$_work" -xzf "$_dir/pgdata.tar.gz" || die "could not unpack $_dir/pgdata.tar.gz" + [ -s "$_work/pgdata/PG_VERSION" ] || die "$_dir/pgdata.tar.gz holds no database" + _source="$_work/pgdata" + else + # The archive's folder, read-only, outside the data root. + _mount="$_dir:/carry-over/archive:ro" + _source="/carry-over/archive/$_file" + fi + _rc=0 + docker run --rm --name "$CARRY_OVER_CONTAINER" --network none --entrypoint "$CARRY_OVER_SCRIPT" \ + -v "$_root:$_root" ${_mount:+-v "$_mount"} "$_img" \ + --live-pgdata "$_pgdata" "--$_kind" "$_source" $_replace || _rc=$? + if [ "$_rc" -ne 0 ]; then + echo "gpuk: nothing was carried over; the installation's database is as it was." >&2 + exit "$_rc" + fi + trap - EXIT + rm -rf "$_work" + echo "==> Restarting $SERVICE_NAME and the app container..." + restart_controller || die "could not restart GPU Kitchen — run: sudo gpuk apply" + echo "Carried over: recipes, templates, benchmarks, evaluations, baskets and saved charts," + echo "with the engines, models and GPU configs they use." + echo "Not carried over: nodes, GPUs, containers, accounts, keys and settings." +} + # ── channel ──────────────────────────────────────────────────────────────────── # Diagnostic (no root): fetch + VERIFY the channel document, print what it # offers. Exercises exactly the trust chain `update` relies on — the CI probes @@ -1298,6 +1860,7 @@ cmd_enroll() { # has no app container — `apply` there is a no-op with a clear message. cmd_apply() { need_root + lifecycle_lock GPUK_MANIFEST_PATH="$MANIFEST" "$BIN_DEST" apply } @@ -1315,7 +1878,8 @@ cmd_apply() { # pinned key, trusted comment naming the build the channel designates for this # architecture, never older than the daemon already installed. Sets DAEMON_UPDATED. DAEMON_UPDATED=0 -update_daemon() { +DAEMON_CANDIDATE_READY=0 +prepare_daemon() { _base=$(channel_field "$CHANNEL_DOC" workerBase) case "$(uname -m)" in x86_64|amd64) _bkey="workerBuildIdX86_64" ;; @@ -1328,6 +1892,7 @@ update_daemon() { fi _installed=$("$BIN_DEST" --version 2>/dev/null | sed -n 's/^gpu-kitchen-worker //p' | head -1) if [ "$_installed" = "$_build" ]; then + check_candidate_release "$BIN_DEST" echo "==> worker daemon already on build $_build" return 0 fi @@ -1356,8 +1921,20 @@ update_daemon() { echo "==> signature verified (build $_build)" fi chmod 0755 "$BIN_DEST.new" - mv "$BIN_DEST.new" "$BIN_DEST" - DAEMON_UPDATED=1 + check_candidate_release "$BIN_DEST.new" "$BIN_DEST.new" + DAEMON_CANDIDATE_READY=1 +} + +install_prepared_daemon() { + if [ "$DAEMON_CANDIDATE_READY" -eq 1 ]; then + check_candidate_release "$BIN_DEST.new" "$BIN_DEST.new" + mv "$BIN_DEST.new" "$BIN_DEST" + DAEMON_UPDATED=1 + fi + # Refresh even an unchanged worker's unit, before applying the app. A failed + # app update must not leave the installed beta without its retirement hook. + write_unit + systemctl daemon-reload } # [INS-74] gpuk replaces itself with the gpuk the verified channel names, before anything @@ -1428,14 +2005,16 @@ cmd_update() { esac done + [ "$_check" -eq 1 ] || lifecycle_lock _image=$(manifest_image) if [ -z "$_image" ]; then # A worker node: the daemon is the whole install. The controller UI's Update # button drives the same swap, but only for a worker it still accepts. [ "$_check" -eq 0 ] || { echo "This is a worker node: 'gpuk update' moves its daemon to the channel's build."; return 0; } channel_fetch || die "cannot read the release channel at $CHANNEL_URL" + prepare_daemon update_cli "" - update_daemon + install_prepared_daemon restart_updated_daemon return 0 fi @@ -1465,7 +2044,6 @@ cmd_update() { _latest="" if channel_fetch; then _latest=$(channel_field "$CHANNEL_DOC" version) - [ -z "$_latest" ] || update_cli "$_want" fi if [ -z "$_latest" ]; then [ -z "$_want" ] \ @@ -1492,6 +2070,11 @@ cmd_update() { esac fi + # Validate the candidate before changing the installed manifest. + [ "$_want" != "$_latest" ] || prepare_daemon + update_cli "$_want" + install_prepared_daemon + _new="$_repo:$_want" [ -n "$_digest" ] && _new="$_repo:$_want@$_digest" _installed=$(manifest_image) @@ -1506,9 +2089,6 @@ cmd_update() { else echo "==> already on $_current — re-pulling and recreating" fi - # The daemon follows the release it is pinned to — only the channel's own one - # carries a designated, signed build. - [ "$_want" != "$_latest" ] || update_daemon GPUK_MANIFEST_PATH="$MANIFEST" "$BIN_DEST" apply \ || die "the update did not apply — the [worker] lines above say why. A manifest refused for a field an older release wrote is repaired by re-running the same install command with --reset-manifest: @@ -1524,8 +2104,246 @@ cmd_update() { # secrets (ENCRYPTION_KEY above all, OPS-04) are the operator's to delete, by # hand, knowingly. After a purge the next install is a first install (INS-03); # without it, install.sh sees the manifest and treats the re-run as an update. +# Called by the expired worker's stop hook or retirement timer, while that +# process owns the host node lock. Never use the ordinary purge path: all configuration, identity, +# databases, models, secrets, backups and Docker volumes must survive retirement. +retirement_docker() { timeout 10 docker "$@"; } + +# An inspect error alone never proves absence: query Docker's complete ID list. +retirement_image_present() { + _known_images=$(retirement_docker image ls --no-trunc -q) || return 2 + printf '%s\n' "$_known_images" | grep -Fx -- "$1" >/dev/null +} + +retirement_remove_image() { + _remove_id="$1" + _present_status=0 + retirement_image_present "$_remove_id" || _present_status=$? + [ "$_present_status" -ne 1 ] || return 0 + [ "$_present_status" -eq 0 ] || die "cannot list beta images; installed files were kept for a retry" + _remove_stamp=$(retirement_docker image inspect --format '{{index .Config.Labels "io.gpukitchen.beta-expires-at"}}' "$_remove_id") \ + || die "cannot inspect beta image; installed files were kept for a retry" + [ "$_remove_stamp" = "$_expiry" ] || die "image ownership changed; installed files were kept for a retry" + _image_users=$(retirement_docker ps -aq --filter "ancestor=$_remove_id" --no-trunc) \ + || die "cannot check image users; installed files were kept for a retry" + if [ -n "$_image_users" ]; then + echo "==> kept a beta image used by another container" + return 0 + fi + # Docker refuses to remove a multiply tagged ID without --force. Remove only + # references still resolving to this proven image, then the immutable ID. + _image_refs=$(retirement_docker image inspect --format '{{range .RepoTags}}{{println .}}{{end}}{{range .RepoDigests}}{{println .}}{{end}}' "$_remove_id") \ + || die "cannot list image references; installed files were kept for a retry" + for _image_ref in $_image_refs; do + case "$_image_ref" in -*|''|':') continue ;; esac + _ref_id=$(retirement_docker image inspect --format '{{.Id}}' "$_image_ref" 2>/dev/null) || continue + [ "$_ref_id" = "$_remove_id" ] || continue + # A reference can disappear with another reference to the same repository. + # The final ID inventory below, not this command's output, is the verdict. + retirement_docker image rm "$_image_ref" >/dev/null 2>&1 || true + done + retirement_docker image rm "$_remove_id" >/dev/null 2>&1 || true + _present_status=0 + retirement_image_present "$_remove_id" || _present_status=$? + [ "$_present_status" -ne 1 ] || return 0 + [ "$_present_status" -eq 0 ] || die "cannot confirm image removal; installed files were kept for a retry" + _image_users=$(retirement_docker ps -aq --filter "ancestor=$_remove_id" --no-trunc) \ + || die "cannot confirm image users; installed files were kept for a retry" + [ -z "$_image_users" ] || { echo "==> kept a beta image now used by another container"; return 0; } + die "cannot remove all beta image references; installed files were kept for a retry" +} + +cmd_retire_beta() { + [ "$#" -eq 0 ] || die "retire-beta takes no arguments" + need_root + lifecycle_lock nonblocking || { echo "==> beta cleanup deferred: installation is being changed"; return 0; } + [ -x "$BIN_DEST" ] && [ -f "$MANIFEST" ] || return 0 + # A replaced symlink or owner is not an installation resource we can retire. + for _program in "$BIN_DEST" "$CLI_DEST" "$MANIFEST"; do + [ -f "$_program" ] && [ ! -L "$_program" ] || return 0 + [ "$(stat -c %u "$_program")" = "$(id -u)" ] || return 0 + done + [ -n "${GPUK_RETIRE_WORKER_SHA256:-}" ] || return 0 + [ "$(sha256sum "$BIN_DEST" | cut -d' ' -f1)" = "$GPUK_RETIRE_WORKER_SHA256" ] || return 0 + _expiry=$("$BIN_DEST" --beta-expiry 2>/dev/null) || return 0 + if [ "$_expiry" = 0 ]; then + # A remote normal upgrade can finish without running gpuk install/update. + # Its explicit retirement invocation only retires the beta retry policy. + # No Docker resource or ordinary installation file is removed here. + for _program in "$UNIT_DEST" "$RETIRE_UNIT" "$RETIRE_TIMER" "$RETIRE_PENDING" "$RETIRE_STATE"; do + [ ! -L "$_program" ] || return 0 + [ ! -e "$_program" ] || { [ -f "$_program" ] && [ "$(stat -c %u "$_program")" = "$(id -u)" ]; } || return 0 + done + if [ -f "$RETIRE_UNIT" ] || [ -f "$RETIRE_TIMER" ] || [ -f "$RETIRE_PENDING" ] || [ -f "$RETIRE_STATE" ]; then + # The file may already be normal while the old beta MainPID still owns + # the service. Only a running normal MainPID can cancel beta recovery. + _normal_pid=$(timeout 10 systemctl show -p MainPID --value "$SERVICE_NAME" 2>/dev/null) || return 0 + case "$_normal_pid" in ''|*[!0-9]*) return 0 ;; esac + [ "$_normal_pid" -gt 1 ] || return 0 + [ "$(sha256sum "/proc/$_normal_pid/exe" 2>/dev/null | cut -d' ' -f1)" = "$GPUK_RETIRE_WORKER_SHA256" ] || return 0 + write_unit + systemctl daemon-reload + fi + return 0 + fi + [ "$_expiry" = "$((0xce8c74e7 ^ 0xa5c39e17))" ] || return 0 + [ -f "$RETIRE_PENDING" ] && [ ! -L "$RETIRE_PENDING" ] || return 0 + [ "$(stat -c %u "$RETIRE_PENDING")" = "$(id -u)" ] || return 0 + [ "$(cat "$RETIRE_PENDING")" = "$_expiry" ] || return 0 + [ "$(stat -c %a "$RETIRE_PENDING")" = 600 ] || return 0 + [ "$(stat -c %s "$RETIRE_PENDING")" -eq "$((${#_expiry} + 1))" ] || return 0 + for _program in "$UNIT_DEST" "$RETIRE_UNIT" "$RETIRE_TIMER" "$RETIRE_STATE"; do + [ ! -L "$_program" ] || return 0 + [ ! -e "$_program" ] || { [ -f "$_program" ] && [ "$(stat -c %u "$_program")" = "$(id -u)" ]; } || return 0 + done + # The durable pending marker records authenticated expiry. Local wall time + # and the timer's unrelated exit status cannot revoke that decision. + _state_key="$_expiry $GPUK_RETIRE_WORKER_SHA256 $(sha256sum "$MANIFEST" | cut -d' ' -f1)" + _images="" + if [ -f "$RETIRE_STATE" ]; then + [ "$(stat -c %a "$RETIRE_STATE")" = 600 ] || return 0 + [ "$(head -n 1 "$RETIRE_STATE")" = "$_state_key" ] || return 0 + _images=$(tail -n +2 "$RETIRE_STATE") + for _image_id in $_images; do + case "$_image_id" in sha256:*) ;; *) return 0 ;; esac + _image_hex=${_image_id#sha256:} + case "$_image_hex" in ''|*[!a-f0-9]*) return 0 ;; esac + [ "${#_image_hex}" -eq 64 ] || return 0 + done + fi + + # Every destructive Docker operation uses an immutable ID captured under the + # lifecycle + node locks. A normal or unknown app image protects the entire + # installation, including a normal upgrade whose worker has not restarted yet. + command -v docker >/dev/null 2>&1 && command -v timeout >/dev/null 2>&1 || return 0 + retirement_docker info >/dev/null 2>&1 || return 0 + _image=$(manifest_image) + _mode=$(manifest_env_value mode) + _containers="" + if [ -n "$_image" ]; then + if _image_expiry=$(retirement_docker image inspect --format '{{index .Config.Labels "io.gpukitchen.beta-expires-at"}}' "$_image" 2>/dev/null); then + [ "$_image_expiry" = "$_expiry" ] || return 0 + _image_id=$(retirement_docker image inspect --format '{{.Id}}' "$_image" 2>/dev/null) || return 0 + _images="$_images $_image_id" + else + # A previous attempt may already have removed this reference or image. + # Only the journal bound to these exact installed files permits resuming. + [ -f "$RETIRE_STATE" ] && [ -n "$_images" ] || return 0 + fi + _cn=$(container_name) + _pcn=$(proxy_container_name) + [ -n "$_cn" ] || return 0 + # A stopped/failed generation is still executable beta software. Names come + # from this installation's manifest; the image stamp is checked independently. + _names="$_cn $_cn-old $_cn-failed $_pcn $_pcn-next $_pcn-failed" + _draining=$(retirement_docker ps -a --format '{{.Names}}' 2>/dev/null) || return 0 + for _name in $_draining; do + case "$_name" in "$_pcn-draining-"*) _names="$_names $_name" ;; esac + done + for _name in $_names; do + printf '%s\n' "$_draining" | grep -Fx -- "$_name" >/dev/null || continue + _facts=$(retirement_docker inspect --format '{{.Id}}|{{index .Config.Labels "io.gpukitchen.beta-expires-at"}}|{{.Image}}' "$_name" 2>/dev/null) || return 0 + _id=${_facts%%|*}; _rest=${_facts#*|}; _stamp=${_rest%%|*}; _image_id=${_rest#*|} + [ "$_stamp" = "$_expiry" ] || return 0 + _image_expiry=$(retirement_docker image inspect --format '{{index .Config.Labels "io.gpukitchen.beta-expires-at"}}' "$_image_id" 2>/dev/null) || return 0 + [ "$_image_expiry" = "$_expiry" ] || return 0 + case "$_id" in ''|*[!a-f0-9]*) return 0 ;; esac + _containers="$_containers $_id" + _images="$_images $_image_id" + done + else + # An empty image is only legitimate for an explicitly headless worker. + [ "$_mode" = "worker" ] || return 0 + fi + + # Engine image names and container-name prefixes do not establish ownership. + # Only workloads stamped by this beta worker for this machine are removed. + _machine_id=$(cat "$MACHINE_ID_FILE" 2>/dev/null) || return 0 + case "$_machine_id" in ''|*[!A-Za-z0-9_-]*) return 0 ;; esac + _engines=$(retirement_docker ps -aq --filter "label=io.gpukitchen.beta-expires-at=$_expiry" \ + --filter "label=io.gpukitchen.machine-id=$_machine_id" --no-trunc) || return 0 + for _id in $_engines; do + case "$_id" in ''|*[!a-f0-9]*) return 0 ;; esac + _containers="$_containers $_id" + done + [ "$(sha256sum "$BIN_DEST" | cut -d' ' -f1)" = "$GPUK_RETIRE_WORKER_SHA256" ] || return 0 + _images=$(printf '%s\n' "$_images" | tr ' ' '\n' | sed '/^$/d' | sort -u) + # Commit the complete proven image inventory before the first mutation. A + # restart after containers/tags disappeared resumes from this durable plan. + _journal=$(mktemp "$RETIRE_STATE.new.XXXXXX") + { printf '%s\n' "$_state_key"; [ -z "$_images" ] || printf '%s\n' "$_images"; } > "$_journal" + chmod 0600 "$_journal" + sync -f "$_journal" + mv "$_journal" "$RETIRE_STATE" + sync -f "$ETC_DIR" + echo "==> This beta has expired. Removing its installed programs; keeping your data." + if [ -n "$_containers" ]; then + # Give the controller's Postgres and active engines a bounded graceful stop. + # IDs were validated above. No volumes are removed and Docker is never pruned. + # shellcheck disable=SC2086 + set -- $_containers + if ! timeout 45 docker stop --time 30 "$@" >/dev/null; then + # A container can disappear or already be stopped during cleanup. Accept + # only states Docker independently proves safe to remove; all other stop + # failures retain the installed programs for the next retirement attempt. + _present=$(retirement_docker ps -aq --no-trunc) \ + || die "cannot confirm beta containers stopped; installed files were kept for a retry" + _stopped="" + for _id in $_containers; do + printf '%s\n' "$_present" | grep -Fx -- "$_id" >/dev/null || continue + _state=$(retirement_docker inspect --format '{{.State.Status}}' "$_id") \ + || die "cannot confirm beta container $_id stopped; installed files were kept for a retry" + case "$_state" in + created|exited|dead) _stopped="$_stopped $_id" ;; + *) die "beta container $_id did not stop; installed files were kept for a retry" ;; + esac + done + _containers="$_stopped" + fi + if [ -n "$_containers" ]; then + # No --force: a container restarted outside this lifecycle is preserved. + # shellcheck disable=SC2086 + set -- $_containers + timeout 30 docker rm "$@" >/dev/null \ + || die "cannot remove all beta containers; cleanup left installed files for a retry" + fi + fi + for _image_id in $_images; do + retirement_remove_image "$_image_id" + done + # ExecStopPost is already inside a stop job: --now/stop would deadlock it. + timeout 10 systemctl disable "$SERVICE_NAME" >/dev/null 2>&1 \ + || die "cannot disable the beta service; installed programs were kept for a retry" + if [ -f "$RETIRE_TIMER" ]; then + timeout 10 systemctl disable --now "$RETIRE_SERVICE.timer" >/dev/null 2>&1 \ + || die "cannot disable the retirement timer; installed programs were kept for a retry" + fi + _unit_backup=$(mktemp -d "$ETC_DIR/.beta-retirement-units.XXXXXX") + for _program in "$UNIT_DEST" "$RETIRE_UNIT" "$RETIRE_TIMER"; do + [ ! -f "$_program" ] || cp -p "$_program" "$_unit_backup/$(basename "$_program")" + rm -f "$_program" + done + if ! timeout 10 systemctl daemon-reload >/dev/null 2>&1; then + for _program in "$UNIT_DEST" "$RETIRE_UNIT" "$RETIRE_TIMER"; do + [ ! -f "$_unit_backup/$(basename "$_program")" ] || cp -p "$_unit_backup/$(basename "$_program")" "$_program" + done + [ ! -f "$RETIRE_TIMER" ] || timeout 10 systemctl enable --now "$RETIRE_SERVICE.timer" >/dev/null 2>&1 || true + rm -rf "$_unit_backup" + die "cannot reload the service manager; installed programs were kept for a retry" + fi + rm -rf "$_unit_backup" + # This state lets the normal installer recover over the retained manifest + # without mistaking the intentionally removed CLI for an incomplete old install. + (umask 077; printf '%s\n' "$_expiry" > "$ETC_DIR/beta-retired.new") + mv "$ETC_DIR/beta-retired.new" "$ETC_DIR/beta-retired" + rm -f "$BIN_DEST" "$CLI_DEST" + rm -f "$RETIRE_PENDING" "$RETIRE_STATE" + echo "Kept: $ETC_DIR and all data, models, secrets and backups. Install the current release to reuse them." +} + cmd_uninstall() { need_root + lifecycle_lock _purge=0 while [ $# -gt 0 ]; do case "$1" in @@ -1579,7 +2397,8 @@ gpuk — GPU Kitchen host daemon (gpu-kitchen-worker) ports and nothing else it listens on touches the host; host makes every listener a host-wide claim (a re-run keeps the mode installed) --domain: the name the UI is reached by through a reverse proxy, any - profile — allowed as a host, trusted proxy on, filled Caddyfile written + profile — allowed as a host, trusted proxy on, filled Caddyfile written; + kept by a re-run, dropped with --no-domain gpuk install --mode worker --controller wss://: --enroll-token gk_enroll_... [--cluster N] [--cache-dir P] [--binary ] [--health-port P] [--data-port P] [--transfer-port P] [--handover-port P] @@ -1593,7 +2412,11 @@ gpuk — GPU Kitchen host daemon (gpu-kitchen-worker) gpuk update --check (controller) Compare the installed version with the release gpuk update --version (controller) Move to a specific release gpuk channel Fetch + VERIFY the release channel and print what it offers - gpuk backup [DIR] (controller) Cold snapshot of the embedded pgdata (stop → tar → restart) + gpuk backup [DIR] [--offsite] (controller) Cold snapshot of the embedded pgdata (stop → tar → restart); + --offsite then copies it with the command in /etc/gpu-kitchen/offsite.env + gpuk carry-over [--replace] (controller) Copy the recipes, benchmarks, evaluations and + baskets of a backup (gpuk backup folder or pg_dump file) into this database; + --replace first deletes the ones it already has gpuk manifest Print the current manifest gpuk logs Follow the app container logs (controller) or the daemon journal; after a failed start, the kept -failed log @@ -1615,7 +2438,8 @@ case "$cmd" in apply) cmd_apply ;; update) cmd_update "$@" ;; channel) cmd_channel ;; - backup) cmd_backup "${1:-}" ;; + backup) cmd_backup "$@" ;; + carry-over) cmd_carry_over "$@" ;; manifest) cat "$MANIFEST" ;; logs) _img=$(manifest_image) @@ -1636,6 +2460,7 @@ case "$cmd" in fi ;; uninstall) cmd_uninstall "$@" ;; + retire-beta) cmd_retire_beta "$@" ;; help|-h|--help) usage ;; *) usage; exit 1 ;; esac diff --git a/install.sh b/install.sh index 24073e3..4a0b14a 100644 --- a/install.sh +++ b/install.sh @@ -99,7 +99,7 @@ EDITION_GIVEN=0; [ -z "${GPUK_EDITION:-}" ] || EDITION_GIVEN=1 PROFILE="" RESET_MANIFEST=0 REINSTALL=0 -DOMAIN="" +DOMAIN=""; NO_DOMAIN=0 VERSION="" IMAGE="" WORKER_BINARY="" @@ -120,6 +120,62 @@ warn() { echo " ${YELLOW}!${RESET} $*"; } step() { echo; echo "${BOLD}$*${RESET}"; } die() { echo " ${RED}✗${RESET} $*" >&2; exit 1; } +# Only a standalone installer invoked directly as the shell's script can remove +# itself. Piped input, sourced wrappers, repository copies and the installed CLI +# have no eligible path. Missing identity tools leave the file in place. +INSTALLER_SELF=""; INSTALLER_SELF_STAT=""; INSTALLER_SELF_HASH="" +remember_standalone_installer() { + for _tool in readlink stat sha256sum; do + command -v "$_tool" >/dev/null 2>&1 || return 0 + done + [ -f "$0" ] && [ ! -L "$0" ] && [ -r "/proc/$$/cmdline" ] || return 0 + # Shell argv[1] is the script only for direct `sh path` / shebang invocation. + # -c, -s and extra interpreter flags are deliberately not guessed through. + _self_arg=$(tr '\000' '\n' < "/proc/$$/cmdline" | sed -n '2p') + [ "$_self_arg" = "$0" ] || return 0 + _self_path=$(readlink -f -- "$0") || return 0 + [ "$_self_path" != "$(readlink -f -- "$GPUK_CLI" 2>/dev/null || true)" ] || return 0 + [ ! -f "$(dirname "$_self_path")/../../dev.sh" ] || return 0 + _self_dir=$(dirname "$_self_path") + while :; do + [ ! -e "$_self_dir/.git" ] && [ ! -L "$_self_dir/.git" ] || return 0 + [ "$_self_dir" != / ] || break + _self_dir=$(dirname "$_self_dir") + done + [ "$(sed -n '2p' "$_self_path")" = '# GPU Kitchen — one-command install (specs/plateforme/installation/README.md).' ] || return 0 + [ "$(tail -n 1 "$_self_path")" = 'main "$@"' ] || return 0 + _self_owner=$(stat -c %u -- "$_self_path") || return 0 + _self_user=$(id -u) + case "$_self_owner" in + "$_self_user") ;; + "${SUDO_UID:-}") [ "$_self_user" -eq 0 ] || return 0 ;; + *) return 0 ;; + esac + INSTALLER_SELF_STAT=$(stat -c '%d:%i:%u:%s:%Y:%Z' -- "$_self_path") || return 0 + INSTALLER_SELF_HASH=$(sha256sum -- "$_self_path" | cut -d' ' -f1) || return 0 + case "$INSTALLER_SELF_HASH" in ''|*[!a-f0-9]*) return 0 ;; esac + [ "${#INSTALLER_SELF_HASH}" -eq 64 ] || return 0 + INSTALLER_SELF="$_self_path" +} + +remove_expired_standalone_installer() { + [ -n "$INSTALLER_SELF" ] || return 0 + [ -f "$INSTALLER_SELF" ] && [ ! -L "$INSTALLER_SELF" ] || return 0 + [ "$(readlink -f -- "$0" 2>/dev/null || true)" = "$INSTALLER_SELF" ] || return 0 + [ "$(stat -c '%d:%i:%u:%s:%Y:%Z' -- "$INSTALLER_SELF" 2>/dev/null || true)" = "$INSTALLER_SELF_STAT" ] || return 0 + [ "$(sha256sum -- "$INSTALLER_SELF" 2>/dev/null | cut -d' ' -f1)" = "$INSTALLER_SELF_HASH" ] || return 0 + rm -f -- "$INSTALLER_SELF" 2>/dev/null || true +} + +installer_failure() { # exit status, ordinary failure message + _installer_status="$1"; shift + [ "$_installer_status" -ne 78 ] || remove_expired_standalone_installer + echo " ${RED}✗${RESET} $*" >&2 + exit "$_installer_status" +} + +remember_standalone_installer + # `curl … | sudo sh` leaves stdin holding the script itself, so questions are # asked and answered on the controlling terminal — /dev/tty — when there is one # (INS-45). No terminal (CI, provisioning), --non-interactive or --dry-run keep @@ -130,9 +186,10 @@ can_prompt() { (: < /dev/tty) 2>/dev/null } -ask() { # $1 = prompt → $REPLY (empty on EOF) +ASK_EOF=0 +ask() { # $1 = prompt → $REPLY (empty on EOF, which also sets ASK_EOF=1) printf '%s' "$1" > /dev/tty - IFS= read -r REPLY < /dev/tty || REPLY="" + IFS= read -r REPLY < /dev/tty || { REPLY=""; ASK_EOF=1; } } usage() { @@ -160,7 +217,8 @@ Options: --domain Name the UI is reached by through a reverse proxy, any profile: allowed as a host of the install, proxy trusted for the client address, and a filled TLS reverse-proxy example - written to /caddy/Caddyfile + written to /caddy/Caddyfile. A re-run keeps it + --no-domain Drop the domain an existing install was given --reinstall On a host that already runs GPU Kitchen, reinstall over it (settings kept, merged into its manifest) instead of the default re-run, which is 'gpuk update' @@ -203,6 +261,7 @@ while [ $# -gt 0 ]; do --network) NETWORK="$2"; NETWORK_GIVEN=1; shift 2 ;; --profile) PROFILE="$2"; shift 2 ;; --domain) DOMAIN="$2"; shift 2 ;; + --no-domain) NO_DOMAIN=1; shift ;; --non-interactive) NON_INTERACTIVE=1; shift ;; --reset-manifest) RESET_MANIFEST=1; shift ;; --reinstall) REINSTALL=1; shift ;; @@ -246,6 +305,7 @@ done echo echo "${BOLD}GPU Kitchen — installing the $EDITION controller${RESET}" +echo "Installing means you accept the GPU Kitchen Community License: https://gpu.kitchen/license" # [WEB-212] # ── 0. An existing install (INS-03) ────────────────────────────────────────── # Re-running this script is the update path, so before checking anything it @@ -344,7 +404,10 @@ case "$EXISTING" in [ "$NETWORK_GIVEN" -eq 0 ] || [ "$NETWORK" = "${C_NETMODE:-host}" ] || reconfigure "--network" [ "$EDITION_GIVEN" -eq 0 ] || [ "$EDITION" = "$_edition" ] || reconfigure "--edition" [ -z "$PROFILE" ] || [ "$PROFILE" = "$_profile" ] || reconfigure "--profile" - [ -z "$DOMAIN" ] || reconfigure "--domain" + _domain=$(manifest_str GPUK_DOMAIN) + [ -z "$DOMAIN" ] || [ "$DOMAIN" = "$_domain" ] || reconfigure "--domain" + [ "$NO_DOMAIN" -eq 0 ] || [ -z "$_domain" ] || reconfigure "--no-domain" + [ "$NO_DOMAIN" -eq 1 ] || [ -n "$DOMAIN" ] || DOMAIN="$_domain" [ -z "$IMAGE" ] || reconfigure "--image" [ -z "$VERSION" ] || reconfigure "--version" [ -z "$WORKER_BINARY" ] || reconfigure "--worker-binary" @@ -401,6 +464,14 @@ esac # An install older than gpuk-on-the-host has nothing to hand the update to: the # only way forward is a reinstall over it. Offer it on a terminal, and always # print the complete command — never a flag to splice in by hand. +# Retirement deliberately removes programs while retaining the recovery set. +# The current signed release can be installed directly over that preserved state. +if [ "$EXISTING" = "manifest" ] && [ ! -x "$GPUK_CLI" ] \ + && [ "$(cat "$ETC_DIR/beta-retired" 2>/dev/null || true)" = "$((0xce8c74e7 ^ 0xa5c39e17))" ]; then + REINSTALL=1 + reconfigure "recovering the expired beta's data" +fi + if [ "$EXISTING" = "manifest" ] && [ -z "$RECONFIGURE" ] && [ "$DRY_RUN" -eq 0 ] \ && [ ! -x "$GPUK_CLI" ]; then step "Update — this install predates gpuk on the host" @@ -429,7 +500,9 @@ if [ "$EXISTING" = "manifest" ] && [ -z "$RECONFIGURE" ]; then echo " existing : yes — updated in place" exit 0 fi - "$GPUK_CLI" update || die "the update failed — gpuk reported the cause just above" + _update_status=0 + "$GPUK_CLI" update || _update_status=$? + [ "$_update_status" -eq 0 ] || installer_failure "$_update_status" "the update failed — gpuk reported the cause just above" echo echo "${BOLD}${GREEN}GPU Kitchen is up to date.${RESET}" echo @@ -658,6 +731,144 @@ else resolve_port "inference" "$INFERENCE_PORT" "--inference-port"; INFERENCE_PORT="$RESOLVED" fi +# BEGIN GENERATED INTERNET REACHABILITY — tools/gen-install-reachability.mjs from deployments/install/reachability.sh.in and packages/contracts/data/public-address-ranges.json; DO NOT EDIT +# Whether the Internet reaches this machine, one finding per line: +# public a public IPv4 on an interface (the controller listens there) +# ipv6 a global IPv6: reported only, nothing listens on IPv6 +# cloud a public IPv4 the cloud metadata service maps 1:1 to it +# unknown no `ip` nor `hostname -I` to read the addresses +# The ranges come from packages/contracts/data/public-address-ranges.json, the controller's +# own definition too. GPUK_CLOUD_METADATA_URL is a test seam. +reach_classify() { # stdin: "
[/prefix]" lines + awk ' + function v4int(a, o, n, i, x) { + n = split(a, o, ".") + if (n != 4) return -1 + x = 0 + for (i = 1; i <= 4; i++) { + if (o[i] !~ /^[0-9]+$/ || o[i] + 0 > 255) return -1 + x = x * 256 + o[i] + } + return x + } + function hexval(h, i, c, x) { + x = 0 + for (i = 1; i <= length(h); i++) { + c = index("0123456789abcdef", substr(h, i, 1)) + if (c == 0) return -1 + x = x * 16 + c - 1 + } + return x + } + function v6head32(a, h, n, h1, h2) { + n = split(tolower(a), h, ":") + if (n < 3 || h[1] == "" || length(h[1]) > 4 || length(h[2]) > 4) return -1 + h1 = hexval(h[1]) + h2 = (h[2] == "") ? 0 : hexval(h[2]) + if (h1 < 0 || h2 < 0) return -1 + return h1 * 65536 + h2 + } + function v4public(a, x) { + x = v4int(a) + if (x < 0) return 0 + if (x >= 0 && x <= 16777215) return 0 # 0.0.0.0/8 this network + if (x >= 167772160 && x <= 184549375) return 0 # 10.0.0.0/8 private + if (x >= 1681915904 && x <= 1686110207) return 0 # 100.64.0.0/10 CGNAT + if (x >= 2130706432 && x <= 2147483647) return 0 # 127.0.0.0/8 loopback + if (x >= 2851995648 && x <= 2852061183) return 0 # 169.254.0.0/16 link local + if (x >= 2886729728 && x <= 2887778303) return 0 # 172.16.0.0/12 private + if (x >= 3221225472 && x <= 3221225727) return 0 # 192.0.0.0/24 IETF protocol assignments + if (x >= 3221225984 && x <= 3221226239) return 0 # 192.0.2.0/24 documentation + if (x >= 3232235520 && x <= 3232301055) return 0 # 192.168.0.0/16 private + if (x >= 3323068416 && x <= 3323199487) return 0 # 198.18.0.0/15 benchmarking + if (x >= 3325256704 && x <= 3325256959) return 0 # 198.51.100.0/24 documentation + if (x >= 3405803776 && x <= 3405804031) return 0 # 203.0.113.0/24 documentation + if (x >= 3758096384 && x <= 4294967295) return 0 # 224.0.0.0/3 multicast and reserved + return 1 + } + function v6global(a, x) { + x = v6head32(a) + if (x < 0) return 0 + if (x < 536870912 || x > 1073741823) return 0 # outside 2000::/3 + if (x >= 536939960 && x <= 536939960) return 0 # 2001:db8::/32 documentation + return 1 + } + { + addr = $3; sub(/\/.*/, "", addr) + if ($2 == "inet" && v4public(addr)) print "public", addr, $1 + else if ($2 == "inet6" && v6global(addr)) print "ipv6", addr, $1 + else if ($2 == "cloud" && v4public(addr)) print "cloud", addr + }' +} + +reach_cloud_ipv4() { # a public IPv4 from AWS, Google Cloud or Azure metadata, or nothing + command -v curl >/dev/null 2>&1 || return 0 + _md="${GPUK_CLOUD_METADATA_URL:-http://169.254.169.254}" + curl -s -o /dev/null --connect-timeout 1 -m 1 "$_md/" 2>/dev/null || return 0 + _tok=$(curl -sf --connect-timeout 1 -m 1 -X PUT \ + -H 'X-aws-ec2-metadata-token-ttl-seconds: 60' "$_md/latest/api/token" 2>/dev/null) || _tok="" + if [ -n "$_tok" ]; then + _ip=$(curl -sf -m 1 -H "X-aws-ec2-metadata-token: $_tok" \ + "$_md/latest/meta-data/public-ipv4" 2>/dev/null) || _ip="" + else + _ip=$(curl -sf -m 1 "$_md/latest/meta-data/public-ipv4" 2>/dev/null) || _ip="" + fi + [ -n "$_ip" ] || _ip=$(curl -sf -m 1 -H 'Metadata-Flavor: Google' \ + "$_md/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" 2>/dev/null) || _ip="" + [ -n "$_ip" ] || _ip=$(curl -sf -m 1 -H 'Metadata: true' \ + "$_md/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2021-02-01&format=text" 2>/dev/null) || _ip="" + case "$_ip" in + *[!0-9.]*|"") return 0 ;; + esac + printf '%s\n' "$_ip" +} + +reach_findings() { + if command -v ip >/dev/null 2>&1; then + ip -o addr show 2>/dev/null | awk '{ print $2, $3, $4 }' | reach_classify + elif _reach_h=$(hostname -I 2>/dev/null); then + for _a in $_reach_h; do + case "$_a" in *:*) echo "- inet6 $_a" ;; *) echo "- inet $_a" ;; esac + done | reach_classify + else + echo "unknown" + fi + _cloud=$(reach_cloud_ipv4) + [ -z "$_cloud" ] || echo "- cloud $_cloud" | reach_classify +} + +# Why the Home lab profile is refused (INS-89), or nothing. $1 = reach_findings output. +homelab_refusal_reason() { + _why=$(printf '%s\n' "$1" | awk ' + $1 == "public" { print "This machine is reachable from the Internet: it has the public address " $2 " on " $3 "."; exit } + $1 == "cloud" { print "This machine is reachable from the Internet: its cloud provider gives it the public address " $2 "."; exit } + $1 == "unknown" { print "GPU Kitchen cannot read the addresses of this machine (no ip or hostname command), so it cannot tell whether the Internet reaches it."; exit }') + [ -n "$_why" ] || return 0 + echo "$_why The Home lab profile lets anyone who reaches it in without signing in, so it is not allowed here. Use --profile small-team (control from this machine only), --profile managed-network (sign-in required) or --profile public (sign-in, behind a TLS reverse proxy)." +} + +# The first public IPv4 of this machine, for the controller ([INS-93]); nothing when none. +# $1 = reach_findings output. +public_ipv4_of() { + printf '%s\n' "$1" | awk '$1 == "public" || $1 == "cloud" { print $2; exit }' +} + +# A global IPv6 address of this machine (INS-92): reported, never refused. $1 = findings. +global_ipv6_note() { + _v6=$(printf '%s\n' "$1" | awk '$1 == "ipv6" { print $2 " on " $3; exit }') + [ -z "$_v6" ] || echo "This machine has the global IPv6 address $_v6. GPU Kitchen listens on IPv4 only, so the Internet does not reach it there." +} +# END GENERATED INTERNET REACHABILITY + +# ── Internet reachability (INS-89, INS-90) ──────────────────────────────────── +# Home lab trusts the network. On a machine the Internet reaches, it is refused here, +# before anything is downloaded, and the profile question does not offer it. +HOMELAB_REFUSAL="" +if [ "$PROFILE" = "homelab" ] || { [ -z "$PROFILE" ] && can_prompt; }; then + HOMELAB_REFUSAL=$(homelab_refusal_reason "$(reach_findings)") +fi +[ "$PROFILE" != "homelab" ] || [ -z "$HOMELAB_REFUSAL" ] || die "$HOMELAB_REFUSAL" + # ── 2. Resolve the release ─────────────────────────────────────────────────── step "Release — resolving the version to install" @@ -886,10 +1097,23 @@ if [ -z "$PROFILE" ] && can_prompt; then already issued is revoked. PROFILES + # [INS-90] On a machine the Internet reaches, Home lab is not offered, and Enter + # asks again instead of choosing it. A closed terminal stops with the reason. + [ -z "$HOMELAB_REFUSAL" ] || printf ' %s\n\n' "Home lab is not available here. $HOMELAB_REFUSAL" > /dev/tty while :; do - ask " Choose a profile [1-4, Enter = 1 (Home lab)]: " + if [ -n "$HOMELAB_REFUSAL" ]; then + ask " Choose a profile [2-4]: " + [ "$ASK_EOF" -eq 0 ] || die "$HOMELAB_REFUSAL" + else + ask " Choose a profile [1-4, Enter = 1 (Home lab)]: " + fi case "$REPLY" in - ""|1|homelab) PROFILE="homelab" ;; + ""|1|homelab) + if [ -n "$HOMELAB_REFUSAL" ]; then + printf '%s\n' " Home lab is not available here: pick 2, 3 or 4" > /dev/tty + continue + fi + PROFILE="homelab" ;; 2|small-team) PROFILE="small-team" ;; 3|managed-network) PROFILE="managed-network" ;; 4|public) PROFILE="public" ;; @@ -979,6 +1203,7 @@ set -- install \ [ -z "$PROFILE" ] || set -- "$@" --profile "$PROFILE" [ -z "$DOMAIN" ] || set -- "$@" --domain "$DOMAIN" +[ "$NO_DOMAIN" -eq 0 ] || set -- "$@" --no-domain [ "$RESET_MANIFEST" -eq 0 ] || set -- "$@" --reset-manifest # Inherited from the manifest or given by flag; unset on a first install, so # gpuk's own default (bridge, INS-49) applies and this script never restates it. @@ -986,7 +1211,12 @@ set -- install \ if [ -n "$WORKER_BINARY" ]; then [ -f "$WORKER_BINARY" ] || die "no such worker binary: $WORKER_BINARY" - set -- "$@" --binary "$WORKER_BINARY" + cp "$WORKER_BINARY" "$TMP/gpu-kitchen-worker" + chmod +x "$TMP/gpu-kitchen-worker" + _candidate_status=0 + GPUK_MANIFEST_PATH="$MANIFEST" "$TMP/gpu-kitchen-worker" check-release || _candidate_status=$? + [ "$_candidate_status" -eq 0 ] || installer_failure "$_candidate_status" "this worker release cannot be installed; use the current release" + set -- "$@" --binary "$TMP/gpu-kitchen-worker" ok "using a locally-built gpu-kitchen-worker" elif [ -n "${WORKER_RELEASE_BASE:-}" ]; then # The privileged daemon: downloaded here, its minisign signature checked @@ -1027,6 +1257,10 @@ elif [ -n "${WORKER_RELEASE_BASE:-}" ]; then fi ok "gpu-kitchen-worker signature verified (build $_build)" fi + chmod +x "$TMP/gpu-kitchen-worker" + _candidate_status=0 + GPUK_MANIFEST_PATH="$MANIFEST" "$TMP/gpu-kitchen-worker" check-release || _candidate_status=$? + [ "$_candidate_status" -eq 0 ] || installer_failure "$_candidate_status" "this worker release cannot be installed; use the current release" set -- "$@" --binary "$TMP/gpu-kitchen-worker" fi # else: gpuk reuses an already-installed binary, or fails with its own message. @@ -1036,7 +1270,9 @@ step "Installing — this pulls the image, so it can take a few minutes" # failed apply, a missing binary…), so the cause is the line right above this # one. journalctl only has something to say once the daemon has started, and # gpuk points at `gpuk logs` itself in that case. -sh "$GPUK_SCRIPT" "$@" || die "the install failed — gpuk reported the cause just above" +_install_status=0 +sh "$GPUK_SCRIPT" "$@" || _install_status=$? +[ "$_install_status" -eq 0 ] || installer_failure "$_install_status" "the install failed — gpuk reported the cause just above" # ── 5. Wait for the app, then say where it is ──────────────────────────────── step "Waiting for the controller to answer" @@ -1072,8 +1308,20 @@ case "$PROFILE" in [ -z "$CLAIM_KEY" ] || CLAIM_SUFFIX="/start?key=${CLAIM_KEY}" ;; esac -echo " ${BOLD}Open:${RESET} http://${HOSTNAME_FQDN}:${PORT}${CLAIM_SUFFIX}" -[ -n "$LAN_IP" ] && echo " http://${LAN_IP}:${PORT}${CLAIM_SUFFIX}" +if [ "$PROFILE" = "public" ]; then + # [INS-83] The plain-HTTP UI port answers on this machine's loopback only: the + # way in is the TLS front, or an SSH tunnel until it serves. + if [ -n "$DOMAIN" ]; then + echo " ${BOLD}Open:${RESET} https://${DOMAIN}${CLAIM_SUFFIX} (once the HTTPS steps below are done)" + else + echo " ${BOLD}Open:${RESET} https://${CLAIM_SUFFIX} (once your TLS reverse proxy serves it)" + fi + echo " Before that, from your computer: ssh -L ${PORT}:127.0.0.1:${PORT} " + echo " then http://localhost:${PORT}${CLAIM_SUFFIX}" +else + echo " ${BOLD}Open:${RESET} http://${HOSTNAME_FQDN}:${PORT}${CLAIM_SUFFIX}" + [ -n "$LAN_IP" ] && echo " http://${LAN_IP}:${PORT}${CLAIM_SUFFIX}" +fi echo case "$PROFILE" in homelab|small-team) @@ -1108,10 +1356,10 @@ case "$PROFILE" in echo " 3. sudo cp $DATA_ROOT/caddy/Caddyfile /etc/caddy/Caddyfile" echo " sudo systemctl reload caddy" echo " A filled example was written to $DATA_ROOT/caddy/Caddyfile." - echo " Until then the UI answers in cleartext on the URLs above." else - echo " ${BOLD}HTTPS:${RESET} the public profile requires a TLS reverse proxy before any" - echo " public exposure. See deployments/controller/Caddyfile.example." + echo " ${BOLD}HTTPS:${RESET} put a TLS reverse proxy on this machine in front of" + echo " http://127.0.0.1:${PORT}, and send /v1 to the inference API on the" + echo " Docker bridge address, port ${INFERENCE_PORT}. See deployments/controller/Caddyfile.example." fi echo ;; @@ -1134,7 +1382,13 @@ if [ -n "$DOMAIN" ] && [ "$PROFILE" != "public" ]; then echo " Caddy example was written to $DATA_ROOT/caddy/Caddyfile." echo fi -echo " Inference endpoint : http://${HOSTNAME_FQDN}:${INFERENCE_PORT}/v1" +# [INS-87] Under public the proxy answers on this machine only (the Docker bridge): tools +# outside reach it through the TLS front, which routes /v1 to it. +if [ "$PROFILE" = "public" ]; then + echo " Inference endpoint : https://${DOMAIN:-}/v1 (through the HTTPS front)" +else + echo " Inference endpoint : http://${HOSTNAME_FQDN}:${INFERENCE_PORT}/v1" +fi echo " Version : ${VERSION}" echo @@ -1161,7 +1415,7 @@ if [ -n "$EXISTING_CACHE" ]; then echo " place. Nothing is moved or deleted." echo fi -echo " Update : re-run this command, or press Update in the UI, or: gpuk update" +echo " Update : automatic, once a day in the slot set in Settings > Updates; now: gpuk update" echo " Status : gpuk status Logs: gpuk logs" echo " Remove : gpuk uninstall (service only) or gpuk uninstall --purge (all but the data root)" echo diff --git a/latest.json b/latest.json index 8458424..564a929 100644 --- a/latest.json +++ b/latest.json @@ -1,87 +1,22 @@ { - "version": "v0.2.0", - "semver": "0.2.0", - "epoch": "0.2", - "contractRevision": "cb395ba6219a3a79d334d841a0dfe4c28beed1af6ba0e516858eb1719f57aec0", - "workerProtocolRevision": "7a521fef149213c8c51fb75e63440fc4b70bf2200a4514e8ef5f2217a700a593", + "version": "v0.5.0", + "semver": "0.5.0", + "epoch": "0.5", + "contractRevision": "d6577e9cc7421ecd985608f98dd05fc8bf263b6ad400ac2cb485dc22edc75b03", + "workerProtocolRevision": "23d2286bc360b6fa4566a0dd399748cb803204bc1d8d20155f20c98e1e495dcb", "security": false, - "evalCatalog": {"sourceCommit":"63630b3c571bb6337cde91eb497d21edc7529824","runnerImage":"repo.byterain.io/gpukitchen/gpukitchen-evals:v0.2.0@sha256:8ce991f89b6944e46e0bc36e05c9ea8775f2f21486fbac4ade27e2d4a0edc8c5","revision":"c8492bd80cfb81d572327bd0496dd4fa19f4059909a066d1003b20b6a3d0f53c","suites":[{"id":"fidelity","version":1,"status":"available","definitionSha256":"0c03a9eb87511f91220450fa92ea61b26c5d39a306c2a5005762392dc477a5e1"},{"id":"gsm8k","version":1,"status":"available","definitionSha256":"7bf9d6826ef5cd5f9ea075e81c7bd153dedb8a2fbff0c933f6e60b79d5d36cd4"},{"id":"ifeval","version":1,"status":"available","definitionSha256":"724aa0ae6e761c8612ace6bf2ad0291f931e6eb70bc2bfa67da8697e02464454"},{"id":"mmlu-pro-mini","version":1,"status":"available","definitionSha256":"e85bd8cd8773c8d7ee8324f0d24c89fd181ef25469bd5f41daee2344127f8473"},{"id":"humaneval-plus","version":1,"status":"planned","definitionSha256":"5366ceb25edd349d6086cf84670ef4eb04c598331632a5b00768e5b794f289d4"},{"id":"mbpp-plus","version":1,"status":"planned","definitionSha256":"900822542a2ae431dc3e94dc94488ac00b3670b5168a544be9c58802c6631496"},{"id":"bfcl-ast","version":1,"status":"planned","definitionSha256":"73380c76264b8ceb3317034c9a45421c682cdbde9fcc75e6c5105a1415d929dc"},{"id":"asr-diagnostic","version":1,"status":"available","definitionSha256":"33389f8305cbb0e68195a6cd9298b2d7b1dc04a94d5b35659b5f8cb63c443208"},{"id":"embedding-relevance","version":1,"status":"available","definitionSha256":"7d152cde2e7d49a1d80bf3c729c8d3dda2efac7c9f8d4c47a50ffad68e81995a"},{"id":"reranking-relevance","version":1,"status":"available","definitionSha256":"75363c5edd32d2bdf2be4cb2ba5d7244fd81888f77054dd5ccb17e7136394189"},{"id":"asr-fleurs-fr","version":1,"status":"available","definitionSha256":"f758fe0224a201f9e3227e7492be429f14bb7fb8eda8a3034307490925eadc19"},{"id":"asr-fleurs-de","version":1,"status":"available","definitionSha256":"09dcc0c9e801f3444ece34cc8cac148ebfdcb0949ae8674558f171a4b6978a5f"},{"id":"asr-fleurs-es","version":1,"status":"available","definitionSha256":"5c35e53980830eded46d29c995056f501e760029d5b6a4574a2cff8dbd2439e1"},{"id":"asr-edacc-en","version":1,"status":"available","definitionSha256":"ca7634580df6820f21cd6676dc6ebae3d10341e83936d2afaf7b2bdbe7b08a9f"}]}, + "evalCatalog": {"sourceCommit":"9d5b9cf87a20a699870b06be00d53cba2e79a11b","runnerImage":"repo.byterain.io/gpukitchen/gpukitchen-evals:v0.5.0@sha256:7135199dd6fa6aeeb19bcc771c47f4221031cfa195830ba32145763f3706d5df","revision":"c8492bd80cfb81d572327bd0496dd4fa19f4059909a066d1003b20b6a3d0f53c","suites":[{"id":"fidelity","version":1,"status":"available","definitionSha256":"0c03a9eb87511f91220450fa92ea61b26c5d39a306c2a5005762392dc477a5e1"},{"id":"gsm8k","version":1,"status":"available","definitionSha256":"7bf9d6826ef5cd5f9ea075e81c7bd153dedb8a2fbff0c933f6e60b79d5d36cd4"},{"id":"ifeval","version":1,"status":"available","definitionSha256":"724aa0ae6e761c8612ace6bf2ad0291f931e6eb70bc2bfa67da8697e02464454"},{"id":"mmlu-pro-mini","version":1,"status":"available","definitionSha256":"e85bd8cd8773c8d7ee8324f0d24c89fd181ef25469bd5f41daee2344127f8473"},{"id":"humaneval-plus","version":1,"status":"planned","definitionSha256":"5366ceb25edd349d6086cf84670ef4eb04c598331632a5b00768e5b794f289d4"},{"id":"mbpp-plus","version":1,"status":"planned","definitionSha256":"900822542a2ae431dc3e94dc94488ac00b3670b5168a544be9c58802c6631496"},{"id":"bfcl-ast","version":1,"status":"planned","definitionSha256":"73380c76264b8ceb3317034c9a45421c682cdbde9fcc75e6c5105a1415d929dc"},{"id":"asr-diagnostic","version":1,"status":"available","definitionSha256":"33389f8305cbb0e68195a6cd9298b2d7b1dc04a94d5b35659b5f8cb63c443208"},{"id":"embedding-relevance","version":1,"status":"available","definitionSha256":"7d152cde2e7d49a1d80bf3c729c8d3dda2efac7c9f8d4c47a50ffad68e81995a"},{"id":"reranking-relevance","version":1,"status":"available","definitionSha256":"75363c5edd32d2bdf2be4cb2ba5d7244fd81888f77054dd5ccb17e7136394189"},{"id":"asr-fleurs-fr","version":1,"status":"available","definitionSha256":"f758fe0224a201f9e3227e7492be429f14bb7fb8eda8a3034307490925eadc19"},{"id":"asr-fleurs-de","version":1,"status":"available","definitionSha256":"09dcc0c9e801f3444ece34cc8cac148ebfdcb0949ae8674558f171a4b6978a5f"},{"id":"asr-fleurs-es","version":1,"status":"available","definitionSha256":"5c35e53980830eded46d29c995056f501e760029d5b6a4574a2cff8dbd2439e1"},{"id":"asr-edacc-en","version":1,"status":"available","definitionSha256":"ca7634580df6820f21cd6676dc6ebae3d10341e83936d2afaf7b2bdbe7b08a9f"}]}, "controllerMigrations": [ - { "tag": "0000_baseline", "hash": "fa8c006eee4721f4b8dafd56dfbac68ddff471feb9eef611b572010840645b74" }, - { "tag": "0001_schema_epoch", "hash": "ea428c2d25ce54c82ed358e7667ccb422cf23a3c09c4a4a55b41039e214adfc7" }, - { "tag": "0002_proxy_version", "hash": "63afece2501f332b5b8270de09835d9382c622bb9955c1d1a4c13d317ae9b4d6" }, - { "tag": "0003_installation_updates", "hash": "b879bde71949503153acd91a20f8a517d65599c016f58e9bd895c876e28e3d75" }, - { "tag": "0004_update_slot", "hash": "e252e03af080530b7b6000fd5c7f222224de5f7652dfead909ba89e897dc0598" }, - { "tag": "0005_feedback_lifecycle", "hash": "7a7c5f346d6ef2b470738ff669332bf05932c1a4ec7bde58ec0070e5d41818f6" }, - { "tag": "0006_stage_job_correlation_id", "hash": "e55eff9ba7cf8408f0c2ac79bc16f3b6716e5b2ce9141cfe83d57ab366f4b833" }, - { "tag": "0007_container_event_correlation_id", "hash": "c24ca9088a296dd8bef540c3a844582f523dfc6bf5e9bb3001ea4e50c552440b" }, - { "tag": "0008_container_launch_correlation_id", "hash": "18ec8fa4fc9dcc947f1e473312716a07453fcf39bac5ae77c842fa2a252054f6" }, - { "tag": "0009_media_usage_counters", "hash": "38484e04e63c9f6e9752a23f6faecc06fb0961447639b925cf256c7a38592baf" }, - { "tag": "0010_key_gpu_time_limit", "hash": "449068bba41e091e4c90989129e1c1b74a7818ab9119f7629238550a65703a85" }, - { "tag": "0011_model_diffusers_variant", "hash": "f4265fcb5c6d332fc8ecbe65023799080410a9b6faa541dca9aca185daedf975" }, - { "tag": "0012_epoch_0_2_cleanup", "hash": "8f25634c1da8fd5d4338b0f14a750977f15b7d40e9b267c2d898b9c3eb4aeeb0" }, - { "tag": "0013_engine_tasks_and_speech_seconds", "hash": "c1bc2c0dc51671c1b8abc59dd41d4056aa4370842aa7bb75c182b999871ef9cc" }, - { "tag": "0014_app_public_url", "hash": "7598bf5802d2482ab934aa55702549df7b8f4c0697d5fdb39769920251462df1" }, - { "tag": "0015_home_text_versions", "hash": "919473455a30458b0b4db6c9192beee6c4f426ca6c74220c578259c58e2952b9" }, - { "tag": "0016_planning_v2", "hash": "857548b731eb5254d10f22166d641fc9e84ab2688573c986bd8225333796f89f" }, - { "tag": "0017_proxy_usage_cold_start_index", "hash": "24de43572b433d943b0af818638713dbb6a7ecf7768ec73ff5db575c50f62a3a" }, - { "tag": "0018_container_event_actor", "hash": "6646cd156c66e043658ac8eca4a59d15d3bf65a30e70dbfeb3106407184268f6" }, - { "tag": "0019_change_events", "hash": "933a9b996355930b705ada678d6736ff813241096d60ede84bcd0e555475b5cc" }, - { "tag": "0020_wall_links", "hash": "7e1b80a64227617521b82ccf2936f0aed307c10ace700b43f0049567b09bc781" }, - { "tag": "0021_quality_evals", "hash": "bc6ff5d628ab06f37508b0fca8dbf809ba5c4ee17a9f3e90e8b85aa29e38ff6b" }, - { "tag": "0022_baskets", "hash": "cc7d2479d6ed13cb9e92d4defaacbf726cfc40c3631bb0f774630db888dc8d06" }, - { "tag": "0023_basket_versions", "hash": "0c372ee34de3b26656c27211d4a04845d5e468883394d199cfd788ffbfdece8f" }, - { "tag": "0024_basket_benchmark_runs", "hash": "9da72ed8d2f8cc3f7ca08f3b6f96695ae80f634ded4a9cd6930740a980ed2913" }, - { "tag": "0025_eval_shared_instance", "hash": "fe2621497ed687d8d86b9977788f22a1b29dfae5442780910f6406721947ff5f" }, - { "tag": "0026_key_sources", "hash": "1b0796535c51367438f0a9617ac46f0933bf4dfbd9ef87359ae4777a861709f5" }, - { "tag": "0027_provider_member_limits", "hash": "0a72581e18deba057eae5f074f9ca91d609a5309fa2b81da46edeb0c1d029d77" }, - { "tag": "0028_basket_poster_drafts", "hash": "6b3bc0fbed24af35bb6325a1613745ae1c82228503508e770127170eb782444c" }, - { "tag": "0029_basket_community_series", "hash": "4bf42d18517aa8043015fab0b8e69c09ae87907bb57a955ca64a753819c106ad" }, - { "tag": "0030_usage_endpoint_index_central_recipe_id", "hash": "806cbe0b1de209ced0fa014afec99731ab614ec97fd5ff7e50d9241e5ccb5d63" }, - { "tag": "0031_drop_cache_dir_legacy_columns", "hash": "dc3f9c5ccf12fe7eb50984972985ab56def56fdf51115b70fc59a5a809b14849" }, - { "tag": "0032_usage_concurrency_required", "hash": "242481109fc71a3772c2520c9ff0af6e7e7ae93235c9dcc19b44a23fc732511d" }, - { "tag": "0033_rename_installation_profiles", "hash": "fd3f235bb7c05f87bda3430feec36444bd62cd1a661407b569ae6ee6dbbc99b6" }, - { "tag": "0034_eval_hub_sharing", "hash": "67f7dc864356a145eb6a0406e17dd0439e0b069dc6c151e7aef112dee11c9eec" }, - { "tag": "0035_saved_posters", "hash": "13a31e98a38b26b6d6d620fcac7c7bd6c75fcedac01f18b3819d2cf3e5d9e65a" }, - { "tag": "0036_app_install_earlier", "hash": "ba07c3e512cf0a37560fb1131fc429ac45d3da4ddf55162c70f8840eb0eb5259" }, - { "tag": "0037_auto_explore_refine_radius", "hash": "b30ab15432198178654820c50e76d3dc6d0f5eabd39c780918b67cdb9917c456" }, - { "tag": "0038_drop_auto_explore_refine_radius", "hash": "ad92fbe53611572ee7090a484942eb48f4f94a78e97cf84c68f8ead78b6572d5" }, - { "tag": "0039_who_uses_what", "hash": "7ed3ddae0cd2769bb0ac16f6b648f33a6c00ceb78e60d45cd2338fa7183c27ac" }, - { "tag": "0040_usage_by_consumer_year", "hash": "f5464c49cbd48c9b588b73d6caa96d619c3fd0aa7283e2ee9c35f25f79052207" }, - { "tag": "0041_test_kitchen_requests", "hash": "fba19529c0eaad751cda07182fc45595ce7dc4e2f64df7a92c5852fa4fe25b94" }, - { "tag": "0042_test_kitchen_benchmark_presets", "hash": "a29bf56be38f5e58c1902c35d8604e14a34b6df2a108394f9036226a517731a2" }, - { "tag": "0043_test_kitchen_creation_requests", "hash": "afd5039c6879c153ab3446114dd7d03d6653e1a3e9451502f7b2fe04e8d3c725" }, - { "tag": "0044_eval_recipe_request_snapshot", "hash": "809382af386dc13095559372493a2590b8c58af76aeb755645dcb6ffd223b008" }, - { "tag": "0045_bench_tested_vram", "hash": "f6912a8fd9a9c07597ee262a237a3b89a6a06673afba712d21ba147202704967" }, - { "tag": "0046_home_app_order", "hash": "683773a89a5b593c648f8ae74d06d2db22e39e90e886c366ec6be0640586e1a9" }, - { "tag": "0047_launch_redispatch", "hash": "2a6fd4259bd506a0534562feecea333c3421a3fe44fc6c634dd41f40c7fa3edd" }, - { "tag": "0048_gpu_share", "hash": "d88b7e600088b8187b209d36a23278d7d0b6f547bdb7aaa16ca3b84c66f6c8a6" }, - { "tag": "0049_api_idempotency_keys", "hash": "e1eac721c33b4fd57c3b9c9b116d08262d092ec40172ca1cdc9b697dabba27d6" }, - { "tag": "0050_gpuh_compute_ms", "hash": "a362a8e70aec39092e1b972c7165aaa979bd855a048b91e2bc5dfabf31d44acb" }, - { "tag": "0051_consumption_hourly", "hash": "ee620b63d19993b44602bd41dcb5ac4842e98af9c58f2851c83b7dbe124ceac9" }, - { "tag": "0052_container_event_snapshot", "hash": "3084c53d8a9b9bb534f7b914423539efae9dcc1338cc52e57a3fe83da9897ed3" }, - { "tag": "0053_model_task_type", "hash": "7771b4de799bb52cadaeed0b4346001dfd4a86d7d7ebc1c2e3341f70e167bf1c" }, - { "tag": "0054_model_capabilities", "hash": "7ffeab02c57e6b9232ae7920cefdbda89cdaa579d49ec91385406dee7e4da17b" }, - { "tag": "0055_engine_help_capture", "hash": "b78663ac43f72c39d2589efbc77dd2fc228402e4388b8be134c9d648f29fecda" }, - { "tag": "0056_planning_live_editing", "hash": "4ca6ff7e0131dd085972869d92e38f1b51ee8457d149c1614e5e5b9ef56e13bc" }, - { "tag": "0057_model_queue_wait_and_capacity_history", "hash": "509915147d34394793b623ab9090b4e4aa345e510615aa021f1a5c6d759c9a3c" }, - { "tag": "0058_proxy_resource_protection", "hash": "19613d8600bc470afb4f75f387d24cdd19255dab203b4b180cb7067b7f3a2ef9" }, - { "tag": "0059_model_measurements_and_eval_pins", "hash": "a934797e8efd117a203f418cbbb30e6b8e447c8b5a8572a169588e487f7ce2ee" }, - { "tag": "0060_asr_timing_and_calibration", "hash": "3ba0e7c4fd7bb722f356bb93efee0823a92402471f707449d82f4ef50567219e" }, - { "tag": "0061_workload_measurement_calibration", "hash": "a3eaadba339c1dd3ef65b9ff9e21e592567b65e4127293ed3c4bf2876c959c07" }, - { "tag": "0062_work_hours", "hash": "fa61a5adcf18538998a099a61c901c1318a23e07bfae4413b357fb0f9656f698" }, - { "tag": "0063_preemptive_start", "hash": "7d6a06f98d68468e81801063ab5d1399b5aac3ecb9eee0d23e9db2a9a182d977" }, - { "tag": "0064_attention_dismissals", "hash": "ff868a28591f0c6bc4cb7f955034cbb2dce467116bb3bf84f4f89b369e8debf4" }, - { "tag": "0065_basket_first_entry_at", "hash": "7807b514173660d9aeb7c5a30fcf55b8c66f31c35779507db2a26b2235d43072" } + { "tag": "0000_baseline", "hash": "e0daa3755cbbf06d867409ceccbc019ae38a97639b435064284f9ccf5435ff4f" } ], "controllerImage": "repo.byterain.io/gpukitchen/gpukitchen-controller", "controllerImageEnterprise": "repo.byterain.io/gpukitchen-private/gpukitchen-controller-ee", - "controllerImageDigest": "sha256:436fe0a694c5d561c0876cf7b6b105f82609ebfc22cb662184873ec238c04b50", - "controllerImageDigestEnterprise": "sha256:74884ad727f7a433ec647f9eb527a5b12409850dbcf137d796411f796a130319", - "gpukScriptSha256": "b84e6b87e3853dadbe7f59c87abbfba2a30b79191c835e11a51789cda6592395", - "workerBuildIdX86_64": "20261009223408-63630b3c571bb6337cde91eb497d21edc7529824", - "workerBuildIdAarch64": "20261009223408-63630b3c571bb6337cde91eb497d21edc7529824", - "workerBase": "https://repo.byterain.io/api/packages/gpukitchen/generic/gpu-kitchen-worker/v0.2.0", - "gpukScript": "https://repo.byterain.io/api/packages/gpukitchen/generic/gpu-kitchen-channel/v0.2.0/gpuk", + "controllerImageDigest": "sha256:905c986a5c295f8cbc271460908242c62b393064f8888b09d8109874848532db", + "controllerImageDigestEnterprise": "sha256:cfab773b80a17bd9c4530889ac008c0930a10407aeb23aa1b911e61024e04436", + "gpukScriptSha256": "6fe709d740fef83ce95e18da9f4dd9cfa212a4325095a490aa8fd735e9f1beca", + "workerBuildIdX86_64": "20261015170044-9d5b9cf87a20a699870b06be00d53cba2e79a11b", + "workerBuildIdAarch64": "20261015170044-9d5b9cf87a20a699870b06be00d53cba2e79a11b", + "workerBase": "https://repo.byterain.io/api/packages/gpukitchen/generic/gpu-kitchen-worker/v0.5.0", + "gpukScript": "https://repo.byterain.io/api/packages/gpukitchen/generic/gpu-kitchen-channel/v0.5.0/gpuk", "releaseNotes": "https://repo.byterain.io/gpukitchen/channel" } diff --git a/latest.json.minisig b/latest.json.minisig index fd9b081..61feac4 100644 --- a/latest.json.minisig +++ b/latest.json.minisig @@ -1,4 +1,4 @@ untrusted comment: signature from minisign secret key -RUQ7BKXJqGX2jdpyEwKZwqDGtqsvqcgiZ06eDnO/WTcMqh1jJqCro9noV54SqlDIz0IV4mlw7nSLdC75KDRwEcmo6mImN4AKWgg= -trusted comment: gpu-kitchen channel v0.2.0 -Gs2rNZ1uHXeNhNEuR/W02ZK/mHp3xMag+uyE0wChmPfl/W4s9UElQau9C8o4RG+tczLsdCh6aid5NUSqOg2vAQ== +RUQ7BKXJqGX2jX45BG7UnMRefeMegGcFhEKaZblv6gk7lRRY3eTwU0hcpNq1bXjKC1sjAP/kK4/cDakkkVj+GWOzHl3ijf5A/ws= +trusted comment: gpu-kitchen channel v0.5.0 +Uv/2wZw187GBHWIVzL884HO9xcghYy6+7cD4BZE2fyRXf10eCt1Hx/pGyJJgJUGNB9wqM+/jnTjREcKCoU6KCg==