1
1
Changing the IOC Instance
2
2
=========================
3
3
4
-
5
- .. Warning ::
6
-
7
- This tutorial is out of date and will be updated in November 2023.
8
-
9
-
10
- This tutorial will make a very simple change to the example IOC ``bl01t-ea-ioc-01 ``.
11
- This is a type 1. change from the above list, types 2, 3 will be covered in the
4
+ This tutorial will make a very simple change to the example IOC ``bl01t-ea-ioc-02 ``.
5
+ This is a type 1 change from `ioc_change_types `, types 2, 3 will be covered in the
12
6
following 2 tutorials.
13
7
8
+ Strictly speaking, Type 1 changes do not require a devcontainer. You created
9
+ and deployed the IOC instance a previous tutorial without one. It is up to
10
+ you how you choose to make these types of changes. Types 2,3 do require a
11
+ devcontainer because they involve compiling Generic IOC / support module code.
12
+
14
13
We are going to add a hand crafted EPICS DB file to the IOC instance. This will
15
14
be a simple record that we will be able to query to verify that the change
16
15
is working.
17
16
18
17
Make the following changes in your test IOC config folder
19
- (``bl01t/iocs/bl01t-ea-ioc-01 /config ``):
18
+ (``bl01t/iocs/bl01t-ea-ioc-02 /config ``):
20
19
21
20
1. Add a file called ``extra.db `` with the following contents.
22
- IMPORTANT replace [$USER] with your username:
23
21
24
22
.. code-block :: text
25
23
26
- record(ai, "[$USER] -EA-IOC-01:TEST") {
24
+ record(ai, "BL01T -EA-IOC-01:TEST") {
27
25
field(DESC, "Test record")
28
26
field(DTYP, "Soft Channel")
29
27
field(SCAN, "Passive")
30
28
field(VAL, "1")
31
29
}
32
30
33
- 2. Add the following line to the `` st.cmd `` file after the last `` dbLoadRecords ``
34
- line:
31
+ 2. Add the following lines to the end `` ioc.yaml `` (verify that the indentation
32
+ matches the above entry so that `` - type: `` statements line up) :
35
33
36
- .. code-block :: text
34
+ .. code-block :: yaml
37
35
38
- dbLoadRecords(config/extra.db)
36
+ - type : epics.StartupCommand
37
+ command : dbLoadRecords(config/extra.db)
39
38
40
39
Locally Testing Your changes
41
40
----------------------------
@@ -46,13 +45,14 @@ folder:
46
45
47
46
.. code-block :: bash
48
47
49
- ec dev ioc-launch iocs/bl01t-ea-ioc-01
48
+ # stop the first IOC shell by hitting Ctrl-D or typing exit
49
+ cd /epics/ioc
50
+ ./start.sh
50
51
51
- This will launch Generic IOC container specified in the ``bl01t-ea-ioc-01 ``
52
- helm chart and mount into it the local config specified in
53
- ``/iocs/bl01t-ea-ioc-01/config ``.
52
+ If all is well you should see your iocShell prompt and the output should
53
+ show ``dbLoadRecords(config/extra.db) ``.
54
54
55
- If all is well you should see your iocShell prompt and you can test your change
55
+ Test your change
56
56
from another terminal (VSCode menus -> Terminal -> New Terminal) like so:
57
57
58
58
.. code-block :: bash
@@ -61,91 +61,57 @@ from another terminal (VSCode menus -> Terminal -> New Terminal) like so:
61
61
62
62
If you see the value 1 then your change is working.
63
63
64
- .. note ::
65
-
66
- If you also wanted to make local changes
67
- to the Generic IOC itself you could clone the Generic IOC source repo,
68
- locally build the container image and then use ``ec dev ioc-launch `` as
69
- follows:
70
-
71
- .. code-block :: bash
72
-
73
- # advanced example - not part of this tutorial
74
- cd < root of your workspace>
75
- git clone [email protected] :epics-containers/ioc-adsimdetector.git
76
- cd ioc-adsimdetector
77
- # this makes a local image with tag :local
78
- ec dev build
79
- cd ../bl01t
80
- ec dev ioc-launch iocs/bl01t-ea-ioc-01 ../ioc-adsimdetector
81
-
82
-
83
- Note you can see your running IOC in podman using this command:
84
-
85
- .. code-block :: bash
86
-
87
- podman ps
88
-
89
- You should see a container named bl01t-ea-ioc-01 and also a another one with a
90
- random name and an image called ``localhost/vsc-work... ``. The latter is the
91
- container that is running your developer environment.
92
-
93
- If you would like to take a look inside the container you can run a bash shell
94
- in the container like this:
95
-
96
- .. code-block :: bash
97
-
98
- podman exec -it bl01t-ea-ioc-01 bash
99
-
100
- When you type exit on the iocShell the container will stop and and be removed.
101
-
102
- .. _local_deploy_ioc :
103
-
104
- Deploying a Beta IOC Instance to The Cluster
105
- ============================================
64
+ .. Note ::
106
65
107
- In `` 05_deploy_example `` we deployed a tagged version of the IOC instance to
108
- the cluster. This the correct way to deploy a production IOC instance as it
109
- means there is a record of version of the IOC instance in the Helm Chart
110
- OCI registry and you can always roll back to that version if needed .
66
+ You are likely to see
67
+ * "Identical process variable names on multiple servers" * warnings. This is
68
+ because caget can see the PV on the host network and the container network,
69
+ but as these are the same IOC this is not a problem .
111
70
112
- However, it is also possible to directly deploy a version of the IOC instance
113
- from your local machine to the cluster.
114
- This is useful for testing changes to the IOC instance
115
- before publishing a new version. In this case
116
- your IOC will be given a beta tag in the cluster, indicating that it has
117
- not yet been released .
71
+ You can change this and make your devcontainer network isolated by removing
72
+ the line `` "--net=host", `` from `` .devcontainer/devcontainer.json ``, but
73
+ it is convenient to leave it if you want to run OPI tools locally on the
74
+ host. You may want to isolate your development network if multiple
75
+ developers are working on the same subnet. In this case some other solution
76
+ is required for running OPI tools on the host (TODO add link to solution) .
118
77
119
- To deploy your changes direct to the cluster use the following command:
78
+ Because of the symlink between ``/epics/ioc/config `` and
79
+ ``/repos/bl01t/iocs/bl01t-ea-ioc-02/config `` the same files you are testing
80
+ by launching the ioc inside of the devcontainer are also ready to be
81
+ committed and pushed to the bl01t repo. i.e.:
120
82
121
83
.. code-block :: bash
122
84
123
- ec ioc deploy-local iocs/bl01t-ea-ioc-01
124
-
125
- You will get a warning that this is a temporary deployment and you will see that
126
- the version number will look something like ``2023.3.29-b14.29 `` this
127
- indicates that this is a beta deployment made at 14:29 on 29th March 2023.
128
-
129
- Now when you ask for the IOCs running in your domain you should see your IOC
130
- with beta version listed:
131
-
132
- .. code-block :: bash
133
-
134
- $ ec ps -w
135
- POD VERSION STATE RESTARTS STARTED IP GENERIC_IOC_IMAGE
136
- bl01t-ea-ioc-01-7d7c5bc759-5bjsr 2023.3.29-b14.29 Running 0 2023-03-29T14:29:18Z 192.168.0.32 ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:23.3.4
137
-
138
- You can check it is working as before (replace the IP with yours
139
- from the above command):
140
-
141
- .. code-block :: bash
142
-
143
- export EPICS_CA_ADDR_LIST=192.168.0.32
144
- caget $USER -EA-IOC-01:TEST
145
-
146
- Once you are happy with your changes you can push and tag your beamline repo.
147
- This will publish a new version of the IOC instance helm chart to the OCI helm
148
- registry. You can then deploy the versioned IOC instance to the cluster.
149
-
150
-
85
+ # Do this from the host terminal (not the devcontainer terminal)
86
+ cd bl01t
87
+ git add .
88
+ git commit -m " Added extra.db"
89
+ git push
90
+ # tag a new version of the beamline repo
91
+ git tag 2023.11.2
92
+ git push origin 2023.11.2
93
+ ec deploy bl01t-ea-ioc-02 2023.11.2
94
+
95
+ The above steps were performed on a host terminal because we are using ``ec ``
96
+ but all of the previous steps could have been done *inside * the devcontainer
97
+ starting with ``cd /repos/bl01t ``.
98
+
99
+ Raw Startup Assets
100
+ ------------------
101
+
102
+ If you plan not to use `ibek ` runtime asset creation you could use the raw
103
+ startup assets from the previous tutorial. If you do this then the process
104
+ above is identical except that you will add the ``dbLoadRecords `` command to
105
+ the end of ``st.cmd ``.
106
+
107
+ More about ibek Runtime Asset Creation
108
+ --------------------------------------
109
+
110
+ The set of ``entities `` that you may create in your ioc.yaml is defined by the
111
+ ``ibek `` IOC schema that we reference at the top of ``ioc.yaml ``.
112
+ The schema is in turn defined by the set of support modules that were compiled
113
+ into the Generic IOC (ioc-adsimdetector). Each support module has an
114
+ ``ibek `` *support YAML * file that contributes to the schema.
115
+
116
+ The *Support yaml * files are in the folder ``/epics/ibek ``
151
117
0 commit comments