Container Virtualization for PANDA DCS

Usefull links:

Docker Container

The PANDA DCS Software will be distributed and maintained using Docker containers. All containers have been tested extensively under Debian 9 and 10. The gateway and IOC containers were also tested under Windows 10 (only connection to network devices!)

All docker images listed below can be downloaded and used with:
docker pull paluma.rub.de/<IMAGENAME>

You can also download a specific version by appending `:<TAG>` to the above command, but it is recommended to use `:latest` (default)

For a deeper look in the docker build process, you might have a look at the build repository https://panda-repo.gsi.de/f.feldbauer/epics-docker.

Images

panda-ioc

The panda-ioc image provides a ready to use EPICS IOC with the following device support routines:
  • asyn
  • autosave
  • calc
  • modbus
  • devSnmp
  • StreamDevice
  • drvAsynI2C
  • devGpio

The image is available for amd64 and arm/v7

Usage

Default run command (standalone):

docker run -dit -v :/config [OPTIONS] paluma.rub.de/panda-ioc ./

The panda-ioc image works with Volumes. With volumes you can mount a local directory from your host system into the Docker container (see `-v` option).
You need a directory on your host containing the IOC startup script, and substitution files which is mounted at `/config`

An example IOC startupscript looks like this
#!/pandaIoc
epicsEnvSet( "STREAM_PROTOCOL_PATH", "/protocols" )
dbLoadDatabase( "/dbd/pandaIoc.dbd", 0, 0 )
pandaIoc_registerRecordDeviceDriver( pdbbase )

## Load device drivers and records at this point
drvAsynIPPortConfigure( "huber", "192.168.0.5 TCP", 0, 0, 0 )

## Load record instances
dbLoadRecords( "/database/Huber_Unistate_425.db", "subsys=LMD, sector=H1, PORT=huber" )

iocInit()

The preinstalled database files provided with this Docker image are located at `/databases` within the container's filesystem. A list of all available database and protocol files can be found on the PANDA Gitlab server.

To run commands within the IOC container use `docker attach <CONTAINER ID/NAME>` and you should see the EPICS IOC command prompt.
To detach from the container again use `CTRL+p CTRL+q`

OPTIONS:

  • Connect to serial devices:
    `--device /dev/<DEVICENAME>`
  • Connect being a member of e.g. group dialout:
    `--group-add: $(getent group | grep dialout | cut -d ":" -f 3)
  • Connect to ethernet devices:
    Works without any additional settings
  • Connect to GPIOs (arm only):
    `-v /sys/class/gpio`
  • Connect to I2C (arm only):
    `--device /dev/i2c-<NUM>`
  • Connect to CAN bus devices:
    `--network host`
  • Access PVs from remote:
    • CA: `-p 5064-5065:5064-5065 -p 5064-5065:5064-5065/udp`
    • PVaccess: `--network host`
  • Access remote PVs:
    • CA: `-e EPICS_CA_AUTO_ADDR_LIST=no -e EPICS_CA_ADDR_LIST=<LIST OF IP ADDRESSES>`
      UDP broadcasts are not forwarded by Docker's default network (bridge). Setting `EPICS_CA_ADDR_LIST` to the broadcast address (e.g. `192.168.0.255`) does not work
      Alternatively use `--network host`
    • PVaccess: `--network host`

Tags

  • 1.0.0, 1, latest
    based on epics-base:7.0.3, asyn 4.36, autosave 5.10, calc 3.7.3, modbus 3.0, devSnmp 1.0.0.1, StreamDevice 2.8.9, drvAsynI2C 1.0.2, devGpio 1.0.6
--

ca-gateway

Docker Image providing the Channel Access gateway.

The image is available for amd64 and arm/v7

Usage

Default run command (PC with two NICs required):
docker run -d --network host -v :/config paluma.rub.de/ca-gateway -cip <CLIENT IP> -sip <SERVER IP> -server -pvlist -access 

The ca-gateway image works with Volumes. With volumes you can mount a local directory from your host system into the Docker container (see `-v` option).
You need a directory on your host containing the gateway configuration (access file and pvlist) which is mounted at `/config`

The CLIENT IP is the broadcast address of the network with the IOCs, the SERVER IP is the local IP address of the network to the supervisory layer.

Tags

  • 2.1.1.0, 2, latest
--

phoebus

The phoebus image provides the Phoebus GUI toolchain, to create, edit and run OPIs.

Usage

Default run command (standalone)
docker run --network host -e DISPLAY=$DISPLAY --device /dev/dri -v :/home/panda-dcs/config -v /tmp/.X11-unix:/tmp/.X11-unix paluma.rub.de/phoebus -settings 

On the host system a user with `UID=1000` has to exists with read/write access to the X server of the host system.

The phoebus image works with Volumes. With volumes you can mount a local directory from your host system into the Docker container (see `-v` option).
You need a directory on your host containing the display files and custom configuration settings which is mounted at `/home/panda-dcs/config`

Tags

  • 4.6.0-SNAPSHOT, 4, latest
--

archive-engine

The archive-engine image provides the Phoebus RDB archiver.

Usage

Default run command (standalone):
docker run -d -v :/home/panda-dcs/config -p 4812 paluma.rub.de/archive-engine -engine <ENGINE> -settings 

The archive-engine image works with Volumes. With volumes you can mount a local directory from your host system into the Docker container (see `-v` option).
You need a directory on your host containing custom configuration settings and engine-configuration file(s) which is mounted at `/home/panda-dcs/config`

When the container is started for the first time, any `*.xml` files present in `/home/panda-dcs/config` are imported as new engines into the archiver configuration (using `-replace_engine -steal_channels`). The basename of the xml-files is used as engine name.

The CA address list must be configured manually in settings file (or use `--network host`).

Tags

  • 4.6.0-SNAPSHOT, 4, latest
--

sncseq base image

This is a base image to create Docker images for sequencer programs and cannot be used directly. The Sequencer programs are collected at our PANDA Gitlab server

The image is available for amd64 and arm/v7

Examples of using the panda-ioc

Hameg HMP4040 LV Power Supply

  1. Install Docker (refer to the links at the top of this page!)
  2. Create a directory, where you will store the needed configuration files for our IOC

  1. Now create a file called "hameg_demo.sub" inside this newly created directory with the following content to get access to all for channels of this device
    file "/databases/hmp4040.db"
    {
    pattern { CHAN, PORT }
    { 0, hmp_1 }
    { 1, hmp_1 }
    { 2, hmp_1 }
    { 3, hmp_1 }
    }
    

  1. The HMP4040 has two interfaces for remote control: USB and Ethernet. I will discuss both
  2. USB:
  1. Connect the HMP4040 to our PC via USB. Under linux, the device will show up under `/dev/ttyAMA0` or similar.
  2. Now we need a startup script for our EPICS IOC, which opens the serial interface and configures it so we can talk to the HMP4040. The default settings of the HMP4040 is 8N1 at 9600baud.
    Create a file "hameg_demo.cmd" within the directory we created at the beginning:
#!/pandaIoc
epicsEnvSet( "STREAM_PROTOCOL_PATH", "/protocols" )
dbLoadDatabase( "/dbd/pandaIoc.dbd", 0, 0 )
pandaIoc_registerRecordDeviceDriver( pdbbase )

## Connect to R&S HMP4040 with HO732 via usb-serial interface
drvAsynSerialPortConfigure( "hmp_1", "/dev/ttyAMA0", 0, 0, 0 )
asynSetOption( "hmp_1", 0, "baud", "9600" )
asynSetOption( "hmp_1", 0, "bits", "8" )
asynSetOption( "hmp_1", 0, "parity", "none" )
asynSetOption( "hmp_1", 0, "stop", "1" )
asynSetOption( "hmp_1", 0, "clocal", "Y" )
asynSetOption( "hmp_1", 0, "crtscts", "N" )
asynSetOption( "hmp_1", 0, "ixon", "N" )
asynSetOption( "hmp_1", 0, "ixoff", "N" )
asynSetOption( "hmp_1", 0, "ixany", "N" )

## Load record instances
dbLoadTemplate ("/config/hameg_demo.sub" )

iocInit()

    1. Note in the file above: the first parameter of `drvAsynSerialPortConfigure` is an internal name for the newly created device handle. This has to be the same name we used in our "hameg_demo.sub" as value for the PORT macro.
      This startup script now creates a handle for the serial port at "/dev/ttyAMA0", configures this port and afterwards loads all needed records via the substitution file we created in the beginning.

    1. Now start the docker container to run your IOC:
      docker run -dit -v ${HOME}/hameg_demo:/config --device /dev/ttyAMA0 paluma.rub.de/panda-ioc ./hameg_demo.cmd

  1. Ethernet:
  1. Connect the HMP4040 to our PC via Ethernet cable. You need a DHCP server and need to get the IP address assigned to the HMP4040 (e.g. 192.168.0.5)
  2. Now we need a startup script for our EPICS IOC, which opens a TCP/IP port to the HMP4040
    Create a file "hameg_demo.cmd" within the directory we created at the beginning:
#!/pandaIoc
epicsEnvSet( "STREAM_PROTOCOL_PATH", "/protocols" )
dbLoadDatabase( "/dbd/pandaIoc.dbd", 0, 0 )
pandaIoc_registerRecordDeviceDriver( pdbbase )

## Connect to R&S HMP4040 with HO732 via usb-serial interface
drvAsynIPPortConfigure( "hmp_1", "192.168.0.5:5025 TCP", 0, 0, 0 )

## Load record instances
dbLoadTemplate ("/config/hameg_demo.sub" )

iocInit()

      1. Note in the file above: the first parameter of `drvAsynIPPortConfigure` is an internal name for the newly created device handle. This has to be the same name we used in our "hameg_demo.sub" as value for the PORT macro.
        This startup script now creates a TCP/IP connection to the HMP4040 and loads all needed records via the substitution file we created in the beginning.
      2. Now start the docker container to run your IOC:
docker run -dit -v ${HOME}/hameg_demo:/config paluma.rub.de/panda-ioc ./hameg_demo.cmd


Wiener PL5xx and Wiener MPOD LV power supplies (SNMP)

  1. Install Docker (refer to the links at the top of this page!)
  2. Create a directory, where you will store the needed configuration files for our IOC

  1. Connect the Wiener MPOD (or PL5xx) via ethernet to your PC and look up the IP address of the device (e.g. 192.168.0.5)
  2. Now create a file called "wiener_demo.sub" inside this newly created directory with the following content to get access to channels 'u0' and 'u1' of this device. The macro CRATE is either the hostname or the IP address of the MPOD crate.
file "/databases/WienerPL500.db"
{
        pattern { subsys, dev, sector, CRATE, CH }
        { LMD, MUPIX, P0:H1:D3:S2, 192.168.0.5, u0 }
        { LMD, MUPIX, P0:H1:D3:S2, 192.168.0.5, u1 }
}

  1. Now create the startup script for the IOC
#!/pandaIoc
epicsEnvSet( "WCR", "guru WIENER-CRATE-MIB::" )
dbLoadDatabase( "/dbd/pandaIoc.dbd", 0, 0 )
pandaIoc_registerRecordDeviceDriver( pdbbase )

## Load record instances
dbLoadTemplate ("/config/wiener_demo.sub" )

iocInit()

  1. Now start the docker container to run your IOC:
docker run -dit -v ${HOME}/wiener_demo:/config paluma.rub.de/panda-ioc ./wiener_demo.cmd

-- PeterZumbruch - 12 Nov 2019
Topic revision: r17 - 12 Nov 2019, FlorianFeldbauer
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding PANDA Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)