# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/refs/heads/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: name: &app blog namespace: blog spec: interval: 15m chart: spec: chart: app-template version: 4.0.1 sourceRef: kind: HelmRepository name: bjw-s namespace: flux-system values: controllers: main: type: deployment annotations: reloader.stakater.com/auto: "true" pod: securityContext: fsGroup: 65533 runAsUser: 65533 runAsGroup: 65533 initContainers: git-sync-init: image: repository: registry.k8s.io/git-sync/git-sync tag: v4.3.0 securityContext: runAsUser: 65533 runAsGroup: 65533 env: GITSYNC_REPO: https://github.com/razelighter777/site.git GITSYNC_ROOT: /git GITSYNC_LINK: current GITSYNC_ONE_TIME: "true" containers: main: image: repository: docker.io/hugomods/hugo tag: nightly-non-root command: ["/bin/sh"] args: - -c - | LAST_HASH="" while true; do # Get current git hash from outside the blog directory CURRENT_HASH=$(readlink /git/current 2>/dev/null || echo "unknown") # If git sync updated, rebuild everything if [ "$CURRENT_HASH" != "$LAST_HASH" ]; then echo "Detected git update (hash: $CURRENT_HASH), rebuilding site..." cd /git/current/blog || { echo "Failed to cd, retrying..."; sleep 5; continue; } # Install npm dependencies npm install || { echo "npm install failed, retrying..."; sleep 5; continue; } # Compile Tailwind CSS echo "Compiling Tailwind CSS..." npx @tailwindcss/cli -i ./assets/css/input.css -o ./assets/css/output.css --minify || { echo "CSS compilation failed, retrying..."; sleep 5; continue; } # Build Hugo to output directory echo "Building Hugo site..." hugo --destination /output --baseURL https://blog.${domain_name} --cacheDir /tmp/hugo_cache || { echo "Hugo build failed, retrying..."; sleep 5; continue; } LAST_HASH="$CURRENT_HASH" echo "Site built successfully" fi sleep 10 done env: TZ: ${timezone} HOME: /tmp npm_config_cache: /tmp/.npm resources: requests: cpu: 100m memory: 128Mi limits: memory: 512Mi nginx: image: repository: docker.io/nginxinc/nginx-unprivileged tag: 1.29-alpine resources: requests: cpu: 50m memory: 32Mi limits: memory: 128Mi git-sync: image: repository: registry.k8s.io/git-sync/git-sync tag: v4.3.0 securityContext: runAsUser: 65533 runAsGroup: 65533 env: GITSYNC_REPO: https://github.com/razelighter777/site.git GITSYNC_ROOT: /git GITSYNC_LINK: current GITSYNC_PERIOD: 60s GITSYNC_ONE_TIME: "false" GITSYNC_MAX_FAILURES: "-1" resources: requests: cpu: 50m memory: 64Mi limits: memory: 128Mi service: main: controller: main ports: http: port: 80 targetPort: 8080 appProtocol: http ingress: main: enabled: false persistence: blog-source: enabled: true type: emptyDir advancedMounts: main: main: - path: /git git-sync-init: - path: /git git-sync: - path: /git blog-output: enabled: true type: emptyDir advancedMounts: main: main: - path: /output nginx: - path: /usr/share/nginx/html readOnly: true