Skip to content

Commit 7d36dfd

Browse files
Warn on mismatching auto-config files
Co-authored-by: Josh <josh.t.richards@gmail.com> Signed-off-by: Florian Latifi <mail@florian-latifi.at>
1 parent f454867 commit 7d36dfd

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@ To customize Apache max file upload limit you can change the following variable:
217217
- `APACHE_BODY_LIMIT` (default `1073741824` [1GiB]) This restricts the total
218218
size of the HTTP request body sent from the client. It specifies the number of _bytes_ that are allowed in a request body. A value of **0** means **unlimited**. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#apache) for more information.
219219

220+
### Auto configuration and Nextcloud updates
221+
The image comes with special config files for Nextcloud that set parameters specific to containerized usage (e.g. `upgrade-disable-web.config.php`) or enable auto configuration via environment variables (e.g. `reverse-proxy.config.php`). Within the image, the latest version of these config files are located in `/usr/src/nextcloud/config`.
222+
223+
During a fresh Nextcloud installation, the latest version (from the image) of these files are copied into `/var/www/html/config` so that they are stored within your container's persistent volume and picked up by Nextcloud alongside your local configuration.
224+
225+
The copied files, however, are **not** automatically overwritten whenever you update your environment with a newer Nextcloud image. This is to prevent local changes in `/var/www/html/config` from being unexpectedly overwritten. This may lead to your image-specific configuration files becoming outdated and image functionality not matching that which is documented.
226+
227+
A warning will be generated in the container log output when outdated image-specific configuration files are detected at startup in a running container. When you see this warning, you should manually compare (or copy) the files from `/usr/src/nextcloud/config` to `/var/www/html/config`.
228+
229+
As long as you have not modified any of the provided config files in `/var/www/html/config` (other than `config.php`) or only added new ones with names that do not conflict with the image specific ones, copying the new ones into place should be safe (but check the source path `/usr/src/nextcloud/config` for any newly named config files to avoid new overlaps just in case).
230+
231+
Not keeping these files up-to-date when this warning appears may cause certain auto configuration environment variables to be ignored or the image to not work as documented or expected.
220232

221233
## Auto configuration via hook folders
222234

docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,17 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
276276
fi
277277
) 9> /var/www/html/nextcloud-init-sync.lock
278278

279+
# warn if config files on persistent storage differ from the latest version of this image
280+
for cfgPath in /usr/src/nextcloud/config/*.php; do
281+
cfgFile=$(basename "$cfgPath")
282+
283+
if [ "$cfgFile" != "config.sample.php" ]; then
284+
if ! cmp -s "/usr/src/nextcloud/config/$cfgFile" "/var/www/html/config/$cfgFile"; then
285+
echo "Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile"
286+
fi
287+
fi
288+
done
289+
279290
run_path before-starting
280291
fi
281292

0 commit comments

Comments
 (0)