|
1 |
| -Changing the Generic IOC |
2 |
| -======================== |
| 1 | +Changing a Generic IOC Part 1 |
| 2 | +============================= |
| 3 | + |
| 4 | +.. warning :: |
| 5 | +
|
| 6 | + This tutorial is a work in progress. It is not yet complete. |
3 | 7 |
|
4 |
| -This tutorial will make a simple change to the Generic IOC ``ioc-adsimdetector``. |
5 |
| -We will also update the IOC instance ``bl01t-ea-ioc-02`` use the new feature of |
6 |
| -the Generic IOC. |
7 | 8 | This is a type 2 change from `ioc_change_types`.
|
8 | 9 |
|
9 |
| -We are going to add an additional support module to the Generic IOC and then |
10 |
| -use it to add a new record to the IOC instance to use this new support. |
| 10 | +The changes that you can make in an IOC instance are limited to what |
| 11 | +the author of the associated Generic IOC has made configurable. |
| 12 | +Therefore you will |
| 13 | +occasionally need to update the Generic IOC that your instance is using. |
| 14 | +Some of the reasons for doing this are: |
| 15 | + |
| 16 | +- Update one or more support modules to new versions |
| 17 | +- Add additional support such as autosave or iocStats |
| 18 | +- For ibek generated IOC instances, you may need to add or change functionality |
| 19 | + in the support YAML file. |
| 20 | + |
| 21 | +This tutorial will make some changes to the generic IOC ``ioc-adsample``. |
| 22 | +This Generic IOC is a simplified copy of ``ioc-adsimdetector`` tailored for |
| 23 | +use in these tutorials. |
| 24 | + |
| 25 | +For this exercise we will initially work locally inside the ``ioc-adsample`` |
| 26 | +developer container. |
| 27 | + |
| 28 | +At the end we will push the changes and see the CI build a new version of the |
| 29 | +generic IOC container image. This allows for the demonstration of: |
| 30 | + |
| 31 | +- Deploying an IOC instance using a new image published by the CI |
| 32 | +- Showing how to do a Pull Request back to the original repository. |
| 33 | + |
| 34 | +For this exercise we will be using an example IOC Instance to test our changes. |
| 35 | +Instead of working with a beamline repository, we will use the example ioc instance |
| 36 | +that comes with ``ioc-adsample``. It is a good idea for Generic IOC authors to |
| 37 | +include an example IOC Instance in their repository for testing changes in |
| 38 | +isolation. |
| 39 | + |
| 40 | + |
| 41 | +Preparation |
| 42 | +----------- |
| 43 | + |
| 44 | +Because we want to push our changes we will first make a fork of the |
| 45 | +``ioc-adsample`` repository. We will then clone our fork locally and |
| 46 | +make the changes there. |
| 47 | + |
| 48 | +To make a fork go to |
| 49 | +`ioc-adsample <https://github.com/epics-containers/ioc-adsample>`_ |
| 50 | +and click the ``Fork`` button in the top right corner. This will create a fork |
| 51 | +of the repository under your own GitHub account. |
| 52 | + |
| 53 | +Now, clone the fork, build the container image locally and open the |
| 54 | +developer container: |
| 55 | + |
| 56 | +.. code-block:: console |
| 57 | +
|
| 58 | + git clone [email protected]:<YOUR GITHUB ACCOUNT NAME>/ioc-adsample.git |
| 59 | + cd ioc-adsample |
| 60 | + ./build |
| 61 | + code . |
| 62 | + # click the green button in the bottom left corner of vscode and select |
| 63 | + # "Reopen in Container" |
| 64 | +
|
| 65 | +The ``build`` script does two things. |
| 66 | + |
| 67 | +- it fetches the git submodule called ``ibek-support``. This submodule is shared |
| 68 | + between all the EPICS IOC container images and contains the support YAML files |
| 69 | + that tell ``ibek`` how to build support modules inside the container |
| 70 | + environment. |
| 71 | +- it builds the Generic IOC container image locally. |
| 72 | + |
| 73 | +.. note:: |
| 74 | + |
| 75 | + The ``build`` script is a convenience script that is provided in the |
| 76 | + Generic IOC Template project. It is exactly equivalent to cloning |
| 77 | + with ``--recursive`` flag and then running ``ec dev build``. |
| 78 | + |
| 79 | +Verify the Example IOC Instance is working |
| 80 | +------------------------------------------ |
| 81 | + |
| 82 | +When a new Generic IOC developer container is opened, there are two things |
| 83 | +that need to be done before you can run an IOC instance inside of it. |
| 84 | + |
| 85 | +- Build the IOC source code |
| 86 | +- Select an IOC instance definition to run |
| 87 | + |
| 88 | +The folder ``ioc`` inside of the ``ioc-adsample`` is where the IOC source code |
| 89 | +is created and built. When you open the developer container, this folder does |
| 90 | +not yet exist. The following command will create it and build the IOC: |
| 91 | + |
| 92 | +.. code-block:: console |
| 93 | +
|
| 94 | + ec ioc build |
| 95 | +
|
| 96 | +The IOC instance definition is a YAML file that tells ``ibek`` what the runtime |
| 97 | +assets (ie. EPICS DB and startup script) should look like. Previous tutorials |
| 98 | +selected the IOC instance definition from a beamline repository. In this case |
| 99 | +we will use the example IOC instance that comes with ``ioc-adsample``. The |
| 100 | +following command will select the example IOC instance: |
| 101 | + |
| 102 | +.. code-block:: console |
| 103 | +
|
| 104 | + ibek dev instance /epics/ioc-adsample/ioc_examples/bl01t-ea-ioc-02 |
| 105 | +
|
| 106 | +In an earlier tutorial when learning about the dev container, we manually |
| 107 | +performed this step, see `choose-ioc-instance`. The above command does |
| 108 | +exactly the same thing: removes the existing config folder in ``/epics/ioc`` |
| 109 | +and symlinks in the chosen IOC instance definition's ``config`` folder. |
| 110 | + |
| 111 | +Now run the IOC: |
| 112 | + |
| 113 | +.. code-block:: console |
| 114 | +
|
| 115 | + ibek dev run |
| 116 | +
|
| 117 | +You should see a iocShell prompt and no error messages above. |
| 118 | + |
| 119 | +.. note:: |
11 | 120 |
|
12 |
| -For this exercise all changes will be local so you will not need to make a |
13 |
| -fork of ``ioc-adsimdetector``. The next tutorial will show how to a new |
14 |
| -Generic IOC and we will look at the Generic IOC CI at that time. |
| 121 | + The ``ec ioc build`` command required to re-create the IOC source code. |
| 122 | + This is even though the container you are using already had the IOC |
| 123 | + source code built by its Dockerfile (``ioc-adsample/Dockerfile`` |
| 124 | + contains the same command). |
15 | 125 |
|
16 |
| -TODO: WIP. |
| 126 | + For a detailed explanation of why this is the case see |
| 127 | + `ioc-source` |
0 commit comments