Skip to content

Instantly share code, notes, and snippets.

@karcaw
Created April 7, 2022 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save karcaw/d3280810c69273b6b989b9e9c44c4453 to your computer and use it in GitHub Desktop.
Save karcaw/d3280810c69273b6b989b9e9c44c4453 to your computer and use it in GitHub Desktop.
# Built by Evan Felix for the PNNL EMSL Systems
# See www.emsl.pnl.gov
#
# Build with commands simalar to this:
# mkdir -p overlay/upper
# mkdir -p overlay/work
# truncate -s $$((1024*1024*1024)) overlay.img && mkfs.ext3 -d overlay overlay.img
# singularity build -F $@ $<
# singularity sif add --datatype 4 --partfs 2 --parttype 4 --partarch 2 --groupid 1 $@ overlay.img
#
#
# run with a command simalar to this:
# /usr/bin/singularity instance start --pid-file /run/ood.pid -w -B /home -B /etc/pki/ --env SYSTEM_NAME=tahoma /cluster/containers/ood.sif ood
# Our singularity.conf mounts in all the other mountpoints.
#
# this just builds up from our centos7/epel/etc base image
Bootstrap: localimage
From: el7-hpc-test.sif
%environment
export SYSTEM_NAME=<example_cluster>
# This helps us secure our server a little more, you may not need it
#%files
# files/secure.conf /opt/rh/httpd24/root/etc/httpd/conf.d/
%post
yum install -y https://yum.osc.edu/ondemand/2.0/ondemand-release-web-2.0-1.noarch.rpm
yum install -y ondemand httpd24-mod_auth_openidc sssd netcat strace httpd24-libnghttp2 ondemand_exporter
for i in <list of users allowed to develop apps>
do
mkdir -p /var/www/ood/apps/dev/$i
ln -sf /home/$i/ondemand/dev/ /var/www/ood/apps/dev/$i/gateway
done
cd /var/www/ood/apps/sys
git clone https://<redacted url>/bc_msc_desktop.git
git clone https://<redacted url>/bc_msc_jupyter.git
git clone https://<redacted url>/bc_msc_rstudio.git
git clone https://<redacted url>/bc_msc_pacifica_uploader.git
git clone https://<redacted url>/bc_msc_codeserver.git
%startscript
cd /root
git clone https://<redacted url>/ood_config.git
(cd ood_config;git pull)
rm -rf /etc/ood/config
cp -a ood_config/$SYSTEM_NAME /etc/ood/config
/opt/ood/ood-portal-generator/sbin/update_ood_portal -f
#hackup the ssl file because we need to mount it into the node.
sed -i -e 's=^SSLCertificateFile.*=SSLCertificateFile "/etc/pki/ca-trust/source/anchors/star.emsl.pnl.gov.pem"=' -e 's=^SSLCertificateKeyFile.*=SSLCertificateKeyFile "/etc/pki/tls/private/star.emsl.pnl.gov.key"=' /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf
#remove old puns
rm -rf /var/run/ondemand-nginx/*
/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper -DFOREGROUND
%apprun bash
echo Starting Shell
exec /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment