@@ -6,22 +6,32 @@ This is a type 1 change from `ioc_change_types`, types 2, 3 will be covered in t
6
6
following 2 tutorials.
7
7
8
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
9
+ and deployed the IOC instance in a previous tutorial without one. It is up to
10
10
you how you choose to make these types of changes. Types 2,3 do require a
11
11
devcontainer because they involve compiling Generic IOC / support module code.
12
12
13
13
We are going to add a hand crafted EPICS DB file to the IOC instance. This will
14
14
be a simple record that we will be able to query to verify that the change
15
15
is working.
16
16
17
+ .. note ::
18
+
19
+ Before doing this tutorial make sure you have not left the IOC
20
+ bl01t-ea-ioc-02 running from a previous tutorial. Execute this command
21
+ outside of the devcontainer to stop it:
22
+
23
+ .. code-block :: bash
24
+
25
+ ec ioc stop bl01t-ea-ioc-02
26
+
17
27
Make the following changes in your test IOC config folder
18
28
(``bl01t/iocs/bl01t-ea-ioc-02/config ``):
19
29
20
30
1. Add a file called ``extra.db `` with the following contents.
21
31
22
32
.. code-block :: text
23
33
24
- record(ai, "BL01T -EA-IOC-01:TEST") {
34
+ record(ai, "BL02T -EA-IOC-01:TEST") {
25
35
field(DESC, "Test record")
26
36
field(DTYP, "Soft Channel")
27
37
field(SCAN, "Passive")
@@ -45,7 +55,7 @@ folder:
45
55
46
56
.. code-block :: bash
47
57
48
- # stop the first IOC shell by hitting Ctrl-D or typing exit
58
+ # stop any existing IOC shell by hitting Ctrl-D or typing exit
49
59
cd /epics/ioc
50
60
./start.sh
51
61
@@ -57,7 +67,7 @@ from another terminal (VSCode menus -> Terminal -> New Terminal) like so:
57
67
58
68
.. code-block :: bash
59
69
60
- caget $USER -EA-IOC-01 :TEST
70
+ caget BL02T -EA-IOC-02 :TEST
61
71
62
72
If you see the value 1 then your change is working.
63
73
@@ -82,24 +92,28 @@ committed and pushed to the bl01t repo. i.e.:
82
92
83
93
.. code-block :: bash
84
94
85
- # Do this from the host terminal (not the devcontainer terminal)
95
+ # Do this from a host terminal (not a devcontainer terminal)
86
96
cd bl01t
87
97
git add .
88
98
git commit -m " Added extra.db"
89
99
git push
90
100
# tag a new version of the beamline repo
91
101
git tag 2023.11.2
92
102
git push origin 2023.11.2
103
+ # deploy the new version of the IOC to the local docker / podman instance
93
104
ec deploy bl01t-ea-ioc-02 2023.11.2
94
105
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 ``.
106
+ The above steps were performed on a host terminal because we are using ``ec ``.
107
+ However all of the steps except for the ``ec `` command could have been done
108
+ *inside * the devcontainer starting with ``cd /repos/bl01t ``.
109
+
110
+ We choose not to have ``ec `` installed inside of the devcontainer because
111
+ that would involve containers in containers which adds too much complexity.
98
112
99
113
Raw Startup Assets
100
114
------------------
101
115
102
- If you plan not to use `ibek ` runtime asset creation you could use the raw
116
+ If you plan not to use `` ibek ` ` runtime asset creation you could use the raw
103
117
startup assets from the previous tutorial. If you do this then the process
104
118
above is identical except that you will add the ``dbLoadRecords `` command to
105
119
the end of ``st.cmd ``.
@@ -113,5 +127,55 @@ The schema is in turn defined by the set of support modules that were compiled
113
127
into the Generic IOC (ioc-adsimdetector). Each support module has an
114
128
``ibek `` *support YAML * file that contributes to the schema.
115
129
116
- The *Support yaml * files are in the folder ``/epics/ibek ``
130
+ The *Support yaml * files are in the folder ``/epics/ibek `` inside of the
131
+ container. They were placed their during the compilation of the support
132
+ modules at Generic IOC build time.
133
+
134
+ It can be instructive to look at these files to see what entities are available
135
+ to *IOC instances *. For example the global support yaml file
136
+ ``/epics/ibek/ibek.yaml `` contains the following:
137
+
138
+ .. code :: yaml
139
+
140
+ - name : StartupCommand
141
+ description : Adds an arbitrary command in the startup script before iocInit
142
+ args :
143
+ - type : str
144
+ name : command
145
+ description : command string
146
+ default : " "
147
+ pre_init :
148
+ - type : text
149
+ value : " {{ command }}"
150
+
151
+ - name : PostStartupCommand
152
+ description : Adds an arbitrary command in the startup script after iocInit
153
+ args :
154
+ - type : str
155
+ name : command
156
+ description : command string
157
+ default : " "
158
+ post_init :
159
+ - type : text
160
+ value : " {{ command }}"
161
+
162
+ These two definitions allow you to add arbitrary commands to the startup script
163
+ before and after iocInit. This is how we added the ``dbLoadRecords `` command.
164
+
165
+ If you want to specify multiple lines in a command you can use the following
166
+ syntax for multi-line stings:
167
+
168
+ .. code-block :: yaml
169
+
170
+ - type : epics.StartupCommand
171
+ command : |
172
+ # loading extra records
173
+ dbLoadRecords(config/extra.db)
174
+ # loading even more records
175
+ dbLoadRecords(config/extra2.db)
176
+
177
+ This would place the 4 lines verbatim into the startup script (except that
178
+ they would not be indented - the nesting whitespace is stripped).
117
179
180
+ In later tutorials we will see where the *Support yaml * files come from and
181
+ how to add your own.
0 commit comments