diff --git a/docs/tutorials/create_beamline.md b/docs/tutorials/create_beamline.md index 72d6b2f3..7f0a2ac1 100644 --- a/docs/tutorials/create_beamline.md +++ b/docs/tutorials/create_beamline.md @@ -40,7 +40,8 @@ Log in to your account by going here . You will also need to setup ssh keys to authenticate to github from git. See [about ssh]. -## Create a New Repository +(create-new-beamline-local)= +## Create a New Beamline Repo for local deployments Here we will use the copy the ec services template repository to make a new beamline. diff --git a/docs/tutorials/setup_k8s_new_beamline.md b/docs/tutorials/setup_k8s_new_beamline.md index 3e6fb6bf..236d6329 100644 --- a/docs/tutorials/setup_k8s_new_beamline.md +++ b/docs/tutorials/setup_k8s_new_beamline.md @@ -3,13 +3,11 @@ # Create a New Kubernetes Beamline :::{warning} -This is a first draft that has been tested against a DLS test beamline +This is a second draft that has been tested against a DLS test beamline only. I will remove this warning once it has been tested against: - the k3s example cluster described in the previous tutorial - a real DLS beamline. - -TODO: would it be better to have a separate tutorial for each of these? ::: 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. ## Create a new beamline repository -To create a new beamline repository, use the template repository at -. Click on the green -"Use this template" button to create a new repository. Name the repository -bl46p (or choose your own name and remember to substitute it in the rest of -this tutorial). Create this repository in your own GitHub account. - -:::{note} -DLS users: if this is real beamline then it needs to be -created in our internal GitLab registry at -. -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). - -For test DLS beamlines these should still be created in github -as per the below instructions. -::: +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. -Clone the new repository to your local machine and change directory into it. +In order to change our original `bl01t` beamline to a Kubernetes beamline perform the following steps: ```bash -git clone https://github.com/YOUR_GITHUB_ACCOUNT/bl46p.git -cd bl46p +# make sure your Python virtual environment is active +pip install copier + +git clone git@github.com:YOUR_GITHUB_ACCOUNT/bl01t.git +cd bl01t +copier update --trust . ``` -Next make some changes to the repository to customise it for your beamline. -Cut and paste the following script to do so. +Answer the copier template questions as follows: + +
🎤 Where are you deploying these IOCs and services?
+      beamline
+   🎤 Short name for the beamline, e.g. "bl47p", "bl20j", "bl21i"
+      bl01t
+   🎤 A One line description of the module
+      beamline bl01t IOC Instances and Services
+   🎤 Cluster namespace. local for no K8S or e.g. p38-iocs, j20-iocs, p47-iocs
+      p46-iocs
+   🎤 Name of the cluster where the IOCs and services in this repository will run
+      pollux
+   🎤 This controls how the `environment.sh` script connects to the cluster.
+      Shared Cluster (inc accelerator)
+   🎤 Add node-type tolerations for the target hosts' node type
+      training-rig
+   🎤 Git platform hosting the repository.
+      github.com
+   🎤 The GitHub organisation that will contain this repo.
+      YOUR_GITHUB_USER
+   🎤 Remote URI of the repository.
+      git@github.com:YOUR_GITHUB_USER/bl01t.git
+   🎤 URL for centralized logging.
+      DLS
+   
-```bash -BEAMLINE=bl46p +:::{warning} +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. +::: -# update the readme -echo "Beamline repo for the beamline $BEAMLINE" > README.md +# Review the New Beamline Repository + +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. -# remove the sample IOC directory -rm -r services/blxxi-ea-ioc-01 -# change the services setup scripts to use the new beamline name -sed -i "s/blxxi/$BEAMLINE/g" services/* beamline-chart/values.yaml -``` ## Cluster Topologies @@ -274,27 +282,17 @@ dataVolume: hostPath: /dls/p46/data ``` -## Set Up The One Time Only Beamline Resources - -There are two scripts in the `services` directory that set up some initial -resources. You should run each of these in order: +# Create a Test IOC to Deploy -- `services/install-pvcs.sh`: this sets up some persistent volume claims for - : the beamline. PVCS are Kubernetes managed chunks of storage that can be - shared between pods if required. The 3 PVCS created here relate to the - `Claim` entries in the `beamline-chart/values.yaml` file. These are - places to store: - \- autosave files - \- runtime generated startup scripts and EPICS database files - \- OPI screens (usually auto generated) -- `services/install-opi.sh`: this sets up an nginx web server for the - : beamline. It serves the OPI screens from the `opisClaim` PVC. Each IOC - instance will place its OPI screens in a subdirectory of this PVC. - OPI clients like phoebus can then retrieve these files via HTTP. +TODO: WIP (but this looks just like it did in the first IOC deployment tutorial). -## Create a Test IOC to Deploy +Essentially you should be able to deploy `bl01t-ea-test-02` to the k3s cluster with the same command as before: -TODO: WIP (but this looks just like it did in the first IOC deployment tutorial) +```bash +cd bl01t +source environment.sh +ec local/deploy services/bl01t-ea-test-02 +``` :::{note} At DLS you can get to a Kubernetes Dashboard for your beamline via