Skip to contentSkip to conversation

Added recipe for the Singularity container platform.

PATCH Superseded Alexandru Tiniuc 2 participants 5 messages Aug 24, 2017 – Aug 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added recipe for the Singularity container platform.

Singularity is a container platform built on the principle of mobility of compute. It is designed to be used on HPC clusters and, unlike Docker, it does not require root access to mount an image. In addition, it can use Docker images out-of-the-box and it can pull them from the Docker Hub. For more information, see singularity.lbl.gov

This recipe enables building the Singularity container platform. Additionally, it creates a symlink from /usr/bin/python3 to /usr/bin/python, as well as a symlink to where python3 expects CA certificates to be.

I have tested it on a Raspberry Pi 3: I successfully built and run arm32v7 images from Docker Hub. Make sure you have the right image for your CPU architecture: it defaults to amd64.

Signed-off-by Alexandru Tiniuc <tiniuc.alexandru at gmail dot com>
---
 recipes-containers/singularity/singularity_git.bb | 35 +++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 recipes-containers/singularity/singularity_git.bb
recipes-containers/singularity/singularity_git.bb new file +35 -0
new file mode 100644
index 0000000..d0fbeb9
@@ -0,0 +1,35 @@
+# Skip QA check for library symbolic links (core issue is a packaging problem within 
+# Singularity build / config: read up on the dev-so test for more info)
+INSANE_SKIP_${PN} += "dev-so"
+
+RDEPENDS_${PN} += "glibc python3 ca-certificates openssl"
+# Singularity expects to find python3 under the name python, therefore both
+# cannot be installed at the same time.
+RCONFLICTS_${PN} = "python"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYRIGHT.md;md5=be78c34e483dd7d8439358b1e024b294 \
+                    file://LICENSE-LBNL.md;md5=45a007b527e1a9507aa7fa869f8d7ede \
+                    file://LICENSE.md;md5=df4326b473db6424033f1d98a5645e30 \
+                    file://debian/copyright;md5=ed267cf386d9b75ab1f27f407e935b10"
+
+SRC_URI = "git://github.com/singularityware/singularity.git;protocol=https"
+PV = "2.3.1+git${SRCPV}"
+SRCREV = "e214d4ebf0a1274b1c63b095fd55ae61c7e92947"
+
+S = "${WORKDIR}/git"
+
+inherit pythonnative autotools-brokensep
+EXTRA_OECONF = "--prefix=/usr/local"
+
+pkg_postinst_${PN}() {
+    # Singularity requires "python" to resolve to "python3" within the commandline.
+    # This creates a symbolic link from python3 to python. A side-effect of this is
+    # that scripts which expect Python 2 may fail to run correctly.
+    ln -sr $D${bindir}/python3 $D${bindir}/python 
+
+    # python3 expects CA certificates to be installed in a different place to where
+    # they are actually installed. These lines link the two locations.
+    rm -r $D${libdir}/ssl-1.1/certs
+    ln -sr $D${sysconfdir}/ssl/certs $D${libdir}/ssl-1.1 
+}
Signature · 1 line
2.1.4
#1 lore raw
Quoted 6 lines · Alexandru Tiniuc

Singularity is a container platform built on the principle of mobility of compute. It is designed to be used on HPC clusters and, unlike Docker, it does not require root access to mount an image. In addition, it can use Docker images out-of-the-box and it can pull them from the Docker Hub. For more information, see singularity.lbl.gov

Quoted 9 lines

This recipe enables building the Singularity container platform. Additionally, it creates a symlink from /usr/bin/python3 to /usr/bin/python, as well as a symlink to where python3 expects CA certificates to be.

I have tested it on a Raspberry Pi 3: I successfully built and run arm32v7 images from Docker Hub. Make sure you have the right image for your CPU architecture: it defaults to amd64.

Looks reasonable to me.

I do have one additional request though.

Even if it is a really simple concept, can you create a README that shows the
commands to run a simple sanity/smoke test. That way, we'll have a guide in the
checked out layer on how to use the infrastructure.

Cheers,

Bruce

Quoted 69 lines
Signed-off-by Alexandru Tiniuc <tiniuc.alexandru at gmail dot com>
---
 recipes-containers/singularity/singularity_git.bb | 35
+++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 recipes-containers/singularity/singularity_git.bb
recipes-containers/singularity/singularity_git.bb new file +1 -0
new file mode 100644
index 0000000..d0fbeb9
@@ -0,0 +1,35 @@
+# Skip QA check for library symbolic links (core issue is a packaging

problem within

recipes-containers/singularity/singularity_git.bb new file +5 -0
+# Singularity build / config: read up on the dev-so test for more info)
+INSANE_SKIP_${PN} += "dev-so"
+
+RDEPENDS_${PN} += "glibc python3 ca-certificates openssl"
+# Singularity expects to find python3 under the name python, therefore

both

recipes-containers/singularity/singularity_git.bb new file +5 -0
+# cannot be installed at the same time.
+RCONFLICTS_${PN} = "python"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYRIGHT.md;md5=

be78c34e483dd7d8439358b1e024b294 \
+ file://LICENSE-LBNL.md;md5=
45a007b527e1a9507aa7fa869f8d7ede \
+ file://LICENSE.md;md5=df4326b473db6424033f1d98a5645e30
\
+ file://debian/copyright;md5=
ed267cf386d9b75ab1f27f407e935b10"

recipes-containers/singularity/singularity_git.bb new file +2 -0
+
+SRC_URI = "git://github.com/singularityware/singularity.

git;protocol=https"

recipes-containers/singularity/singularity_git.bb new file +10 -0
+PV = "2.3.1+git${SRCPV}"
+SRCREV = "e214d4ebf0a1274b1c63b095fd55ae61c7e92947"
+
+S = "${WORKDIR}/git"
+
+inherit pythonnative autotools-brokensep
+EXTRA_OECONF = "--prefix=/usr/local"
+
+pkg_postinst_${PN}() {
+    # Singularity requires "python" to resolve to "python3" within the

commandline.
+ # This creates a symbolic link from python3 to python. A side-effect
of this is

recipes-containers/singularity/singularity_git.bb new file +4 -0
+    # that scripts which expect Python 2 may fail to run correctly.
+    ln -sr $D${bindir}/python3 $D${bindir}/python
+
+    # python3 expects CA certificates to be installed in a different

place to where

recipes-containers/singularity/singularity_git.bb new file +4 -1
+    # they are actually installed. These lines link the two locations.
+    rm -r $D${libdir}/ssl-1.1/certs
+    ln -sr $D${sysconfdir}/ssl/certs $D${libdir}/ssl-1.1
+}
--

2.1.4

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#2 lore raw

PATCH v2 1/2 Added recipe for the Singularity container platform.

Singularity is a container platform built on the principle of mobility of compute. It is designed to be used on HPC clusters and, unlike Docker, it does not require root access to mount an image. In addition, it can use Docker images out-of-the-box and it can pull them from the Docker Hub. For more information, see singularity.lbl.gov

This recipe enables building the Singularity container platform. Additionally, it creates a symlink from /usr/bin/python3 to /usr/bin/python, as well as a symlink to where python3 expects CA certificates to be.

I have tested it on a Raspberry Pi 3: I successfully built and run arm32v7 images from Docker Hub. Make sure you have the right image for your CPU architecture: it defaults to amd64.

Signed-off-by Alexandru Tiniuc <tiniuc.alexandru at gmail dot com>
---
 recipes-containers/singularity/singularity_git.bb | 35 +++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 recipes-containers/singularity/singularity_git.bb
recipes-containers/singularity/singularity_git.bb new file +35 -0
new file mode 100644
index 0000000..d0fbeb9
@@ -0,0 +1,35 @@
+# Skip QA check for library symbolic links (core issue is a packaging problem within 
+# Singularity build / config: read up on the dev-so test for more info)
+INSANE_SKIP_${PN} += "dev-so"
+
+RDEPENDS_${PN} += "glibc python3 ca-certificates openssl"
+# Singularity expects to find python3 under the name python, therefore both
+# cannot be installed at the same time.
+RCONFLICTS_${PN} = "python"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYRIGHT.md;md5=be78c34e483dd7d8439358b1e024b294 \
+                    file://LICENSE-LBNL.md;md5=45a007b527e1a9507aa7fa869f8d7ede \
+                    file://LICENSE.md;md5=df4326b473db6424033f1d98a5645e30 \
+                    file://debian/copyright;md5=ed267cf386d9b75ab1f27f407e935b10"
+
+SRC_URI = "git://github.com/singularityware/singularity.git;protocol=https"
+PV = "2.3.1+git${SRCPV}"
+SRCREV = "e214d4ebf0a1274b1c63b095fd55ae61c7e92947"
+
+S = "${WORKDIR}/git"
+
+inherit pythonnative autotools-brokensep
+EXTRA_OECONF = "--prefix=/usr/local"
+
+pkg_postinst_${PN}() {
+    # Singularity requires "python" to resolve to "python3" within the commandline.
+    # This creates a symbolic link from python3 to python. A side-effect of this is
+    # that scripts which expect Python 2 may fail to run correctly.
+    ln -sr $D${bindir}/python3 $D${bindir}/python 
+
+    # python3 expects CA certificates to be installed in a different place to where
+    # they are actually installed. These lines link the two locations.
+    rm -r $D${libdir}/ssl-1.1/certs
+    ln -sr $D${sysconfdir}/ssl/certs $D${libdir}/ssl-1.1 
+}
Signature · 1 line
2.1.4
#3 lore raw

PATCH v2 2/2 Added README file

---
 recipes-containers/singularity/README | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 recipes-containers/singularity/README
recipes-containers/singularity/README new file +46 -0
new file mode 100644
index 0000000..582480f
@@ -0,0 +1,46 @@
+Singularity is a container platform based on the principle of mobility of 
+compute, and it is designed for use within HPC clusters. For more info see
+singularity.lbl.gov.  
+
+To test whether the software functions correctly, you can use `singularity
+selftest`. This is what you would expect to see:
+
+~# singularity selftest
+ + sh -c test -f /etc/singularity/singularity.conf                                     (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/action-suid                                    (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/create-suid                                    (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/expand-suid                                    (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/export-suid                                    (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/import-suid                                    (retval=0) OK
+ + test -u /usr/libexec/singularity/bin/mount-suid                                     (retval=0) OK
+
+You can also pull a container from Docker Hub to prove full functionality
+(Test was performed on a Raspberry Pi 3, hence the arm32v7 part of the Docker
+link. Make sure you pull an image which is compatible with your hardware.) 
+For instance:
+
+~# singularity pull docker://arm32v7/debian:latest
+Initializing Singularity image subsystem
+Opening image file: debian-latest.img
+Creating 200MiB image
+Binding image to loop
+Creating file system within image
+Image is done: debian-latest.img
+Docker image path: index.docker.io/arm32v7/debian:latest
+Cache folder set to /home/root/.singularity/docker
+[1/1] |===================================| 100.0% 
+Importing: base Singularity environment
+Importing: /home/root/.singularity/docker/sha256:ed4f1f0d0a0457e7f76ffb25a8d6a193007709dd312b7647cb44fc6979ec4a53.tar.gz
+Importing: /home/root/.singularity/metadata/sha256:89997b2c16b29c5a3a316e314172ef21b36f67cc3200b1c4d95927f716dbee83.tar.gz
+Done. Container is at: debian-latest.img
+~# singularity shell debian-latest.img 
+Singularity: Invoking an interactive shell within container...
+
+Singularity debian-latest.img:~> echo "Hello from within the container!"
+Hello from within the container!
+Singularity debian-latest.img:~> ls /
+bin   dev  home  lost+found  mnt  proc	run   singularity  sys	usr
+boot  etc  lib	 media	     opt  root	sbin  srv	   tmp	var
+Singularity debian-latest.img:~> exit
+exit
+~# 
Signature · 1 line
2.1.4
#4 lore raw
In reply to Alexandru Tiniuc

v2 is now merged!

Bruce

Quoted 83 lines · Alexandru Tiniuc

Singularity is a container platform built on the principle of mobility of compute. It is designed to be used on HPC clusters and, unlike Docker, it does not require root access to mount an image. In addition, it can use Docker images out-of-the-box and it can pull them from the Docker Hub. For more information, see singularity.lbl.gov

This recipe enables building the Singularity container platform. Additionally, it creates a symlink from /usr/bin/python3 to /usr/bin/python, as well as a symlink to where python3 expects CA certificates to be.

I have tested it on a Raspberry Pi 3: I successfully built and run arm32v7 images from Docker Hub. Make sure you have the right image for your CPU architecture: it defaults to amd64.

Signed-off-by Alexandru Tiniuc <tiniuc.alexandru at gmail dot com>
---
 recipes-containers/singularity/singularity_git.bb | 35
+++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 recipes-containers/singularity/singularity_git.bb
recipes-containers/singularity/singularity_git.bb new file +1 -0
new file mode 100644
index 0000000..d0fbeb9
@@ -0,0 +1,35 @@
+# Skip QA check for library symbolic links (core issue is a packaging

problem within

recipes-containers/singularity/singularity_git.bb new file +5 -0
+# Singularity build / config: read up on the dev-so test for more info)
+INSANE_SKIP_${PN} += "dev-so"
+
+RDEPENDS_${PN} += "glibc python3 ca-certificates openssl"
+# Singularity expects to find python3 under the name python, therefore

both

recipes-containers/singularity/singularity_git.bb new file +5 -0
+# cannot be installed at the same time.
+RCONFLICTS_${PN} = "python"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYRIGHT.md;md5=

be78c34e483dd7d8439358b1e024b294 \
+ file://LICENSE-LBNL.md;md5=
45a007b527e1a9507aa7fa869f8d7ede \
+ file://LICENSE.md;md5=df4326b473db6424033f1d98a5645e30
\
+ file://debian/copyright;md5=
ed267cf386d9b75ab1f27f407e935b10"

recipes-containers/singularity/singularity_git.bb new file +2 -0
+
+SRC_URI = "git://github.com/singularityware/singularity.

git;protocol=https"

recipes-containers/singularity/singularity_git.bb new file +10 -0
+PV = "2.3.1+git${SRCPV}"
+SRCREV = "e214d4ebf0a1274b1c63b095fd55ae61c7e92947"
+
+S = "${WORKDIR}/git"
+
+inherit pythonnative autotools-brokensep
+EXTRA_OECONF = "--prefix=/usr/local"
+
+pkg_postinst_${PN}() {
+    # Singularity requires "python" to resolve to "python3" within the

commandline.
+ # This creates a symbolic link from python3 to python. A side-effect
of this is

recipes-containers/singularity/singularity_git.bb new file +4 -0
+    # that scripts which expect Python 2 may fail to run correctly.
+    ln -sr $D${bindir}/python3 $D${bindir}/python
+
+    # python3 expects CA certificates to be installed in a different

place to where

recipes-containers/singularity/singularity_git.bb new file +4 -1
+    # they are actually installed. These lines link the two locations.
+    rm -r $D${libdir}/ssl-1.1/certs
+    ln -sr $D${sysconfdir}/ssl/certs $D${libdir}/ssl-1.1
+}
--

2.1.4

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"