Set up Stratum 1 server
The Stratum 1 servers for the desktop are configured here: https://github.com/neurodesk/neurodesktop/blob/main/Dockerfile.
If you want more speed in a region, one way could be to set up another Stratum 1 server or a proxy.
Setup a Stratum 1 server
Section titled “Setup a Stratum 1 server”This setup works best on Rocky Linux 9.
sudo yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpmsudo yum install -y cvmfs-server squid tmuxsudo yum install -y python3-mod_wsgi
sudo dnf install dnf-automatic -ysudo systemctl enable dnf-automatic-install.timersudo systemctl status dnf-automatic-installsudo systemctl cat dnf-automatic-install.timersudo vi /etc/dnf/automatic.conf# check if automatic updates are downloaded and applied
tmux new -s cvmfs# return to session: tmux a -t cvmfs
sudo sed -i 's/Listen 80/Listen 127.0.0.1:8080/' /etc/httpd/conf/httpd.conf
set +Hecho "http_port 80 accel" | sudo tee /etc/squid/squid.confecho "http_port 8000 accel" | sudo tee -a /etc/squid/squid.confecho "http_access allow all" | sudo tee -a /etc/squid/squid.confecho "cache_peer 127.0.0.1 parent 8080 0 no-query originserver" | sudo tee -a /etc/squid/squid.confecho "acl CVMFSAPI urlpath_regex ^/cvmfs/[^/]*/api/" | sudo tee -a /etc/squid/squid.confecho "cache deny !CVMFSAPI" | sudo tee -a /etc/squid/squid.confecho "cache_mem 128 MB" | sudo tee -a /etc/squid/squid.conf
sudo systemctl start httpdsudo systemctl start squidsudo systemctl enable httpdsudo systemctl enable squid
#YOU NEED TO ADD YOUR GEO IP data here!echo 'CVMFS_GEO_ACCOUNT_ID=APPLY_FOR_ONE_THIS_IS_a_SIX_DIGIT_NUMBER' | sudo tee -a /etc/cvmfs/server.localecho 'CVMFS_GEO_LICENSE_KEY=APPLY_FOR_ONE_THIS_IS_a_password' | sudo tee -a /etc/cvmfs/server.localsudo chmod 600 /etc/cvmfs/server.local
sudo mkdir -p /etc/cvmfs/keys/ardc.edu.au/
echo "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwUPEmxDp217SAtZxaBepBi2TQcLoh5AJ//HSIz68ypjOGFjwExGlHb95Frhu1SpcH5OASbV+jJ60oEBLi3sDqA6rGYt9kVi90lWvEjQnhBkPb0uWcp1gNqQAUocybCzHvoiG3fUzAe259CrK09qRpX8sZhgK3eHlfx4ycyMiIQeg66AHlgVCJ2fKa6fl1vnh6adJEPULmn6vZnevvUkeI6U1VcYTKm5dPMrOlY/fGimKlyWvivzVv1laa5TAR2Dt4CfdQncOz+rkXmWjLjkD87WMiTgtKybsmMLb2yCGSgLSArlSWhbMA0MaZSzAwE9PJKCCMvTANo5644zc8jBeNQIDAQAB-----END PUBLIC KEY-----" | sudo tee /etc/cvmfs/keys/ardc.edu.au/neurodesk.ardc.edu.au.pub
sudo cvmfs_server add-replica -o $USER http://stratum0.neurodesk.cloud.edu.au/cvmfs/neurodesk.ardc.edu.au /etc/cvmfs/keys/ardc.edu.au
# CVMFS will store everything in /srv/cvmfs so make sure there is enough space or create a symlink to a bigger storage volume# e.g.:#cd /storage#sudo mkdir -p cvmfs-storage/srv/#cd /srv/#sudo mv cvmfs/ /storage/cvmfs-storage/srv/#sudo ln -s /storage/cvmfs-storage/srv/cvmfs/ -->
sudo cvmfs_server snapshot neurodesk.ardc.edu.au
#If this keeps failing with errors like "Processing chunks [21605 registered chunks]: failed to download #http://stratum0.neurodesk.cloud.edu.au/cvmfs/neurodesk.ardc.edu.au/data/03/99e1faa88d0d66a8707cdecdc9b063cc527e50 (17 - host data transfer cut short)#couldn't reach Stratum 0 - please check the network connection#terminate called after throwing an instance of 'ECvmfsException'# what(): PANIC: /home/sftnight/jenkins/workspace/CvmfsFullBuildDocker/CVMFS_BUILD_ARCH/docker-x86_64/CVMFS_BUILD_PLATFORM/cc9/build/BUILD/cvmfs-2.13.0/cvmfs/swissknife_pull.cc : 286#Download error#Aborted (core dumped)"
#Then this is a deep packet inspection issue on the side of the stratum 1. To get around this, create an SSH tunnel to the stratum 0 server and transfer via that tunnel:
#ssh -L 8081:localhost:80 ec2-user@stratum0.neurodesk.cloud.edu.au#sudo vi /etc/cvmfs/repositories.d/neurodesk.ardc.edu.au/server.conf# change this:#CVMFS_STRATUM0=http://stratum0.neurodesk.cloud.edu.au/cvmfs/neurodesk.ardc.edu.au# to this:#CVMFS_STRATUM0=http://localhost:8081/cvmfs/neurodesk.ardc.edu.au
# Then run the sync again
echo "/var/log/cvmfs/*.log { weekly missingok notifempty}" | sudo tee /etc/logrotate.d/cvmfs
echo '*/5 * * * * root output=$(/usr/bin/cvmfs_server snapshot -a -i 2>&1) || echo "$output" ' | sudo tee /etc/cron.d/cvmfs_stratum1_snapshot
sudo yum install iptablessudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8000
sudo systemctl disable firewalldsudo systemctl stop firewalld# make sure that port 80 is open in the real firewall
sudo cvmfs_server update-geodb
#testcurl --head http://YOUR_IP_OR_DNS/cvmfs/neurodesk.ardc.edu.au/.cvmfspublished
sudo crontab -e
# Run CVMFS Stratum 1 Garbage Collection every Sunday at 3:00 AM0 3 * * 0 /usr/bin/cvmfs_server gc -a >> /var/log/cvmfs_gc.log 2>&1