diff --git a/CHANGELOG.md b/CHANGELOG.md index fd5d6c8a7f..7984a93c1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and changes prior to that are (unfortunately) done retrospectively. Critical ite - [nvliblist.conf](https://github.com/singularityware/singularity/blob/master/etc/nvliblist.conf) now has a section for binaries - --nv can be made default with all action commands in singularity.conf - --nv can be controlled by env vars `$SINGULARITY_NV` and `$SINGULARITY_NV_OFF` + - Adjustments to SCIF (Scientific Filesystem) integration for broader use ### Security related fixes - Add capability support and secure build #934 @@ -31,6 +32,7 @@ and changes prior to that are (unfortunately) done retrospectively. Critical ite ### Bug Fixes - Put /usr/local/{bin,sbin} in front of the default PATH + - Fixed bug that did not export environment variables for apps with "-" in name ## [v2.4.2](https://github.com/singularityware/singularity/tree/release-2.4) diff --git a/examples/apps/README.md b/examples/apps/README.md index a92c135c0a..cf65da30ce 100644 --- a/examples/apps/README.md +++ b/examples/apps/README.md @@ -1,15 +1,21 @@ # Singularity SCI-F Apps +The Scientific Filesystem is well suited for Singularity containers to allow you +to build a container that has multiple entrypoints, along with modular environments, +libraries, and executables. Here we will review the basic building and using of a +Singularity container that implements SCIF. For more quick start tutorials, see +the [official documentation for SCIF](https://vsoch.github.io/scif/). + Build your image ``` -sudo singularity build cowsay.img Singularity.cowsay +sudo singularity build cowsay.simg Singularity.cowsay ``` What apps are installed? ``` -singularity apps cowsay.img +singularity apps cowsay.simg cowsay fortune lolcat @@ -18,14 +24,17 @@ lolcat Ask for help for a specific app! ``` -singularity help --app fortune cowsay.img +singularity help --app fortune cowsay.simg fortune is the best app ``` Run a particular app ``` -singularity run --app fortune cowsay.img +singularity run --app fortune cowsay.simg +When I reflect upon the number of disagreeable people who I know who have gone +to a better world, I am moved to lead a different life. + -- Mark Twain, "Pudd'nhead Wilson's Calendar" ``` Inspect an app @@ -33,8 +42,7 @@ Inspect an app ``` singularity inspect --app fortune cowsay.img { - "SINGULARITY_APP_NAME": "fortune", - "SINGULARITY_APP_SIZE": "1MB" + "SCIF_APPNAME": "fortune", + "SCIF_APPSIZE": "1MB" } ``` - diff --git a/libexec/bootstrap-scripts/deffile-sections.sh b/libexec/bootstrap-scripts/deffile-sections.sh index 6f6ba313d6..4e3caa7ae6 100644 --- a/libexec/bootstrap-scripts/deffile-sections.sh +++ b/libexec/bootstrap-scripts/deffile-sections.sh @@ -302,8 +302,8 @@ if [ -z "${SINGULARITY_BUILDSECTION:-}" -o "${SINGULARITY_BUILDSECTION:-}" == "a # Make sure we have metadata APPBASE="$SINGULARITY_ROOTFS/scif/apps/${APPNAME}" APPFOLDER_SIZE=$(singularity_calculate_size "${APPBASE}") - $ADD_LABEL --key "SINGULARITY_APP_SIZE" --value "${APPFOLDER_SIZE}MB" --file "$APPBASE/scif/labels.json" - $ADD_LABEL --key "SINGULARITY_APP_NAME" --value "${APPNAME}" --file "${APPBASE}/scif/labels.json" + $ADD_LABEL --key "SCIF_APPSIZE" --value "${APPFOLDER_SIZE}MB" --file "$APPBASE/scif/labels.json" + $ADD_LABEL --key "SCIF_APPNAME" --value "${APPNAME}" --file "${APPBASE}/scif/labels.json" done fi @@ -325,7 +325,7 @@ fi ### APPLABELS -if [ -z "${SINGULARITY_BUILDSECTION:-}" -o "${SINGULARITY_BUILDSECTION:-}" == "appfiles" ]; then +if [ -z "${SINGULARITY_BUILDSECTION:-}" -o "${SINGULARITY_BUILDSECTION:-}" == "applabels" ]; then if singularity_section_exists "applabels" "$SINGULARITY_BUILDDEF"; then APPNAMES=(`singularity_section_args "applabels" "$SINGULARITY_BUILDDEF"`) @@ -349,15 +349,15 @@ if [ -z "${SINGULARITY_BUILDSECTION:-}" -o "${SINGULARITY_BUILDSECTION:-}" == "a for APPNAME in "${APPNAMES[@]}"; do message 1 "Installing ${APPNAME}\n" APPBASE="$SINGULARITY_ROOTFS/scif/apps/${APPNAME}" - SINGULARITY_APPROOT="/scif/apps/${APPNAME}" - export SINGULARITY_APPROOT + SCIF_APPROOT="/scif/apps/${APPNAME}" + export SCIF_APPROOT singularity_app_init "${APPNAME}" "${SINGULARITY_ROOTFS}" singularity_app_save "${APPNAME}" "$SINGULARITY_BUILDDEF" "${APPBASE}/scif/Singularity" singularity_app_install_get "${APPNAME}" "$SINGULARITY_BUILDDEF" | chroot "$SINGULARITY_ROOTFS" /bin/sh -xe || ABORT 255 APPFOLDER_SIZE=$(singularity_calculate_size "${APPBASE}") - $ADD_LABEL --key "SINGULARITY_APP_SIZE" --value "${APPFOLDER_SIZE}MB" --file "$APPBASE/scif/labels.json" --quiet -f - $ADD_LABEL --key "SINGULARITY_APP_NAME" --value "${APPNAME}" --file "${APPBASE}/scif/labels.json" --quiet -f + $ADD_LABEL --key "SCIF_APPSIZE" --value "${APPFOLDER_SIZE}MB" --file "$APPBASE/scif/labels.json" --quiet -f + $ADD_LABEL --key "SCIF_APPNAME" --value "${APPNAME}" --file "${APPBASE}/scif/labels.json" --quiet -f done fi @@ -373,34 +373,34 @@ for app in ${SINGULARITY_ROOTFS}/scif/apps/*; do if [ -d "$app" ]; then app="${app##*/}" - app=(`echo $app | sed -e "s/-/_/g"`) + appvar=(`echo $app | sed -e "s/-/_/g"`) appbase="${SINGULARITY_ROOTFS}/scif/apps/$app" appmeta="${appbase}/scif" # Export data, root, metadata, labels, environment - echo "APPDATA_$app=/scif/data/$app" >> "${APPGLOBAL}" - echo "APPMETA_$app=/scif/apps/$app/scif" >> "${APPGLOBAL}" - echo "APPROOT_$app=/scif/apps/$app" >> "${APPGLOBAL}" - echo "APPBIN_$app=/scif/apps/$app/bin" >> "${APPGLOBAL}" - echo "APPLIB_$app=/scif/apps/$app/lib" >> "${APPGLOBAL}" - echo "export APPDATA_$app APPROOT_$app APPMETA_$app APPBIN_$app APPLIB_$app" >> "${APPGLOBAL}" + echo "SCIF_APPDATA_$appvar=/scif/data/$app" >> "${APPGLOBAL}" + echo "SCIF_APPMETA_$appvar=/scif/apps/$app/scif" >> "${APPGLOBAL}" + echo "SCIF_APPROOT_$appvar=/scif/apps/$app" >> "${APPGLOBAL}" + echo "SCIF_APPBIN_$appvar=/scif/apps/$app/bin" >> "${APPGLOBAL}" + echo "SCIF_APPLIB_$appvar=/scif/apps/$app/lib" >> "${APPGLOBAL}" + echo "export SCIF_APPDATA_$appvar SCIF_APPROOT_$appvar SCIF_APPMETA_$appvar SCIF_APPBIN_$appvar SCIF_APPLIB_$appvar" >> "${APPGLOBAL}" # Environment if [ -e "${appmeta}/env/90-environment.sh" ]; then - echo "APPENV_${app}=/scif/apps/$app/scif/env/90-environment.sh" >> "${APPGLOBAL}" - echo "export APPENV_${app}" >> "${APPGLOBAL}" + echo "SCIF_APPENV_${appvar}=/scif/apps/$app/scif/env/90-environment.sh" >> "${APPGLOBAL}" + echo "export SCIF_APPENV_${appvar}" >> "${APPGLOBAL}" fi # Labels if [ -e "${appmeta}/labels.json" ]; then - echo "APPLABELS_${app}=/scif/apps/$app/scif/labels.json" >> "${APPGLOBAL}" - echo "export APPLABELS_${app}" >> "${APPGLOBAL}" + echo "SCIF_APPLABELS_${appvar}=/scif/apps/$app/scif/labels.json" >> "${APPGLOBAL}" + echo "export SCIF_APPLABELS_${appvar}" >> "${APPGLOBAL}" fi # Runscript if [ -e "${appmeta}/runscript" ]; then - echo "APPRUN_${app}=/scif/apps/$app/scif/runscript" >> "${APPGLOBAL}" - echo "export APPRUN_${app}" >> "${APPGLOBAL}" + echo "SCIF_APPRUN_${appvar}=/scif/apps/$app/scif/runscript" >> "${APPGLOBAL}" + echo "export SCIF_APPRUN_${appvar}" >> "${APPGLOBAL}" fi fi done diff --git a/libexec/bootstrap-scripts/environment/95-apps.sh b/libexec/bootstrap-scripts/environment/95-apps.sh index 492ca43fe1..d20b119f08 100644 --- a/libexec/bootstrap-scripts/environment/95-apps.sh +++ b/libexec/bootstrap-scripts/environment/95-apps.sh @@ -18,9 +18,9 @@ if test -n "${SINGULARITY_APPNAME:-}"; then export SINGULARITY_APPNAME if test -d "/scif/apps/${SINGULARITY_APPNAME:-}/"; then - SINGULARITY_APPS="/scif/apps" - SINGULARITY_APPROOT="/scif/apps/${SINGULARITY_APPNAME:-}" - export SINGULARITY_APPROOT SINGULARITY_APPS + SCIF_APPS="/scif/apps" + SCIF_APPROOT="/scif/apps/${SINGULARITY_APPNAME:-}" + export SCIF_APPROOT SCIF_APPS PATH="/scif/apps/${SINGULARITY_APPNAME:-}:$PATH" # Automatically add application bin to path diff --git a/libexec/bootstrap-scripts/functions b/libexec/bootstrap-scripts/functions index ea39132040..9da77416f5 100644 --- a/libexec/bootstrap-scripts/functions +++ b/libexec/bootstrap-scripts/functions @@ -198,14 +198,14 @@ singularity_app_init() { # App specific variables should be exposed at run, shell, exec echo " - SINGULARITY_APPNAME=$APPNAME - SINGULARITY_APPROOT=\"/scif/apps/${APPNAME}\" - SINGULARITY_APPMETA=\"/scif/apps/${APPNAME}/scif\" - SINGULARITY_DATA=\"/scif/data\" - SINGULARITY_APPDATA=\"/scif/data/${APPNAME}\" - SINGULARITY_APPINPUT=\"/scif/data/${APPNAME}/input\" - SINGULARITY_APPOUTPUT=\"/scif/data/${APPNAME}/output\" - export SINGULARITY_APPDATA SINGULARITY_APPNAME SINGULARITY_APPROOT SINGULARITY_APPMETA SINGULARITY_APPINPUT SINGULARITY_APPOUTPUT SINGULARITY_DATA + SCIF_APPNAME=$APPNAME + SCIF_APPROOT=\"/scif/apps/${APPNAME}\" + SCIF_APPMETA=\"/scif/apps/${APPNAME}/scif\" + SCIF_DATA=\"/scif/data\" + SCIF_APPDATA=\"/scif/data/${APPNAME}\" + SCIF_APPINPUT=\"/scif/data/${APPNAME}/input\" + SCIF_APPOUTPUT=\"/scif/data/${APPNAME}/output\" + export SCIF_APPDATA SCIF_APPNAME SCIF_APPROOT SCIF_APPMETA SCIF_APPINPUT SCIF_APPOUTPUT SCIF_DATA " > "${APPMETA}/env/01-base.sh" } diff --git a/libexec/cli/apps.info b/libexec/cli/apps.info index f1e0bff393..28593ba1e8 100644 --- a/libexec/cli/apps.info +++ b/libexec/cli/apps.info @@ -24,20 +24,20 @@ for all apps regardless of the active: ACTIVE APP ENVIRONMENT: - SINGULARITY_APPNAME the name of the application - SINGULARITY_APPROOT the application base (/scif/apps/) - SINGULARITY_APPMETA the application metadata folder - SINGULARITY_APPDATA the data base folder for active app - SINGULARITY_APPINPUT expected input folder within data base folder - SINGULARITY_APPOUTPUT the output data folder within data base folder + SCIF_APPNAME the name of the application + SCIF_APPROOT the application base (/scif/apps/) + SCIF_APPMETA the application metadata folder + SCIF_APPDATA the data base folder for active app + SCIF_APPINPUT expected input folder within data base folder + SCIF_APPOUTPUT the output data folder within data base folder GLOBAL APP ENVIRONMENT: - SINGULARITY_DATA scif defined data base for all apps (/scif/data) - SINGULARITY_APPS scif defined install bases for all apps (/scif/apps) - APPROOT_ root for application - APPDATA_ data root for application + SCIF_DATA scif defined data base for all apps (/scif/data) + SCIF_APPS scif defined install bases for all apps (/scif/apps) + SCIF_APPROOT_ root for application + SCIF_APPDATA_ data root for application For additional help, please visit our public documentation pages which are