Skip to content

Commit 511207a

Browse files
committed
Docker files for alarm server
1 parent cb1dd18 commit 511207a

File tree

4 files changed

+155
-6
lines changed

4 files changed

+155
-6
lines changed

services/alarm-server/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,64 @@ some useful startup arguments include
4747
-import config.xml - Import alarm configruation from file
4848
-logging logging.properties - Load log settings
4949
```
50+
51+
## Docker
52+
53+
Docker compose files are provided for convenience.
54+
55+
### Launch only Kafka
56+
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``.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
services:
2+
zookeeper:
3+
image: confluentinc/cp-zookeeper:latest
4+
container_name: zookeeper
5+
healthcheck:
6+
test: nc -z localhost 2181 || exit -1
7+
interval: 10s
8+
timeout: 5s
9+
retries: 3
10+
environment:
11+
ZOOKEEPER_CLIENT_PORT: 2181
12+
ZOOKEEPER_TICK_TIME: 2000
13+
ports:
14+
- 2181:2181
15+
16+
17+
kafka:
18+
image: confluentinc/cp-kafka:latest
19+
hostname: ${HOSTNAME}
20+
ports:
21+
- 9092:9092
22+
depends_on:
23+
zookeeper:
24+
condition: service_healthy
25+
healthcheck:
26+
test: kafka-topics --bootstrap-server ${HOSTNAME}:9092 --list
27+
interval: 30s
28+
timeout: 10s
29+
retries: 3
30+
environment:
31+
KAFKA_BROKER_ID: 1
32+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
33+
KAFKA_LISTENERS: INTERNAL://0.0.0.0:9094,OUTSIDE://0.0.0.0:9092
34+
KAFKA_ADVERTISED_LISTENERS: INTERNAL://:9094,OUTSIDE://:9092
35+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
36+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
37+
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
38+
39+
alarmserver:
40+
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:master
41+
depends_on:
42+
kafka:
43+
condition: service_healthy
44+
volumes:
45+
- /home:/home
46+
command: >
47+
/bin/bash -c "
48+
java -jar /alarmserver/service-alarm-server-*.jar -import ${CONFIG_FILE} -server ${HOSTNAME}:9092"

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ services:
2020
ports:
2121
- 9092:9092
2222
depends_on:
23-
- zookeeper
23+
zookeeper:
24+
condition: service_healthy
2425
healthcheck:
25-
test: kafka-topics --bootstrap-server broker:9092 --list
26+
test: kafka-topics --bootstrap-server ${HOSTNAME}:9092 --list
2627
interval: 30s
2728
timeout: 10s
2829
retries: 3
@@ -36,10 +37,12 @@ services:
3637
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
3738

3839
alarmserver:
39-
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:csstudio-2989
40+
image: ghcr.io/controlsystemstudio/phoebus/service-alarm-server:master
4041
depends_on:
41-
- kafka
42+
kafka:
43+
condition: service_healthy
44+
volumes:
45+
- /home:/home
4246
command: >
4347
/bin/bash -c "
44-
java -jar /alarmserver/service-alarm-server-*.jar"
45-
48+
java -jar /alarmserver/service-alarm-server-*.jar -server ${HOSTNAME}:9092"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
services:
2+
zookeeper:
3+
image: confluentinc/cp-zookeeper:latest
4+
container_name: zookeeper
5+
healthcheck:
6+
test: nc -z localhost 2181 || exit -1
7+
interval: 10s
8+
timeout: 5s
9+
retries: 3
10+
environment:
11+
ZOOKEEPER_CLIENT_PORT: 2181
12+
ZOOKEEPER_TICK_TIME: 2000
13+
ports:
14+
- 2181:2181
15+
16+
17+
kafka:
18+
image: confluentinc/cp-kafka:latest
19+
hostname: ${HOSTNAME}
20+
ports:
21+
- 9092:9092
22+
depends_on:
23+
zookeeper:
24+
condition: service_healthy
25+
healthcheck:
26+
test: kafka-topics --bootstrap-server ${HOSTNAME}:9092 --list
27+
interval: 30s
28+
timeout: 10s
29+
retries: 3
30+
environment:
31+
KAFKA_BROKER_ID: 1
32+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
33+
KAFKA_LISTENERS: INTERNAL://0.0.0.0:9094,OUTSIDE://0.0.0.0:9092
34+
KAFKA_ADVERTISED_LISTENERS: INTERNAL://:9094,OUTSIDE://:9092
35+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
36+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
37+
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL

0 commit comments

Comments
 (0)