1
- Deploy The Example IOC
2
- ======================
3
-
4
- .. Warning ::
5
-
6
- This tutorial is out of date and will be updated soon.
1
+ Deploying and Managing IOC Instances
2
+ ====================================
7
3
8
4
Introduction
9
5
------------
10
6
11
- This tutorial will show you how to deploy some IOC Instances to the test
12
- beamline bl01t. You will need to have your own bl01t beamline repository
7
+ This tutorial will show you how to deploy and manage the example IOC Instance
8
+ that came with the template beamline repository.
9
+ You will need to have your own ``bl01t `` beamline repository
13
10
from the previous tutorial.
14
11
15
12
For these early tutorials we are not using Kubernetes and instead are deploying
16
- IOCs to the local docker or podman instance. So for the this tutorial we
13
+ IOCs to the local docker or podman instance. So for these tutorials we
17
14
shall pretend that your workstation is one of the IOC servers on the fictitious
18
- beamline BL01T.
15
+ beamline ``BL01T ``.
16
+
17
+ Continuous Integration
18
+ ----------------------
19
+
20
+ Before we change anything, we shall make sure that the beamline repository CI
21
+ is working as expected. To do this go to the following URL (make sure you insert
22
+ your GitHub account name where indicated):
23
+
24
+ .. code ::
19
25
20
- Take a Look at Your Project's Continuous Integration
21
- ----------------------------------------------------
26
+ [email protected] :**YOUR GITHUB ACCOUNT**/bl01t/actions
22
27
23
- Before we change anything we shall make sure that the beamline repository CI
24
- is working as expected. To do this go to the following URL:
28
+ You should see something like the following:
25
29
26
- -
30
+ .. figure :: ../images/bl01t-actions.png
31
+
32
+ the GitHub Actions page for the example beamline repository
33
+
34
+ This is a list of all the Continuous Integration (CI) jobs that have been
35
+ executed (or are executing) for your beamline repository. There should be
36
+ two jobs listed, one for when you pushed the main branch and one for when you
37
+ tagged with the ``CalVer `` version number.
38
+
39
+ If you click on the most recent job you can drill in and see the steps that
40
+ were executed. The most interesting step is ``Run bash ./ci_verify.sh ``. This
41
+ is executing the script in the root of your beamline repository that verifies
42
+ each IOC instance in the ``iocs `` folder. In future we can make this script
43
+ more sophisticated when we have simulated hardware to test against.
44
+
45
+ For the moment just check that your CI passed and if not review that you
46
+ have followed the instructions in the previous tutorial correctly.
27
47
28
48
Set up Environment for BL01T Beamline
29
49
-------------------------------------
@@ -45,38 +65,28 @@ where indicated):
45
65
46
66
cd /tmp
47
67
curl -o ~ /.local/bin/bl01t https://raw.githubusercontent.com/** YOUR GITHUB ACCOUNT** /bl01t/main/environment.sh? token=$( date +%s)
48
- . ~ /.bash_profile
49
- . bl01t
68
+ source ~ /.bash_profile
69
+ source bl01t
50
70
51
71
Once you have done this and logged out and back in again to pick up your new
52
- profile you should be able enable the bl01t environment as follows:
72
+ profile you should be able enable the `` bl01t `` environment as follows:
53
73
54
74
.. code-block :: bash
55
75
56
- . bl01t
76
+ # first make sure you have loaded your virtual environment
77
+ source $HOME /ec-venv/bin/activate
78
+ source bl01t
57
79
58
80
59
- Deploy the IOC Instance to Kubernetes
60
- -------------------------------------
81
+ Deploy the Example IOC Instance
82
+ -------------------------------
61
83
62
- For this tutorial we are going to work with the example IOC bl01t-ea-ioc-01
63
- that came with our beamline repository from the previous tutorial.
64
- Here we will deploy the IOC into our cluster and then learn how to interact
65
- with it.
84
+ For this section we will be making use of the epics-containers-cli tool.
85
+ This command line entry point for the tool is ``ec ``. For more
86
+ details see: `CLI ` or try ``ec --help ``.
66
87
67
- If you are interested in the detail of what is in the bl01t-ea-ioc-01 folder
68
- that describes this IOC instance then see: `../reference/ioc_helm_chart `.
69
-
70
- Also, if you are interested in how the helm chart manifests itself in your
71
- cluster when deployed then see: `../reference/k8s_resources `.
72
-
73
- For this section we will be making use of the epics-containers-cli tool. This makes
74
- it easier to interact with kubernetes and helm from the command line and is
75
- described in more detail here: `CLI `.
76
-
77
- You will need a working Kubernetes cluster for most of the rest of the
78
- tutorials. You can verify that it is working by asking for a list of IOCs
79
- running in your default domain as follows:
88
+ The simplest command to check that the tool is working is ``ps `` which lists
89
+ the IOC Instances that are currently running:
80
90
81
91
.. code-block :: bash
82
92
@@ -85,134 +95,115 @@ running in your default domain as follows:
85
95
You should see some headings and an empty list as you have not yet started an
86
96
IOC Instance.
87
97
88
- .. note ::
89
-
90
- The command ``ec `` is the epics-containers command line utilities entry
91
- point. For more information see `CLI ` or try ``ec --help ``.
92
-
93
-
94
- The following command will deploy the example IOC instance to your cluster
95
- (if you changed the ioc name in the previous tutorial then
96
- remember to change bl01t-ea-ioc-01 to your unique name here):
98
+ The following command will deploy the example IOC instance to your local
99
+ machine (unless you have skipped ahead and set up your Kubernetes config
100
+ in which case the same command will deploy to your Kubernetes cluster).
97
101
98
102
.. code-block :: bash
99
103
100
- ec ioc deploy bl01t-ea-ioc-01 23.4.1
101
-
102
- Note that this is looking for the IOC's helm chart in your OCI helm registry.
103
- You delivered the IOC helm chart to the registry when you made a release of
104
- the beamline repo in the previous tutorial. You must supply a version number
105
- that exists. If you do not recall the version number you used in the last tutorial,
106
- you can use the following command to list the versions available in your
107
- registry:
108
-
109
- .. code-block :: bash
104
+ cd bl01t # (if you are not already in your beamline repo)
105
+ ec ioc deploy-local iocs/bl01t-ea-ioc-01
110
106
111
- ec ioc versions bl01t-ea-ioc-01
107
+ You will be prompted to say that this is a *TEMPORARY * deployment. This is
108
+ because we are deploying directly from the local filesystem. You should only
109
+ use this for testing purposes because there is no guarantee that you could
110
+ ever roll back to this version of the IOC (as it is lost as soon as filesystem
111
+ changes are made). Local filesystem deployments are given a beta version
112
+ number to indicate that they are not permanent.
112
113
113
- As the deployment is progressing you could use the following command to
114
- monitor the progress (hit ctrl-C to stop following the logs):
114
+ You can now see the beta IOC instance running with:
115
115
116
116
.. code-block :: bash
117
117
118
- ec ioc logs bl01t-ea-ioc-01 -f
119
-
120
- Note there may be a little delay while the cluster pulls the Generic IOC
121
- image from the GitHub container registry. The error
122
- "recGblRecordError: devStringinEnvVar (init_record) Illegal INP parm field Illegal field value PV: BL01T-EA-IOC-01:TIMEZONE"
123
- is benign, TODO: take a look at the cause of this error.
118
+ $ ec ps
119
+ IOC NAME VERSION STATUS IMAGE
120
+ bl01t-ea-ioc-01 2023.10.26-b11.53 Up 6 minutes ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5
124
121
125
- Once the IOC is running you can find out the IP address of the pod it is
126
- running in with:
122
+ At the end of the last tutorial we tagged the beamline repository with a
123
+ ``CalVer `` version number and pushed it up to GitHub. This means that we
124
+ can now release the IOC instance with that same version number. First let's
125
+ check that the IOC instance version is available as expected:
127
126
128
127
.. code-block :: bash
129
128
130
- ec ps -w
131
-
132
- This will show you the status of the IOC instance and the IP address of the
133
- pod it is running in. In a real beamline setup the IOCs would run in the same
134
- subnet as your workstation so you would not care about the IP address. But
135
- for the example you may need to do the following to let our EPICS clients
136
- know where to look for PVs:
137
-
138
- .. code-block :: bash
129
+ $ ec ioc instances bl01t-ea-ioc-01
130
+ Available instance versions for bl01t-ea-ioc-01:
131
+ 2023.11.1
139
132
140
- export EPICS_CA_ADDR_LIST=ip_address_of_pod
141
- export EPICS_PVA_ADDR_LIST=ip_address_of_pod
142
133
143
- epics-containers does not yet have any provision for EPICS operator interfaces.
144
- For this example we have hand crafted some EDM screens to control and monitor
145
- the test IOC. These EDM screens are supplied in the template so you will
146
- have them in the ``opi `` folder in your beamline repository.
147
-
148
- You can now launch the client applications as follows:
134
+ Now that we know the latest version number we can deploy a release version.
135
+ This command will extract the IOC instance using the tag from GitHub and deploy
136
+ it to your local machine:
149
137
150
138
.. code-block :: bash
151
139
152
- ./blxxi-ea-ioc-01-gui.sh
153
- c2dv --pv $USER -EA-TST-01:IMAGE
154
-
155
- Now make sure the AreaDetector is Acquiring by clicking Start if needed on
156
- the CAM screen. Next click on Auto to scale the
157
- black and white thresholds on the C2D viewer. You should see something like the
158
- following images.
159
-
160
- .. figure :: ../images/edm_sim.png
161
-
162
- edm screen for the example IOC
140
+ $ ec ioc deploy bl01t-ea-ioc-01 2023.11.1
141
+ bdbd155d437361fe88bce0faa0ddd3cd225a9026287ac5e73545aeb4ab3a67e9
163
142
164
- .. figure :: ../images/c2dv.png
143
+ $ ec ps
144
+ IOC NAME VERSION STATUS IMAGE
145
+ bl01t-ea-ioc-01 2023.11.1 Up 4 seconds ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5
165
146
166
- the c2dv viewer showing an image from the example IOC
167
147
168
-
169
- Managing IOCs
170
- --------------
171
-
172
- IOCs running in Kubernetes can be managed using the ``ec `` command.
148
+ Managing the Example IOC Instance
149
+ ---------------------------------
173
150
174
151
Starting and Stopping IOCs
175
152
~~~~~~~~~~~~~~~~~~~~~~~~~~
176
153
177
- To stop / start the example IOC:
154
+ To stop / start the example IOC try the following commands. Note that
155
+ ``ec ps -a `` shows you all IOCs including stopped ones.
178
156
179
157
.. code-block :: bash
180
158
159
+ ec ps -a
181
160
ec ioc stop bl01t-ea-ioc-01
161
+ ec ps -a
182
162
ec ioc start bl01t-ea-ioc-01
163
+ ec ps
164
+
165
+ .. Note ::
166
+
167
+ Generic IOCs.
168
+
169
+ You may have noticed that the IOC instance has is showing that it has
170
+ an image ``ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5 ``.
171
+
172
+ This is a Generic IOC image and all IOC Instances must be based upon one
173
+ of these images. This IOC instance has no startup script and is therefore
174
+ not functional, it could have been based on any Generic IOC.
183
175
184
176
Monitoring and interacting with an IOC shell
185
177
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
178
187
- To attach to the ioc shell:
179
+ To attach to the ioc shell you can use the following command. HOWEVER, this
180
+ will attach you to nothing in the case of this example IOC as it has no
181
+ shell. In the next tutorial we will use this command to interact with
182
+ iocShell.
188
183
189
184
.. code-block :: bash
190
185
191
186
ec ioc attach bl01t-ea-ioc-01
192
187
193
- Use the command sequence ctrl-P then ctrl-Q to detach or ctrl-D to restart the
194
- IOC and detach.
195
-
196
- TODO: I'm having issues with the shell eating the ^P^Q sequences so
197
- at present you can only detach from the IOC by killing the terminal or
198
- using ^D.
188
+ Use the command sequence ctrl-P then ctrl-Q to detach from the IOC
189
+ You can also usually restart and detach from the IOC using ctrl-D or
190
+ ctrl-C.
199
191
200
192
To run a bash shell inside the IOC container:
201
193
202
194
.. code-block :: bash
203
195
204
196
ec ioc exec bl01t-ea-ioc-01
205
197
206
- Once you have a shell inside the container you can inspect the following
198
+ Once you have a shell inside the container you could inspect the following
207
199
folders:
208
200
209
201
=============== ==============================================================
210
- ioc code repos /epics/ioc
211
- support modules repos /epics/support
212
- epics binaries repos /epics/epics-base
202
+ ioc code /epics/ioc
203
+ support modules /epics/support
204
+ EPICS binaries /epics/epics-base
213
205
=============== ==============================================================
214
206
215
-
216
207
Logging
217
208
~~~~~~~
218
209
@@ -228,6 +219,9 @@ Or follow the IOC log until you hit ctrl-C:
228
219
229
220
ec ioc logs bl01t-ea-ioc-01 -f
230
221
222
+ You will notice that this IOC simply prints out a message regarding what
223
+ you can place in the /epics/ioc/config folder. In the next tutorial
224
+ we will look at how to configure a real EPICS IOC.
231
225
232
226
233
227
0 commit comments