Skip to content

Commit

Permalink
Merge pull request apptainer#1238 from vsoch/scif-revision
Browse files Browse the repository at this point in the history
SCIF revision
  • Loading branch information
ctmadison authored Jan 20, 2018
2 parents 8be8cb2 + e9b1ad3 commit f4210ff
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 48 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
22 changes: 15 additions & 7 deletions examples/apps/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,23 +24,25 @@ 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

```
singularity inspect --app fortune cowsay.img
{
"SINGULARITY_APP_NAME": "fortune",
"SINGULARITY_APP_SIZE": "1MB"
"SCIF_APPNAME": "fortune",
"SCIF_APPSIZE": "1MB"
}
```

40 changes: 20 additions & 20 deletions libexec/bootstrap-scripts/deffile-sections.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"`)

Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions libexec/bootstrap-scripts/environment/95-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions libexec/bootstrap-scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}
20 changes: 10 additions & 10 deletions libexec/cli/apps.info
Original file line number Diff line number Diff line change
Expand Up @@ -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/<app>)
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/<app>)
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_<app> root for application <app>
APPDATA_<app> data root for application <app>
SCIF_DATA scif defined data base for all apps (/scif/data)
SCIF_APPS scif defined install bases for all apps (/scif/apps)
SCIF_APPROOT_<app> root for application <app>
SCIF_APPDATA_<app> data root for application <app>


For additional help, please visit our public documentation pages which are
Expand Down

0 comments on commit f4210ff

Please sign in to comment.