djjudas21 / charts

Collection of Helm charts
14 stars 7 forks source link

[homer] Persistence settings #44

Open sergio-bastian opened 1 year ago

sergio-bastian commented 1 year ago

Describe the bug a clear and concise description of what the bug is.

Hello.

In you Homer HomeLab Dashboard Chart persistence configuration in the values.yaml file hasn't any effect in the deployment. No PVC is created in the helm apply command (I used helmfile instead of helm):

image

In your other Chart for Heimdall Dashboards it works properly, and the resource PVC is created:

image

I have got both Charts but I couldn't find any difference yet.

Regards

What's your helm version?

version.BuildInfo{Version:"v3.12.1", GitCommit:"f32a527a060157990e2aa86bf45010dfb3cc8b8d", GitTreeState:"clean", GoVersion:"go1.20.5"}

What's your kubectl version?

Client Version: v1.24.13 Kustomize Version: v4.5.4 Server Version: v1.24.12-gke.1000

Which chart?

https://github.com/djjudas21/charts/tree/main/charts/homer

What's the chart version?

8.1.7

What happened?

No effect with Persistence values, so no PVC is created.

What you expected to happen?

Something wrong in the Chart.

How to reproduce it?

With helmfile -i apply no PVC resource to create is shown.

Enter the changed values of values.yaml?

persistence: config: enabled: true mountPath: /www/assets type: pvc retain: true readOnly: false storageClass: regional-ssd accessMode: ReadWriteOnce size: 10Gi

Enter the command that you execute and failing/misfunctioning.

helmfile -i apply

Anything else we need to know?

In https://github.com/djjudas21/charts/tree/bd2d95da3e068765b9a3e3ab31b0b7981a35b7ee/charts/heimdall with the same configuration and, apparently, same Charts it works properly.

djjudas21 commented 1 year ago

Thanks for reporting. I will check this out tonight

djjudas21 commented 12 months ago

I've had a look at this. I think this is because the Homer chart isn't supposed to be used with a PVC, but with a yaml file in a ConfigMap that gets mounted as a volume. This is hard-coded as a volume called config: https://github.com/djjudas21/charts/blob/main/charts/homer/templates/common.yaml#L14

I think if you rename your PVC to anything else except config it should work for you. Can you try this and let me know?

sergio-bastian commented 12 months ago

Hi djjuas21.

I agree with you, but keep in mind that if you want to use icons in your URL entries PVC is neccesary. Have a look the example URLs which logos are in asset/tools folder by default. Without PVC every config change applied in the CM will recreate the POD storage, so all logos will dessapear.

I tried to create my own PVC outside the chart and then used the parameter persistence.config.existingClaim without success. The deployment never takes this config.

Regards

sergio-bastian commented 12 months ago

Other test I have tried, creating my own PVC and editing the deployment to mount the folder assets/tools as Volume, but the user:group owner is created for root:root and permissions for lighthttpd user to write there is not allowed. So wget any logo there is not possible.

image
djjudas21 commented 12 months ago

I think never ran into this problem with PVCs because I'm actually using a ConfigMap to store my images, as it is easy to populate the ConfigMap at deployment time. You just have to keep the total size of logos under 256KB. This also means Homer does not depend on any persistent storage and can start up fast.

There's nothing secret on my Homer site so I can share my entire config. I have a deployment directory like this:

[jonathan@poseidon-gazeley-uk homer]$ tree
.
├── deploy.sh
├── logos
│   ├── bookstack.png
│   ├── camerahub.png
│   ├── ceph.png
│   ├── grafana.png
│   ├── influxdb.png
│   ├── joplin.png
│   ├── minio.png
│   ├── navidrome.png
│   ├── owncloud.png
│   ├── paperless.png
│   ├── photoprism.png
│   ├── pihole.png
│   ├── portainer.png
│   ├── postgres.png
│   ├── prometheus.png
│   ├── truenas.png
│   └── webtrees.png
├── README.md
└── values.yaml

deploy.sh

#!/bin/sh
helm upgrade -i --create-namespace \
    -n homer homer \
    -f values.yaml \
    djjudas21/homer
kubectl create configmap -n homer homer-images --from-file=logos --dry-run=client -o yaml | kubectl apply -f -

values.yaml

env:
  # -- Set the container timezone
  TZ: Europe/London

controller:
  replicas: 2
  strategy: RollingUpdate
affinity:
  podAntiAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
    - weight: 100
      podAffinityTerm:
        labelSelector:
          matchExpressions:
          - key: app.kubernetes.io
            operator: In
            values:
            - homer
        topologyKey: kubernetes.io/hostname

ingress:
  main:
    enabled: true
    annotations:
      cert-manager.io/cluster-issuer: "letsencrypt-prod"
    ingressClassName: "public"
    hosts:
      - host: apps.gazeley.uk
        paths:
          - path: /
            pathType: Prefix
    tls:
      - secretName: homer-tls
        hosts:
          - apps.gazeley.uk
persistence:
  images:
    name: homer-images
    enabled: true
    mountPath: /www/assets/custom
    type: configMap

priorityClassName: normal-priority

resources:
  limits:
    memory: 64Mi
  requests:
    cpu: 1m
    memory: 4Mi

configmap:
  images:
    enabled: true
  config:
    # -- Store homer configuration as a ConfigMap
    enabled: true
    # -- Homer configuration. See [image documentation](https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md) for more information.
    # @default -- See values.yaml
    data:
      config.yml: |
        # Homepage configuration
        # See https://fontawesome.com/icons for icons options
        title: "App dashboard"
        subtitle: "Jonathan Gazeley"
        icon: "fas fa-icons" # Optional icon
        header: true
        footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it.
        # Optional navbar
        # links: [] # Allows for navbar (dark mode, layout, and search) without any links
        links: []
          #      - name: "Contribute"
          #  icon: "fab fa-github"
          #  url: "https://github.com/bastienwirtz/homer"
          #  target: "_blank"
          #- name: "Wiki"
          #  icon: "fas fa-book"
          #  url: "https://www.wikipedia.org/"
        # Services
        # First level array represent a group.
        # Leave only a "items" key if not using group (group name, icon & tagstyle are optional, section separation will not be displayed).
        services:
          - name: "Public apps"
            icon: "fas fa-cloud"
            items:
              - name: "Biosite"
                icon: "fas fa-user"
                subtitle: "Biosite for Jonathan Gazeley"
                tag: "app"
                url: "https://jonathan.gazeley.uk"
                target: "_blank"
              - name: "LittleLink"
                icon: "fas fa-link"
                subtitle: "Social links for Jonathan Gazeley"
                tag: "app"
                url: "https://littlelink.gazeley.uk"
                target: "_blank"
              - name: "CameraHub"
                logo: "assets/custom/camerahub.png"
                subtitle: "App for cataloguing vintage cameras"
                tag: "app"
                url: "https://camerahub.info"
                target: "_blank"
              - name: "CameraHub Dev"
                logo: "assets/custom/camerahub.png"
                subtitle: "App for cataloguing vintage cameras"
                tag: "app"
                url: "https://dev.camerahub.info"
                target: "_blank"
              - name: "BookStack"
                logo: "assets/custom/bookstack.png"
                subtitle: "Platform for organising and storing information"
                tag: "app"
                url: "https://docs.gazeley.uk/"
                target: "_blank"
              - name: "St Mary's Music Library"
                logo: "assets/custom/navidrome.png"
                subtitle: "Music collection server and streamer"
                tag: "app"
                url: "https://music.stmarysfishponds.org.uk/"
                target: "_blank"
          - name: "Private apps"
            icon: "fas fa-user-shield"
            items:
              - name: "ownCloud"
                logo: "assets/custom/owncloud.png"
                subtitle: "File sync server"
                tag: "app"
                url: "https://owncloud.jonathangazeley.com"
                target: "_blank"
              - name: "Navidrome"
                logo: "assets/custom/navidrome.png"
                subtitle: "Music collection server and streamer"
                tag: "app"
                url: "https://music.gazeley.uk/"
                target: "_blank"
              - name: "PhotoPrism"
                logo: "assets/custom/photoprism.png"
                subtitle: "Photo album"
                tag: "app"
                url: "https://photos.gazeley.uk/"
                target: "_blank"
              - name: "Webtrees"
                logo: "assets/custom/webtrees.png"
                subtitle: "Online collaborative genealogy application"
                tag: "app"
                url: "https://webtrees.gazeley.uk"
                target: "_blank"
              - name: "Hammond"
                icon: "fas fa-gas-pump"
                subtitle: "Vehicle expense tracking system"
                tag: "app"
                url: "https://hammond.gazeley.uk"
                target: "_blank"
              - name: "Portainer"
                logo: "assets/custom/portainer.png"
                subtitle: "Manage your Kubernetes cluster"
                tag: "management"
                url: "https://kube.gazeley.uk"
                target: "_blank"
              - name: "Grafana"
                logo: "assets/custom/grafana.png"
                subtitle: "Analytics & monitoring solution"
                tag: "monitoring"
                url: "https://grafana.gazeley.uk"
                target: "_blank"
              - name: "Paperless"
                logo: "assets/custom/paperless.png"
                subtitle: "Archive all of your paper documents"
                tag: "app"
                url: "https://paperless.gazeley.uk"
                target: "_blank"
              - name: "Joplin"
                logo: "assets/custom/joplin.png"
                subtitle: "Note-taking app"
                tag: "app"
                url: "https://joplin.gazeley.uk"
                target: "_blank"
              - name: "InfluxDB"
                logo: "assets/custom/influxdb.png"
                subtitle: "Time series database"
                tag: "monitoring"
                url: "https://influxdb.gazeley.uk"
                target: "_blank"
              - name: "Prometheus"
                logo: "assets/custom/prometheus.png"
                subtitle: "Monitoring system & time series database"
                tag: "monitoring"
                url: "https://prometheus.gazeley.uk"
                target: "_blank"
              - name: "Alertmanager"
                logo: "assets/custom/prometheus.png"
                subtitle: "Handle alerts sent by Prometheus"
                tag: "monitoring"
                url: "https://alertmanager.gazeley.uk"
                target: "_blank"
              - name: "Minio"
                logo: "assets/custom/minio.png"
                subtitle: "Minio Console for object storage"
                tag: "monitoring"
                url: "https://console.minio.gazeley.uk"
                target: "_blank"
              - name: "Ceph Dashboard"
                logo: "assets/custom/ceph.png"
                subtitle: "Dashboard for Rook/Ceph"
                tag: "monitoring"
                url: "https://ceph.gazeley.uk"
                target: "_blank"
          - name: "LAN devices"
            icon: "fas fa-server"
            items:
              - name: "Router"
                icon: "fas fa-wifi"
                subtitle: ""
                tag: ""
                url: "http://router.gazeley.lan"
                target: "_blank"
              - name: "Pi-hole"
                logo: "assets/custom/pihole.png"
                subtitle: "Network-wide Ad Blocking"
                tag: "monitoring"
                url: "https://pihole.gazeley.uk/admin/login.php"
                target: "_blank"
              - name: "TrueNAS"
                logo: "assets/custom/truenas.png"
                tag: ""
                url: "http://nas.gazeley.lan"
                target: "_blank"
              - name: "Printer"
                icon: "fas fa-print"
                subtitle: "HP LaserJet P1606dn"
                tag: ""
                url: "http://printer.gazeley.lan"
                target: "_blank"
sergio-bastian commented 11 months ago

The problem with this solution is the limit storage in the ControlPlane, as you said.

Using other persistent group different of config solve this issue, but only accepts RWO because Many not allow mountPath option, so is neccesary to play with RollingUpdates options (maxUnavailable and surge).

But I solve my issue using URLs instead of relative paths in the logo section of each item. No storage is neccesary.

Thanks for your help and time.

djjudas21 commented 11 months ago

Oh cool, I didn't realise you could use URLs in there! Glad you have a solution now.

It's also worth noting that I copied this chart from the deprecated k8sathome/charts repo and adapted it for my needs. The upstream chart may have different options for PVC, I can't remember.