Skip to content

Commit 089d8c9

Browse files
committed
CI: start save-and-restore service
1 parent f23b503 commit 089d8c9

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

.github/workflows/testing.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
pip install .[dev]
2626
pip list
2727
28+
- name: Start save-and-restore service
29+
run: |
30+
pushd container
31+
bash start-save-and-restore.sh
32+
popd
33+
2834
- name: Test with pytest
2935
run: |
3036
# pytest -k test_ip_kernel_func -vvv

container/create_env_file.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import socket
2+
3+
if __name__ == "__main__":
4+
# Get the local IP address
5+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
6+
s.connect(("8.8.8.8", 80))
7+
ip = s.getsockname()[0]
8+
9+
with open(".env", "w") as f:
10+
f.write(f"HOST_EXTERNAL_IP_ADDRESS={ip}")

container/save-and-restore.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Running elasticsearch in docker
2+
# sudo docker compose -f save-and-restore.yml up -d
3+
# Test:
4+
# curl -X GET "http://localhost:9200/"
5+
6+
# .env file:
7+
#
8+
# HOST_EXTERNAL_IP_ADDRESS=192.168.50.49
9+
10+
services:
11+
saveandrestore:
12+
image: ghcr.io/controlsystemstudio/phoebus/service-save-and-restore:master
13+
ports:
14+
- "8080:8080"
15+
depends_on:
16+
- elasticsearch
17+
environment:
18+
ELASTICSEARCH_NETWORK_HOST: ${HOST_EXTERNAL_IP_ADDRESS}
19+
EPICS_PVA_ADDR_LIST: ${HOST_EXTERNAL_IP_ADDRESS}
20+
EPICS_PVA_AUTO_ADDR_LIST: "NO"
21+
EPICS_PVA_ENABLE_IPV6: "false"
22+
command: >
23+
/bin/bash -c "
24+
until curl --fail --silent http://${HOST_EXTERNAL_IP_ADDRESS}:9200/_cluster/health; do
25+
echo 'Waiting for Elasticsearch'
26+
sleep 1
27+
done
28+
java -DdefaultProtocol=pva -Dauthorization.permitall=false -Dauth.impl=demo -jar /saveandrestore/service-save-and-restore-*.jar"
29+
extra_hosts:
30+
- "host.docker.internal:host-gateway"
31+
32+
elasticsearch:
33+
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2
34+
ports:
35+
- "9200:9200"
36+
environment:
37+
discovery.type: single-node
38+
bootstrap.memory_lock: "true"
39+
xpack.security.enabled: "false"
40+
volumes:
41+
- saveandrestore-es-data:/usr/share/elasticsearch/data
42+
extra_hosts:
43+
- "host.docker.internal:host-gateway"
44+
45+
volumes:
46+
saveandrestore-es-data:
47+
driver: local
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set -x
2+
3+
python create_env_file.py
4+
sudo docker compose -f save-and-restore.yml up -d
5+
6+
# Wait until the service is started.
7+
sleep 30

0 commit comments

Comments
 (0)