You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These settings can be edited using `Ctrl-Shift-P`: `Preferences: Open User Settings: (JSON)`
21
+
22
+
(scm_settings)=
23
+
### Disable recursive search for git repositories
24
+
25
+
Because all ioc-XXX have the same submodule `ibek-support` and because `/epics/support` in Generic IOCs contains many repositories, it is best not to automatically have vscode search for git repositories in the workspace. These settings are useful in this regard.
Copy file name to clipboardExpand all lines: docs/tutorials/dev_container.md
+62-96Lines changed: 62 additions & 96 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,70 +7,62 @@
7
7
Containerized IOCs can be modified in 3 distinct places (in order of decreasing
8
8
frequency of change but increasing complexity):
9
9
10
-
1. The IOC instance: this means making changes to the IOC instance folders
11
-
which appear in the `iocs` folder of a domain repository. e.g.:
12
-
13
-
- changing the EPICS DB (or the `ibek` files that generate it)
14
-
- altering the IOC boot script (or the `ibek` files that generate it)
15
-
- changing the version of the Generic IOC used in values.yaml
16
-
- for Kubernetes: the values.yaml can override any settings used by helm
17
-
so these can also be adjusted on a per IOC instance basis.
18
-
- for Kubernetes: changes to the global values.yaml
19
-
file found in `beamline-chart`, these affect all IOCs in the domain.
20
-
21
-
2. The Generic IOC: i.e. altering how the Generic IOC container image
22
-
is built. This means making changes to an `ioc-XXX`
23
-
source repo and publishing a new version of the container image.
24
-
Types of changes include:
10
+
(changes_1)=
11
+
### Changing the IOC instance
12
+
13
+
This means making changes to the IOC instance folders
14
+
which appear in the `iocs` folder of an {any}`ec-services-repo`. e.g.:
15
+
16
+
- changing the EPICS DB (or the `ibek` files that generate it)
17
+
- altering the IOC boot script (or the `ibek` files that generate it)
18
+
- changing the version of the Generic IOC used in values.yaml
19
+
- for Kubernetes: the values.yaml can override any settings used by helm
20
+
so these can also be adjusted on a per IOC instance basis.
21
+
- for Kubernetes: changes to the global values.yaml
22
+
file found in `beamline-chart`, these affect all IOCs in the repository.
23
+
24
+
(changes_2)=
25
+
### Changing the Generic IOC
26
+
27
+
This involves altering how the Generic IOC container image
28
+
is built. This means making changes to an `ioc-XXX`
29
+
source repo and publishing a new version of the container image.
30
+
Types of changes include:
25
31
26
32
- changing the EPICS base version
27
33
- changing the versions of EPICS support modules compiled into the IOC binary
28
34
- adding new support modules
29
35
- altering the system dependencies installed into the container image
30
36
31
-
3. The dependencies - Support modules used by the Generic IOC. Changes to support
32
-
module repos. To make use of these changes would require:
33
-
34
-
- publishing a new release of the support module,
35
-
- updating and publishing the Generic IOC
36
-
- updating and publishing the IOC instance
37
+
(changes_3)=
38
+
### Changing the dependencies
37
39
38
-
For all of the above, the epics-containers approach allows
39
-
local testing of the changes before going through the publishing cycle.
40
-
This allows us to have a fast 'inner loop' of development and testing.
40
+
Sometimes you will need to alter the support modules used by the Generic IOC. To make use of these changes would require:
41
41
42
-
Also, epics-containers provides a mechanism for creating a separate workspace for
43
-
working on all of the above elements in one place.
42
+
- publishing a new release of the support module,
43
+
- updating and publishing the Generic IOC
44
+
- updating and publishing the IOC instance
44
45
45
46
## Need for a Developer Container
46
47
47
-
The earlier tutorials were firmly in the realm of `1` above.
48
-
It was adequate for us to install a container platform, IDE and python
49
-
and that is all we needed.
48
+
For all of the above types of changes, the epics-containers approach allows local testing of the changes before going through the publishing cycle. This allows us to have a fast 'inner loop' of development and testing.
50
49
51
-
Once you get to level `2` changes you need to have compilers and build tools
52
-
installed. You might also require system level dependencies. AreaDetector,
53
-
that we used earlier has a long list of system dependencies that need to be
54
-
installed in order to compile it. Traditionally we have installed all of these
55
-
onto developer workstations or separately compiled the dependencies as part of
56
-
the build.
50
+
Also, epics-containers provides a mechanism for creating a separate workspace for working on all of the above elements in one place.
57
51
58
-
These tools and dependencies will differ from one Generic IOC to the next.
52
+
The earlier tutorials were firmly in the realm of [](changes_1) above. It was adequate for us to install a container platform, IDE and python and that is all we needed.
59
53
60
-
When using epics-containers we don't need to install any of these tools or
61
-
dependencies on our local machine. Instead we can use a developer container,
62
-
and in fact our Generic IOC *is* our developer container.
54
+
Once you get to level of [](changes_2) you need to have compilers and build tools installed. You might also require system level dependencies. AreaDetector, that we used earlier has a long list of system dependencies that need to be installed in order to compile it. Traditionally we have installed all of these onto developer workstations or separately compiled the dependencies as part of the build.
These tools and dependencies will differ from one Generic IOC to the next.
66
57
67
-
```{eval-rst}
58
+
When using epics-containers we don't need to install any of these tools or dependencies on our local machine. Instead we can use a developer container, and in fact our Generic IOC *is* our developer container.
68
59
69
-
:runtime: this target installs only the runtime dependencies into the container.
70
-
It also extracts the built runtime assets from the developer target.
60
+
When the CI builds a Generic IOC it creates [two targets](https://github.com/orgs/epics-containers/packages?repo_name=ioc-adsimdetector)
71
61
72
-
The developer stage of the build is a necessary step in order to get a
73
-
```
62
+
|||
63
+
|---|---|
64
+
|**developer**| this target installs all the build tools and build time dependencies into the container image. It then compiles the support modules and IOC. |
65
+
|**runtime**| this target installs only the runtime dependencies into the container. It also extracts the built runtime assets from the developer target. |
74
66
75
67
The developer stage of the build is a necessary step in order to get a
76
68
working runtime container. However, we choose to keep this stage as an additional
@@ -154,7 +146,7 @@ because it makes it possible to archive away the development environment
154
146
along side the source code. It also means that you can easily share the
155
147
development environment with other developers.
156
148
157
-
For epics-containers the generic IOC >>>is\<\<\< the developer container. When
149
+
For epics-containers the generic IOC *is* the developer container. When
158
150
you build the developer target of the container in CI it will contain all the
159
151
build tools and dependencies needed to build the IOC. It will also contain
160
152
the IOC source code and the support module source code. For this reason
@@ -166,7 +158,7 @@ tools to build and test it.
166
158
It is also important to understand that although your vscode session is
167
159
entirely inside the container, some of your host folders have been mounted
168
160
into the container. This is done so that your important changes to source
169
-
code would not be lost if the container were rebuilt. See [container-layout]
161
+
code would not be lost if the container were rebuilt. See [](container-layout)
170
162
for details of which host folders are mounted into the container.
171
163
172
164
Once built, open the project in VSCode:
@@ -180,13 +172,13 @@ the green icon in the bottom left of the VSCode window and select
180
172
`Reopen in Container`.
181
173
182
174
You should now be *inside* the container. All terminals started in VSCode will
183
-
be inside the container. Every file that you open with the VSCode editor
175
+
be running inside the container. Every file that you open with the VSCode editor
184
176
will be inside the container.
185
177
186
178
There are some caveats because some folders are mounted from the host file
187
179
system. For example, the `ioc-adsimdetector` project folder
188
180
is mounted into the container as a volume. It is mounted under
189
-
`/epics/ioc-adsimdetector`. This means that you can edit the source code
181
+
`/workspaces/ioc-adsimdetector`. This means that you can edit the source code
190
182
from your local machine and the changes will be visible inside the container and
191
183
outside the container. This is a good thing as you should consider the container
192
184
filesystem to be a temporary filesystem that will be destroyed when the container
@@ -210,39 +202,21 @@ it, this includes `ibek`.
210
202
The first commands you should run are as follows:
211
203
212
204
```bash
205
+
# open a terminal: Menu -> Terminal -> New Terminal
213
206
cd /epics/ioc
214
207
make
215
208
```
216
209
217
-
It is useful to understand that /epics/ioc is a soft link to the IOC source
218
-
that came with your generic IOC source code. Therefore if you edit this
219
-
code and recompile it, the changes will be visible inside the container and
220
-
outside the container. Meaning that the repository `ioc-adsimdetector` is
221
-
now showing your changes in it's `ioc` folder and you could push them
210
+
It is useful to understand that `/epics/ioc` is a soft link to the IOC source that came with your generic IOC source code. Therefore if you edit this code and recompile it, the changes will be visible inside the container and outside the container. Meaning that the repository `ioc-adsimdetector` is now showing your changes in it's `ioc` folder and you could push them
222
211
up to GitHub if you wanted.
223
212
224
-
The above is true because your project folder ioc-adsimdetector is mounted into
225
-
the container's filesystem with a bind mount at the same place that the
226
-
ioc files were originally placed by the container build.
227
-
228
-
epics-containers devcontainers have carefully curated host filesystem mounts.
229
-
This allows the developer environment to look as similar as possible to the
230
-
runtime container.
231
-
It also will preserve any important changes that you make in the host file system.
232
-
This is essential because the container filesystem is temporary and will be
233
-
destroyed when the container is rebuilt or deleted.
213
+
epics-containers devcontainers have carefully curated host filesystem mounts. This allows the developer environment to look as similar as possible to the runtime container. It also will preserve any important changes that you make in the host file system. This is essential because the container filesystem is temporary and will be destroyed when the container is rebuilt or deleted.
234
214
235
-
See [container-layout] for details of which host folders are mounted into the
236
-
container.
215
+
See [](container-layout) for details of which host folders are mounted into the container.
237
216
238
-
The IOC source code is entirely boilerplate, `/epics/ioc/iocApp/src/Makefile`
239
-
determines which dbd and lib files to link by including two files that
240
-
`ibek` generated during the container build. You can see these files in
241
-
`/epics/support/configure/lib_list` and `/epics/support/configure/dbd_list`.
217
+
The IOC source code is entirely boilerplate, `/epics/ioc/iocApp/src/Makefile` determines which dbd and lib files to link by including two files that `ibek` generated during the container build. You can see these files in `/epics/support/configure/lib_list` and `/epics/support/configure/dbd_list`.
242
218
243
-
Although all Generic IOCs derived from ioc-template start out with the same
244
-
generic source, you are free to change them if there is
245
-
a need for different compilation options etc.
219
+
Although all Generic IOCs derived from ioc-template start out with the same generic source, you are free to change them if there is a need for different compilation options etc.
246
220
247
221
The Generic IOC should now be ready to run inside of the container. To do this:
248
222
@@ -280,13 +254,15 @@ located.
280
254
281
255
:::{note}
282
256
Docker Users: your account inside the container will not be the owner of
283
-
/epics files. vscode will try to open the repos in epics-base and support/\*
257
+
/epics files. vscode may try to open the repos in epics-base and support/\*
284
258
and git will complain about ownership. You can cancel out of these errors
285
259
as you should not edit project folders inside of `/epics` - they were
286
260
built by the container and should be considered immutable. We will learn
287
261
how to work on support modules in later tutorials. This error should only
288
262
be seen on first launch. podman users will have no such problem because they
289
263
will be root inside the container and root built the container.
264
+
265
+
To mitigate this problem you can tell vscode not to look for git repos in subfolders, see [](scm_settings).
290
266
:::
291
267
292
268
You can now easily browse around the `/epics` folder and see all the
@@ -317,6 +293,10 @@ host. i.e. the root folder under which your projects are all cloned):
317
293
- WS/ioc-adsimdetector/ioc
318
294
- soft link to IOC source tree
319
295
296
+
* - /epics/runtime
297
+
- N/A
298
+
- generated startup script and EPICS database files
299
+
320
300
* - /epics/ibek-defs
321
301
- N/A
322
302
- All ibek *Support yaml* files
@@ -339,7 +319,7 @@ host. i.e. the root folder under which your projects are all cloned):
339
319
340
320
* - /epics/generic-source
341
321
- WS/ioc-adsimdetector
342
-
- A second - fixed location mount of the Generic IOC source repo
322
+
- A second - fixed location mount of the Generic IOC source repo to allow `ibek` to find it easily.
343
323
```
344
324
345
325
IMPORTANT: remember that the container filesystem is temporary and will be
@@ -353,39 +333,25 @@ in the host filesystem.
353
333
Also note that VSCode keeps your developer container until you rebuild it
354
334
or explicitly delete it. Restarting your PC and coming back to the same
355
335
devcontainer does keep all state. This can make you complacent about doing
356
-
work in the container filesystem, this is not recommended.
336
+
work in the container filesystem, but it is still not recommended.
357
337
358
338
(choose-ioc-instance)=
359
339
360
340
## Choose the IOC Instance to Test
361
341
362
-
Now that we have the beamline repo visible in our container we can
363
-
easily supply some instance configuration to the Generic IOC.
342
+
Now that we have the beamline repo visible in our container we can easily supply some instance configuration to the Generic IOC. This will use the `ibek` tool convenience function `dev instance` which declares which IOC instance you want to work on in the developer container.
ibek dev instance /workspaces/bl01t/services/bl01t-ea-test-02
349
+
# check the it worked - should see a symlink to the config folder
371
350
ls -l config
372
351
./start.sh
373
352
```
374
353
375
-
This removed the boilerplate config and replaced it with the config from
376
-
the IOC instance bl01t-ea-test-02. Note that we used a soft link, this
377
-
means we can edit the config, restart the IOC to test it and the changes
378
-
will already be in place in the beamline repo. You can even open a shell
379
-
onto the beamline repo and commit and push the changes.
380
-
381
-
:::{note}
382
-
The manual steps above were shown to demonstrate the process. In practice
383
-
you can use this command to do the same thing:
384
-
385
-
```bash
386
-
ibek dev instance /workspaces/bl01t/services/bl01t-ea-test-02
387
-
```
388
-
:::
354
+
This removed any existing config folder and replaced it with the config from the IOC instance bl01t-ea-test-02 by symlinking to that IOC Instance's config folder. Note that we used a soft link, this means we can edit the config, restart the IOC to test it and the changes will already be in place in the beamline repository. You could therefore open a shell onto the beamline repository at `/workspaces/bl01t` and commit and push the changes.
0 commit comments