|
| 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. |
0 commit comments