Skip to content

Commit 48bde76

Browse files
committed
Docker compose files for 3rd party, save&restore, alarm server
1 parent 3b11fb9 commit 48bde76

11 files changed

+102
-235
lines changed

services/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Services
2+
3+
Modules in this directory include CS Studio/Phoebus middleware services:
4+
5+
* Alarm Config Logger
6+
* Alarm Logger
7+
* Alarm Service
8+
* Archive Engine
9+
* Save-and-Restore
10+
11+
Additional middleware services are maintained in other repositories:
12+
* Phoebus Logbook Service (Olog): https://github.com/Olog/phoebus-olog
13+
* Channel Finder Service: https://github.com/ChannelFinder/ChannelFinderService
14+
* Archiver Appliance: https://github.com/archiver-appliance/epicsarchiverap
15+
16+
# Docker
17+
18+
The provided Docker compose file can be used to launch the full stack of 3rd party services upon which
19+
services in this repository depend:
20+
21+
* Elasticsearch
22+
* Used by Save-and-Restore, Alarm Logger, Channel Finder and Olog
23+
* MongoDB
24+
* Used by Olog
25+
* Kafka + Zookeeper
26+
* Used by Alarm Server and Alarm Logger
27+
28+
The Docker compose file depends on the environment variable ```HOST_IP_ADDRESS```, which must be set
29+
to the IP address of the host running the Docker container. Kafka clients must use this as the
30+
```bootstrap-server``` IP address.

services/alarm-server/README.md

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -50,61 +50,13 @@ some useful startup arguments include
5050

5151
## Docker
5252

53-
Docker compose files are provided for convenience.
53+
Docker compose files are provided for convenience to cover two use cases:
5454

55-
### Launch only Kafka
55+
1. ```docker-compose-alarm-server-only.yml``` will run the alarm server. The
56+
environment variable ```KAFKA_HOST``` must be set to identify the Kafka server IP address,
57+
while the environment variable ```CONFIG``` identifies the configuration (topic) name.
58+
2. ```docker-compose-alarm-server-only-import.yml``` will run the alarm server for the
59+
purpose of importing a configuration. Environment variables must be se as in case 1.
60+
Additionally, the environment variable ```CONFIG_FILE``` must identify an alarm
61+
configuration file in the current user's home directory.
5662

57-
``docker-compose-kafka.yml``
58-
59-
This is used to start the Kafka message broker (in Zookeeper mode). Typical use case: launch alarm
60-
server manually.
61-
62-
Usage:
63-
64-
```
65-
>docker compose -f docker-compose-kafka.yml --env-file /path/to/environment/file
66-
```
67-
68-
where ``/path/to/environment/file`` is a file defining a ``HOSTNAME`` variable, e.g.
69-
```
70-
HOSTNAME=foo.bar.com
71-
```
72-
When launching the alarm server, the ``-server`` argument must match the value of ``HOSTNAME``.
73-
74-
### Launch Kafka and alarm server for import
75-
76-
``docker-compose-alarm-server-for-import.yml``
77-
78-
This is used to start the full stack for the purpose of importing an alarm configuration file.
79-
80-
Usage:
81-
82-
```
83-
>docker compose -f docker-compose-alarm-server-for-import.yml --env-file /path/to/environment/file
84-
```
85-
86-
Here the ``/path/to/environment/file`` file *must* list:
87-
```
88-
HOSTNAME=foo.bar.com
89-
CONFIG_FILE=/path/to/Accelerator.xml
90-
```
91-
In other words, this imports an alarm configuration for the default topic ``Accelerator``.
92-
93-
### Launch Kafka and alarm server
94-
95-
``docker-compose-alarm-server-for-import.yml``
96-
97-
This is used to start the full stack for running the alarm server and listen to EPICS alarms.
98-
99-
Usage:
100-
101-
```
102-
>docker compose -f docker-compose-alarm-server.yml --env-file /path/to/environment/file
103-
```
104-
105-
Here the ``/path/to/environment/file`` file *must* list:
106-
```
107-
HOSTNAME=foo.bar.com
108-
```
109-
110-
Note that in all cases ``HOSTNAME`` *can not* be set to ``localhost``.

services/alarm-server/docker-compose-alarm-server-for-import.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
alarmserver:
3+
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:csstudio-2989
4+
volumes:
5+
- /home:/home
6+
command: >
7+
/bin/bash -c "
8+
java -jar /alarmserver/service-alarm-server-*.jar -config ${CONFIG} -import ${CONFIG_FILE} -server ${KAFKA_HOST}:9092"
9+
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
services:
22
alarmserver:
3-
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:CSSTUDIO-2989
4-
networks:
5-
- middleware-net
3+
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:csstudio-2989
64
volumes:
75
- /home:/home
86
command: >
97
/bin/bash -c "
10-
java -jar /alarmserver/service-alarm-server-*.jar -server kafka:9092"
11-
12-
networks:
13-
middleware-net:
14-
driver: bridge
8+
java -jar /alarmserver/service-alarm-server-*.jar -config ${CONFIG} -server ${KAFKA_HOST}:9092 -noshell"
9+

services/alarm-server/docker-compose-alarm-server.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

services/alarm-server/docker-compose-kafka.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

services/docker-compose-kafka-elastic-mongodb.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ services:
22
elasticsearch:
33
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2
44
hostname: elastic
5-
networks:
6-
- middleware-net
75
ports:
86
- "9200:9200"
97
environment:
@@ -15,8 +13,6 @@ services:
1513

1614
mongo:
1715
image: mongo
18-
networks:
19-
- middleware-net
2016
ports:
2117
- 27017:27017
2218
volumes:
@@ -26,8 +22,6 @@ services:
2622
zookeeper:
2723
image: confluentinc/cp-zookeeper:latest
2824
hostname: zookeeper
29-
networks:
30-
- middleware-net
3125
healthcheck:
3226
test: nc -z localhost 2181 || exit -1
3327
interval: 10s
@@ -42,31 +36,28 @@ services:
4236
kafka:
4337
image: confluentinc/cp-kafka:latest
4438
hostname: kafka
45-
networks:
46-
- middleware-net
47-
ports:
48-
- 9092:9092
4939
depends_on:
5040
zookeeper:
5141
condition: service_healthy
42+
ports:
43+
- "9092:9092"
44+
- "29092:29092"
5245
environment:
46+
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:19092,EXTERNAL://${HOST_IP_ADDRESS}:9092,DOCKER://localhost:29092
47+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT
48+
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
49+
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
5350
KAFKA_BROKER_ID: 1
54-
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
55-
KAFKA_LISTENERS: INTERNAL://0.0.0.0:9094,OUTSIDE://0.0.0.0:9092
56-
KAFKA_ADVERTISED_LISTENERS: INTERNAL://:9094,OUTSIDE://:9092
57-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
5851
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
59-
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
60-
52+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
53+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
54+
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
6155

6256
volumes:
6357
es-data:
6458
driver: local
6559
mongodata:
6660
driver: local
6761

68-
networks:
69-
middleware-net:
70-
driver: bridge
7162

7263

services/save-and-restore/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ or you can use a `.properties file`
3636
To check that the server is running correctly.
3737

3838
```
39-
$ curl --fail-with-body http://localhost:8080/save-restore
39+
$ curl --fail-with-body http://localhost:8080/save-restore/
4040
{
4141
"name" : "service-save-and-restore",
4242
"version" : "4.7.4-SNAPSHOT",
@@ -58,6 +58,16 @@ Details about the REST API is found in the Phoebus bundled help content, which i
5858

5959
# Docker
6060

61-
The latest version of the service is available as a Docker image (ghcr.io/controlsystemstudio/phoebus/service-save-and-restore:master). Any pushes to the master branch into this directory will trigger a new build of the image.
61+
The latest version of the service is available as a Docker image (ghcr.io/controlsystemstudio/phoebus/service-save-and-restore:master). Pushes to the master branch into this directory will trigger a new build of the image.
6262

63-
To run the service and its dependency (Elasticsearch), use docker-compose.yml.
63+
Docker compose files are provided. These depend on the environment variables as described below.
64+
65+
1. ```docker-compose.yml```. Use this to launch both Elasticsearch and the service. The environment variable ```HOST_EXTERNAL_IP_ADDRESS```
66+
should be set to the host's external IP address (i.e. **not** 127.0.0.1 or localhost).
67+
2. ```docker-compose-save-and-restore.yml```. Use this to launch save-and-restore service only. The environment variable ```HOST_EXTERNAL_IP_ADDRESS```
68+
should be set to the host's external IP address (i.e. **not** 127.0.0.1 or localhost), while the environment variable ```ELASTIC_HOST``` should
69+
be set to the IP address of the Elasticsearch host. If Elasticsearch is running on localhost, please specify the host's
70+
external IP address.
71+
72+
**NOTE:** Accessing IOCs over pva (default mode in the Docker compose files) works **only** if IOC is running on the
73+
same host as the Docker container. Moreover, this has been verified to work only on Linux.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
saveandrestore:
3+
image: ghcr.io/controlsystemstudio/phoebus/service-save-and-restore:master
4+
ports:
5+
- "8080:8080"
6+
environment:
7+
ELASTICSEARCH_NETWORK_HOST: ${ELASTIC_HOST_IP_ADDRESS}
8+
EPICS_PVA_ADDR_LIST: ${HOST_EXTERNAL_IP_ADDRESS}
9+
EPICS_PVA_AUTO_ADDR_LIST: "NO"
10+
EPICS_PVA_ENABLE_IPV6: "false"
11+
command: >
12+
/bin/bash -c "
13+
java -DdefaultProtocol=pva -Dauthorization.permitall=false -Dauth.impl=demo -jar /saveandrestore/service-save-and-restore-*.jar"
14+
extra_hosts:
15+
- "host.docker.internal:host-gateway"
16+
17+
volumes:
18+
saveandrestore-es-data:
19+
driver: local
20+

0 commit comments

Comments
 (0)