Bug: config.json is reset to default whenever the pod is recreated #28

Closed
opened 2026-02-15 19:15:35 -05:00 by yindo · 2 comments
Owner

Originally created by @Infinoid on GitHub (Aug 15, 2024).

The initContainer copies default files into the data volume whenever it runs, and it runs every time the pod is recreated.

This defeats the purpose of storing config.json in persistent storage, because any settings I make in the admin panel are reset whenever I update the helm chart, modify an environment variable, etc.

To reproduce:

  1. install the helm chart with persistence.enabled=true (it's on by default)
  2. create an admin user, log in
  3. go to admin panel, set the default model (to llama3.1:8b in my case)
  4. cause the pod to be restarted, for instance by doing one of the following:
    • do a helm upgrade to --set some values (example: add a resource request to ensure it always has at least 1GB of memory)
    • do a kubectl rollout restart statefulset/open-webui to get the latest docker image (new releases seem to come out about once per week)
    • take the cluster node down for an OS update, so that k8s migrates it to a new node (by recreating the pod)
  5. log in again
  6. go to admin panel, see that the default model is no longer set

The initContainer mounts the persistent volume at /tmp/app-data and runs this cp command, which clobbers the config.json file:

        command: ['sh', '-c', 'cp -R /app/backend/data/* /tmp/app-data/']

What do you think about passing the --update=none flag? From the cp docs:

Do not copy a non-directory that has an existing destination with the same or newer modification timestamp; instead, silently skip the file without failing.
[snip]
‘none’
This is like the deprecated --no-clobber option, where no files in the destination are replaced, and also skipping a file does not induce a failure.

I don't fully understand the other files in there. I don't know if config.json is the only file that should be preserved, or if this logic also applies to the other stuff. But config.json is definitely a problem.

Originally created by @Infinoid on GitHub (Aug 15, 2024). The [initContainer](https://github.com/open-webui/helm-charts/blob/3cf45141663a635cb37477eea2f7215ea8b6b524/charts/open-webui/templates/workload-manager.yaml#L32-L45) copies default files into the data volume whenever it runs, and it runs every time the pod is recreated. This defeats the purpose of storing `config.json` in persistent storage, because any settings I make in the admin panel are reset whenever I update the helm chart, modify an environment variable, etc. To reproduce: 1. install the helm chart with `persistence.enabled=true` (it's on by default) 2. create an admin user, log in 3. go to admin panel, set the default model (to `llama3.1:8b` in my case) 4. cause the pod to be restarted, for instance by doing one of the following: * do a `helm upgrade` to `--set` some values (example: add a resource request to ensure it always has at least 1GB of memory) * do a `kubectl rollout restart statefulset/open-webui` to get the latest docker image (new releases seem to come out about once per week) * take the cluster node down for an OS update, so that k8s migrates it to a new node (by recreating the pod) 5. log in again 6. go to admin panel, see that the default model is no longer set The initContainer mounts the persistent volume at `/tmp/app-data` and runs [this cp command](https://github.com/open-webui/helm-charts/blob/main/charts/open-webui/templates/workload-manager.yaml#L38), which clobbers the `config.json` file: ``` command: ['sh', '-c', 'cp -R /app/backend/data/* /tmp/app-data/'] ``` What do you think about passing the `--update=none` flag? From [the cp docs](https://www.gnu.org/software/coreutils/manual/html_node/cp-invocation.html#index-_002du-6): > Do not copy a non-directory that has an existing destination with the same or newer modification timestamp; instead, silently skip the file without failing. [snip] > ‘none’ > This is like the deprecated --no-clobber option, where no files in the destination are replaced, and also skipping a file does not induce a failure. I don't fully understand the other files in there. I don't know if `config.json` is the only file that should be preserved, or if this logic also applies to the other stuff. But `config.json` is definitely a problem.
yindo closed this issue 2026-02-15 19:15:35 -05:00
Author
Owner

@westbrook-ai commented on GitHub (Aug 15, 2024):

Hey @Infinoid, thanks for reporting this and for the great reproduction steps and idea for a solution. The cp command in the Open WebUI image didn't want an option on the --update flag, but the -n flag seemed to add the desired behavior.

I tested this by checking the default model stayed in place after deleting a pod, and manually checked the contents of config.json before and after deleting a pod. It looks good in my testing, please let me know if the latest chart solves the issue for you too!

@westbrook-ai commented on GitHub (Aug 15, 2024): Hey @Infinoid, thanks for reporting this and for the great reproduction steps and idea for a solution. The `cp` command in the Open WebUI image didn't want an option on the `--update` flag, but the `-n` flag seemed to add the desired behavior. I tested this by checking the default model stayed in place after deleting a pod, and manually checked the contents of `config.json` before and after deleting a pod. It looks good in my testing, please let me know if the latest chart solves the issue for you too!
Author
Owner

@Infinoid commented on GitHub (Aug 16, 2024):

Nice! I can restart it without losing all of my settings now. Thanks!

@Infinoid commented on GitHub (Aug 16, 2024): Nice! I can restart it without losing all of my settings now. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/helm-charts#28