Skip to content

Commit 055f827

Browse files
committed
add example-beamline tutorial
1 parent 99a58ff commit 055f827

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed

docs/images/example_beamline.png

329 KB
Loading

docs/tutorials.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Tutorials for installation and typical usage. New users start here.
99
1010
tutorials/intro
1111
tutorials/setup_workstation
12+
tutorials/launch_example
1213
tutorials/create_beamline
1314
tutorials/deploy_example
1415
tutorials/create_ioc

docs/tutorials/launch_example.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
# Launch A Simulation Beamline
3+
4+
In this tutorial we will launch a simulation beamline using docker compose. This demonstrates that the a containerised beamline is portable and that the setup instructions from the previous tutorial have been successful.
5+
6+
:::{note}
7+
This tutorial has been tested with the following versions of software. If you have issues then you may need to update your software to these versions or higher.
8+
9+
- git 2.43.5
10+
- One of the following
11+
- docker 20.10.0
12+
- podman 4.9.4 and docker-compose 2.29.2
13+
14+
See "Start the Podman system service" in [this article](https://www.redhat.com/sysadmin/podman-docker-compose) to set up podman and docker-compose
15+
16+
If you have a choice, a recent docker version is the preferred option.
17+
:::
18+
19+
The example beamline wiil launch the following set of containers:
20+
- a simulation Area Detector IOC
21+
- a simulation Motion IOC
22+
- a basic IOC with a sum record
23+
- a ca-gateway to expose the above to the host
24+
- a phoebus instance to view the beamline
25+
26+
To launch simply run the following commands:
27+
28+
```bash
29+
git clone https://github.com/epics-containers/example-services
30+
cd example-services
31+
# setup some environment variables
32+
source ./environment.sh
33+
# lauch the docker compose configuration (with dc alias for docker compose)
34+
dc up -d
35+
```
36+
37+
If all is well you should see phoebus lauch with an overview of the beamline like the following:
38+
39+
:::{figure} ../images/example_beamline.png
40+
The example beamline overview screen
41+
:::
42+
43+
You can now try out the following commands to interact with the beamline:
44+
45+
```bash
46+
# use caget/put locally
47+
export EPICS_CA_ADDR_LIST=127.0.0.1
48+
caget BL01T-DI-CAM-01:DET:Acquire_RBV
49+
50+
# OR if you don't have caget/put locally then use one of the containers instead:
51+
# execute caget from inside one of the example IOCs
52+
dc exec bl01t-ea-test-01 caget BL01T-DI-CAM-01:DET:Acquire_RBV
53+
# or get a shell inside an example IOC and use caget
54+
dc exec bl01t-ea-test-01 bash
55+
caget BL01T-DI-CAM-01:DET:Acquire_RBV
56+
57+
# attach to logs of a service (-f follows the logs, use ctrl-c to exit)
58+
dc logs bl01t-di-cam-01 -f
59+
# stop a service
60+
dc stop bl01t-di-cam-01
61+
# restart a service
62+
dc start bl01t-di-cam-01
63+
# attach to a service stdio
64+
dc attach bl01t-di-cam-01
65+
# exec a process in a service
66+
dc exec bl01t-di-cam-01 bash
67+
# delete a service (deletes the container)
68+
dc down bl01t-di-cam-01
69+
# create and launch a single service (plus its dependencies)
70+
dc up bl01t-di-cam-01 -d
71+
# close down and delete all the containers
72+
# volumes are not deleted to preserve the data
73+
dc down
74+
```
75+
76+
This tutorial is a simple introduction to validate that the setup is working. In the following tutorials you will get to create your own beamline and start adding IOCs to it.
77+
78+
::: {important}
79+
Before moving on to the next tutorial always make sure to stop and delete the containers from your current example as follows:
80+
81+
```bash
82+
dc down
83+
```
84+
85+
If you do not do this you will get name clashes when trying the next example. If this happens - return to the previous project directory and use `dc down`.
86+
87+
This is a deliberate choice as we can only run a single ca-gateway on a given host port at a time. For more complex setups you could share one ca-gateway between multiple compose configurations, but we have chosen to keep things simple for these tutorials.

docs/tutorials/setup_workstation.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ sed -i ~/.config/containers/containers.conf -e '/label=false/d' -e '/^\[containe
128128
Next install docker or podman as your container platform. epics-containers
129129
has been tested with podman 4.4.1 and higher on RedHat 8, and Docker 24.0.5 and higher on for Ubuntu 22.04 and higher.
130130

131-
The podman version required is 4.0 or later. Any version of docker since 20.10 will also work. Pick the tool that has the most recent version for your platform. RedHat 8 and above have recent podman versions. Older Debian platforms don't yet
132-
have recent podman versions available. If you have a choice then podman is slightly preferred because it does not require root access and it is the tool with which epics-containers has had the most testing. However, docker is the most widely used container platform and is also well supported.
131+
The podman version required is 4.0 or later. Any version of docker since 20.10 will also work.
132+
133+
Because we use docker compose which is built in to later versions of docker, we recommend using docker if you have a choice.
133134

134135
The links below have details of how to install your choice of container platform:
135136

@@ -144,7 +145,7 @@ docker compose allows you to define and run multi-container Docker applications.
144145

145146
If you installed docker using the above instructions then docker compose is already installed. If you installed podman then you will need to install docker compose separately. We prefer to use docker-compose instead of podman-compose because it is more widely used and avoids behaviour differences between the two tools. If you are at DLS you just need to run 'module load docker-compose' to get access to docker compose with podman as the back end.
146147

147-
Other users of podman please see these instructions [rootless podman with docker-compose](https://connect.redhat.com/hydra/prm/v1/business/companies/0ed5e6899bce415b89d82cb334da214a/linked-resources/aa9ae6ada5f04000a66472cc0fc18160/content/public/view).
148+
Other users of podman please see these instructions [rootless podman with docker-compose](https://www.redhat.com/sysadmin/podman-docker-compose). You need only read the section titled "Start the Podman system service" (the rest of the page validates the setup).
148149

149150
### Important Notes Regarding docker and podman
150151

0 commit comments

Comments
 (0)