Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASA6.1-6.4 updates #114

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions science-containers/Dockerfiles/casa/centos7/CentOS-Base.repo
Original file line number Diff line number Diff line change
@@ -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/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

# 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/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

# 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/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
24 changes: 15 additions & 9 deletions science-containers/Dockerfiles/casa/centos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ FROM centos:7
#This dockerfile makes a centos7 container with library dependencies needed
# for casa versions

RUN yum clean all -y
RUN yum makecache -y
RUN yum update -y
RUN yum install -y freetype libSM libXi libXrender libXrandr \
# 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 && \
yum makecache -y && \
yum update -y && \
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 xz

RUN yum install -y firefox

RUN yum install -y sssd-client acl
tkinter ImageMagick-c++ xterm perl autoconf python-sphinx graphviz xz && \
yum install -y firefox && \
yum install -y sssd-client acl && \
#for admit:
yum install -y tcsh && \
#for analysisUtils:
yum install -y wget

29 changes: 14 additions & 15 deletions science-containers/Dockerfiles/casa/ubuntu20.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ FROM ubuntu:20.04
# 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 \
RUN apt update && \
apt upgrade -y && \
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
imagemagick xterm && \
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

apt install -y libxslt1.1 xauth xorg xvfb dbus && \
#
apt install -y libfuse2 && \
#Add in firefox and library dependency
RUN apt install -y firefox libpci3

RUN apt install -y sssd acl

apt install -y firefox libpci3 && \
apt install -y sssd acl && \
apt install -y wget && \
#add in tcsh for admit installation
apt install -y tcsh
6 changes: 0 additions & 6 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/init.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
FROM images.canfar.net/skaha/centos:7
#NB: CASA 6.1.X needs glibc2.29 and does not work with ubuntu20.04 which
# has glibc2.31.
#xterm dependency is an extra to get the casa shell in the display
#perl was added for casa later than 5

# xterm dependency is an extra to get the casa shell in the display
# perl was added for casa later than 5

##additional packages for UVmultifit
#RUN yum install -y gcc gcc-c++ gsl-devel fftw-devel

# setup all required env variables
ARG CASA_RELEASE
ENV CASA_RELEASE=${CASA_RELEASE}
Expand All @@ -11,39 +16,38 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/casa/
# unpack and move casa databundle to container
ADD ${CASA_RELEASE}.tar.xz /opt/

# ADD does not untar xz automatically
# RUN unxz /opt/${CASA_RELEASE}.tar.xz
# RUN tar -xf /opt/${CASA_RELEASE}.tar

# chown because the untarred casa has wrong owner/group
##NB: commands below revert back to the pre-CASA6.4 terminology, as the version of python is now specified everywhere in the full path.
##NB2: exception is pipeline6.5.3, which does not specify -py3.8 and thus has a different naming structure to that below.
## (the %%-py* string removes the -py3.X part of the CASA_RELEASE variable name for the directory structure)
RUN chown -R root:root /opt/${CASA_RELEASE%%-py*} && ln -s /opt/${CASA_RELEASE%%-py*} /opt/casa


# add the admit enhancement (issue #25)
RUN yum install -y tcsh
## add the admit enhancement (issue #25)
RUN mkdir /opt/admit
ADD admit /opt/admit
RUN cd /opt/admit && \
autoconf && ./configure --with-casa-root=/opt/${CASA_RELEASE%%-py*}
autoupdate && autoconf && \
./configure --with-casa-root=/opt/${CASA_RELEASE%%-py*}

# 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%%-py*}/data && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/data
RUN chmod 777 /opt/${CASA_RELEASE%%-py*}
RUN cd /opt/${CASA_RELEASE%%-py*} && \
RUN mkdir -p /arc/projects/casa-data-repository && \
rm -rf /opt/${CASA_RELEASE%%-py*}/data && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/data && \
chmod 777 /opt/${CASA_RELEASE%%-py*} && \
cd /opt/${CASA_RELEASE%%-py*} && \
REPLACED_DATA=`find lib -name __data__` && \
chmod 777 ${REPLACED_DATA}/.. && \
rm -rf ${REPLACED_DATA} && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/${REPLACED_DATA}
RUN rm -rf /arc
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/${REPLACED_DATA} && \
rm -rf /arc

#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
#Add in analysisUtils package
RUN mkdir /opt/casa/analysisUtils && \
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
Expand All @@ -57,8 +61,12 @@ ADD init.sh /skaha/
RUN dbus-uuidgen --ensure

ADD nsswitch.conf /etc/

WORKDIR /opt
COPY extract-casaviewer.sh .
#below suggested by Seb to help with viewer script & variables, doesn't work
# here for some reason, and generally hasn't been effective
#ENV PYTHONPATH /opt/${CASA_RELEASE%%-py*}/lib/py/lib/python3.8/site-packages
RUN bash extract-casaviewer.sh && rm extract-casaviewer.sh

RUN chmod 777 -R /opt/squashfs-root /opt/squashfs-root/usr /opt/squashfs-root/usr/*
Expand Down
53 changes: 53 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# NB: before using, uncomment the version to be built
# NB2: One manual edit is also required in the extract_casaviewer.sh script,
# about halfway down, to again select the command associated with setting up
# plotms for the desired version of CASA

VERSIONS = \
casa-6.1.0-118# \

VERSIONS_PIPELINE = \
# casa-6.1.1-15-pipeline-2020.1.0.40

DOCKER_REPO_BASE=images.canfar.net/casa-6/casa

.PHONY: build clean run

all: build build-pipeline

build:
@- $(foreach V,$(VERSIONS), \
./download.sh $(V) current ; \
docker build --build-arg CASA_RELEASE=$(V) -t ${DOCKER_REPO_BASE}:$(V) .; \
)

build-pipeline:
@- $(foreach V,$(VERSIONS_PIPELINE), \
./download.sh $(V) pipeline ; \
docker build --build-arg CASA_RELEASE=$(V) -t ${DOCKER_REPO_BASE}:$(V) .; \
)


clean:
@- $(foreach V,$(VERSIONS), \
docker rmi ${DOCKER_REPO_BASE}:$(V) ; \
)

clean-pipeline:
@- $(foreach V,$(VERSIONS_PIPELINE), \
docker rmi ${DOCKER_REPO_BASE}:$(V) ; \
)

clean-all: clean clean-pipeline

upload: build
@- $(foreach V,$(VERSIONS), \
docker push ${DOCKER_REPO_BASE}:$(V) ; \
)

upload-pipeline: build-pipeline
@- $(foreach V,$(VERSIONS_PIPELINE), \
docker push ${DOCKER_REPO_BASE}:$(V) ; \
)

upload-all: upload upload-pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#NB: needs to be edited for casa version in first coding line below
# AppImage fix applies now too casaviewer, casaplotms
# and new: casalogger, casaplotserver, casatablebrowser, casafeather

casavers=casa-6.1.0-118
#casavers=casa-6.1.1-15-pipeline-2020.1.0.40

pyvers=python3.6

pushd /opt
#below command was original way of structuring this, but not working anymore
#manually inputting casavers above to get around this
#casaviewer=$(python3 -m casaviewer --app-path 2> /dev/null | grep casaviewer)
#echo ${casaviewer}
casaviewer=/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage
${casaviewer} --appimage-extract 2> /dev/null

mv /opt/casa/bin/casaviewer /opt/casa/bin/casaviewer.old
ln -s /opt/squashfs-root/AppRun /opt/casa/bin/casaviewer

#additional steps courtesy of CASA helpdesk
#NB: casa6.5 and higher use python3.8, only option
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage.orig
ln -s /opt/squashfs-root/usr/bin/casaviewer /opt/casa/lib/py/lib/${pyvers}/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage

#Apply similar process for other packages
#1) extract AppImage
/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casalogger/__bin__/casalogger-x86_64.AppImage --appimage-extract 2> /dev/null
/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casafeather/__bin__/casafeather-x86_64.AppImage --appimage-extract 2> /dev/null
/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casaplotserver/__bin__/casaplotserver-x86_64.AppImage --appimage-extract 2> /dev/null
/opt/${casavers}/lib/py/lib/${pyvers}/site-packages/casatablebrowser/__bin__/casatablebrowser-x86_64.AppImage --appimage-extract 2> /dev/null

#2a) move old AppImage
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage.orig
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casalogger/__bin__/casalogger-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casalogger/__bin__/casalogger-x86_64.AppImage.orig
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casafeather/__bin__/casafeather-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casafeather/__bin__/casafeather-x86_64.AppImage.orig
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotserver/__bin__/casaplotserver-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotserver/__bin__/casaplotserver-x86_64.AppImage.orig
mv /opt/casa/lib/py/lib/${pyvers}/site-packages/casatablebrowser/__bin__/casatablebrowser-x86_64.AppImage /opt/casa/lib/py/lib/${pyvers}/site-packages/casatablebrowser/__bin__/casatablebrowser-x86_64.AppImage.orig

#2b) link to new one
ln -s /opt/squashfs-root/usr/bin/casaplotms /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage
ln -s /opt/squashfs-root/usr/bin/casalogger /opt/casa/lib/py/lib/${pyvers}/site-packages/casalogger/__bin__/casalogger-x86_64.AppImage
ln -s /opt/squashfs-root/usr/bin/casafeather /opt/casa/lib/py/lib/${pyvers}/site-packages/casafeather/__bin__/casafeather-x86_64.AppImage
ln -s /opt/squashfs-root/usr/bin/casaplotserver /opt/casa/lib/py/lib/${pyvers}/site-packages/casaplotserver/__bin__/casaplotserver-x86_64.AppImage
ln -s /opt/squashfs-root/usr/bin/casatablebrowser /opt/casa/lib/py/lib/${pyvers}/site-packages/casatablebrowser/__bin__/casatablebrowser-x86_64.AppImage


popd
12 changes: 12 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.1/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/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/startup.py
echo 'sys.path.append("/opt/casa/analysisUtils/analysis_scripts/")' >> $HOME/.casa/startup.py
echo 'import analysisUtils as au' >> $HOME/.casa/startup.py
echo 'import analysisUtils as AU' >> $HOME/.casa/startup.py
echo "INIT DONE"
echo "INIT DONE"
83 changes: 83 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.2-6.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
FROM images.canfar.net/skaha/ubuntu:20.04

# xterm dependency is an extra to get the casa shell in the display
# perl was added for casa later than 5

##additional packages for UVmultifit
#RUN yum install -y gcc gcc-c++ gsl-devel fftw-devel
#
#
# 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

# unpack and move casa databundle to container
ADD ${CASA_RELEASE}.tar.xz /opt/

# chown because the untarred casa has wrong owner/group
##NB: commands below revert back to the pre-CASA6.4 terminology, as the version of python is now specified everywhere in the full path.
##NB2: exception is pipeline6.5.3, which does not specify -py3.8 and thus has a different naming structure to that below.
## (the %%-py* string removes the -py3.X part of the CASA_RELEASE variable name for the directory structure)
RUN chown -R root:root /opt/${CASA_RELEASE%%-py*} && ln -s /opt/${CASA_RELEASE%%-py*} /opt/casa

## add the admit enhancement (issue #25)
RUN mkdir /opt/admit
ADD admit /opt/admit
RUN cd /opt/admit && \
autoupdate && autoconf && \
./configure --with-casa-root=/opt/${CASA_RELEASE%%-py*}

# 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 && \
rm -rf /opt/${CASA_RELEASE%%-py*}/data && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/data && \
chmod 777 /opt/${CASA_RELEASE%%-py*} && \
cd /opt/${CASA_RELEASE%%-py*} && \
REPLACED_DATA=`find lib -name __data__` && \
chmod 777 ${REPLACED_DATA}/.. && \
rm -rf ${REPLACED_DATA} && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/${REPLACED_DATA} && \
rm -rf /arc

#Add in analysisUtils package
RUN mkdir /opt/casa/analysisUtils && \
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)

#NB: astropy & astroquery do not seem compatible with py3.6 & ubuntu20.04
# At least some of the casa versions in this directory (6.4) do work with
# py3.8 & ubuntu22.04, however, firefox does not currently work there,
# and is helpful for some pipeline tasks
###NEW for CASA6.*: explicitly add in astropy
###Instructions here: https://casadocs.readthedocs.io/en/latest/notebooks/frequently-asked-questions.html
#RUN /opt/casa/bin/python3 -m pip install --upgrade pip && \
# /opt/casa/bin/pip3 install astropy && \
##also add astroquery (astroquery.readthedocs.io/en/latest/)
# /opt/casa/bin/python3 -m pip install --pre astroquery[all]

RUN mkdir /skaha
ADD init.sh /skaha/

# generate missing dbus uuid (issue #47)
RUN dbus-uuidgen --ensure

ADD nsswitch.conf /etc/

WORKDIR /opt
COPY extract-casaviewer.sh .
#below suggested by Seb to help with viewer script & variables, doesn't work
# here for some reason, and generally hasn't been effective
#ENV PYTHONPATH /opt/${CASA_RELEASE%%-py*}/lib/py/lib/python3.8/site-packages
RUN bash extract-casaviewer.sh && rm extract-casaviewer.sh && \
#
chmod 777 -R /opt/squashfs-root /opt/squashfs-root/usr /opt/squashfs-root/usr/*

CMD [ "/skaha/init.sh" ]
Loading
Loading