Skip to content

Commit

Permalink
get templated config files fully working
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Dec 2, 2024
1 parent 4c420a4 commit 16d345a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
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
22 changes: 15 additions & 7 deletions environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,29 @@ fi
# to allow multiple compose beamlines to run on the same host.
# BASE values should be separated by 20.
#
BASE=5064
BASE=5094 # default would usually be 5064
#
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 EPICS_CA_SERVER_PORT=$BASE # default 5064
export EPICS_CA_REPEATER_PORT=$(( $BASE + 1 )) # default 5065
export EPICS_PVA_SERVER_PORT=$(( $BASE + 11 )) # default 5075

export CA_SUBNET=170.$(($BASE % 256)).0.0/16
export CA_BROADCAST=170.$(($BASE % 256)).255.255
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
Expand All @@ -47,7 +56,6 @@ else
unset DOCKER_HOST
docker=docker
fi

echo using $docker as container engine

# ensure local container users can access X11 server
Expand Down
3 changes: 3 additions & 0 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 Down
4 changes: 4 additions & 0 deletions services/gateway/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ services:
- 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

networks:
Expand Down
4 changes: 2 additions & 2 deletions services/phoebus/config/settings.template
Original file line number Diff line number Diff line change
@@ -1,6 +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
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
org.phoebus.pv.pva/epics_pva_name_servers=127.0.0.1:5075
File renamed without changes.

0 comments on commit 16d345a

Please sign in to comment.