diff --git a/services/base/entrypoint.sh b/services/base/entrypoint.sh index b3c80a519c188b7b29d85e8cc1069c7781a78e32..fe984acd161fb2a6e34c326abbd055faf249b688 100644 --- a/services/base/entrypoint.sh +++ b/services/base/entrypoint.sh @@ -88,7 +88,7 @@ fi #--------------------- if [ "x$SAFEMODE" == "xFalse" ]; then - echo "[INFO] Executing prestartup scripts (current + parents):" + echo "[INFO] Executing prestartup scripts (parents + current):" python /prestartup.py else echo "[INFO] Not executing prestartup scripts as we are in safemode" diff --git a/services/base/prestartup.py b/services/base/prestartup.py index 82eb0ec871677b25ab0cf65c9d9fc87d14382fa3..1bcfd455887481aad1d51e5fb0d7a676bf03df96 100644 --- a/services/base/prestartup.py +++ b/services/base/prestartup.py @@ -34,7 +34,9 @@ def shell(command, interactive=False): prestartup_scripts_path='/prestartup' def sorted_ls(path): mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime - return list(sorted(os.listdir(path), key=mtime)) + file_list = list(sorted(os.listdir(path), key=mtime)) + file_list.reverse() + return file_list for item in sorted_ls(prestartup_scripts_path): if item.endswith('.sh'): diff --git a/services/slurmbase/Dockerfile b/services/slurmbase/Dockerfile index 18e4791cbed5b337ae99bcbc045684145b626e9c..16126b744192172a9bb2611f9db8b06069741835 100755 --- a/services/slurmbase/Dockerfile +++ b/services/slurmbase/Dockerfile @@ -28,3 +28,6 @@ RUN useradd slurmtestuser RUN mkdir -p /home/slurmtestuser/.ssh RUN cat /rosetta/.ssh/id_rsa.pub >> /home/slurmtestuser/.ssh/authorized_keys RUN chown -R slurmtestuser:slurmtestuser /home/slurmtestuser + +# Add prestartup +COPY prestartup_slurmbase.sh /prestartup/ \ No newline at end of file diff --git a/services/slurmbase/prestartup_slurmbase.sh b/services/slurmbase/prestartup_slurmbase.sh new file mode 100644 index 0000000000000000000000000000000000000000..1c2fb8497263e4ffdc38b153b31b5de98ff5d86d --- /dev/null +++ b/services/slurmbase/prestartup_slurmbase.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +# "Deactivate" local slurmtestuser home +mv /home/slurmtestuser /home_slurmtestuser_vanilla + +# Link slurmtestuser against the home in the shared folder (which will be setup by the master node) +ln -s /shared/home_slurmtestuser /home/slurmtestuser diff --git a/services/slurmclustermaster/prestartup_slurmclustermaster.sh b/services/slurmclustermaster/prestartup_slurmclustermaster.sh index e1e24db9d1374b11d118d6ec477c6c9977514dc8..7f5354c94082b939960e7d16142c9a1082d32d81 100644 --- a/services/slurmclustermaster/prestartup_slurmclustermaster.sh +++ b/services/slurmclustermaster/prestartup_slurmclustermaster.sh @@ -1,4 +1,8 @@ #!/bin/bash set -e +# Generic rosetta user shared folder mkdir -p /shared/rosetta && chown rosetta:rosetta /shared/rosetta + +# Shared home for slurmtestuser to simulate a shared home folders filesystem +cp -a /home_slurmtestuser_vanilla /shared/home_slurmtestuser