Skip to content

Commit

Permalink
add phoebus launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Aug 23, 2024
1 parent 50e6e4f commit 7af627a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
48 changes: 48 additions & 0 deletions opi/phoebus-launch.sh
Original file line number Diff line number Diff line change
@@ -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} "${@}"
2 changes: 2 additions & 0 deletions opi/settings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# bl47p-ea-serv-01.diamond.ac.uk
org.phoebus.pv.ca/addr_list=172.23.242.47

0 comments on commit 7af627a

Please sign in to comment.