From 7af627a66a7c32b838d77a65322f744b06793ef0 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Fri, 23 Aug 2024 10:21:12 +0100 Subject: [PATCH] add phoebus launcher --- opi/phoebus-launch.sh | 48 +++++++++++++++++++++++++++++++++++++++++++ opi/settings.ini | 2 ++ 2 files changed, 50 insertions(+) create mode 100755 opi/phoebus-launch.sh create mode 100644 opi/settings.ini diff --git a/opi/phoebus-launch.sh b/opi/phoebus-launch.sh new file mode 100755 index 0000000..8ec5640 --- /dev/null +++ b/opi/phoebus-launch.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# A launcher for the phoebus container that allows X11 forwarding + +thisdir=$(realpath $(dirname ${BASH_SOURCE[0]})) +workspace=$(realpath ${thisdir}/..) + +if [[ $(docker --version 2>/dev/null) == *Docker* ]]; then + docker=docker +else + docker=podman + args="--security-opt=label=type:container_runtime_t" +fi + +XSOCK=/tmp/.X11-unix # X11 socket (but we mount the whole of tmp) +XAUTH=/tmp/.container.xauth.$USER +touch $XAUTH +xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - +chmod 777 $XAUTH + +x11=" +-e DISPLAY +-v $XAUTH:$XAUTH +-e XAUTHORITY=$XAUTH +--net host +" + +args=${args}" +-it +" + +export MYHOME=/home/${USER} +# mount in your own home dir in same folder for access to external files +mounts=" +-v=/tmp:/tmp +-v=${MYHOME}/.ssh:/root/.ssh +-v=${MYHOME}:${MYHOME} +-v=${workspace}:/workspace +" + +# settings for p47 +settings=" +-resource /workspace/opi/p47-beamline.opi +-settings /workspace/opi/settings.ini +" + +set -x +$docker run ${mounts} ${args} ${x11} ghcr.io/epics-containers/ec-phoebus:latest ${settings} "${@}" diff --git a/opi/settings.ini b/opi/settings.ini new file mode 100644 index 0000000..4f60b71 --- /dev/null +++ b/opi/settings.ini @@ -0,0 +1,2 @@ +# bl47p-ea-serv-01.diamond.ac.uk +org.phoebus.pv.ca/addr_list=172.23.242.47