Skip to content

Commit 9698e58

Browse files
authored
Merge pull request #92 from epics-containers/md
update k8s beamline tutorial
2 parents 8e64399 + 7a75d95 commit 9698e58

File tree

2 files changed

+50
-51
lines changed

2 files changed

+50
-51
lines changed

docs/tutorials/create_beamline.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Log in to your account by going here <https://github.com/login>.
4040
You will also need to setup ssh keys to authenticate to github from git. See
4141
[about ssh].
4242

43-
## Create a New Repository
43+
(create-new-beamline-local)=
44+
## Create a New Beamline Repo for local deployments
4445

4546
Here we will use the copy the ec services template repository to make a new beamline.
4647

docs/tutorials/setup_k8s_new_beamline.md

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
# Create a New Kubernetes Beamline
44

55
:::{warning}
6-
This is a first draft that has been tested against a DLS test beamline
6+
This is a second draft that has been tested against a DLS test beamline
77
only. I will remove this warning once it has been tested against:
88

99
- the k3s example cluster described in the previous tutorial
1010
- a real DLS beamline.
11-
12-
TODO: would it be better to have a separate tutorial for each of these?
1311
:::
1412

1513
Up until now the tutorials have been deploying IOCs to the local docker or
@@ -44,43 +42,53 @@ beamline by the cloud team and have requested access via the URL above.
4442

4543
## Create a new beamline repository
4644

47-
To create a new beamline repository, use the template repository at
48-
<https://github.com/epics-containers/blxxi-template>. Click on the green
49-
"Use this template" button to create a new repository. Name the repository
50-
bl46p (or choose your own name and remember to substitute it in the rest of
51-
this tutorial). Create this repository in your own GitHub account.
52-
53-
:::{note}
54-
DLS users: if this is real beamline then it needs to be
55-
created in our internal GitLab registry at
56-
<https://gitlab.diamond.ac.uk/controls/containers/beamline>.
57-
For this purpose use the template description for [bl38p](https://github.com/epics-containers/bl38p?tab=readme-ov-file#how-to-create-a-new-beamline--accelerator-domain).
58-
59-
For test DLS beamlines these should still be created in github
60-
as per the below instructions.
61-
:::
45+
This step is almost exactly the same as [](create-new-beamline-local). Except that you will answer some of the questions in the copier template differently. In fact you can re-use the same repository you created in the previous tutorial and update the copier to change where we deploy the IOCs to. The following steps will guide you through this, but if you want to keep your old local beamline repo. The just follow the steps in [](create-new-beamline-local) but pick a new name and use the answers below.
6246

63-
Clone the new repository to your local machine and change directory into it.
47+
In order to change our original `bl01t` beamline to a Kubernetes beamline perform the following steps:
6448

6549
```bash
66-
git clone https://github.com/YOUR_GITHUB_ACCOUNT/bl46p.git
67-
cd bl46p
50+
# make sure your Python virtual environment is active
51+
pip install copier
52+
53+
git clone [email protected]:YOUR_GITHUB_ACCOUNT/bl01t.git
54+
cd bl01t
55+
copier update --trust .
6856
```
6957

70-
Next make some changes to the repository to customise it for your beamline.
71-
Cut and paste the following script to do so.
58+
Answer the copier template questions as follows:
59+
60+
<pre><font color="#5F87AF">🎤</font><b> Where are you deploying these IOCs and services?</b>
61+
<b> </b><font color="#FFAF00"><b>beamline</b></font>
62+
<font color="#5F87AF">🎤</font><b> Short name for the beamline, e.g. &quot;bl47p&quot;, &quot;bl20j&quot;, &quot;bl21i&quot;</b>
63+
<b> </b><font color="#FFAF00"><b>bl01t</b></font>
64+
<font color="#5F87AF">🎤</font><b> A One line description of the module</b>
65+
<b> </b><font color="#FFAF00"><b>beamline bl01t IOC Instances and Services</b></font>
66+
<font color="#5F87AF">🎤</font><b> Cluster namespace. local for no K8S or e.g. p38-iocs, j20-iocs, p47-iocs</b>
67+
<b> </b><font color="#FFAF00"><b>p46-iocs</b></font>
68+
<font color="#5F87AF">🎤</font><b> Name of the cluster where the IOCs and services in this repository will run</b>
69+
<b> </b><font color="#FFAF00"><b>pollux</b></font>
70+
<font color="#5F87AF">🎤</font><b> This controls how the `environment.sh` script connects to the cluster.</b>
71+
<b> </b><font color="#FFAF00"><b>Shared Cluster (inc accelerator)</b></font>
72+
<font color="#5F87AF">🎤</font><b> Add node-type tolerations for the target hosts&apos; node type</b>
73+
<b> </b><font color="#FFAF00"><b>training-rig</b></font>
74+
<font color="#5F87AF">🎤</font><b> Git platform hosting the repository.</b>
75+
<b> </b><font color="#FFAF00"><b>github.com</b></font>
76+
<font color="#5F87AF">🎤</font><b> The GitHub organisation that will contain this repo.</b>
77+
<b> </b><font color="#FFAF00"><b>YOUR_GITHUB_USER</b></font>
78+
<font color="#5F87AF">🎤</font><b> Remote URI of the repository.</b>
79+
<b> </b><font color="#FFAF00"><b>[email protected]:YOUR_GITHUB_USER/bl01t.git</b></font>
80+
<font color="#5F87AF">🎤</font><b> URL for centralized logging.</b>
81+
<b> </b><font color="#FFAF00"><b>DLS</b></font>
82+
</pre>
7283

73-
```bash
74-
BEAMLINE=bl46p
84+
:::{warning}
85+
DLS Users: These instructions are for the BL46P beamline. This beamline is a training rig and it is OK to install some test Simulation IOCs on it. However you will need to get access before you can deploy to it. Ask giles to request access to the `p46-iocs` namespace on the `pollux` cluster. In future the ec-services-template will be updated to allow you to deploy IOCs to your own namespace on the `pollux` cluster.
86+
:::
7587

76-
# update the readme
77-
echo "Beamline repo for the beamline $BEAMLINE" > README.md
88+
# Review the New Beamline Repository
89+
90+
The following sections are just a review of what the template project created. Those of you who are outside of DLS can use this as a guide to what you need to set up in your own beamline repository to talk you your own cluster. DLS users will already have these things set up by the copier template.
7891

79-
# remove the sample IOC directory
80-
rm -r services/blxxi-ea-ioc-01
81-
# change the services setup scripts to use the new beamline name
82-
sed -i "s/blxxi/$BEAMLINE/g" services/* beamline-chart/values.yaml
83-
```
8492

8593
## Cluster Topologies
8694

@@ -274,27 +282,17 @@ dataVolume:
274282
hostPath: /dls/p46/data
275283
```
276284
277-
## Set Up The One Time Only Beamline Resources
278-
279-
There are two scripts in the `services` directory that set up some initial
280-
resources. You should run each of these in order:
285+
# Create a Test IOC to Deploy
281286
282-
- `services/install-pvcs.sh`: this sets up some persistent volume claims for
283-
: the beamline. PVCS are Kubernetes managed chunks of storage that can be
284-
shared between pods if required. The 3 PVCS created here relate to the
285-
`Claim` entries in the `beamline-chart/values.yaml` file. These are
286-
places to store:
287-
\- autosave files
288-
\- runtime generated startup scripts and EPICS database files
289-
\- OPI screens (usually auto generated)
290-
- `services/install-opi.sh`: this sets up an nginx web server for the
291-
: beamline. It serves the OPI screens from the `opisClaim` PVC. Each IOC
292-
instance will place its OPI screens in a subdirectory of this PVC.
293-
OPI clients like phoebus can then retrieve these files via HTTP.
287+
TODO: WIP (but this looks just like it did in the first IOC deployment tutorial).
294288
295-
## Create a Test IOC to Deploy
289+
Essentially you should be able to deploy `bl01t-ea-test-02` to the k3s cluster with the same command as before:
296290

297-
TODO: WIP (but this looks just like it did in the first IOC deployment tutorial)
291+
```bash
292+
cd bl01t
293+
source environment.sh
294+
ec local/deploy services/bl01t-ea-test-02
295+
```
298296

299297
:::{note}
300298
At DLS you can get to a Kubernetes Dashboard for your beamline via

0 commit comments

Comments
 (0)