Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ venv*
# and is created at runtime by IOCs using PVI
opi/auto-generated/*
!opi/auto-generated/README.md

# these files are generated from templates
# when sourcing environment.sh
services/pvagw/config/pvagw.config
services/phoebus/config/settings.ini
52 changes: 37 additions & 15 deletions environment.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,49 @@ if [ "$0" = "$BASH_SOURCE" ]; then
exit 1
fi

# Environment variables for the EPICS IOC ports. Pick a Unique BASE
# to allow multiple compose beamlines to run on the same host.
# BASE values should be separated by 20.
#
BASE=5094
#
export EPICS_CA_SERVER_PORT=$BASE # defaults to 5064
export EPICS_CA_REPEATER_PORT=$(( $BASE + 1 )) # defaults to 5065
export EPICS_PVA_SERVER_PORT=$(( $BASE + 11 )) # defaults to 5075

export CA_SUBNET=170.$(( $BASE % 256 )).0.0/16
export CA_BROADCAST=170.$(( $BASE % 256 )).255.255

export EPICS_PVA_NAME_SERVERS=localhost:${EPICS_PVA_SERVER_PORT}
export EPICS_CA_NAME_SERVERS=localhost:${EPICS_CA_SERVER_PORT}

export EPICS_CA_ADDR_LIST=127.0.0.1

# update configuration files that depend on the above environment variables
cat services/phoebus/config/settings.template |
sed -e "s/5064/$EPICS_CA_SERVER_PORT/g" \
-e "s/5065/$EPICS_CA_REPEATER_PORT/g" \
-e "s/5075/$EPICS_PVA_SERVER_PORT/g" > services/phoebus/config/settings.ini
cat services/pvagw/config/pvagw.template |
sed -e "s/172.20.255.255/$CA_BROADCAST/g" \
-e "s/5075/$EPICS_PVA_SERVER_PORT/g" > services/pvagw/config/pvagw.config

# if there is a docker-compose module then load it
if [[ $(module avail docker-compose 2>/dev/null) != "" ]] ; then
module load docker-compose
fi

function check_docker {
# return 0 if docker is detected, or 1 otherwise,
# cope with the possibility that podman is aliased to docker
if [[ $(docker version) =~ "Docker" ]]&> /dev/null; then
return 0
fi
return 1
}

# set user id for the phoebus container for easy X11 forwarding.
if check_docker; then
USER_ID=$(id -u); USER_GID=$(id -g)
else
alias docker=podman
# podman vs docker differences.
if podman version &> /dev/null && [[ -z $USE_DOCKER ]] ; then
USER_ID=0; USER_GID=0
DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock
docker=podman
else
USER_ID=$(id -u); USER_GID=$(id -g)
unset DOCKER_HOST
docker=docker
fi
echo using $docker as container engine

# ensure local container users can access X11 server
xhost +SI:localuser:$(id -un)
Expand All @@ -48,4 +70,4 @@ export COMPOSE_PROFILES=test
# for test profile our ca-gateway publishes PVS on the loopback interface
export EPICS_CA_ADDR_LIST=127.0.0.1
# make a short alias for docker-compose for convenience
alias dc='docker compose'
alias dc='$docker compose'
6 changes: 3 additions & 3 deletions include/ioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ services:
IOC_LOCATION: localhost
BEAMLINE: bl01t
IOC_GROUP: bl01t
EPICS_CA_SERVER_PORT: ${EPICS_CA_SERVER_PORT}
EPICS_CA_REPEATER_PORT: ${EPICS_CA_REPEATER_PORT}
EPICS_PVA_SERVER_PORT: ${EPICS_PVA_SERVER_PORT}

tty: true
stdin_open: true
Expand All @@ -39,9 +42,6 @@ services:

networks:
- channel_access
expose:
- "5064-5065/udp"
- "5064-5065"

# proxy services that each manage an RTEMS hard IOC ##########################
rtems_ioc:
Expand Down
2 changes: 1 addition & 1 deletion include/networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ networks:
ipam:
driver: default
config:
- subnet: "172.20.0.0/16"
- subnet: "${CA_SUBNET}"
84 changes: 42 additions & 42 deletions opi/demo.bob
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Saved on 2024-07-30 13:33:45 by root-->
<!--Saved on 2024-12-02 19:37:07 by root-->
<display version="2.0.0">
<name>Example IOCs</name>
<width>388</width>
Expand Down Expand Up @@ -372,47 +372,6 @@
<tooltip>$(text)</tooltip>
</widget>
</widget>
<widget type="image" version="2.0.0">
<name>Image</name>
<pv_name>BL01T-DI-CAM-01:ARR:ArrayData</pv_name>
<x>396</x>
<y>36</y>
<width>670</width>
<height>670</height>
<show_toolbar>true</show_toolbar>
<x_axis>
<visible>false</visible>
<title>SimDetector Image</title>
<minimum>0.0</minimum>
<maximum>1024.0</maximum>
<title_font>
<font name="Default Bold" family="Liberation Sans" style="BOLD" size="14.0">
</font>
</title_font>
<scale_font>
<font name="Default" family="Liberation Sans" style="REGULAR" size="14.0">
</font>
</scale_font>
</x_axis>
<y_axis>
<visible>false</visible>
<title>Y</title>
<minimum>0.0</minimum>
<maximum>1024.0</maximum>
<title_font>
<font name="Default Bold" family="Liberation Sans" style="BOLD" size="14.0">
</font>
</title_font>
<scale_font>
<font name="Default" family="Liberation Sans" style="REGULAR" size="14.0">
</font>
</scale_font>
</y_axis>
<data_width>1024</data_width>
<data_height>1024</data_height>
<unsigned>true</unsigned>
<cursor_crosshair>true</cursor_crosshair>
</widget>
<widget type="group" version="3.0.0">
<name>Autogenerated Engineering Screens</name>
<macros>
Expand Down Expand Up @@ -579,4 +538,45 @@
<y>77</y>
</widget>
</widget>
<widget type="image" version="2.0.0">
<name>Image_1</name>
<pv_name>pva://BL01T-DI-CAM-01:PVA:OUTPUT</pv_name>
<x>402</x>
<y>36</y>
<width>670</width>
<height>670</height>
<show_toolbar>true</show_toolbar>
<x_axis>
<visible>false</visible>
<title>SimDetector Image</title>
<minimum>0.0</minimum>
<maximum>1024.0</maximum>
<title_font>
<font name="Default Bold" family="Liberation Sans" style="BOLD" size="14.0">
</font>
</title_font>
<scale_font>
<font name="Default" family="Liberation Sans" style="REGULAR" size="14.0">
</font>
</scale_font>
</x_axis>
<y_axis>
<visible>false</visible>
<title>Y</title>
<minimum>0.0</minimum>
<maximum>1024.0</maximum>
<title_font>
<font name="Default Bold" family="Liberation Sans" style="BOLD" size="14.0">
</font>
</title_font>
<scale_font>
<font name="Default" family="Liberation Sans" style="REGULAR" size="14.0">
</font>
</scale_font>
</y_axis>
<data_width>1024</data_width>
<data_height>1024</data_height>
<unsigned>true</unsigned>
<cursor_crosshair>true</cursor_crosshair>
</widget>
</display>
4 changes: 4 additions & 0 deletions services/bl01t-di-cam-01/config/ioc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ ioc_name: "{{ _global.get_env('IOC_NAME') }}"
description: Example simulated camera for BL01T

entities:
- type: devIocStats.iocAdminSoft
IOC: "{{ ioc_name | upper }}"

- type: ADSimDetector.simDetector
PORT: DET.DET
P: BL01T-DI-CAM-01
Expand All @@ -19,6 +22,7 @@ entities:
dbpf BL01T-DI-CAM-01:ARR:EnableCallbacks 1
dbpf BL01T-DI-CAM-01:PROC:EnableCallbacks 1
dbpf BL01T-DI-CAM-01:ROI:EnableCallbacks 1
dbpf BL01T-DI-CAM-01:PVA:EnableCallbacks 1
dbpf BL01T-DI-CAM-01:DET:Acquire 1

- type: ADCore.NDROI
Expand Down
22 changes: 12 additions & 10 deletions services/gateway/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ services:

image: ghcr.io/epics-containers/docker-ca-gateway:2.1.3ec1

expose:
- 5064-5065/udp
- 5064-5065

security_opt:
- label=disable

ports:
# bind to localhost to isolate channel access to this host only
- 127.0.0.1:5064:5064/udp
- 127.0.0.1:5064-5065:5064-5065
- 127.0.0.1:${EPICS_CA_SERVER_PORT}:${EPICS_CA_SERVER_PORT}/udp
- 127.0.0.1:${EPICS_CA_SERVER_PORT}:${EPICS_CA_SERVER_PORT}
- 127.0.0.1:${EPICS_CA_REPEATER_PORT}:${EPICS_CA_REPEATER_PORT}

environment:
EPICS_CA_SERVER_PORT: ${EPICS_CA_SERVER_PORT}
EPICS_CA_REPEATER_PORT: ${EPICS_CA_REPEATER_PORT}

restart: unless-stopped

Expand All @@ -36,7 +37,7 @@ services:
- source: ca-gateway_config
target: /config

command: -cip 172.20.255.255 -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1
command: -cip ${CA_BROADCAST} -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1

profiles:
- test
Expand All @@ -62,10 +63,11 @@ services:

ports:
# TODO - I need to look into safe config for per server ca-gateways
- 127.0.0.1:5064:5064/udp
- 127.0.0.1:5064-5065:5064-5065
- 127.0.0.1:${EPICS_CA_SERVER_PORT}:${EPICS_CA_SERVER_PORT}/udp
- 127.0.0.1:${EPICS_CA_SERVER_PORT}:${EPICS_CA_SERVER_PORT}
- 127.0.0.1:${EPICS_CA_REPEATER_PORT}:${EPICS_CA_REPEATER_PORT}

command: -cip 172.20.255.255 -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1
command: -cip ${CA_BROADCAST} -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1

profiles:
- deploy
Expand Down
1 change: 0 additions & 1 deletion services/phoebus/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
command: phoebus-product/phoebus.sh -settings /config/settings.ini -resource /opi/demo.bob -server 7010
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- ~/.Xauthority:/root/.Xauthority
- ../../opi:/opi
- ../../..:/workspaces

Expand Down
4 changes: 0 additions & 4 deletions services/phoebus/config/settings.ini

This file was deleted.

6 changes: 6 additions & 0 deletions services/phoebus/config/settings.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# using localhost for channel access to isolate it to the host for development
org.phoebus.pv.ca/addr_list=127.0.0.1:5064
org.phoebus.pv.ca/server_port=5064
org.phoebus.pv.ca/repeater_port=5065
org.phoebus.pv.pva/server_port=5075
org.phoebus.pv.pva/epics_pva_name_servers=127.0.0.1:5075
21 changes: 8 additions & 13 deletions services/pvagw/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ services:

image: ghcr.io/epics-containers/ec-p4p:4.1.12ec1

expose:
- 5076/udp
- 5075

ports:
# bind to localhost to isolate channel access to this host only
- 127.0.0.1:5076:5076/udp
- 127.0.0.1:5075:5075
- 127.0.0.1:${EPICS_PVA_SERVER_PORT}:${EPICS_PVA_SERVER_PORT}

environment:
- EPICS_PVA_SERVER_PORT=${EPICS_PVA_SERVER_PORT}
- EPICS_PVAS_SERVER_PORT=${EPICS_PVA_SERVER_PORT}

restart: unless-stopped

Expand All @@ -30,10 +28,8 @@ services:
command: -c "pvagw /config/pvagw.config --debug"

profiles:
# PVAcess cannot set up channels into a container yet, so we are using
# ndstdarrys instead of ndpva for now
# https://github.com/epics-base/pvAccessCPP/issues/197
- removed
- test
- dev

# per server pvagw for deployment #############################################
pvagw-deploy:
Expand All @@ -42,8 +38,7 @@ services:

ports:
# TODO investigate how to configure this for deployment
- 127.0.0.1:5076:5076/udp
- 127.0.0.1:5075:5075
- 127.0.0.1:${EPICS_PVA_SERVER_PORT}:${EPICS_PVA_SERVER_PORT}

command: -c "pvagw /config/pvagw.config"

Expand Down
Loading