From 92597ed6bcb7ce6a7f1cc8ebd6beb3ff5df826df Mon Sep 17 00:00:00 2001 From: Helen Kirk Date: Wed, 10 Apr 2024 10:28:41 -0700 Subject: [PATCH 1/2] Adding Centos6.10 and Ubuntu20.04 containers to harbor for future stability --- .../casa/centos610/CentOS-Base.repo | 25 ++++++++ .../Dockerfiles/casa/centos610/Dockerfile | 20 ++++++ .../Dockerfiles/casa/centos610/Makefile | 28 +++++++++ .../Dockerfiles/casa/ubuntu20.04/Dockerfile | 24 +++++++ .../Dockerfiles/casa/ubuntu20.04/Makefile | 28 +++++++++ .../Dockerfiles/casa/ubuntu20.04/init.sh | 11 ++++ .../casa/ubuntu20.04/nsswitch.conf | 62 +++++++++++++++++++ .../casa/ubuntu20.04/update-data.patch | 27 ++++++++ 8 files changed, 225 insertions(+) create mode 100644 science-containers/Dockerfiles/casa/centos610/CentOS-Base.repo create mode 100644 science-containers/Dockerfiles/casa/centos610/Dockerfile create mode 100644 science-containers/Dockerfiles/casa/centos610/Makefile create mode 100644 science-containers/Dockerfiles/casa/ubuntu20.04/Dockerfile create mode 100644 science-containers/Dockerfiles/casa/ubuntu20.04/Makefile create mode 100755 science-containers/Dockerfiles/casa/ubuntu20.04/init.sh create mode 100644 science-containers/Dockerfiles/casa/ubuntu20.04/nsswitch.conf create mode 100755 science-containers/Dockerfiles/casa/ubuntu20.04/update-data.patch diff --git a/science-containers/Dockerfiles/casa/centos610/CentOS-Base.repo b/science-containers/Dockerfiles/casa/centos610/CentOS-Base.repo new file mode 100644 index 0000000..17157f2 --- /dev/null +++ b/science-containers/Dockerfiles/casa/centos610/CentOS-Base.repo @@ -0,0 +1,25 @@ +[base] +name=CentOS-$releasever - Base +# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra +# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ +baseurl=https://vault.centos.org/6.10/os/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 + +# released updates +[updates] +name=CentOS-$releasever - Updates +# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra +# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ +baseurl=https://vault.centos.org/6.10/updates/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 + +# additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra +# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ +baseurl=https://vault.centos.org/6.10/extras/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 diff --git a/science-containers/Dockerfiles/casa/centos610/Dockerfile b/science-containers/Dockerfiles/casa/centos610/Dockerfile new file mode 100644 index 0000000..427de44 --- /dev/null +++ b/science-containers/Dockerfiles/casa/centos610/Dockerfile @@ -0,0 +1,20 @@ +FROM centos:6.10 +#this Dockerfile runs through the build of a centos6 container and saves it +# to images.canfar.net, to use as a base for the subsequent builds of older +# casa versions, because the web-based centos6 distributions are becoming +# unstable and unmaintained + +# Override old repo info with current urls +RUN rm /etc/yum.repos.d/CentOS-Base.repo +ADD CentOS-Base.repo /etc/yum.repos.d/ + +RUN yum clean all -y +RUN yum makecache -y +RUN yum update -y +RUN yum install -y freetype libSM libXi libXrender libXrandr \ + libXfixes libXcursor libXinerama fontconfig \ + libxslt xauth xorg-x11-server-Xvfb dbus-x11 \ + tkinter ImageMagick-c++ xterm perl autoconf python-sphinx graphviz + +RUN yum install -y sssd-client acl + diff --git a/science-containers/Dockerfiles/casa/centos610/Makefile b/science-containers/Dockerfiles/casa/centos610/Makefile new file mode 100644 index 0000000..fd1ddad --- /dev/null +++ b/science-containers/Dockerfiles/casa/centos610/Makefile @@ -0,0 +1,28 @@ + +VERSIONS = \ + 6.10 + + +DOCKER_REPO_BASE=images.canfar.net/skaha/centos + +.PHONY: build clean run + +all: build + +build: + @- $(foreach V,$(VERSIONS), \ + docker build -t ${DOCKER_REPO_BASE}:$(V) .; \ + ) + +clean: + @- $(foreach V,$(VERSIONS), \ + docker rmi ${DOCKER_REPO_BASE}:$(V) ; \ + ) + + +upload: build + @- $(foreach V,$(VERSIONS), \ + docker push ${DOCKER_REPO_BASE}:$(V) ; \ + ) +clean_all: clean +upload_all: upload diff --git a/science-containers/Dockerfiles/casa/ubuntu20.04/Dockerfile b/science-containers/Dockerfiles/casa/ubuntu20.04/Dockerfile new file mode 100644 index 0000000..a08eeeb --- /dev/null +++ b/science-containers/Dockerfiles/casa/ubuntu20.04/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:20.04 + +#This Dockerfile creates a local version of the Ubuntu 20.04 OS, along with +# standard software/libraries that CASA versions need to run. This container +# is stored on harbor for to assist with long term stability + +RUN apt update +RUN apt upgrade -y + +RUN apt install -y libsm6 libxi6 libxrender1 libxrandr2 \ + libxfixes3 libxcursor1 libxinerama1 fontconfig \ + imagemagick xterm +RUN apt install -y perl autoconf autoconf graphviz xz-utils \ + gfortran libcanberra-gtk-module libsnl0 +#NB: for 20.04, need libsnl0 not libsnl-dev +RUN apt install -y libxslt1.1 xauth xorg xvfb dbus + +RUN apt install -y libfuse2 + +#Add in firefox and library dependency +RUN apt install -y firefox libpci3 + +RUN apt install -y sssd acl + diff --git a/science-containers/Dockerfiles/casa/ubuntu20.04/Makefile b/science-containers/Dockerfiles/casa/ubuntu20.04/Makefile new file mode 100644 index 0000000..cf73fad --- /dev/null +++ b/science-containers/Dockerfiles/casa/ubuntu20.04/Makefile @@ -0,0 +1,28 @@ + +VERSIONS = \ + 20.04 + + +DOCKER_REPO_BASE=images.canfar.net/skaha/ubuntu + +.PHONY: build clean run + +all: build + +build: + @- $(foreach V,$(VERSIONS), \ + docker build -t ${DOCKER_REPO_BASE}:$(V) .; \ + ) + +clean: + @- $(foreach V,$(VERSIONS), \ + docker rmi ${DOCKER_REPO_BASE}:$(V) ; \ + ) + + +upload: build + @- $(foreach V,$(VERSIONS), \ + docker push ${DOCKER_REPO_BASE}:$(V) ; \ + ) +clean_all: clean +upload_all: upload diff --git a/science-containers/Dockerfiles/casa/ubuntu20.04/init.sh b/science-containers/Dockerfiles/casa/ubuntu20.04/init.sh new file mode 100755 index 0000000..035e666 --- /dev/null +++ b/science-containers/Dockerfiles/casa/ubuntu20.04/init.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "INIT START" +echo "sourcing admit_start.sh" +source /opt/admit/admit_start.sh +echo "setting up analysisUtils path" +echo 'import sys' > $HOME/.casa/init.py +echo 'sys.path.append("/opt/casa/analysisUtils/analysis_scripts/")' >> $HOME/.casa/init.py +echo 'import analysisUtils as au' >> $HOME/.casa/init.py +echo 'import analysisUtils as AU' >> $HOME/.casa/init.py +echo "INIT DONE" diff --git a/science-containers/Dockerfiles/casa/ubuntu20.04/nsswitch.conf b/science-containers/Dockerfiles/casa/ubuntu20.04/nsswitch.conf new file mode 100644 index 0000000..22d8d99 --- /dev/null +++ b/science-containers/Dockerfiles/casa/ubuntu20.04/nsswitch.conf @@ -0,0 +1,62 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Valid entries include: +# +# nisplus Use NIS+ (NIS version 3) +# nis Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# db Use the local database (.db) files +# compat Use NIS on compat mode +# hesiod Use Hesiod for user lookups +# [NOTFOUND=return] Stop searching if not found so far +# + +# To use db, put the "db" in front of "files" for entries you want to be +# looked up first in the databases +# +# Example: +#passwd: db files nisplus nis +#shadow: db files nisplus nis +#group: db files nisplus nis + +passwd: sss files +shadow: files sss +group: sss files + +#hosts: db files nisplus nis dns +hosts: files dns + +# Example - obey only what nisplus tells us... +#services: nisplus [NOTFOUND=return] files +#networks: nisplus [NOTFOUND=return] files +#protocols: nisplus [NOTFOUND=return] files +#rpc: nisplus [NOTFOUND=return] files +#ethers: nisplus [NOTFOUND=return] files +#netmasks: nisplus [NOTFOUND=return] files + +bootparams: nisplus [NOTFOUND=return] files + +ethers: files +netmasks: files +networks: files +protocols: files +rpc: files +services: files + +netgroup: nisplus + +publickey: nisplus + +automount: files nisplus +aliases: files nisplus diff --git a/science-containers/Dockerfiles/casa/ubuntu20.04/update-data.patch b/science-containers/Dockerfiles/casa/ubuntu20.04/update-data.patch new file mode 100755 index 0000000..3dc80c6 --- /dev/null +++ b/science-containers/Dockerfiles/casa/ubuntu20.04/update-data.patch @@ -0,0 +1,27 @@ +#!/usr/bin/perl +## +## move rsync point from svn.cv.nrao.edu to casa.nrao.edu +## +use File::Find; + +if ( scalar(@ARGV) < 1 ) { die "$0 requires path to CASA installation to be patched..." } +if ( scalar(@ARGV) > 1 ) { die "$0 requires only one parameter which is the path to CASA installation to be patched..." } + +unless ( -d $ARGV[0] ) { die "$0 requires path to CASA installation (which should be a directory) to be patched..." } + +sub locate_script { + if ( -f $_ && $_ eq "update-data" ) { + print "substituting $File::Find::dir/$_\n"; + open( CONTENTS, "< $_" ); + my @contents = ; + close( CONTENTS ); + open( CONTENTS, "> $_" ); + foreach my $x ( @contents ) { + $x =~ s@(?:rsync://svn.cv.nrao.edu/casa-data|rsync://casa.nrao.edu/casa-data)@rsync://casa-rsync.nrao.edu/casa-data@g; + print CONTENTS "$x"; + } + close( CONTENTS ); + } +} + +find( { wanted => \&locate_script }, $ARGV[0] ); \ No newline at end of file From f57c3024755ff56c6a6a66b400aa2592e1c92cbb Mon Sep 17 00:00:00 2001 From: Helen Kirk Date: Wed, 10 Apr 2024 16:31:39 -0700 Subject: [PATCH 2/2] Updated to centos6 container on harbor. Additionally, split building of versions 4.5-4.7 from 5.X as the latter now contains an extra package, UVmultiFit, which is not compatible with casa4.X --- .../casa/version-4.5-4.7/Dockerfile | 57 +++++++++++++++++ .../Dockerfiles/casa/version-4.5-4.7/Makefile | 34 ++++++++++ .../Dockerfiles/casa/version-4.5-4.7/admit | 1 + .../casa/version-4.5-4.7/download.sh | 36 +++++++++++ .../Dockerfiles/casa/version-4.5-4.7/init.sh | 11 ++++ .../casa/version-4.5-4.7/nsswitch.conf | 62 +++++++++++++++++++ .../casa/version-4.5-4.7/update-data.patch | 27 ++++++++ 7 files changed, 228 insertions(+) create mode 100644 science-containers/Dockerfiles/casa/version-4.5-4.7/Dockerfile create mode 100644 science-containers/Dockerfiles/casa/version-4.5-4.7/Makefile create mode 160000 science-containers/Dockerfiles/casa/version-4.5-4.7/admit create mode 100755 science-containers/Dockerfiles/casa/version-4.5-4.7/download.sh create mode 100755 science-containers/Dockerfiles/casa/version-4.5-4.7/init.sh create mode 100644 science-containers/Dockerfiles/casa/version-4.5-4.7/nsswitch.conf create mode 100755 science-containers/Dockerfiles/casa/version-4.5-4.7/update-data.patch diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/Dockerfile b/science-containers/Dockerfiles/casa/version-4.5-4.7/Dockerfile new file mode 100644 index 0000000..7d49b4a --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/Dockerfile @@ -0,0 +1,57 @@ +FROM images.canfar.net/skaha/centos:6 + +#Upgraded to use base OS as centos6 as saved on harbor for stability +#Split out from old 4.5-5.8 combined directory as casa5.x versions +#Can have UVMultiFit installed, but casa4.X cannot + +# xterm dependency is an extra to get the casa shell in the display +# perl was added for casa later than 5 + +# setup all required env variables +ARG CASA_RELEASE +ENV CASA_RELEASE=${CASA_RELEASE} +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/casa/bin + +# untar casa databundle to container +ADD ${CASA_RELEASE}.tar.gz /opt/ + +# chown because the untarred casa has wrong owner/group +RUN chown -R root:root /opt/${CASA_RELEASE} && ln -s /opt/${CASA_RELEASE} /opt/casa + +# add the admit enhancement (issue #25) +RUN yum install -y tcsh +RUN mkdir /opt/admit +ADD admit /opt/admit +RUN cd /opt/admit && \ + autoconf && ./configure --with-casa-root=/opt/${CASA_RELEASE} + +# Allow runtime symlink creation to the casa-data-repository +# Create a dangling symlink to casa-data-repository so that after deployment +# the symlink will link to the actual casa-data-repository in storage. +RUN mkdir -p /arc/projects/casa-data-repository +RUN rm -rf /opt/${CASA_RELEASE}/data && \ + ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE}/data +RUN chmod 777 /opt/${CASA_RELEASE} +RUN rm -rf /arc + + +RUN mkdir /skaha +ADD init.sh /skaha/ + +# generate missing dbus uuid (issue #47) +RUN dbus-uuidgen --ensure + +ADD nsswitch.conf /etc/ + +#Add in analysisUtils package +RUN mkdir /opt/casa/analysisUtils +RUN yum install -y wget +RUN cd /opt/casa/analysisUtils && wget ftp://ftp.cv.nrao.edu/pub/casaguides/analysis_scripts.tar && tar -xvf analysis_scripts.tar +#(if above doesn't work, can manually download the package and add as below) +#ADD ./analysis_scripts.tar /opt/casa/analysisUtils/ +#NB: the analysisUtils path is added to the CASA startup file in the init.sh script +# (needs access to user's $HOME) + +RUN cd /opt/${CASA_RELEASE} + +CMD [ "/skaha/init.sh" ] diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/Makefile b/science-containers/Dockerfiles/casa/version-4.5-4.7/Makefile new file mode 100644 index 0000000..cd22494 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/Makefile @@ -0,0 +1,34 @@ +VERSIONS = \ + 4.5.0-el6 #\ +# 4.5.1-el6 \ + 4.5.2-el6 \ + 4.5.3-el6 \ + 4.6.0-el6 \ + 4.7.0-el6 \ + 4.7.1-el6 \ + 4.7.2-el6 + +DOCKER_REPO_BASE=images.canfar.net/casa-4/casa + +.PHONY: build clean run + +all: build +build: + @- $(foreach V,$(VERSIONS), \ + ./download.sh casa-release-$(V) current ; \ + docker build --build-arg CASA_RELEASE=casa-release-$(V) -t ${DOCKER_REPO_BASE}:$(V) .; \ + ) + +clean: + @- $(foreach V,$(VERSIONS), \ + docker rmi ${DOCKER_REPO_BASE}:$(V) ; \ + ) + +clean-all: clean + +upload: build + @- $(foreach V,$(VERSIONS), \ + docker push ${DOCKER_REPO_BASE}:$(V) ; \ + ) + +upload-all: upload diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/admit b/science-containers/Dockerfiles/casa/version-4.5-4.7/admit new file mode 160000 index 0000000..bbf3d79 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/admit @@ -0,0 +1 @@ +Subproject commit bbf3d79bb6e1a6f7523553ed8ede0d358d106f2c diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/download.sh b/science-containers/Dockerfiles/casa/version-4.5-4.7/download.sh new file mode 100755 index 0000000..6a617d3 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/download.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +if [ $# -lt 2 ] +then + echo "usage: $0 <"old"|"current">" + exit 1 +fi + +RELEASE=$1 +FILE="${RELEASE}.tar.gz" + +if [ $2 == "old" ]; then + URL="https://casa.nrao.edu/download/distro/linux/release/el6/${FILE}" +elif [ $2 == "pipeline" ]; then + URL="https://casa.nrao.edu/download/distro/casa-pipeline/release/el6/${FILE}" +else + URL="https://casa.nrao.edu/download/distro/casa/release/el6/${FILE}" +fi + +# make sure we are in the source folder +HERE=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +cd $HERE + +if [ ! -e "$FILE" ]; then + curl -O $URL +else + echo "$FILE already downloaded." +fi + +FILE="admit" +URL="https://github.com/astroumd/${FILE}" +if [ ! -e "$FILE" ]; then + git clone $URL +else + echo "$FILE already downloaded." +fi diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/init.sh b/science-containers/Dockerfiles/casa/version-4.5-4.7/init.sh new file mode 100755 index 0000000..035e666 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/init.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "INIT START" +echo "sourcing admit_start.sh" +source /opt/admit/admit_start.sh +echo "setting up analysisUtils path" +echo 'import sys' > $HOME/.casa/init.py +echo 'sys.path.append("/opt/casa/analysisUtils/analysis_scripts/")' >> $HOME/.casa/init.py +echo 'import analysisUtils as au' >> $HOME/.casa/init.py +echo 'import analysisUtils as AU' >> $HOME/.casa/init.py +echo "INIT DONE" diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/nsswitch.conf b/science-containers/Dockerfiles/casa/version-4.5-4.7/nsswitch.conf new file mode 100644 index 0000000..22d8d99 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/nsswitch.conf @@ -0,0 +1,62 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Valid entries include: +# +# nisplus Use NIS+ (NIS version 3) +# nis Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# db Use the local database (.db) files +# compat Use NIS on compat mode +# hesiod Use Hesiod for user lookups +# [NOTFOUND=return] Stop searching if not found so far +# + +# To use db, put the "db" in front of "files" for entries you want to be +# looked up first in the databases +# +# Example: +#passwd: db files nisplus nis +#shadow: db files nisplus nis +#group: db files nisplus nis + +passwd: sss files +shadow: files sss +group: sss files + +#hosts: db files nisplus nis dns +hosts: files dns + +# Example - obey only what nisplus tells us... +#services: nisplus [NOTFOUND=return] files +#networks: nisplus [NOTFOUND=return] files +#protocols: nisplus [NOTFOUND=return] files +#rpc: nisplus [NOTFOUND=return] files +#ethers: nisplus [NOTFOUND=return] files +#netmasks: nisplus [NOTFOUND=return] files + +bootparams: nisplus [NOTFOUND=return] files + +ethers: files +netmasks: files +networks: files +protocols: files +rpc: files +services: files + +netgroup: nisplus + +publickey: nisplus + +automount: files nisplus +aliases: files nisplus diff --git a/science-containers/Dockerfiles/casa/version-4.5-4.7/update-data.patch b/science-containers/Dockerfiles/casa/version-4.5-4.7/update-data.patch new file mode 100755 index 0000000..3dc80c6 --- /dev/null +++ b/science-containers/Dockerfiles/casa/version-4.5-4.7/update-data.patch @@ -0,0 +1,27 @@ +#!/usr/bin/perl +## +## move rsync point from svn.cv.nrao.edu to casa.nrao.edu +## +use File::Find; + +if ( scalar(@ARGV) < 1 ) { die "$0 requires path to CASA installation to be patched..." } +if ( scalar(@ARGV) > 1 ) { die "$0 requires only one parameter which is the path to CASA installation to be patched..." } + +unless ( -d $ARGV[0] ) { die "$0 requires path to CASA installation (which should be a directory) to be patched..." } + +sub locate_script { + if ( -f $_ && $_ eq "update-data" ) { + print "substituting $File::Find::dir/$_\n"; + open( CONTENTS, "< $_" ); + my @contents = ; + close( CONTENTS ); + open( CONTENTS, "> $_" ); + foreach my $x ( @contents ) { + $x =~ s@(?:rsync://svn.cv.nrao.edu/casa-data|rsync://casa.nrao.edu/casa-data)@rsync://casa-rsync.nrao.edu/casa-data@g; + print CONTENTS "$x"; + } + close( CONTENTS ); + } +} + +find( { wanted => \&locate_script }, $ARGV[0] ); \ No newline at end of file