immich-app / immich-charts

Helm chart implementation of Immich
https://immich.app
GNU Affero General Public License v3.0
117 stars 49 forks source link

feat: support server configuration as code (using immich-config.json) #76

Closed hiteshnayak305 closed 5 months ago

hiteshnayak305 commented 6 months ago

Description of the change

Support configuration of immich settings using helm chart.

values.yaml example

...
immich:
  configuration: 
    trash:
      enabled: true
      days: 30
...

Applicable issues

Open Point

No open points

Use cases

hiteshnayak305 commented 6 months ago

For now using two separate config map for microservices and server.

  1. Tried with own template for configmap but change in configuration is not rolling deployments on upgrade.
  2. I think same will occur when deploy configmap through library usage. But I don't have any refrence or docs.
bo0tzz commented 6 months ago

Tried with own template for configmap but change in configuration is not rolling deployments on upgrade.

I think this issue happens because the Deployment isn't actually changing, and Kubernetes won't automatically reload configmaps. This would be fixed by generating a new configmap every time the config file changes (https://stackoverflow.com/a/40624029). We could do this for example by including the first section of the configuration's hash in the configmap name (also see https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments).

I think same will occur when deploy configmap through library usage. But I don't have any refrence or docs.

The library handles this by applying a trick like above: it adds the hash of the configmap as an annotation on the pod (see https://github.com/bjw-s/helm-charts/blob/923ef40a39520979c98f354ea23963ee54f54433/charts/library/common/templates/lib/metadata/_podAnnotations.tpl#L7-L15). However, I had a quick attempt at using the library's configmap and it seems more trouble than it's worth, and I also think it might not work nicely with the hashing that it does.

If you're up for it, let's try our own configmap template with the hash trick (or something like it).

hiteshnayak305 commented 6 months ago

I looked into https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments , to achieve this we need to set annotation inside deployment spec which is not exposed by library. Let me know if possible in any ways.

Current changes contains redundant config maps but reloading is working properly.

bo0tzz commented 6 months ago

I think it can be done with podAnnotations in the values. Another option might be to append (part of) the hash to the name of the configmap.

hiteshnayak305 commented 5 months ago

Thanks. It worked. Using custom configMap also resolves condition for {{, no need to wrap in {{`.