Skip to content

Commit

Permalink
update to copier 4.1.0b4
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Dec 2, 2024
1 parent aaf24cd commit c200daa
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 4.1.0b1
_commit: 4.1.0b4
_src_path: gh:epics-containers/ioc-template
description: Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers
git_platform: github.com
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EPICS_CA_SERVER_PORT=5064
EPICS_CA_REPEATER_PORT=5065
EPICS_PVA_SERVER_PORT=5075
18 changes: 11 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@
"--security-opt=label=disable"
],
"appPort": [
// Expose Channel Access on the hosts loopback interface
// NOTE: change the first port number to run more than one devcontainer
// on the same host.
// Expose Channel Access ports on the host's loopback interface
// Note: update the environment variables in .devcontainer/.env to
// change the ports when running multiple devcontainers simultaneously,
// then use e.g. EPICS_CA_ADDR_LIST="127.0.0.1:5064 127.0.0.1:6064"
// for clients to connect to multiple devcontainers' PVs.
//
// To access two devcontainers from the host for example:
// EPICS_CA_ADDR_LIST="127.0.0.1:5064 127.0.0.1:6064"
"127.0.0.1:5064:5064/udp",
"127.0.0.1:5064-5065:5064-5065"
"127.0.0.1:${remoteEnv:EPICS_CA_SERVER_PORT}:${remoteEnv:EPICS_CA_SERVER_PORT}/udp",
"127.0.0.1:${remoteEnv:EPICS_CA_SERVER_PORT}:${remoteEnv:EPICS_CA_SERVER_PORT}",
"127.0.0.1:${remoteEnv:EPICS_CA_REPEATER_PORT}:${remoteEnv:EPICS_CA_REPEATER_PORT}",
//
// Expose the PVA name server port on all host interfaces
"${remoteEnv:EPICS_PVA_SERVER_PORT}:${remoteEnv:EPICS_PVA_SERVER_PORT}"
],
// Mount the parent of the project folder so we can access peer projects
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
Expand Down
19 changes: 9 additions & 10 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ cd $(dirname ${0})
# make sure the ioc binaries and config symlink are cleaned up
git clean -fdx ioc

if podman version &> /dev/null && [[ -z $USE_DOCKER ]]
then docker=podman
else docker=docker
# prefer docker but use podman if USE_PODMAN is set
if docker version &> /dev/null && [[ -z $USE_PODMAN ]]
then docker=docker
else docker=podman
fi

if $docker buildx version &>/dev/null; then buildx=buildx; load=--load ; fi
if [[ $DOCKER_BUILDKIT == "0" ]]; then buildx=; load=; fi

# make sure new repos get their submodule ibek-support
if [ ! -d ibek-support/_global ] ; then git submodule update --init ; fi

# build and developer images
# build runtime or developer image
set -x
$docker $buildx build -t ${TAG} "${@}" $load \
--build-arg IMAGE_EXT=$IMAGE_EXT \
$runtime --target $TARGET .
$docker build -t ${TAG} "${@}" --build-arg IMAGE_EXT=$IMAGE_EXT \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg EPICS_TARGET_ARCH=$T_A \
--load --target $TARGET .
23 changes: 16 additions & 7 deletions opi/phoebus-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@
thisdir=$(realpath $(dirname $0))
workspace=$(realpath ${thisdir}/..)

# update settings.ini with CA and PVA ports
source ${workspace}/.devcontainer/.env
cat ${workspace}/opi/settings.ini |
sed -r \
-e "s|5064|${EPICS_CA_SERVER_PORT}|" \
-e "s|5075|${EPICS_PVA_SERVER_PORT}|" \
-e "s|5065|${EPICS_CA_REPEATER_PORT}|" > /tmp/settings.ini

settings="
-resource ${workspace}/opi/auto-generated/index.bob
-settings ${workspace}/opi/settings.ini
-settings /tmp/settings.ini
"

if which phoebus.sh &>/dev/null ; then
Expand All @@ -23,9 +31,10 @@ elif module load phoebus 2>/dev/null; then
else
echo "No local phoebus install found, using a container"

if podman version &> /dev/null && [[ -z $USE_DOCKER ]] ;
then docker=podman
else docker=docker
# prefer docker but use podman if USE_PODMAN is set
if docker version &> /dev/null && [[ -z $USE_PODMAN ]]
then docker=docker; UIDGID=$(id -u):$(id -g)
else docker=podman; UIDGID=0:0
fi
echo "Using $docker as container runtime"

Expand All @@ -34,13 +43,13 @@ else

# settings for container launch
x11="-e DISPLAY --net host"
args=$"--rm -it --security-opt=label=none"
mounts="-v=/tmp:/tmp -v=${workspace}:/workspace"
args="--rm -it --security-opt=label=none --user ${UIDGID}"
mounts="-v=/tmp:/tmp -v=${workspace}:/workspace -v=${workspace}/..:/workspaces"
image="ghcr.io/epics-containers/ec-phoebus:latest"

settings="
-settings /workspace/opi/settings.ini
-resource /workspace/opi/auto-generated/index.bob
-settings /tmp/settings.ini
"

set -x
Expand Down
9 changes: 9 additions & 0 deletions opi/settings.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# NOTE: port numbers are defaults only
# this script to be processed with sed to replace port numbers
# see phoebus-launch.sh

# point at local host for channel access
org.phoebus.pv.ca/addr_list=127.0.0.1
org.phoebus.pv.ca/server_port=5064
org.phoebus.pv.ca/repeater_port=5065
# point at local host for pvAccess name server
org.phoebus.pv.pva/epics_pva_name_servers=127.0.0.1
org.phoebus.pv.pva/server_port=5075
9 changes: 4 additions & 5 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ CONF=/epics/ioc/config
# log commands and stop on errorsr
set -ex

if podman version &> /dev/null && [[ -z $USE_DOCKER ]]
then docker=podman
else docker=docker
# prefer docker but use podman if USE_PODMAN is set
if docker version &> /dev/null && [[ -z $USE_PODMAN ]]
then docker=docker
else docker=podman
fi

cd ${ROOT}
Expand All @@ -39,5 +40,3 @@ fi

echo "Tests passed!"



0 comments on commit c200daa

Please sign in to comment.