-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses docker to up two recceivers and channelfinder
- Loading branch information
Showing
11 changed files
with
291 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM python:3.8 as build | ||
|
||
WORKDIR /home/recceiver | ||
|
||
COPY . ./server | ||
|
||
RUN python -m venv venv && \ | ||
venv/bin/pip install \ | ||
--no-cache-dir \ | ||
-i https://artifactory.esss.lu.se/artifactory/api/pypi/pypi-virtual/simple \ | ||
-r server/requirements.txt | ||
|
||
RUN venv/bin/python -m pip install ./server | ||
|
||
FROM python:3.8-slim | ||
|
||
WORKDIR /home/recceiver | ||
|
||
COPY --from=build /home/recceiver/venv venv | ||
|
||
CMD venv/bin/twistd --pidfile= --nodaemon recceiver --config cf.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
Server testing | ||
# Recceiver | ||
|
||
## Server testing | ||
|
||
Setup | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# run with | ||
#twistd -n recceiver -f <thisfile>.conf | ||
|
||
[recceiver] | ||
|
||
# list of broadcast addresses. | ||
# default | ||
#addrlist = 255.255.255.255:5049 | ||
# for local testing w/ firewall | ||
#addrlist = 127.255.255.255:5049 | ||
|
||
# Listen for TCP connections on this interface and port. | ||
# Port also used as source for UDP broadcasts. | ||
# Default uses wildcard address and a random port. | ||
#bind = 0.0.0.0:0 | ||
|
||
# Processing chain | ||
procs = cf | ||
|
||
# Time interval for sending recceiver advertisments | ||
#announceInterval = 15.0 | ||
|
||
# Idle Timeout for TCP connections. | ||
#tcptimeout = 15.0 | ||
|
||
# Time to wait before commiting updates | ||
# Doesn't effect IOC clients | ||
#commitInterval = 5.0 | ||
|
||
# Maximum concurrent "active" clients | ||
# to allow. | ||
#maxActive = 20 | ||
|
||
# The channelFinder client is configuration information is | ||
# stored in /etc/channelfinderapi.conf as described in the client | ||
|
||
[cf] | ||
# a space-separated list of infotags to set as CF Properties | ||
#infotags = archive foo bar blah | ||
# List environment variables that should be written as channel finder properties | ||
# | ||
# Comma-separated list of VARIABLE:PropertyName, | ||
# specifying which environment VARIABLEs to pass on to the channel finder | ||
# and defining the corresponding PropertyName | ||
#environment_vars=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory | ||
# Turn on optional alias and recordType properties | ||
#alias = on | ||
#recordType = on | ||
#recordDesc = on | ||
|
||
# Mark all channels as 'Inactive' when processor is stopped (default: True) | ||
cleanOnStop = True | ||
# Mark all channels as 'Inactive' when processor is started (default: True) | ||
cleanOnStart = True | ||
|
||
recceiverID = recc1 | ||
[DEFAULT] | ||
BaseURL = http://cf:8080/ChannelFinder | ||
username = admin | ||
password = password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# run with | ||
#twistd -n recceiver -f <thisfile>.conf | ||
|
||
[recceiver] | ||
|
||
# list of broadcast addresses. | ||
# default | ||
#addrlist = 255.255.255.255:5049 | ||
# for local testing w/ firewall | ||
#addrlist = 127.255.255.255:5049 | ||
|
||
# Listen for TCP connections on this interface and port. | ||
# Port also used as source for UDP broadcasts. | ||
# Default uses wildcard address and a random port. | ||
#bind = 0.0.0.0:0 | ||
|
||
# Processing chain | ||
procs = cf | ||
|
||
# Time interval for sending recceiver advertisments | ||
#announceInterval = 15.0 | ||
|
||
# Idle Timeout for TCP connections. | ||
#tcptimeout = 15.0 | ||
|
||
# Time to wait before commiting updates | ||
# Doesn't effect IOC clients | ||
#commitInterval = 5.0 | ||
|
||
# Maximum concurrent "active" clients | ||
# to allow. | ||
#maxActive = 20 | ||
|
||
# The channelFinder client is configuration information is | ||
# stored in /etc/channelfinderapi.conf as described in the client | ||
|
||
[cf] | ||
# a space-separated list of infotags to set as CF Properties | ||
#infotags = archive foo bar blah | ||
# List environment variables that should be written as channel finder properties | ||
# | ||
# Comma-separated list of VARIABLE:PropertyName, | ||
# specifying which environment VARIABLEs to pass on to the channel finder | ||
# and defining the corresponding PropertyName | ||
#environment_vars=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory | ||
# Turn on optional alias and recordType properties | ||
#alias = on | ||
#recordType = on | ||
#recordDesc = on | ||
|
||
# Mark all channels as 'Inactive' when processor is stopped (default: True) | ||
#cleanOnStop = True | ||
# Mark all channels as 'Inactive' when processor is started (default: True) | ||
cleanOnStart = True | ||
|
||
recceiverID = recc2 | ||
|
||
[DEFAULT] | ||
BaseURL = http://cf:8080/ChannelFinder | ||
username = admin | ||
password = password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
version: '3' | ||
|
||
services: | ||
cf: | ||
image: ghcr.io/channelfinder/channelfinderservice:master | ||
hostname: cf | ||
networks: | ||
- net-cf | ||
ports: | ||
- "8080:8080" | ||
- "8443:8443" | ||
depends_on: | ||
elasticsearch: | ||
condition: service_healthy | ||
restart: true | ||
environment: | ||
ELASTICSEARCH_NETWORK_HOST: elasticsearch-cf | ||
ELASTICSEARCH_QUERY_SIZE: 10 | ||
demo_auth.enabled: true | ||
demo_auth.users: admin | ||
demo_auth.pwds: password | ||
demo_auth.roles: ADMIN | ||
EPICS_PVAS_INTF_ADDR_LIST: "0.0.0.0" | ||
aa.enabled: false | ||
logging.level.org.springframework.web: DEBUG | ||
healthcheck: | ||
test: curl -s -f http://cf:8080/ChannelFinder | ||
interval: 10s | ||
timeout: 60s | ||
retries: 5 | ||
|
||
elasticsearch: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.4 | ||
hostname: elasticsearch-cf | ||
networks: | ||
- net-cf | ||
environment: | ||
cluster.name: channelfinder | ||
discovery.type: single-node | ||
bootstrap.memory_lock: "true" | ||
xpack.security.enabled: "false" | ||
healthcheck: | ||
test: curl -s -f http://localhost:9200/_cluster/health | ||
interval: 10s | ||
timeout: 60s | ||
retries: 5 | ||
volumes: | ||
- channelfinder-es-data:/usr/share/elasticsearch/data | ||
|
||
recc1: | ||
build: . | ||
networks: | ||
- net-recc-1 | ||
- net-cf | ||
depends_on: | ||
cf: | ||
condition: service_healthy | ||
restart: true | ||
volumes: | ||
- type: bind | ||
source: cf1.conf | ||
target: /home/recceiver/cf.conf | ||
read_only: true | ||
- type: bind | ||
source: cf1.conf | ||
target: /home/recceiver/channelfinderapi.conf | ||
read_only: true | ||
recc2: | ||
build: . | ||
networks: | ||
- net-recc-2 | ||
- net-cf | ||
depends_on: | ||
cf: | ||
condition: service_healthy | ||
restart: true | ||
volumes: | ||
- type: bind | ||
source: cf2.conf | ||
target: /home/recceiver/cf.conf | ||
read_only: true | ||
- type: bind | ||
source: cf2.conf | ||
target: /home/recceiver/channelfinderapi.conf | ||
read_only: true | ||
|
||
volumes: | ||
channelfinder-es-data: | ||
driver: local | ||
|
||
networks: | ||
net-cf: | ||
driver: bridge | ||
net-recc-1: | ||
driver: bridge | ||
net-recc-2: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
channelfinder==3.0.0.post2 | ||
twisted==22.8.0 | ||
requests==2.28.1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import json | ||
|
||
import urllib3 | ||
|
||
|
||
def fake_channel(ch_name: str, recc: str, status: str): | ||
return { | ||
"name": ch_name, | ||
"owner": recc, | ||
"properties": [ | ||
{"name": "recceiverID", "owner": recc, "value": recc}, | ||
{"name": "pvStatus", "owner": recc, "value": status}, | ||
], | ||
} | ||
|
||
|
||
def insert_fake_data(recc: str, cf: str, chs: list[str], status: str): | ||
http = urllib3.PoolManager() | ||
headers = urllib3.make_headers(basic_auth="admin:password") | ||
headers.update({"Content-Type": "application/json"}) | ||
req = http.request( | ||
"PUT", | ||
cf + "/ChannelFinder/resources/channels", | ||
headers=headers, | ||
body=json.dumps([fake_channel(ch, recc, status) for ch in chs]), | ||
) | ||
|
||
|
||
cf = "http://localhost:8080" | ||
|
||
insert_fake_data("recc1", cf, ["ch_1_" + str(i) for i in range(10002)], "Active") | ||
insert_fake_data("recc2", cf, ["ch_2_" + str(i) for i in range(100)], "Active") |