From 05864f3c2c1fd66529663c4977b39417a7d3ec6a Mon Sep 17 00:00:00 2001 From: Hermes DevOps Date: Thu, 19 Nov 2026 16:15:29 -0500 Subject: [PATCH] apps(siriusdevops): serve owner media from the private Garage bucket - site image pinned to :4d03fc814d39... (nginx.conf gains location /media/) - initContainer media-sync pulls s3://siriusdevops-media from 10.10.0.1:3900 over the WireGuard mesh into an emptyDir mounted at /usr/share/nginx/html/media; creds from secret garage-media-s3 - the sync retries 5x then exits 0, so a Garage outage cannot take the site down (headshot falls back to its monogram) - the bucket stays private: no website access, no public hostname --- apps/base/siriusdevops/deployment-site.yaml | 62 ++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/apps/base/siriusdevops/deployment-site.yaml b/apps/base/siriusdevops/deployment-site.yaml index 0bb6daa..00b5cd3 100644 --- a/apps/base/siriusdevops/deployment-site.yaml +++ b/apps/base/siriusdevops/deployment-site.yaml @@ -19,13 +19,70 @@ spec: effect: PreferNoSchedule nodeSelector: kubernetes.io/hostname: siriussec + # Owner media is NOT in the image, and the Garage bucket stays private + # (WireGuard-only: no website access, no public hostname). This + # initContainer pulls s3://siriusdevops-media over the mesh into an + # emptyDir that nginx serves at /media/. Baked assets (site.css, og.png, + # favicon, screenshots) stay baked - scope is owner media only. + # + # It must never take the site down: if Garage is unreachable at boot it + # retries a few times, then exits 0 with a warning and the page serves + # with the monogram fallback instead of the headshot. + initContainers: + - name: media-sync + image: amazon/aws-cli@sha256:7a77ccb39e3272191adbf905c50db8c127db88fd79454911a41a6b1c0e419e9b + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - | + set -u + for attempt in 1 2 3 4 5; do + if aws s3 sync "s3://siriusdevops-media/" /media/ \ + --endpoint-url http://10.10.0.1:3900 \ + --only-show-errors; then + echo "media sync ok (attempt $attempt): $(ls -R /media | head -20)" + exit 0 + fi + echo "media sync attempt $attempt failed; retrying in 10s" + sleep 10 + done + echo "WARNING: media sync failed after 5 attempts - serving without /media (headshot falls back to monogram)" + exit 0 + env: + # aws-cli v2 sends a CRC32 checksum header on PutObject/HeadObject + # by default and Garage v1.1.0 rejects it as "invalid checksum + # algorithm" - only send checksums when an operation requires one. + - name: AWS_DEFAULT_REGION + value: garage + - name: AWS_EC2_METADATA_DISABLED + value: "true" + - name: AWS_REQUEST_CHECKSUM_CALCULATION + value: when_required + - name: AWS_RESPONSE_CHECKSUM_VALIDATION + value: when_required + envFrom: + - secretRef: + name: garage-media-s3 + volumeMounts: + - name: media + mountPath: /media + resources: + requests: + cpu: 10m + memory: 32Mi + limits: + memory: 128Mi containers: - name: nginx - image: forgejo.siriusdevops.com/sirius/siriusdevops-site:f0dde2f48c8224fb80d801ecb0d155c93332dc13 + image: forgejo.siriusdevops.com/sirius/siriusdevops-site:4d03fc814d39faaf5d8cc64b794aa4bc19f72995 imagePullPolicy: IfNotPresent ports: - containerPort: 80 name: http + volumeMounts: + - name: media + mountPath: /usr/share/nginx/html/media readinessProbe: httpGet: path: / @@ -38,3 +95,6 @@ spec: memory: 64Mi limits: memory: 256Mi + volumes: + - name: media + emptyDir: {}