Skip to content

Commit 7efd34d

Browse files
committed
update deploy_example to new framework
1 parent a6638a1 commit 7efd34d

14 files changed

+144
-212
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![CI](https://github.com/epics-containers/epics-containers.github.io/actions/workflows/ci.yml/badge.svg)](https://github.com/epics-containers/epics-containers-github-io/actions/workflows/ci.yml)
1+
[![CI](https://github.com/epics-containers/epics-containers.github.io/actions/workflows/ci.yml/badge.svg)](https://github.com/epics-containers/epics-containers.github.io/actions/workflows/ci.yml)
22
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33

44

docs/how-to/ibek-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git clone [email protected]:controls/containers/accelerator/acc-psc.git
2121
# get latest ibek installed
2222
pip install ibek
2323

24-
cd acc-psc/iocs/sr25a-ioc-01
24+
cd acc-psc/services/sr25a-ioc-01
2525
ibek build-startup config/ioc.boot.yaml ../../../ibek-defs/*/*.yaml
2626
```
2727

docs/images/bl01t-actions.png

-2.04 KB
Loading

docs/reference/cli.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
The python project {any}`edge-containers-cli` is installed as part of the Python section of the initial tutorial {any}`../tutorials/setup_workstation`. It provides a command line function `ec` with support for:
66

7-
- deploying, managing and debugging IOCs and other application Instances
7+
- deploying, managing and monitoring IOC and service instances
88

99
The CLI is just a thin wrapper around the underlying tools that do the real work:
1010

1111
```{eval-rst}
1212
1313
:kubectl: the command line interface to the Kubernetes APIs
1414
:helm: the command line interface to the Kubernetes Helm package manager
15-
:podman (or docker): CLIs for container engines
15+
:podman/docker: CLIs for container engines
1616
:git: the git version control system client
1717
```
1818

@@ -23,11 +23,16 @@ To see the available commands, run `ec --help`.
2323
It may be instructive to understand the underlying tools and how they are being called. For this reason `ec` supports a `-v` option to show the underlying commands being executed. e.g.
2424

2525
```{raw} html
26-
<pre>$ ec -v ps
27-
<font color="#5F8787">kubectl get namespace p38-iocs -o name</font>
28-
<font color="#5F8787">kubectl -n p38-iocs get pod -l is_ioc==True -o custom-columns=IOC_NAME:metadata.labels.app,VERSION:metadata.labels.ioc_version,STATE:status.phase,RESTARTS:status.containerStatuses[0].restartCount,STARTED:metadata.managedFields[0].time</font>
29-
IOC_NAME VERSION STATE RESTARTS STARTED
30-
bl38p-ea-ioc-03 2023.10.6 Running 0 2023-10-25T14:07:44Z
31-
bl38p-ea-panda-02 2023.10.25-b16.24 Running 0 2023-10-25T15:24:41Z
26+
<pre>(venv) <font color="#64BA12">(main) </font>[<font color="#6491CB">hgv27681@pc0116</font> bl47p]$ ec -v ps
27+
<font color="#5F8787">kubectl get namespace p47-iocs -o name</font>
28+
<font color="#5F8787">helm list -n p47-iocs -o json</font>
29+
<font color="#5F8787">kubectl get pods -n p47-iocs -o jsonpath=&apos;{range .items[*]}{..labels.app}{&quot;,&quot;}{..containerStatuses[0].ready}{&quot;,&quot;}{..containerStatuses[0].restartCount}{&quot;,&quot;}{.status.startTime}{&quot;\n&quot;}{end}&apos;</font>
30+
name ready restarts started namespace app_version
31+
bl47p-ea-dcam-01 true 0 2024-02-09T12:34:18Z p47-iocs 2024.2.1b2
32+
bl47p-ea-dcam-02 true 0 2024-02-09T15:10:06Z p47-iocs 2024.2.1
33+
bl47p-ea-panda-01 true 0 2024-02-09T21:57:23Z p47-iocs 2024.2.1b2
34+
bl47p-mo-ioc-01 true 0 2024-02-09T15:42:24Z p47-iocs 2024.2.1
35+
epics-opis true 0 2024-02-09T21:55:21Z p47-iocs 2024.2.2
36+
(venv) <font color="#64BA12">(main) </font>[<font color="#6491CB">hgv27681@pc0116</font> bl47p]$
3237
</pre>
3338
```

docs/reference/environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ be adjusted to suit your domain. The variables are as follows:
5151

5252
- **EC_LOG_URL**: if you have a centralized logging service with a web UI then
5353
you can set this variable to the URL of the web UI. This will then be
54-
displayed when the command `ec ioc log-history <ioc-name>` is run. The
54+
displayed when the command `ec log-history <ioc-name>` is run. The
5555
IOC name is added to the URL using `{ioc-name}` as a placeholder e.g.
5656

5757
- `EC_LOG_URL='https://graylog2.diamond.ac.uk/search?rangetype=relative&fields`

docs/reference/ioc_helm_chart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Here we will look inside the template IOC instance in the template
1212
domain repository blxxi-template.
1313

1414
You can see these files in Github here:
15-
<https://github.com/epics-containers/blxxi-template/tree/main/iocs/blxxi-ea-ioc-01>
15+
<https://github.com/epics-containers/blxxi-template/tree/main/services/blxxi-ea-ioc-01>
1616

1717
## Examine the Example IOC Instance
1818

19-
Take a look in the folder iocs/blxxi-ea-ioc-01. This contains a helm chart
19+
Take a look in the folder services/blxxi-ea-ioc-01. This contains a helm chart
2020
that defines the example IOC instance. To make new IOC instance you could
2121
copy this folder into your own domain repository's iocs folder. You would then
2222
need to rename it and make a few changes. Below is a description of the files

docs/reference/k8s_resources.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ example IOC you can use the following command from inside of your example
1212
beamline repository:
1313

1414
```bash
15-
ec ioc template iocs/bl01t-ea-ioc-01
15+
ec template services/bl01t-ea-ioc-01
1616
```
1717

18-
This is expanding the local helm chart in the `iocs/bl01t-ea-ioc-01` folder and using
18+
This is expanding the local helm chart in the `services/bl01t-ea-ioc-01` folder and using
1919
its `templates/ioc.yaml` plus the templates in `helm-ioc-lib`. These templates
20-
are expanded using the values in the `iocs/bl01t-ea-ioc-01/values.yaml` file and also
20+
are expanded using the values in the `services/bl01t-ea-ioc-01/values.yaml` file and also
2121
`beamline-chart/values.yaml` and finally the default `values.yaml` file
2222
from the helm-ioc-lib.
2323

docs/tutorials/create_beamline.md

Lines changed: 52 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
In this tutorial we will create a new {any}`ec-services-repo`.
66

7-
All IOC Instances that we deploy will be grouped into domains and each
8-
domain will have its own repository which defines those Instances.
9-
Typically each beamline would have its own domain and
10-
the accelerator would be split into a few functional domains.
7+
All IOC Instances that we deploy will be grouped into repositories that define a set of IOC and service instances. Typically each beamline would have its own repository and the accelerator would be split by location or technical area.
118

12-
In the case of Beamlines, the domain is named after the beamline itself. At DLS
9+
In the case of Beamlines, the repo is named after the beamline itself. At DLS
1310
we use the naming convention `blxxc` where `xx` is the beamline number,
1411
and c is the class of beamline.
1512

@@ -19,25 +16,18 @@ numbers and hyphens only are recommended for both domain names and
1916
IOC names. This is a restriction that helm introduces for package names.
2017
:::
2118

22-
We are going to create the test beamline repository `bl01t`.
23-
When the project `bl01t` is pushed to GitHub, continuous integration will
24-
verify that each of the IOCs in the beamline are valid by launching them
25-
with basic configuration.
19+
Here we are going to create the test beamline repository `bl01t`. When the project `bl01t` is pushed to GitHub, continuous integration (CI) will verify each of the IOC instances.
2620

27-
The tests on beamline repositories are basic at present. However the intention
28-
is that eventually each device on a beamline will be simulated using
29-
[Tickit](https://github.com/dls-controls/tickit) . Then Continuous
30-
Integration will perform system tests for each IOC against simulated hardware.
21+
This beamline repository will be made from a template that comes with a single example IOC and further steps in the following tutorials will teach you how to add your own.
3122

32-
Also note that each of these IOC instances will be launched using a
33-
Generic IOC image. Ideally the CI for each Generic IOC should have already run
34-
system tests against simulated (but not beamline specific) hardware.
35-
36-
This beamline repo will be taken from a template that comes with a single example
37-
IOC and further steps in the following tutorials will teach you how to add your own.
23+
:::{note}
24+
If you are going to work in a shared environment then it is worth choosing
25+
a different name for your test beamline and its associated PV prefixes. PVs
26+
will be published on the local subnet by default so two people working on the
27+
tutorials without doing this will clash. If you do this just remember to
28+
substitute your beamline name for `bl01t` in the following instructions.
29+
:::
3830

39-
For accelerator domains the approach described here will be identical. The
40-
only difference is that IOC repos are split by domain rather than by beamline.
4131

4232
## To Start
4333

@@ -52,135 +42,72 @@ You will also need to setup ssh keys to authenticate to github from git. See
5242

5343
## Create a New Repository
5444

55-
Here we will copy the beamline template repository and change its name to bl01t.
56-
We will then step through the changes that are required to make it your own.
45+
Here we will use the copy the ec services template repository to make a new beamline.
5746

5847
NOTE: for these tutorials we will use your personal GitHub Account to
5948
store everything we do, all source repositories and container images. For
6049
production, each facility will need its own policy for where to store these
61-
assets. See `../explanations/workspacesitories`.
50+
assets. See `../explanations/repositories`.
6251

6352
## Steps
6453

65-
1. Go to the template repository here:
66-
<https://github.com/epics-containers/blxxi-template>. Click on the green
67-
button `Use this template` and follow the instructions to create a new
68-
repository in your own account and give it the name bl01t.
54+
1. Go to your GitHub account home page. Click on 'Repositories' and then 'New', give your new repository the name `bl01t` plus a description, then click 'Create'.
6955

7056
If you are using an alternative to GitHub for your repositories then
7157
see [these instructions] for an alternative approach.
7258

73-
2. Clone the template repo locally (substituting in your own GitHub Account).
59+
1. From a command line with your virtual environment activated. Use copier to start to make a new repository like this:
60+
61+
```bash
62+
pip install copier
63+
# this will create the folder bl01t in the current directory
64+
copier copy gh:epics-containers/ec/services-template --trust bl01t
65+
```
66+
1. Answer the copier template questions as follows:
67+
68+
69+
<pre><font color="#5F87AF">🎤</font><b> Where are you deploying these IOCs and services?</b>
70+
<b> </b><font color="#FFAF00"><b>beamline</b></font>
71+
<font color="#5F87AF">🎤</font><b> Short name for the beamline, e.g. &quot;bl47p&quot;, &quot;bl20j&quot;, &quot;bl21i&quot;</b>
72+
<b> </b><font color="#FFAF00"><b>bl01t</b></font>
73+
<font color="#5F87AF">🎤</font><b> A One line description of the module</b>
74+
<b> </b><font color="#FFAF00"><b>beamline bl01t IOC Instances and Services</b></font>
75+
<font color="#5F87AF">🎤</font><b> Cluster namespace for these IOCs and services.</b>
76+
<b> </b><font color="#FFAF00"><b>local</b></font>
77+
<font color="#5F87AF">🎤</font><b> Git platform hosting the repository.</b>
78+
<b> </b><font color="#FFAF00"><b>github.com</b></font>
79+
<font color="#5F87AF">🎤</font><b> The GitHub organisation that will contain this repo.</b>
80+
<b> </b><font color="#FFAF00"><b>YOUR_GITHUB_NAME_GOES_HERE</b></font>
81+
<font color="#5F87AF">🎤</font><b> Remote URI of the repository.</b>
82+
<b> </b><font color="#FFAF00"><b>[email protected]:YOUR_GITHUB_NAME/bl01t.git</b></font>
83+
</pre>
84+
85+
1. Make the first commit and push the repository to GitHub.
7486

7587
```bash
76-
git clone [email protected]:**YOUR GITHUB ACCOUNT**/bl01t.git
88+
cd bl01t
89+
git add .
90+
git commit -m "initial commit"
91+
git push -u origin main
7792
```
7893

79-
3. Open the project in vscode.
94+
1. Open the project in vscode.
8095

8196
```bash
82-
cd bl01t
8397
# DLS users make sure you have done: module load vscode
8498
code .
8599
```
86100

87-
4. Now make the necessary changes to the template to make the project your
88-
own. These changes will be covered in more detail in the remaining
89-
sections of this page.
90-
91-
1. Replace README.md with your own README.md as you see fit.
92-
2. edit `environment.sh`
93-
3. change the name of the example IOC from `iocs/blxxi-ea-ioc-01` to
94-
`iocs/bl01t-ea-ioc-01`
95-
4. change the beamline name in the two bash scripts in the `services`
96-
directory.
97-
5. change the beamline name in `beamline-chart/values.yaml`
98-
6. add some meaningful configuration to the example IOCs config folder
99-
`iocs/bl01t-ea-ioc-01/config/ioc.yaml`. We will do this in the
100-
next tutorial.
101-
102-
Much of the above can be achieved with a global find and replace of 'xxi' with
103-
'01t'.
104-
105-
### Environment.sh
106-
107-
Environment.sh is a bash script that is sourced by a beamline user or developer
108-
in order to set up their environment to work with the beamline.
109-
110-
The command line tool `ec` uses the environment configured by this script
111-
to determine where to deploy IOCS and where to find container images etc.
112-
113-
For details of what goes in this file see {any}`../reference/environment`.
114-
For the purpose of this tutorial for `bl01t` you should have the following
115-
in your environment.sh (make sure you insert your GitHub account name
116-
where indicated):
117-
118-
- SECTION 1:
119-
120-
- `export EC_REGISTRY_MAPPING='github.com=ghcr.io'`
121-
- `export EC_K8S_NAMESPACE=local`
122-
- `export [email protected]:**YOUR GITHUB ACCOUNT**/bl01t`
123-
124-
- SECTION 2:
125-
126-
- The existing script code in blxxi-template is fine for this tutorial.
127-
It checks to see if `ec` is available and installs it into a
128-
virtual environment if not. It requires that you already have a
129-
virtual environment set up. See [](python-setup) for details.
130-
131-
- SECTION 3:
132-
133-
- We are not using Kubernetes for the first few tutorials so you can
134-
leave this section blank for now.
135-
136-
:::{note}
137-
DLS Users: `ec` is already installed for you. So leave SECTION 2
138-
blank. See {any}`ec` for details.
139-
:::
140-
141-
### Change the IOC Name
142-
143-
The IOC name is
144-
taken from the folder name under `iocs`. In this case we want to change
145-
`blxxi-ea-ioc-01` to `bl01t-ea-ioc-01`.
146-
147-
```bash
148-
cd iocs
149-
mv blxxi-ea-ioc-01 bl01t-ea-ioc-01
150-
```
151-
152-
### Change the Beamline Name in Services
153-
154-
There are two files in the `services/` directory that need to be changed. These
155-
files are used to set up some beamline wide resources on each beamline domain.
156-
At present they are only relevant to Kubernetes installations but we will change
157-
then now so that bl01t is ready for Kubernetes when we get to that tutorial.
158-
159-
Open both files in `services/` and replace blxxi with bl01t.
160-
161-
TODO: add support for local docker installations of these services.
162-
163-
### Change the Beamline Name in the Helm Chart
164-
165-
The file `beamline-chart/values.yaml` contains the configuration values
166-
for the helm chart that is used to deploy the beamline. You can change
167-
the values `blxxi` to `bl01t` in here. But this will not be relevant until
168-
we get to the Kubernetes tutorial when the deployment is done using helm.
169-
170101
## Wrapping Up
171102

172-
You should now have a working beamline repository. It contains a single
173-
IOC Instance which is a non-functional example. In the following two
174-
tutorials we will investigate the example and then create a real IOC Instance.
103+
You should now have a working beamline repository. It contains a single IOC Instance which is a very basic example. In the following two tutorials we will investigate the example and then create a real IOC Instance.
175104

176-
You can now push the repository up to GitHub and give it a version tag like this:
105+
You can now give your repository a version tag like this:
177106

178107
```bash
179-
git add .
180-
git commit -m "changed blxxi to bl01t"
181-
git push
182-
git tag 2024.1.1
183-
git push origin 2024.1.1
108+
# open a terminal in vscode: Menu -> Terminal -> New Terminal
109+
git tag 2024.2.1
110+
git push origin 2024.2.1
184111
```
185112

186113
We use `CalVer` version numbers for beamline repositories and Generic IOCs.
@@ -191,7 +118,7 @@ CalVer is described here: <https://calver.org/> and is used where semantic
191118
versioning is not appropriate because the repository contains a mix of
192119
dependencies and does not have a clear API.
193120

194-
Note that 2024.1.1 represents the time that this tutorial was last updated.
121+
Note that 2024.2.1 represents the time that this tutorial was last updated.
195122
For completeness you could use the current year and month instead. You
196123
are also free to choose your own versioning scheme as this is not enforced by
197124
any of the epics-containers tools.

0 commit comments

Comments
 (0)