diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 6ffdf4a81b0..b6545a1a0e5 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -783,7 +783,7 @@ Docker Compose provides the full local development stack. All services include h | Postgres | `postgres:17-alpine` | 5432 | Primary event store — events, channels, tokens, workflows, audit; full-text search (`search_tsv` GIN) | | Redis | `redis:7-alpine` | 6379 | Pub/sub fan-out, presence (SET EX), typing (sorted sets) | | Adminer | `adminer` | 8082 | DB web UI (dev only) | -| MinIO | `cgr.dev/chainguard/minio` (dev/CI) | 9000 (API), 9001 (console) | S3-compatible object storage (media) | +| MinIO | `cgr.dev/chainguard/minio:latest-dev` (digest-pinned in `deploy/compose` and the chart quickstart; dev and CI compose files track `latest-dev`) | 9000 (API), 9001 (console) | S3-compatible object storage (media) | | Prometheus | `prom/prometheus` | 9090 | Metrics collection | ### Postgres Schema (key tables) diff --git a/deploy/charts/buzz/templates/quickstart-minio.yaml b/deploy/charts/buzz/templates/quickstart-minio.yaml index 9685a7ff34e..4fcc0304b6b 100644 --- a/deploy/charts/buzz/templates/quickstart-minio.yaml +++ b/deploy/charts/buzz/templates/quickstart-minio.yaml @@ -28,6 +28,44 @@ spec: {{- include "buzz.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: minio spec: + {{- with .Values.minio.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.minio.fixDataOwnership }} + initContainers: + # Volumes written by the old root-run minio/minio image are root-owned, + # and fsGroup does not fix hostPath-backed PVCs. Hand them over to the + # nonroot uid. The walk is skipped once nothing is left to change, so a + # reschedule costs one find; files that vanish mid-walk are tolerated + # and only ownership still wrong afterwards fails the pod. + - name: data-ownership + image: {{ .Values.minio.image | quote }} + command: + - /bin/sh + - -c + - | + # Vanished entries ("No such file") are expected while MinIO serves; + # any other find error means /data could not be checked. + scan() { + out="$(find /data -xdev ! -user 65532 -print -quit 2>&1)" + bad="$(printf '%s\n' "$out" | grep '^find: ' | grep -v 'No such file or directory')" + [ -z "$bad" ] || { echo "data-ownership: cannot scan /data: $bad" >&2; exit 1; } + printf '%s\n' "$out" | grep '^/' | head -n 1 + } + first="$(scan)" || exit 1 + [ -z "$first" ] && exit 0 + chown -Rh 65532:65532 /data || true + left="$(scan)" || exit 1 + [ -z "$left" ] && exit 0 + echo "data-ownership: $left is not owned by 65532 (set minio.fixDataOwnership=false if the storage rejects root chown)" >&2 + exit 1 + securityContext: + runAsUser: 0 + runAsNonRoot: false + volumeMounts: + - { name: data, mountPath: /data } + {{- end }} containers: - name: minio image: {{ .Values.minio.image | quote }} diff --git a/deploy/charts/buzz/tests/quickstart_bundled_test.yaml b/deploy/charts/buzz/tests/quickstart_bundled_test.yaml index ecb7877e9f0..1a7ef2b2d43 100644 --- a/deploy/charts/buzz/tests/quickstart_bundled_test.yaml +++ b/deploy/charts/buzz/tests/quickstart_bundled_test.yaml @@ -88,3 +88,50 @@ tests: path: spec.selector["app.kubernetes.io/component"] value: relay template: templates/service.yaml + + # The Chainguard image runs as uid 65532; volumes from the old root-run + # minio/minio image need a root ownership hand-over, which some storage + # (NFS root_squash) and namespaces (PSA restricted) refuse. + - it: hands a root-owned MinIO volume to uid 65532 by default + release: + name: rel + set: + relayUrl: wss://buzz.example.com + ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000" + postgresql.enabled: true + redis.enabled: true + minio.enabled: true + template: templates/quickstart-minio.yaml + documentIndex: 0 + asserts: + - equal: + path: spec.template.spec.securityContext + value: { fsGroup: 65532, fsGroupChangePolicy: OnRootMismatch } + - equal: + path: spec.template.spec.initContainers[0].name + value: data-ownership + - equal: + path: spec.template.spec.initContainers[0].securityContext.runAsUser + value: 0 + - matchRegex: + path: spec.template.spec.initContainers[0].command[2] + pattern: "chown -Rh 65532:65532 /data" + + - it: drops the root init container when minio.fixDataOwnership=false + release: + name: rel + set: + relayUrl: wss://buzz.example.com + ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000" + postgresql.enabled: true + redis.enabled: true + minio.enabled: true + minio.fixDataOwnership: false + minio.podSecurityContext: null + template: templates/quickstart-minio.yaml + documentIndex: 0 + asserts: + - notExists: + path: spec.template.spec.initContainers + - notExists: + path: spec.template.spec.securityContext diff --git a/deploy/charts/buzz/values.schema.json b/deploy/charts/buzz/values.schema.json index aaab848fd33..4ea251a176d 100644 --- a/deploy/charts/buzz/values.schema.json +++ b/deploy/charts/buzz/values.schema.json @@ -224,6 +224,8 @@ "enabled": { "type": "boolean" }, "image": { "type": "string", "minLength": 1 }, "mcImage": { "type": "string", "minLength": 1 }, + "fixDataOwnership": { "type": "boolean" }, + "podSecurityContext": { "type": ["object", "null"] }, "persistence": { "type": "object", "additionalProperties": false, diff --git a/deploy/charts/buzz/values.yaml b/deploy/charts/buzz/values.yaml index 6c57a5c8ac9..89b029ae692 100644 --- a/deploy/charts/buzz/values.yaml +++ b/deploy/charts/buzz/values.yaml @@ -367,8 +367,26 @@ s3: # this disabled and use s3.* (or secrets.existingSecret) against managed S3. minio: enabled: false # quickstart: set true for bundled in-cluster MinIO - image: minio/minio:RELEASE.2025-09-07T16-13-09Z - mcImage: minio/mc:RELEASE.2025-08-13T08-35-41Z + # minio/minio and minio/mc left Docker Hub and Quay. Chainguard's free images + # (latest tags only) are pinned by digest; -dev variants carry the /bin/sh the + # init job needs. They run as uid 65532 (see quickstart-minio fsGroup). + # These digests were minio RELEASE.2026-09-22T19-25-18Z (the old pin was + # RELEASE.2025-09-07T16-13-09Z); check `minio --version` when bumping them. + image: cgr.dev/chainguard/minio:latest-dev@sha256:1f74aba71eff94011dbcb62947354f19d6e6efda5facd023fa3f4560d2a088d4 + mcImage: cgr.dev/chainguard/minio-client:latest-dev@sha256:2d11d09801b035510cb0c2ff0c64aa016fc94f0c4e7055a31ec17cf41dd154cb + # Root initContainer that hands a root-owned volume (written by the old + # minio/minio image) to uid 65532 before MinIO starts; it skips the chown + # (not the ownership scan) once ownership is right. Set false when the storage + # rejects root chown (NFS root_squash) or the namespace forbids root init + # containers; the volume must then already be writable by uid 65532. This + # quickstart sets no container securityContext, so false alone does not make + # it pass PSA restricted or OpenShift restricted-v2. + fixDataOwnership: true + # Pod securityContext for MinIO. OpenShift restricted-v2 assigns its own + # fsGroup range: set this to null there ({} merges with the defaults). + podSecurityContext: + fsGroup: 65532 + fsGroupChangePolicy: OnRootMismatch persistence: enabled: true size: 10Gi diff --git a/deploy/compose/README.md b/deploy/compose/README.md index bb0e63fe15d..8661881d577 100644 --- a/deploy/compose/README.md +++ b/deploy/compose/README.md @@ -46,6 +46,27 @@ keypair. Run `./run.sh backup-hint` for the backup checklist. +### Moving off the Docker Hub MinIO image + +`minio/minio` and `minio/mc` are gone from Docker Hub. The stack now runs +Chainguard's MinIO (uid 65532, a newer MinIO release, so the on-disk format may +change one way). The `minio-perms` step hands an old root-owned `buzz-minio-data` +volume to uid 65532, but it must not run while the old root-run container is +still writing. Move over once, in this order: + +```bash +cd deploy/compose +docker compose stop relay minio # quiesce writers first +docker run --rm -v buzz-prod_buzz-minio-data:/data -v /var/backups:/backup alpine \ + tar czf /backup/minio-data-$(date +%F).tgz -C /data . # back up the volume +./run.sh pull +./run.sh start # runs minio-perms, then minio, then relay +``` + +Check the volume name with `docker volume ls | grep minio` (the project name is +`buzz-prod`). To roll the data back, restore the archive into the volume; the old +image is no longer pullable, so keep any local copy of it on the host. + ## Validation Before sharing an install link publicly, verify a fresh install with: diff --git a/deploy/compose/compose.yml b/deploy/compose/compose.yml index 15337c92a27..a5da25c1090 100644 --- a/deploy/compose/compose.yml +++ b/deploy/compose/compose.yml @@ -84,16 +84,58 @@ services: networks: - buzz-net + # The Chainguard MinIO image runs as uid 65532; volumes written by the old + # root-run minio/minio image are root-owned. Hand them over before start. + # `up` reruns this while MinIO may be serving, so the walk is skipped once + # nothing is left to change, files that vanish mid-walk are tolerated, and + # only ownership still wrong afterwards fails the step. + # First move off the old root-run image: stop relay and minio BEFORE `up` + # (see README, "Moving off the Docker Hub MinIO image"), or the old container + # can write root-owned files after this step has finished. + minio-perms: + image: cgr.dev/chainguard/minio:latest-dev@sha256:1f74aba71eff94011dbcb62947354f19d6e6efda5facd023fa3f4560d2a088d4 + user: "0:0" + entrypoint: + - /bin/sh + - -c + - | + # Vanished entries ("No such file") are expected while MinIO serves; + # any other find error means /data could not be checked. + scan() { + out="$$(find /data -xdev ! -user 65532 -print -quit 2>&1)" + bad="$$(printf '%s\n' "$$out" | grep '^find: ' | grep -v 'No such file or directory')" + [ -z "$$bad" ] || { echo "minio-perms: cannot scan /data: $$bad" >&2; exit 1; } + printf '%s\n' "$$out" | grep '^/' | head -n 1 + } + first="$$(scan)" || exit 1 + [ -z "$$first" ] && exit 0 + chown -Rh 65532:65532 /data || true + left="$$(scan)" || exit 1 + [ -z "$$left" ] && exit 0 + echo "minio-perms: $$left is not owned by 65532" >&2 + exit 1 + volumes: + - buzz-minio-data:/data + network_mode: none + labels: + com.buzz.role: minio-ownership-migration + restart: "no" + minio: - image: minio/minio:RELEASE.2025-09-07T16-13-09Z + # minio/minio left Docker Hub; -dev adds sh and wget. This digest is minio + # RELEASE.2026-09-22T19-25-18Z (the old pin was RELEASE.2025-09-07T16-13-09Z). + image: cgr.dev/chainguard/minio:latest-dev@sha256:1f74aba71eff94011dbcb62947354f19d6e6efda5facd023fa3f4560d2a088d4 command: server /data --console-address ":9001" + depends_on: + minio-perms: + condition: service_completed_successfully environment: MINIO_ROOT_USER: ${BUZZ_S3_ACCESS_KEY:?set BUZZ_S3_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${BUZZ_S3_SECRET_KEY:?set BUZZ_S3_SECRET_KEY} volumes: - buzz-minio-data:/data healthcheck: - test: ["CMD", "curl", "-f", "http://127.0.0.1:9000/minio/health/live"] + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9000/minio/health/live"] interval: 5s timeout: 5s retries: 12 @@ -103,7 +145,7 @@ services: - buzz-net minio-init: - image: minio/mc:RELEASE.2025-08-13T08-35-41Z + image: cgr.dev/chainguard/minio-client:latest-dev@sha256:2d11d09801b035510cb0c2ff0c64aa016fc94f0c4e7055a31ec17cf41dd154cb depends_on: minio: condition: service_healthy diff --git a/renovate.json b/renovate.json index 91bd5fcc837..563c9760b68 100644 --- a/renovate.json +++ b/renovate.json @@ -10,6 +10,15 @@ "recreateWhen": "always", "separateMinorPatch": true, "postUpdateOptions": ["cargo:updateLockfile"], + "customManagers": [ + { + "description": "Renovate's helm-values manager only reads keys named image; minio.mcImage needs its own rule so its digest is refreshed with the minio image.", + "customType": "regex", + "managerFilePatterns": ["/^deploy/charts/buzz/values\\.yaml$/"], + "matchStrings": ["mcImage: (?[^:\\s]+):(?[^@\\s]+)@(?sha256:[a-f0-9]{64})"], + "datasourceTemplate": "docker" + } + ], "packageRules": [ { "description": "Major version bumps often require code changes — require human review.", @@ -46,6 +55,14 @@ "matchManagers": ["cargo"], "allowedVersions": "<1.2.0" }, + { + "description": "MinIO runs from Chainguard's free latest-dev tags pinned by digest; superseded digests are not retained, so refresh them weekly. A digest bump can carry a new MinIO release with a one-way on-disk migration: never automerge. Digests carry no release timestamp, so the global timestamp-required release-age gate is lifted here.", + "matchPackageNames": ["cgr.dev/chainguard/**"], + "groupName": "chainguard minio images", + "schedule": ["before 6am on monday"], + "minimumReleaseAge": null, + "automerge": false + }, { "description": "tiptap 3.23.x breaks editor lifecycle under real relay latency — pin until upstream stabilizes.", "matchPackageNames": ["@tiptap/{/,}**"],