diff --git a/README.md b/README.md index c20df5d..2fd914c 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned). * **11.07.21:** - Bump node to 14 to fix builds * **08.05.21:** - Fix doc link * **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`. diff --git a/readme-vars.yml b/readme-vars.yml index 08dbd39..2fea39f 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -75,6 +75,7 @@ app_setup_block: | # changelog changelogs: + - { date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)." } - { date: "11.07.21:", desc: "Bump node to 14 to fix builds" } - { date: "08.05.21:", desc: "Fix doc link" } - { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index b3f6cd4..1c09036 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -18,5 +18,20 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then fi # permissions -chown -R abc:abc \ - /config +if [ -f "/usr/bin/find" ] && [ -f "/usr/bin/xargs" ]; then + CORES=$(nproc --all) + + # Split workload between config and workspace + echo "setting permissions::configuration" + find /config -path /config/workspace -prune -false -o -type d -print0 | \ + xargs --null -r --max-args=1 --max-procs=$((CORES*2*8)) \ + chown -R abc:abc + + echo "setting permissions::workspace" + chown abc:abc /config/workspace +else + # Set permissions on data mount + # do not decend into the workspace + chown -R abc:abc "$(ls /config -I workspace)" + chown abc:abc /config/workspace +fi