Skip to content

Commit

Permalink
Merge pull request #113 from helenkirk/new_casa66
Browse files Browse the repository at this point in the history
New casa66
  • Loading branch information
sfabbro authored Jul 17, 2024
2 parents 12a987d + 93e738f commit 7f283ef
Show file tree
Hide file tree
Showing 1,159 changed files with 266,235 additions and 0 deletions.
23 changes: 23 additions & 0 deletions science-containers/Dockerfiles/casa/ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:22.04

#This Dockerfile creates a local version of the Ubuntu 22.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 && \
apt upgrade -y && \
apt install -y libsm6 libxi6 libxrender1 libxrandr2 \
libxfixes3 libxcursor1 libxinerama1 fontconfig \
imagemagick xterm && \
apt install -y perl autoconf autoconf graphviz xz-utils \
gfortran libcanberra-gtk-module libsnl-dev && \
apt install -y libxslt1.1 xauth xorg xvfb dbus && \
apt install -y libfuse2 && \
apt install -y gcc libgsl-dev libfftw3-dev && \
apt install -y sssd acl && \
apt install -y tcsh && \
apt install -y wget



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

VERSIONS = \
22.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
11 changes: 11 additions & 0 deletions science-containers/Dockerfiles/casa/ubuntu22.04/init.sh
Original file line number Diff line number Diff line change
@@ -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"
62 changes: 62 additions & 0 deletions science-containers/Dockerfiles/casa/ubuntu22.04/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
27 changes: 27 additions & 0 deletions science-containers/Dockerfiles/casa/ubuntu22.04/update-data.patch
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] );
72 changes: 72 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
FROM images.canfar.net/skaha/ubuntu:22.04

# 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 AND el7 (etc) is now specified everywhere in the full path.
##NB2: pipelines may be an exception.
## (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
RUN chown -R root:root /opt/${CASA_RELEASE} && ln -s /opt/${CASA_RELEASE} /opt/casa

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

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

##NEW for CASA6.*: explicitly add in astropy
##Instructions here: https://casadocs.readthedocs.io/en/latest/notebooks/frequently-asked-questions.html
RUN /opt/${CASA_RELEASE}/bin/pip3 install astropy && \
#also add astroquery (astroquery.readthedocs.io/en/latest/)
/opt/${CASA_RELEASE}/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

RUN chmod 777 -R /opt/squashfs-root /opt/squashfs-root/usr /opt/squashfs-root/usr/*

CMD [ "/skaha/init.sh" ]
56 changes: 56 additions & 0 deletions science-containers/Dockerfiles/casa/version-6.6/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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_PIPELINE = \
# casa-6.1.1-15-pipeline-2020.1.0.40

#!NB >casa6.5.6 versions have a different directory naming structure again
VERSIONS = \
casa-6.6.3-22-py3.8.el7
# casa-6.6.0-20-py3.8.el7
# casa-6.5.6-22-py3.8.el7

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

.PHONY: build clean run

all: build-pipeline build

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

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

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

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

clean-all: clean-old clean-pipeline clean

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

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

upload-all: upload-pipeline upload
Loading

0 comments on commit 7f283ef

Please sign in to comment.