Create script to export an environment via `cvmfs_shrinkwrap`

We can export EESSI to squashfs via cvmfs_shrinkwrap in user space

ocaisa@LAPTOP-O6HF2IKC:~$ cat software.eessi.io.config

CVMFS_REPOSITORIES=software.eessi.io
CVMFS_REPOSITORY_NAME=software.eessi.io
CVMFS_CONFIG_REPOSITORY=cvmfs-config.cern.ch
CVMFS_SERVER_URL='http://aws-eu-west-s1-sync.eessi.science/cvmfs/software.eessi.io'
CVMFS_HTTP_PROXY=DIRECT # Avoid filling up any local squid's cache
CVMFS_CACHE_BASE=/tmp/shrinkwrap
CVMFS_KEYS_DIR=/etc/cvmfs/keys/eessi.io # Need to be provided for shrinkwrap
CVMFS_SHARED_CACHE=no # Important as libcvmfs does not support shared caches
CVMFS_USER=cvmfs
CVMFS_UID_MAP=uid.map
CVMFS_GID_MAP=gid.map

ocaisa@LAPTOP-O6HF2IKC:~$ cat uid.map
* 1000

ocaisa@LAPTOP-O6HF2IKC:~$ cat gid.map
* 1000

ocaisa@LAPTOP-O6HF2IKC:~$ cvmfs_shrinkwrap -r software.eessi.io -f software.eessi.io.config -t software.eessi.io.spec --dest-base /tmp/cvmfs -j 4

LibCvmfs version 2.12, revision 31
(libcvmfs) (manager 'standard') switching proxy from (none) to DIRECT. Reason: set random start proxy from the first proxy group [Current host: http://aws-eu-west-s1-sync.eessi.science/cvmfs/software.eessi.io]
(libcvmfs) (manager 'external') switching proxy from (none) to DIRECT. Reason: cloned [Current host: http://aws-eu-west-s1-sync.eessi.science/cvmfs/software.eessi.io]
(libcvmfs) Starting 4 workers
(libcvmfs) cntByte|0|Byte count of projected repository
cntDir|1|Number of directories from source repository
cntFile|0|Number of files from source repository
cntSymlink|0|Number of symlinks from source repository
dataBytes|0|Bytes transferred from source to destination
dataBytesDeduped|0|Number of bytes not copied due to deduplication
dataFiles|0|Number of data files transferred from source to destination
dataFilesDeduped|0|Number of files not copied due to deduplication
entriesDest|1|Number of file system entries processed in the destination
entriesSrc|1|Number of file system entries processed in the source

...

and from that you can construct a squashfs volume with

mksquashfs /tmp/cvmfs software.eessi.io-skylake-image.sqsh

which can be mounted in any container:

apptainer shell -B software.eessi.io-skylake-image.sqsh:/cvmfs:image-src=/ docker://ubuntu

Based on this, and shipping cvmfs_shrinkwrap via the EESSI container, we can create a workflow that could:

  • Start the EESSI container on a new target system
  • Load the environment they want to export (source EESSI, load their required modules or not if they want to export everything)
  • Run a script (yet to be created) that would
    • Generate a spec file for cvmfs_shrinkwrap based on the current environment
    • Run cvmfs_shrinkwrap to export the environment
    • Run mksquashfs to create a squashfs from the export
    • Tidy up
Edited by Pedro Santos Neves