Skip to content

Commit

Permalink
Merge pull request #103 from helenkirk/casa61-64
Browse files Browse the repository at this point in the history
Casa61 64
  • Loading branch information
brianmajor committed May 6, 2024
2 parents 5cdb3eb + 917565c commit f3fe135
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 44 deletions.
16 changes: 16 additions & 0 deletions science-containers/Dockerfiles/casa/centos7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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 \
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

28 changes: 28 additions & 0 deletions science-containers/Dockerfiles/casa/centos7/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

VERSIONS = \
7


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
27 changes: 11 additions & 16 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
FROM centos:6
FROM images.canfar.net/skaha/centos:7

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

# 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 xz

# setup all required env variables
ARG CASA_RELEASE
ENV CASA_RELEASE=${CASA_RELEASE}
Expand All @@ -30,7 +18,6 @@ ADD ${CASA_RELEASE}.tar.xz /opt/
# chown because the untarred casa has wrong owner/group
RUN chown -R root:root /opt/${CASA_RELEASE%%-py*} && ln -s /opt/${CASA_RELEASE%%-py*} /opt/casa

RUN yum install -y sssd-client acl

# add the admit enhancement (issue #25)
RUN yum install -y tcsh
Expand All @@ -53,6 +40,16 @@ RUN cd /opt/${CASA_RELEASE%%-py*} && \
ln -s /arc/projects/casa-data-repository/ /opt/${CASA_RELEASE%%-py*}/${REPLACED_DATA}
RUN 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
#(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 mkdir /skaha
ADD init.sh /skaha/

Expand All @@ -64,8 +61,6 @@ WORKDIR /opt
COPY extract-casaviewer.sh .
RUN bash extract-casaviewer.sh && rm extract-casaviewer.sh

#RUN chmod 755 /opt/squashfs-root /opt/squashfs-root/usr /opt/squashfs-root/usr/*
#COMMENTED BELOW LINE OUT ONLY FOR TESTING PURPOSES. NEED TO INCLUDE!
RUN chmod 777 -R /opt/squashfs-root /opt/squashfs-root/usr /opt/squashfs-root/usr/*

CMD [ "/skaha/init.sh" ]
4 changes: 2 additions & 2 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ VERSIONS_OLD = \
# casa-6.3.0-48 #\
VERSIONS_PIPELINE = \
casa-6.4.1-12-pipeline-2022.2.0.64-py3.6
casa-6.1.1-15-pipeline-2020.1.0.40
# casa-6.4.1-12-pipeline-2022.2.0.64-py3.6
# casa-6.2.1-7-pipeline-2021.2.0.128
# casa-6.1.1-15-pipeline-2020.1.0.40

#!NB >casa6.4.3 versions have a different directory naming structure
VERSIONS = \
Expand Down
1 change: 1 addition & 0 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/admit
Submodule admit added at bbf3d7
36 changes: 36 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

if [ $# -lt 2 ]
then
echo "usage: $0 <version> <"old"|"current">"
exit 1
fi

RELEASE=$1
FILE="${RELEASE}.tar.xz"

if [ $2 == "old" ]; then
URL="https://casa.nrao.edu/download/distro/casa/release/rhel//${FILE}"
elif [ $2 == "pipeline" ]; then
URL="https://casa.nrao.edu/download/distro/casa-pipeline/release/linux/${FILE}"
else
URL="https://casa.nrao.edu/download/distro/casa/release/rhel/${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
Original file line number Diff line number Diff line change
@@ -1,36 +1,59 @@
#!/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.5.4-9-pipeline-2023.1.0.124
#casavers=casa-6.5.3-28-pipeline-2023.0.0.36
#casavers=casa-6.4.1-12-pipeline-2022.2.0.64
#casavers=casa-6.2.1-7-pipeline-2021.2.0.128
casavers=casa-6.1.1-15-pipeline-2020.1.0.40
#casavers=casa-6.3.0-48
#casavers=casa-6.2.0-124
#casavers=casa-6.1.0-118
#casavers=casa-6.4.0-16
#casavers=casa-6.4.3-27

#pyvers=python3.8
pyvers=python3.6

pushd /opt
casaviewer=$(python3 -m casaviewer --app-path 2> /dev/null | grep casaviewer)
echo ${casaviewer}
#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
#ln -s /opt/squashfs-root/AppRun /usr/local/bin/casaviewer

#additional steps courtesy of CASA helpdesk
mv /opt/casa/lib/py/lib/python3.6/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage /opt/casa/lib/py/lib/python3.6/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage.orig
ln -s /opt/squashfs-root/usr/bin/casaviewer /opt/casa/lib/py/lib/python3.6/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage

#additional steps below to fix a similar problem for plotms
# Right now, need to uncomment out each specific version for the first
# command to run. Hopefully this can be tidied up to something similar to the
# first set of commands above

#---- Choose the correct line/version below & uncomment out ------
#/opt/casa-6.1.0-118/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.2.0-124/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.3.0-48/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
/opt/casa-6.4.1-12-pipeline-2022.2.0.64/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.2.1-7-pipeline-2021.2.0.128/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.1.1-15-pipeline-2020.1.0.40/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.4.0-16/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.4.3-27/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#/opt/casa-6.4.4-31/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract 2> /dev/null
#----------------

#the two commands below apply to all versions to finish fixing plotms
mv /opt/casa/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage /opt/casa/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage.orig
ln -s /opt/squashfs-root/usr/bin/casaplotms /opt/casa/lib/py/lib/python3.6/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage
#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
6 changes: 6 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

echo "INIT START"
echo "sourcing admit_start.sh"
source /opt/admit/admit_start.sh
echo "INIT DONE"
62 changes: 62 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.1-6.4/nsswitch.conf
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 = <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] );

0 comments on commit f3fe135

Please sign in to comment.