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!)

When installing Docker CE for Windows 10, chose "Linux Containers" when aksed which kind of containers you want to use on your system.

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)

Usage

panda-ioc

Default run command (standalone):

docker run -dit [VOLUMES] [OPTIONS] paluma.rub.de/panda-ioc ./[ST.CMD]

Volumes:

The panda-ioc image offers three mountable Volumes
  • /home/panda-dcs/config: This directory should contain the substitution files and start up scripts for your IOC.
  • /home/panda-dcs/protocols: This directory contains the protocol files for StreamDevice (if this directory is empty, all protocol files from our git repo are copied here)
  • /home/panda-dcs/databases: This directory contains the database files for the IOC (if this directory is empty, all database files from our git repo are copied here)
Mount volumes with: `-v <PATH_ON_HOST>:/home/panda-dcs/config`

OPTIONS can be:

  • Connect to serial devices:
    `--device /dev/<DEVICENAME>`
  • Connect to ethernet devices:
    Works without any additional settings
  • Connect to GPIOs (arm only):
    `-v /sys/class/gpio --group-add $(grep gpio /etc/group | awk -F':' '{ print $3 }')`
    (add panda-dcs user to host's gpio group, does not work in compose files!)
  • Connect to I2C (arm only):
    `--device /dev/i2c-<NUM> --group-add $(grep i2c /etc/group | awk -F':' '{ print $3 }')`
    (add panda-dcs user to host's i2c group, does not work in compose files!)
  • Connect to CAN bus devices:
    `--network host`
  • Access PVs from remote:
    • CA: `-p 5064-5065:5064-5065 -p 5064-5065:5064-5065/udp` (might be sufficient to publish CAS ports)
    • 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`
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

ca-gateway

Default run command (PC with two NICs required):

docker run -d --network host -v <PATH_ON_HOST>:/home/panda-dcs/config paluma.rub.de/ca-gateway -cip <CLIENT IP> -sip <SERVER IP> -server -pvlist <PVLIST_FILE> -access <ACCESS_FILE>

The directory `/home/panda-dcs/config` must contain the configuration files for the gateway, i.e. PVLIST_FILE and ACCESS_FILE.

Phoebus

Default run command (standalone)

docker run --network host -e DISPLAY=$DISPLAY --device /dev/dri -v ${PWD}/phoebus-config:/home/panda-dcs/config -v /tmp/.X11-unix:/tmp/.X11-unix paluma.rub.de/phoebus -settings <SETTINGS_FILE>

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 directory `/home/panda-dcs/config` contains configuration files and bob files (display-files)

Archive-Engine

Default run command (standalone):

docker run -d -v ${PWD}/phoebus-config:/home/panda-dcs/config -p 4812:4812 paluma.rub.de/archive-engine -engine Test -settings <SETTINGS_FILE>

If there are any `*.xml` files present in the `/home/panda-dcs/config` directory at the first start of the container, the archive engine will import them as new engines (using `-replace_engine -steal_channels`). The basename of the xml-files is used as engine name.
CA address list must be configured manually in settings file (or use `--network host`).

Examples

Hameg HMP4040 LV Power Supply

  1. First we need to install Docker CE (refer to the links at the top of this page!)
  2. Create a directory, where we will store some files needed for our IOC
    mkdir ${HOME}/hameg_demo
  3. 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 "/epics/databases/hmp4040.db"
    {
     pattern { CHAN, PORT }
       { 0, hmp_1 }
       { 1, hmp_1 }
       { 2, hmp_1 }
       { 3, hmp_1 }
    }
  4. The HMP4040 has two interfaces for remote control: USB and Ethernet. I will discuss both
    1. 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:
        #!/epics/ioc/bin/linux-x86_64/pandaIoc
        
        epicsEnvSet( "ARCH",                 "linux-x86_64" )
        epicsEnvSet( "TOP",                  "/epics/ioc" )
        epicsEnvSet( "STREAM_PROTOCOL_PATH", "/home/panda-dcs/protocols" )
        
        ## Register all support components
        dbLoadDatabase( "$(TOP)/dbd/pandaIoc.dbd", 0, 0 )
        pandaIoc_registerRecordDeviceDriver( pdbbase )
        
        ## Load drivers
        ## 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 ("/home/panda-dcs/config/hameg_demo.sub" )
        
        iocInit()
      3. 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.
      4. Now start the docker container to run your IOC:
        docker run -dit -v ${HOME}/hameg_demo:/home/panda-dcs/config --device /dev/ttyAMA0 paluma.rub.de/panda-ioc ./hameg_demo.cmd
    2. 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:
        #!/epics/ioc/bin/linux-x86_64/pandaIoc
        
        epicsEnvSet( "ARCH",                 "linux-x86_64" )
        epicsEnvSet( "TOP",                  "/epics/ioc" )
        epicsEnvSet( "STREAM_PROTOCOL_PATH", "/home/panda-dcs/protocols" )
        
        ## Register all support components
        dbLoadDatabase( "$(TOP)/dbd/pandaIoc.dbd", 0, 0 )
        pandaIoc_registerRecordDeviceDriver( pdbbase )
        
        ## Load drivers
        ## 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 ("/home/panda-dcs/config/hameg_demo.sub" )
        
        iocInit()
      3. 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.
      4. Now start the docker container to run your IOC:
        docker run -dit -v ${HOME}/hameg_demo:/home/panda-dcs/config paluma.rub.de/panda-ioc ./hameg_demo.cmd

Wiener PL5xx and Wiener MPOD LV power supplies (SNMP)

  1. First we need to install Docker CE (refer to the links at the top of this page!)
  2. Create a directory, where we will store some files needed for our IOC
    mkdir ${HOME}/wiener_demo
  3. 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)
  4. 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 "/epics/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 }
    }
  5. Now create the startup script for the IOC
    #!/epics/ioc/bin/linux-x86_64/pandaIoc
    
    epicsEnvSet( "ARCH", "linux-x86_64" )
    epicsEnvSet( "TOP",  "/epics/ioc" )
    epicsEnvSet( "WCR",  "guru WIENER-CRATE-MIB::" )
    
    ## Register all support components
    dbLoadDatabase( "$(TOP)/dbd/pandaIoc.dbd", 0, 0 )
    pandaIoc_registerRecordDeviceDriver( pdbbase )
    
    ## Load record instances
    dbLoadTemplate ("/home/panda-dcs/config/wiener_demo.sub" )
    
    iocInit()
  6. Now start the docker container to run your IOC:
    docker run -dit -v ${HOME}/wiener_demo:/home/panda-dcs/config paluma.rub.de/panda-ioc ./wiener_demo.cmd

List of Images and Tags

epics-base

This image is only needed if you want do create your own IOC Docker image. It is just a base image for the panda-ioc and ca-gateway images.
  • 7.0.3
    EPICS base 7.0.3, based on Debian-Buster
  • 7.0.2
    EPICS base 7.0.2, based on Debian-Stretch
  • 7.0.2-raspi
    EPICS base 7.0.2, based on Debian-Stretch, cross-build for usage on the Raspberry pi
  • 7.0.2-beagleboneblack
    EPICS base 7.0.2, based on Debian-Stretch, cross-build for usage on the BeagleBone Black

panda-ioc

Image with ready-to-use EPICS IOC. Includes asyn, stream, autosave, calc, modbus and snmp device support modules
  • 7.0.3, 7, latest
    Based on "epics-base:7.0.3", asyn 4.36, autosave 5.10, calc 3.7.3 modbus 3.0, snmp 1.0.0.1, stream 2.8.9
  • 7.0.2
    Based on "epics-base:7.0.2", asyn 4.36, autosave 5.10, calc 3.7.3 modbus 3.0, snmp 1.0.0.1, stream 2.8.9
  • 7.0.2-raspi, 7-raspi, raspi-latest
    Based on "epics-base:7.0.2-raspi", asyn 4.36, autosave 5.10, calc 3.7.3 modbus 3.0, snmp 1.0.0.1, stream 2.8.9, drvasyni2c 1.0.2, devgpio 1.0.6
  • 7.0.2-beagleboneblack, 7-bbb, bbb-latest
    Based on "epics-base:7.0.2-beagleboneblack", asyn 4.36, autosave 5.10, calc 3.7.3 modbus 3.0, snmp 1.0.0.1, stream 2.8.9, drvasyni2c 1.0.2, devgpio 1.0.6

ca-gateway

Image with ready to use CA-Gateway
  • 7.0.3, 7, latest
    Based on "epics-base:7.0.3", CA-Gateway R2.1.1.0
  • 7.0.2
    Based on "epics-base:7.0.2", CA-Gateway R2.1.1.0

Phoebus

Image with the main Phoebus product
  • openjdk11, latest

Archive-Engine

Image with the archive-engine from Phoebus
  • openjdk11, latest

-- FlorianFeldbauer - 21 Aug 2019
Topic revision: r9 - 10 Sep 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)