Skip to content

Commit 8e9b88f

Browse files
authored
Merge pull request #73 from epics-containers/2024-rework
Add How to make a Generic IOC tutorial
2 parents 949aafd + fd08df7 commit 8e9b88f

19 files changed

+948
-378
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# General information about the project.
1717
project = "epics-containers.github.io"
18-
copyright = "2023, Diamond Light Source"
18+
copyright = "2024, Diamond Light Source"
1919
author = "Giles Knap"
2020

2121
# The full version, including alpha/beta/rc tags.

docs/user/how-to/builder2ibek.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Builder2ibek Conversion Tool
2+
============================
3+
4+
.. warning::
5+
6+
This page is only relevant to DLS users who are converting an xml
7+
builder beamline to epics-containers. i.e. those whose beamlines
8+
have a BLxxY-BUILDER project.
9+
10+
TODO: this page is WIP and will be updated by Feb 2024.
11+
12+
``builder2ibek`` is a tool to convert DLS builder XML to ibek instance YAML.
13+
It is for working with converting IOC instances to epics-containers.
14+
15+
At present (until a new python app distribution mechanism is in place) it
16+
is installed at DLS in the following location:
17+
18+
``/dls_sw/work/python3/ec-venv/bin/builder2ibek``
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Builder2ibek.support Conversion Tool
2+
====================================
3+
4+
.. warning::
5+
6+
This page is only relevant to DLS users who are converting
7+
a DLS support module with builder support into an epics-containers
8+
Generic IOC. i.e. support modules that have an ``etc/builder.py`` file.
9+
10+
TODO: this page is WIP and will be updated by Feb 2024.
11+
12+
``builder2ibek.support`` is a tool to convert DLS builder support modules
13+
into ibek support YAML for the ``ibek-support`` repository.
14+
15+
16+
builder2ibek.support example
17+
----------------------------
18+
19+
.. code:: bash
20+
21+
./builder2ibek.support.py /dls_sw/prod/R3.14.12.7/support/lakeshore340/2-6 ioc-lakeshore340/ibek-support/lakeshore340/lakeshore340.yaml
22+
23+
24+
.. code-block:: xml
25+
26+
<?xml version="1.0" ?>
27+
<components arch="linux-x86_64">
28+
<devIocStats.devIocStatsHelper ioc="BL16I-EA-IOC-07" name="STATS"/>
29+
<asyn.AsynIP name="p1" port="127.0.0.1:5400"/>
30+
<lakeshore340.lakeshore340 ADDR="12" LOOP="1" P="BL16I-EA-LS340-01" PORT="p1" SCAN="5" TEMPSCAN="1" gda_desc="Lakeshore 340 Temperature Controller" gda_name="LS340b" name="lakeshore"/>
31+
<EPICS_BASE.dbpf name="d1" pv="BL16I-EA-LS340-01:DISABLE" value="1"/>
32+
</components>
33+
34+
35+
.. code:: yaml
36+
37+
# yaml-language-server: $schema=https://github.com/epics-containers/ibek/releases/download/1.2.0/ibek.support.schema.json
38+
39+
module: lakeshore340
40+
41+
defs:
42+
43+
- name: lakeshore340
44+
description: |-
45+
Lakeshore 340 Temperature Controller
46+
Notes: The temperatures in Kelvin are archived once every 10 secs.
47+
args:
48+
49+
- type: str
50+
name: P
51+
description: |-
52+
Prefix for PV name
53+
54+
- type: str
55+
name: PORT
56+
description: |-
57+
Bus/Port Address (eg. ASYN Port).
58+
59+
- type: str
60+
name: ADDR
61+
description: |-
62+
Address on the bus
63+
64+
- type: str
65+
name: SCAN
66+
description: |-
67+
SCAN rate for non-temperature/voltage parameters.
68+
69+
- type: str
70+
name: TEMPSCAN
71+
description: |-
72+
SCAN rate for the temperature/voltage readings
73+
74+
- type: id
75+
name: name
76+
description: |-
77+
Object and gui association name
78+
79+
- type: str
80+
name: gda_name
81+
description: |-
82+
Name in gda interface file (Default = )
83+
84+
- type: str
85+
name: gda_desc
86+
description: |-
87+
Description in gda interface file (Default = )
88+
89+
- type: int
90+
name: LOOP
91+
description: |-
92+
Which heater PID loop to control (Default = 1)
93+
default: 1
94+
95+
databases:
96+
97+
- file: $(LAKESHORE340)/db/lakeshore340.template
98+
args:
99+
name:
100+
SCAN:
101+
gda_name:
102+
P:
103+
TEMPSCAN:
104+
gda_desc:
105+
PORT:
106+
LOOP:
107+
ADDR:
108+

docs/user/how-to/phoebus.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ This is the initial target for epics-containers GUIs, other OPI
99
formats may be supported in the future.
1010

1111
OPI file generation is work in progress and this page will be updated when
12-
it is ready (est Nov 2023).
12+
it is ready (est Feb 2024).

docs/user/index.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ side-bar.
2222
tutorials/ioc_changes1
2323
tutorials/ioc_changes2
2424
tutorials/ioc_changes3
25-
tutorials/ioc_changes4
2625
tutorials/generic_ioc
2726
tutorials/debug_generic_ioc
2827
tutorials/test_generic_ioc
@@ -47,6 +46,8 @@ side-bar.
4746
how-to/own_tools
4847
how-to/useful_k8s
4948
how-to/ibek-support
49+
how-to/builder2ibek
50+
how-to/builder2ibek.support
5051

5152
+++
5253

@@ -76,10 +77,12 @@ side-bar.
7677
:maxdepth: 1
7778

7879
reference/faq
80+
reference/configuration
7981
reference/environment
8082
reference/cli
8183
reference/ioc_helm_chart
8284
reference/k8s_resources
85+
reference/vscode_settings
8386

8487
+++
8588

docs/user/reference/configuration.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Configuration for epics-containers
2+
==================================
3+
4+
A collection of all the configuration points mentioned in the rest of this
5+
documentation.
6+
7+
TODO: this needs completing - pull all configuration discussions into
8+
one place. Most of these will come from the original Setting up the
9+
Workspace document.
10+
11+
12+
Git Configuration
13+
-----------------
14+
15+
.. code-block::
16+
17+
[url "ssh://[email protected]/"]
18+
insteadOf = https://github.com/

docs/user/reference/ioc_helm_chart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ in this folder and what you would need to change in your new IOC instance:
5858

5959
- ``config`` this folder contains any files unique to this IOC instance. At
6060
runtime on the cluster when the Generic IOC image is running it will see
61-
these files as mounted into the folder ``/repos/epics/ioc/config``.
61+
these files as mounted into the folder ``/workspaces/epics/ioc/config``.
6262
In this case we have an EPICS startup script ``st.cmd`` only
6363
and the default behaviour is just to run the IOC binary and pass it
6464
``st.cmd``.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Recommended VSCode Settings
2+
===========================
3+
4+
I've picked a handful of my user settings which I think are useful for most
5+
people working on epics-containers.
6+
7+
TODO: write up a description of why these are useful. Particularly with
8+
regards to auto discovery of git repos.
9+
10+
.. code-block::
11+
12+
scm.repositories.visible: 10
13+
git.repositoryScanMaxDepth: 0
14+
git.openRepositoryInParentFolders: never
15+
files.trimTrailingWhitespace: true
16+
terminal.integrated.scrollback: 20000
17+
dev.containers.defaultExtensions: [
18+
"samuelcolvin.jinjahtml",
19+
"moshfeu.compare-folders",
20+
"GitHub.copilot",
21+
"charliermarsh.ruff",
22+
"Gruntfuggly.todo-tree",
23+
"streetsidesoftware.code-spell-checker",
24+
"eamodio.gitlens",
25+
"tamasfe.even-better-toml",
26+
"redhat.vscode-yaml",
27+
"ryanluker.vscode-coverage-gutters",
28+
"mhutchie.git-graph",
29+
"ms-vscode.makefile-tools"
30+
"peakchen90.open-html-in-browser",
31+
],
32+
"[yaml]": {
33+
"editor.defaultFormatter": "redhat.vscode-yaml"
34+
},

docs/user/tutorials/create_beamline.rst

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ We will then step through the changes that are required to make it your own.
6666
NOTE: for these tutorials we will use your personal GitHub Account to
6767
store everything we do, all source repositories and container images. For
6868
production, each facility will need its own policy for where to store these
69-
assets. See `../explanations/repositories`.
69+
assets. See ``../explanations/workspacesitories``.
7070

7171
Steps
7272
-----
@@ -110,10 +110,15 @@ Steps
110110
#. change the beamline name in the two bash scripts in the ``services``
111111
directory.
112112

113+
#. change the beamline name in ``beamline-chart/values.yaml``
114+
113115
#. add some meaningful configuration to the example IOCs config folder
114116
``iocs/bl01t-ea-ioc-01/config/ioc.yaml``. We will do this in the
115117
next tutorial.
116118

119+
Much of the above can be achieved with a global find and replace of 'xxi' with
120+
'01t'.
121+
117122
Environment.sh
118123
~~~~~~~~~~~~~~
119124

@@ -175,6 +180,14 @@ Open both files in ``services/`` and replace blxxi with bl01t.
175180

176181
TODO: add support for local docker installations of these services.
177182

183+
Change the Beamline Name in the Helm Chart
184+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185+
186+
The file ``beamline-chart/values.yaml`` contains the configuration values
187+
for the helm chart that is used to deploy the beamline. You can change
188+
the values ``blxxi`` to ``bl01t`` in here. But this will not be relevant until
189+
we get to the Kubernetes tutorial when the deployment is done using helm.
190+
178191
Wrapping Up
179192
-----------
180193

@@ -189,8 +202,8 @@ You can now push the repository up to GitHub and give it a version tag like this
189202
git add .
190203
git commit -m "changed blxxi to bl01t"
191204
git push
192-
git tag 2023.11.1
193-
git push origin 2023.11.1
205+
git tag 2024.1.1
206+
git push origin 2024.1.1
194207
195208
196209
We use ``CalVer`` version numbers for beamline repositories and Generic IOCs.
@@ -201,3 +214,9 @@ CalVer is described here: https://calver.org/ and is used where semantic
201214
versioning is not appropriate because the repository contains a mix of
202215
dependencies and does not have a clear API.
203216

217+
Note that 2024.1.1 represents the time that this tutorial was last updated.
218+
For completeness you could use the current year and month instead. You
219+
are also free to choose your own versioning scheme as this is not enforced by
220+
any of the epics-containers tools.
221+
222+

docs/user/tutorials/create_ioc.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This should launch vscode and open the values.yaml file. Add the following:
4545

4646
.. code-block:: yaml
4747
48-
image: ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.11.1
48+
image: ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2024.1.1
4949
5050
This tells the IOC Instance to run in the ``ioc-adsimdetector-linux-runtime``
5151
container. This container was built by the Generic IOC source repo here
@@ -71,7 +71,7 @@ To recap, we have two python CLI tools for supporting ``epics-containers``:
7171
- Generating startup scripts and EPICS databases at container runtime
7272
from *IOC yaml* files.
7373
- Fetching and compiling support modules at build time.
74-
- Other build time utilities such as creating and compiling IOC source and
74+
- Other build time utilities such as
7575
extracting runtime assets for the runtime container target.
7676

7777
:ec: provides developer support *outside* of the container such as:
@@ -190,7 +190,7 @@ This should launch vscode and open the ioc.yaml file. Add the following:
190190

191191
.. code:: yaml
192192
193-
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adsimdetector/releases/download/2023.11.1/ibek.ioc.schema.json
193+
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adsimdetector/releases/download/2024.1.1/ibek.ioc.schema.json
194194
195195
ioc_name: bl01t-ea-ioc-02
196196
description: Example simulated camera for BL01T
@@ -320,15 +320,15 @@ That is because every Generic IOC publishes an *IOC schema* that describes
320320
the set of entities that an instance of that IOC may instantiate.
321321

322322
The Generic IOC we used was released at this location:
323-
https://github.com/epics-containers/ioc-adsimdetector/releases/tag/2023.11.1.
323+
https://github.com/epics-containers/ioc-adsimdetector/releases/tag/2024.1.1.
324324
This page includes the assets that are published as part of the release and
325325
one of those is ``ibek.ioc.schema.json``. This is the *IOC schema* for the
326326
``ioc-adsimdetector`` Generic IOC. This is what we referred to at the top of
327327
our *IOC yaml* file like this:
328328

329329
.. code:: yaml
330330
331-
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adsimdetector/releases/download/2023.11.1/ibek.ioc.schema.json
331+
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adsimdetector/releases/download/2024.1.1/ibek.ioc.schema.json
332332
333333
When editing with a YAML aware editor like VSCode this will enable auto
334334
completion and validation of the *IOC yaml* file. To enable this in VSCode

0 commit comments

Comments
 (0)