Skip to content

Commit 6aa62c3

Browse files
authored
Merge pull request #64 from epics-containers/dev
Adding some Architectural Decisions
2 parents 5e7c7ee + 1df2d34 commit 6aa62c3

File tree

8 files changed

+163
-10
lines changed

8 files changed

+163
-10
lines changed

docs/developer/explanations/decisions/0002-switched-to-pip-skeleton.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2. Adopt epics-containers.github.io for project structure
2-
=========================================================
1+
2. Adopt python3-pip-skeleton for project structure
2+
===================================================
33

44
Date: 2022-02-18
55

@@ -11,7 +11,7 @@ Accepted
1111
Context
1212
-------
1313

14-
We should use the following `pip-skeleton <https://github.com/epics-containers/epics-containers.github.io>`_.
14+
We should use the following `pip-skeleton <https://github.com/DiamondLightSource/python3-pip-skeleton>`_.
1515
The skeleton will ensure consistency in developer
1616
environments and package management.
1717

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
3. Use of substitution files to generate EPICS Databases
2+
========================================================
3+
4+
Date: 2023-11-30
5+
6+
Status
7+
------
8+
9+
Accepted
10+
11+
Context
12+
-------
13+
14+
There are two proposals for how EPICS Databases should be generated:
15+
16+
1. At IOC startup ``ibek`` should generate a substitution file that describes the
17+
required Databases.
18+
19+
The IOC instance yaml combined with the definitions from support module yaml
20+
controls what the generated substitution file will look like.
21+
22+
``ibek`` will then execute ``msi`` to generate the Databases from the
23+
substitution file.
24+
25+
2. The dbLoadRecord calls in the startup script will pass all macro substitutions
26+
in-line. Removing the need for a substitution file.
27+
28+
29+
Decision
30+
--------
31+
32+
Proposal 1 is accepted.
33+
34+
Some template files such as those in the ``pmac`` support module use the
35+
following pattern:
36+
37+
.. code-block::
38+
39+
substitute "P=$(PMAC):, M=CS$(CS):M1, ADDR=1, DESC=CS Motor A"
40+
include "pmacDirectMotor.template"
41+
42+
This pattern is supported by msi but not by the EPICS dbLoadRecord command which
43+
does not recognise the ``substitute`` command.
44+
45+
46+
Consequences
47+
------------
48+
49+
An extra file ``ioc.subst`` is seen in the runtime directory. In reality this
50+
is easier to read than a full Database file. So can be useful for debugging.
51+
52+
Finally those developers who are unable to use ``ibek yaml`` for some reason can
53+
supply their own substitution file and ibek will expand it at runtime. This is
54+
much more compact that supplying a full Database file and important due to the
55+
1MB limit on K8S ConfigMaps.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
4. How to configure autosave for IOCs
2+
=====================================
3+
4+
Date: 2023-11-30
5+
6+
Status
7+
------
8+
9+
Accepted
10+
11+
Context
12+
-------
13+
14+
There is a choice of supplying the list of PVs to autosave by:
15+
16+
- adding info tags to the Database Templates
17+
- supplying a raw req file with list of PVs to autosave
18+
19+
Decision
20+
--------
21+
22+
We will go with req files for the following reasons:
23+
24+
- https://epics.anl.gov/tech-talk/2019/msg01600.php
25+
- adding info tags would require upstream changes to most support modules
26+
- default req files are already supplied in many support modules
27+
- req files are in common use and many facilities may already have their own
28+
req files for support modules.
29+
30+
We expect to autogenerate the list of PVs to autosave from the IOC's. We could
31+
therefore generate a Database override file which adds info tags. But it is
32+
simpler to just generate a req file.
33+
34+
The mechanism for using req files is that defaults will come from the support
35+
module or from the generic IOC if the support module does not supply a req file.
36+
37+
Then override files can exist at the beamline level and / or at the IOC
38+
instance level. These will simply take the form of a req file with the same
39+
name as the one it is overriding.
40+
41+
Consequences
42+
------------
43+
44+
Everything is nice and simple.
45+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2. Use Python for scripting inside and outside containers
2+
=========================================================
3+
4+
Date: 2022-11-30
5+
6+
Status
7+
------
8+
9+
Accepted
10+
11+
Context
12+
-------
13+
14+
Inside the container, we use the ``ibek`` tool for scripting. Outside we
15+
use ``ec`` from ``epics-containers-cli``.
16+
17+
Much of what these tools do is
18+
call command line tools like ``docker``, ``helm``, ``kubectl``, compilers,
19+
etc. This seems like a natural fit for bash scripts.
20+
21+
These features were originally implemented in bash but were converted to
22+
python for the following reasons:
23+
24+
- python provides for much richer command line arguments
25+
- it is also much easier to provide rich help
26+
- managing errors is vastly improved with exception handling
27+
- the unit testing framework allows for 85% coverage in continuous integration
28+
- complex string handling is a common requirement and is much easier in python
29+
- there is a clear versioning strategy and packages can be installed with pip,
30+
meaning that you can check which version of the script you are running and
31+
report bugs against a specific version
32+
- the code is much easier to read and maintain
33+
- because the packages can be pip installed they can be used in CI and inside
34+
multiple containers without having to copy the scripts around
35+
36+
Decision
37+
--------
38+
39+
We always prefer Python and keep bash scripts to a minimum
40+
41+
Consequences
42+
------------
43+
44+
Scripting is much easier to maintain and is more reliable.

docs/user/explanations/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ An important principal of the approach presented here is that an IOC container
4646
image represents a 'Generic' IOC. The Generic IOC image is used for all
4747
IOC instances that connect to a given class of device. For example the
4848
Generic IOC image here:
49-
`ghcr.io/epics-containers/ioc-adaravis-linux-runtime:2023.10.1
49+
`ghcr.io/epics-containers/ioc-adaravis-linux-runtime:2023.10.2
5050
<https://github.com/epics-containers/ioc-adaravis/pkgs/container/ioc-adaravis-linux-runtime>`_
5151
uses the AreaDetector driver ADAravis to connect to GigE cameras.
5252

docs/user/tutorials/dev_container.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,13 @@ used in previous tutorials. Let's go and fetch a version of the Generic IOC
109109
source and build it locally.
110110

111111
For the purposes of this tutorial we will place the source in a folder right
112-
next to your test beamline ``bl01t`` folder. We will also be getting a
113-
specific version of the Generic IOC source so that future changes don't break
114-
this tutorial:
112+
next to your test beamline ``bl01t``:
115113

116114
.. code-block:: bash
117115
118116
# starting from folder bl01t so that the clone is next to bl01t
119117
cd ..
120-
git clone --recursive [email protected]:epics-containers/ioc-adsimdetector.git -b 2023.11.1
118+
git clone --recursive [email protected]:epics-containers/ioc-adsimdetector.git
121119
cd ioc-adsimdetector
122120
ec dev build
123121
@@ -162,6 +160,17 @@ You should now be *inside* the container. All terminals started in VSCode will
162160
be inside the container. Every file that you open with the VSCode editor
163161
will be inside the container.
164162

163+
.. note::
164+
165+
Troubleshooting: if you are experiencing problems with the devcontainer you
166+
can try resetting your vscode and vscode server caches on your host machine.
167+
To do this, exit vscode use the following command and restart vscode:
168+
169+
.. code-block:: bash
170+
171+
rm -rf ~/.vscode/* ~/.vscode-server/*
172+
173+
165174
There are some caveats because some folders are mounted from the host file
166175
system. For example, the ``ioc-adsimdetector`` project folder
167176
is mounted into the container as a volume. It is mounted under

docs/user/tutorials/rtems_ioc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RTEMS - Deploying an Example IOC
33

44
.. Warning::
55

6-
This tutorial is out of date and will be updated in November 2023.
6+
This tutorial is out of date and will be updated in December 2023.
77

88
The previous tutorials walked through how to create a Generic linux soft
99
IOC and how to deploy an IOC instance using that Generic IOC.

docs/user/tutorials/rtems_setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RTEMS - Creating a File Server
33

44
.. Warning::
55

6-
This tutorial is out of date and will be updated in November 2023.
6+
This tutorial is out of date and will be updated in December 2023.
77

88
Introduction
99
------------

0 commit comments

Comments
 (0)