Conversation
Every start chowns the whole vendor tree (~13k files) when a custom PUID/PGID is used. Those files live in the image layer, so each chown copies the file up, delaying startup for 90s on fast disks and up to hours on slow or network storage (librenms#524, librenms#557). The find introduced in librenms#540 cannot help here: a freshly created container always starts with the build-time ownership, so the tree needs fixing again every time. The vendor tree and the composer files are dropped from the runtime permission fix and made writable for any uid during the build instead (they are only written by plugin/composer installs). All other paths keep their ownership fix. Fixes librenms#557
|
And this fix is always correct? it will never result in a broken container? |
|
Fair question, and I would rather give you the precise answer than a reassurance. It cannot produce a container that fails to start. The change removes But your question exposes the real risk, and it is not "will it start". It is: does anything in the container need to write to
Where I would be careful, honestly:
So: it will not start a broken container, and the case you are actually worried about - a valid container that used to start and now does not - is not reachable through this change. The open question is whether you are comfortable with the permission broadening, and if not I have a narrower alternative ready. #510 raised the startup cost this removes; I agree with that and I think the build-time approach is the right trade. Happy to be told otherwise. |
|
Following up on my last comment, since I do not want it to sit unanswered. To restate the one decision that is actually yours: the change makes If you would rather not ship world-writable files, I have a narrower version ready that keeps the permissions as they were and still removes the first-start penalty: re-own only what is still Either is fine by me - I went with the build-time If you are happy with the current approach, a review would be appreciated, and I am happy to rebase onto main if anything has moved. |
Fixes the slow startup with a custom
PUID/PGIDreported in #557.Problem
On every start
03-config.shchowns the whole${LIBRENMS_PATH}/vendortree — 13,704 entries on a fresh image. Those files live in the image layer, so every chown copies the file up: startup stalls for 90s+ on fast disks and many minutes on slower/network storage (#524). The existing find can't converge here: a freshly created container always starts from the build-time ownership, so the tree needs "fixing" again on every start.Change
03-config.sh: thevendortree and thecomposer*files are no longer chowned at startup — the performance penalty CrazyMax pointed out in Add missing ext-xmlwriter extension and fix permissions #510. The runtime fix still covers the paths that need ownership while the container runs (config.d,bootstrap,logs,storage,/data/...).Dockerfile:vendorand the composer files are made writable for any uid at build time (chmod -R a+rwX vendor,chmod a+rw composer.json composer.lock), keeping plugin/composer installs working under a custom PUID/PGID (the use case from Add missing ext-xmlwriter extension and fix permissions #510) without any runtime chown.Measured (custom PUID/PGID, fresh container, same machine)
13,704 → 355 entries is the point: the remaining work is per-file overlay copy-up (~90ms/file on this machine's storage — also why the before case never completed; the 90s in #557 is the same 13.7k copy-ups on faster disks).
Verified
vendordirs writable/traversable, composer files writable, existing exec bits kept)librenmswith PUID/PGID=805: writes OK intobootstrap/cache,storage,storage/framework/cache,logs,/data/logs(including a root-owned log file)vendor, append tocomposer.lock— all OKtest/compose stack boots to "ready to handle connections" with the patched image