Skip to content

Commit 8659340

Browse files
committed
update tutorials up to dev_container with Jan 2024 framework changes
1 parent 949aafd commit 8659340

File tree

6 files changed

+100
-44
lines changed

6 files changed

+100
-44
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/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/tutorials/create_beamline.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

docs/user/tutorials/deploy_example.rst

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The standard way to set up your environment for any domain is to get
5252
the environment.sh script from the domain repository and source it.
5353

5454
First make sure you have the local binaries folder in your path by adding
55-
the following to the end of you $HOME/.bash_profile file:
55+
the following to the end of you ``$HOME/.bash_profile`` file:
5656

5757
.. code-block:: bash
5858
@@ -63,7 +63,7 @@ where indicated):
6363

6464
.. code-block:: bash
6565
66-
cd /tmp
66+
mkdir -p ~/.local/bin
6767
curl -o ~/.local/bin/bl01t https://raw.githubusercontent.com/**YOUR GITHUB ACCOUNT**/bl01t/main/environment.sh?token=$(date +%s)
6868
source ~/.bash_profile
6969
source bl01t
@@ -73,8 +73,8 @@ profile you should be able to enable the ``bl01t`` environment as follows:
7373

7474
.. code-block:: bash
7575
76-
# first make sure you have loaded your virtual environment
77-
source $HOME/ec-venv/bin/activate
76+
# first make sure you have loaded your virtual environment for the ec tool
77+
source $HOME/ec-venv/bin/activate # DLS users don't need this step
7878
source bl01t
7979
8080
@@ -117,18 +117,20 @@ You can now see the beta IOC instance running with:
117117
118118
$ ec ps
119119
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
120+
bl01t-ea-ioc-01 2024.1.19-b11.53 Up 6 minutes ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2024.1.1
121121
122122
At the end of the last tutorial we tagged the beamline repository with a
123123
``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:
124+
can now use that tagged release of the IOC instance. First let's
125+
check that the IOC instance version is available as expected. The following
126+
command lists all of the tagged versions of the IOC instance that are
127+
available in the GitHub repository.
126128

127129
.. code-block:: bash
128130
129131
$ ec ioc instances bl01t-ea-ioc-01
130132
Available instance versions for bl01t-ea-ioc-01:
131-
2023.11.1
133+
2024.1.1
132134
133135
.. note::
134136

@@ -144,13 +146,27 @@ it to your local machine:
144146

145147
.. code-block:: bash
146148
147-
$ ec ioc deploy bl01t-ea-ioc-01 2023.11.1
149+
$ ec ioc deploy bl01t-ea-ioc-01 2024.1.1
148150
bdbd155d437361fe88bce0faa0ddd3cd225a9026287ac5e73545aeb4ab3a67e9
149151
150152
$ ec ps
151153
IOC NAME VERSION STATUS IMAGE
152-
bl01t-ea-ioc-01 2023.11.1 Up 4 seconds ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5
154+
bl01t-ea-ioc-01 2024.1.1 Up 4 seconds ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5
153155
156+
IMPORTANT: deploy-local vs deploy
157+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158+
159+
Be aware of the distinction of ``deploy-local`` vs ``deploy``. Both of these
160+
commands create a running instance of the IOC in the target environment (currently
161+
your local machine - later on a Kubernetes Cluster). However, ``deploy-local``
162+
gets the IOC instance description YAML direct from your local filesystem. This
163+
means it is not likely to be available for re-deployment later on. ``deploy``
164+
gets the IOC instance description YAML from the GitHub repository with able
165+
specific tag and therefore is a known state that can be recovered at a later
166+
date.
167+
168+
Always strive to have released versions of IOC instances deployed in your
169+
environments. ``deploy-local`` is only for temporary testing purposes.
154170

155171
Managing the Example IOC Instance
156172
---------------------------------
@@ -174,7 +190,7 @@ To stop / start the example IOC try the following commands. Note that
174190
Generic IOCs.
175191

176192
You may have noticed that the IOC instance has is showing that it has
177-
an image ``ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2023.10.5``.
193+
an image ``ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2024.1.1``.
178194

179195
This is a Generic IOC image and all IOC Instances must be based upon one
180196
of these images. This IOC instance has no startup script and is therefore
@@ -192,9 +208,11 @@ iocShell.
192208
193209
ec ioc attach bl01t-ea-ioc-01
194210
195-
Use the command sequence ctrl-P then ctrl-Q to detach from the IOC
196-
You can also usually restart and detach from the IOC using ctrl-D or
197-
ctrl-C.
211+
Use the command sequence ctrl-P then ctrl-Q to detach from the IOC. **However,
212+
there are issues with both VSCode and IOC shells capturing ctrl-P. until
213+
this is resolved it may be necessary to close the terminal window to detach.**
214+
You can also restart and detach from the IOC using ctrl-D or ctrl-C, or
215+
by typing ``exit``.
198216

199217
To run a bash shell inside the IOC container:
200218

@@ -205,11 +223,17 @@ To run a bash shell inside the IOC container:
205223
Once you have a shell inside the container you could inspect the following
206224
folders:
207225

208-
=============== ==============================================================
209-
ioc code /epics/ioc
210-
support modules /epics/support
211-
EPICS binaries /epics/epics-base
212-
=============== ==============================================================
226+
=================== =======================================================
227+
ioc code /epics/ioc
228+
support modules /epics/support
229+
EPICS binaries /epics/epics-base
230+
IOC instance config /epics/ioc/config
231+
IOC startup script /epics/runtime
232+
=================== =======================================================
233+
234+
Being at a terminal prompt inside the IOC container can be useful for debugging
235+
and testing. You will have access to caget and caput, plus other EPICS tools,
236+
and you can can inspect files such as the IOC startup script.
213237

214238
Logging
215239
~~~~~~~

docs/user/tutorials/dev_container.rst

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,25 +211,38 @@ Preparing the IOC for Testing
211211
rm -rf ~/.vscode/* ~/.vscode-server/*
212212
213213
Now that you are *inside* the container you have access to the tools built into
214-
it, this includes ``ibek``. The first command you should run is:
214+
it, this includes ``ibek``.
215+
216+
The first commands you should run are as follows:
215217

216218
.. code-block:: bash
217219
218-
ibek ioc build
219-
220-
This generates an IOC source tree in the ``ioc`` folder under your
221-
``ioc-adsimdetector`` folder and compiles it. Note that the IOC code is
222-
boilerplate, but that the ``src/Makefile`` is generated according to the
223-
support modules this Generic IOC contains. You can go and take a look at
224-
the Makefile and see that it contains ``dbd`` and ``lib`` references for each
225-
of the support modules in the container.
226-
See ``/epics/ioc-adsimdetector/ioc/iocApp/src/Makefile``
227-
228-
You will note that the ``ioc`` folder is greyed out in the VSCode explorer. This
229-
is because it is in ``.gitignore`` and it is purely generated code. If you
230-
particularly needed to customize the contents of the IOC source tree then
231-
you can remove it from ``.gitignore`` and commit your changes to the repo. These
232-
changes would then always get loaded for every instance of the Generic IOC.
220+
cd /epics/ioc
221+
make
222+
223+
It is useful to understand that /epics/ioc is a soft link to the IOC source
224+
that came with your generic IOC source code. Therefore if you edit this
225+
code and recompile it, the changes will be visible inside the container and
226+
outside the container. Meaning that the repository ``ioc-adsimdetector`` is
227+
now showing your changes and you could push them up to GitHub if you wanted.
228+
229+
The above is true because your project folder ioc-adsimdetector is mounted into
230+
the container's filesystem with a bind mount at the same place that the
231+
ioc files were originally placed by the container build.
232+
233+
epics-containers devcontainers have carefully curated host filesystem mounts
234+
that allow them to look as similar as possible to the runtime container but
235+
at the same time preserve any changes that you make in the host file system.
236+
This is important because the container filesystem is temporary and will be
237+
destroyed when the container is rebuilt or deleted.
238+
239+
The IOC code is entirely boilerplate boilerplate, the ``src/Makefile``
240+
determines which dbd and lib files to link by including two files that
241+
ibek generated during the container build namely
242+
``/epics/support/configure/lib_list`` and ``/epics/support/configure/dbd_list``.
243+
244+
You can go and take a look at the Makefile in
245+
``/epics/ioc/iocApp/src/Makefile`` to see how this is done.
233246

234247
The Generic IOC should now be ready to run inside of the container. To do this:
235248

0 commit comments

Comments
 (0)