Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change service key from device-bacnet to device-bacnet-ip #398

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions compose-builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ define OPTIONS
- arm64 no-secty dev app-dev device-dev ui-dev delayed-start -
- nats-bus mqtt-bus mqtt-broker mqtt-verbose nanomq -
- taf-secty taf-no-secty taf-perf taf-perf-no-secty -
- ds-onvif-camera ds-usb-camera ds-bacnet ds-modbus ds-mqtt ds-rest ds-snmp ds-virtual ds-llrp ds-coap ds-gpio -
- ds-onvif-camera ds-usb-camera ds-bacnet-ip ds-bacnet-mstp ds-modbus ds-mqtt ds-rest ds-snmp ds-virtual ds-llrp ds-coap ds-gpio -
- asc-http asc-mqtt asc-sample asc-metrics as-llrp asc-ex-mqtt -
- modbus-sim -
endef
Expand Down Expand Up @@ -156,30 +156,52 @@ ifeq (ds-usb-camera, $(filter ds-usb-camera,$(ARGS)))
endif
endif
endif
ifeq (ds-bacnet, $(filter ds-bacnet,$(ARGS)))
COMPOSE_FILES:=$(COMPOSE_FILES) -f add-device-bacnet.yml
ifeq (ds-bacnet-ip, $(filter ds-bacnet-ip,$(ARGS)))
COMPOSE_FILES:=$(COMPOSE_FILES) -f add-device-bacnet-ip.yml
ifneq (no-secty, $(filter no-secty,$(ARGS)))
ifeq ($(TOKEN_LIST),)
TOKEN_LIST:=device-bacnet
TOKEN_LIST:=device-bacnet-ip
else
TOKEN_LIST:=$(TOKEN_LIST),device-bacnet
TOKEN_LIST:=$(TOKEN_LIST),device-bacnet-ip
endif
ifeq ($(KNOWN_SECRETS_LIST),)
KNOWN_SECRETS_LIST:=redisdb[device-bacnet],message-bus[device-bacnet]
KNOWN_SECRETS_LIST:=redisdb[device-bacnet-ip],message-bus[device-bacnet-ip]
else
KNOWN_SECRETS_LIST:=$(KNOWN_SECRETS_LIST),redisdb[device-bacnet],message-bus[device-bacnet]
KNOWN_SECRETS_LIST:=$(KNOWN_SECRETS_LIST),redisdb[device-bacnet-ip],message-bus[device-bacnet-ip]
endif
extension_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_secure_compose_ext.sh device-bacnet device-bacnet device-bacnet-ip/device-bacnet-c " -cp=consul://edgex-core-consul:8500 --registry")
extension_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_secure_compose_ext.sh device-bacnet-ip device-bacnet-ip device-bacnet-ip/device-bacnet-c " -cp=consul://edgex-core-consul:8500 --registry")

COMPOSE_FILES:=$(COMPOSE_FILES) -f $(extension_file)
# add runtime token config for delayed-start if specified
ifeq (delayed-start, $(filter delayed-start,$(ARGS)))
ext_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_runtime_token_config_compose_ext.sh device-bacnet)
ext_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_runtime_token_config_compose_ext.sh device-bacnet-ip)
COMPOSE_FILES:=$(COMPOSE_FILES) -f $(ext_file)
endif
endif
endif
ifeq (ds-bacnet-mstp, $(filter ds-bacnet-mstp,$(ARGS)))
COMPOSE_FILES:=$(COMPOSE_FILES) -f add-device-bacnet-mstp.yml
ifneq (no-secty, $(filter no-secty,$(ARGS)))
ifeq ($(TOKEN_LIST),)
TOKEN_LIST:=device-bacnet-mstp
else
TOKEN_LIST:=$(TOKEN_LIST),device-bacnet-mstp
endif
ifeq ($(KNOWN_SECRETS_LIST),)
KNOWN_SECRETS_LIST:=redisdb[device-bacnet-mstp],message-bus[device-bacnet-mstp]
else
KNOWN_SECRETS_LIST:=$(KNOWN_SECRETS_LIST),redisdb[device-bacnet-mstp],message-bus[device-bacnet-mstp]
endif
extension_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_secure_compose_ext.sh device-bacnet-mstp device-bacnet-mstp device-bacnet-mstp/device-bacnet-c " -cp=consul://edgex-core-consul:8500 --registry")

COMPOSE_FILES:=$(COMPOSE_FILES) -f $(extension_file)
# add runtime token config for delayed-start if specified
ifeq (delayed-start, $(filter delayed-start,$(ARGS)))
ext_file:= $(shell GEN_EXT_DIR="$(GEN_EXT_DIR)" ./gen_runtime_token_config_compose_ext.sh device-bacnet-mstp)
COMPOSE_FILES:=$(COMPOSE_FILES) -f $(ext_file)
endif
endif
endif
ifeq (ds-modbus, $(filter ds-modbus,$(ARGS)))
COMPOSE_FILES:=$(COMPOSE_FILES) -f add-device-modbus.yml
ifneq (no-secty, $(filter no-secty,$(ARGS)))
Expand Down Expand Up @@ -712,7 +734,8 @@ export SPIFFE_ENDPOINTSOCKET
define COMPOSE_DOWN
${DOCKER_COMPOSE} -p edgex \
-f docker-compose-base.yml \
-f add-device-bacnet.yml \
-f add-device-bacnet-ip.yml \
-f add-device-bacnet-mstp.yml \
-f add-device-onvif-camera.yml \
-f add-device-usb-camera.yml \
-f add-device-modbus.yml \
Expand Down
90 changes: 48 additions & 42 deletions compose-builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ This folder contains the following compose files:
Secure Redis MessageBus **extending** compose file. Adds the additional security configuration for when Redis is used as MessageBus in secure mode so Kuiper can connect to the secure MessageBus.
- **add-delayed-start-services.yml**<br/>
Secure delayed start services **extending** compose file. Adds additional delayed start services based on spire/spiffe implementation to provide the secret store token on the runtime secure configuration.
- **add-device-bacnet.yml**<br/>
Device Service **extending** compose file, which adds the **Device Bacnet** service.
- **add-device-bacnet-ip.yml**<br/>
Device Service **extending** compose file, which adds the **Device Bacnet(IP)** service.
- **add-device-bacnet-mstp.yml**<br/>
Device Service **extending** compose file, which adds the **Device Bacnet(MSTP)** service.
- **add-device-onvif-camera.yml**<br/>
Device Service **extending** compose file, which adds the **Device ONVIF Camera** service.
- **add-device-usb-camera.yml**<br/>
Expand Down Expand Up @@ -196,7 +198,8 @@ Options:
delayed-start: Runs with delayed start services-
spire related services and spiffe-token-provider service included
ds-modbus: Runs with device-modbus included
ds-bacnet: Runs with device-bacnet included
ds-bacnet-ip: Runs with device-bacnet-ip included
ds-bacnet-mstp: Runs with device-bacnet-mstp included
ds-onvif-camera: Runs with device-onvif-camera included
ds-usb-camera: Runs with device-usb-camera included
ds-mqtt: Runs with device-mqtt included
Expand Down Expand Up @@ -250,7 +253,8 @@ Options:
arm64: Pulls ARM64 version of images
delayed-start: Pull includes delayed start services- spire related services
and spiffe-token-provider service
ds-bacnet: Pull includes device-bacnet
ds-bacnet-ip: Pull includes device-bacnet-ip
ds-bacnet-mstp: Pull includes device-bacnet-mstp
ds-onvif-camera: Pull includes device-onvif-camera included
ds-usb-camera: Pull includes device-usb-camera included
ds-modbus: Pull includes device-modbus
Expand Down Expand Up @@ -298,7 +302,8 @@ Options:
delayed-start: Generates compose file with delayed start services- spire
related services and spiffe-token-provider service included
ds-modbus: Generates compose file with device-modbus included
ds-bacnet: Generates compose file with device-bacnet included
ds-bacnet-ip: Generates compose file with device-bacnet-ip included
ds-bacnet-mstp: Generates compose file with device-bacnet-mstp included
ds-onvif-camera: Generates compose file with device-onvif-camera included
ds-usb-camera: Generates compose file with device-usb-camera included
ds-mqtt: Generates compose file with device-mqtt included
Expand Down Expand Up @@ -391,43 +396,44 @@ compose [options]
Generates the EdgeX compose file as specified by options and stores them in the configured release folder. Compose files are named appropriately for release and options used to generate them.

Options:
no-secty: Generates non-secure compose file, otherwise generates secure compose file
arm64: Generates compose file using ARM64 images
dev: Generates using local built images from edgex-go repo
'make docker' creates local docker images tagged with '0.0.0-dev'
app-dev: Generates using local built images from application service repos
'make docker' creates local docker images tagged with '0.0.0-dev`
device-dev: Generates using local built images from device service repos
'make docker' creates local docker images tagged with '0.0.0-dev'
ui-dev: Generates using local built images from edgex-ui-go repo
'make docker' creates local docker image tagged with '0.0.0-dev'
delayed-start: Generates compose file with delayed start services- spire related services and
spiffe-token-provider service included
ds-bacnet: Generates compose file with device-bacnet included
ds-modbus: Generates compose file with device-modbus included
ds-mqtt: Generates compose file with device-mqtt included
ds-rest: Generates compose file with device-rest included
ds-snmp: Generates compose file with device-snmp included
ds-virtual: Generates compose file with device-virtual included
ds-coap: Generates compose file with device-coap included
ds-gpio: Generates compose file with device-gpio included
ds-llrp: Generates compose file with device-rfid-llrp included
modbus-sim: Generates compose file with ModBus simulator included
asc-http: Generates compose file with App Service HTTP Export included
asc-mqtt: Generates compose file with App Service MQTT Export included
asc-metrics: Generates compose file with App Service Metrics InfluxDb included
asc-sample: Generates compose file with App Service Sample included
as-llrp: Generates compose file with App RFID LLRP Inventory included
asc-ex-mqtt: Generates compose file with App Service External MQTT Trigger included
mqtt-broker: Generates compose file with a MQTT Broker service included
mqtt-bus: Generates compose file with services configure for MQTT Message Bus
The MQTT Broker service is also included.
nanomq: ** Experimental **
Generates compose file with NonoMQ MQTT broker when mqtt-broker or mqtt-bus are specified
Not valid in secure mode when uses with mqtt-bus
mqtt-verbose Enables MQTT Broker verbose logging.
nats-bus: Generates compose file with services configure for NATS Message Bus
The NATS Server service is also included.
no-secty: Generates non-secure compose file, otherwise generates secure compose file
arm64: Generates compose file using ARM64 images
dev: Generates using local built images from edgex-go repo
'make docker' creates local docker images tagged with '0.0.0-dev'
app-dev: Generates using local built images from application service repos
'make docker' creates local docker images tagged with '0.0.0-dev`
device-dev: Generates using local built images from device service repos
'make docker' creates local docker images tagged with '0.0.0-dev'
ui-dev: Generates using local built images from edgex-ui-go repo
'make docker' creates local docker image tagged with '0.0.0-dev'
delayed-start: Generates compose file with delayed start services- spire related services and
spiffe-token-provider service included
ds-bacnet-ip: Generates compose file with device-bacnet-ip included
ds-bacnet-mstp: Generates compose file with device-bacnet-mstp included
ds-modbus: Generates compose file with device-modbus included
ds-mqtt: Generates compose file with device-mqtt included
ds-rest: Generates compose file with device-rest included
ds-snmp: Generates compose file with device-snmp included
ds-virtual: Generates compose file with device-virtual included
ds-coap: Generates compose file with device-coap included
ds-gpio: Generates compose file with device-gpio included
ds-llrp: Generates compose file with device-rfid-llrp included
modbus-sim: Generates compose file with ModBus simulator included
asc-http: Generates compose file with App Service HTTP Export included
asc-mqtt: Generates compose file with App Service MQTT Export included
asc-metrics: Generates compose file with App Service Metrics InfluxDb included
asc-sample: Generates compose file with App Service Sample included
as-llrp: Generates compose file with App RFID LLRP Inventory included
asc-ex-mqtt: Generates compose file with App Service External MQTT Trigger included
mqtt-broker: Generates compose file with a MQTT Broker service included
mqtt-bus: Generates compose file with services configure for MQTT Message Bus
The MQTT Broker service is also included.
nanomq: ** Experimental **
Generates compose file with NonoMQ MQTT broker when mqtt-broker or mqtt-bus are specified
Not valid in secure mode when uses with mqtt-bus
mqtt-verbose Enables MQTT Broker verbose logging.
nats-bus: Generates compose file with services configure for NATS Message Bus
The NATS Server service is also included.
```

#### TAF Compose
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# /*******************************************************************************
# * Copyright 2022 Intel Corporation.
# * Copyright 2023 IOTech.
# *
# * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# * in compliance with the License. You may obtain a copy of the License at
Expand All @@ -16,19 +17,19 @@
version: '3.7'

services:
device-bacnet:
device-bacnet-ip:
image: ${DEVICE_SVC_REPOSITORY}/device-bacnet${ARCH}:${DEVICE_BACNET_VERSION}
command: "-cp=consul://edgex-core-consul:8500 --registry"
ports:
- "127.0.0.1:59980:59980"
container_name: edgex-device-bacnet
hostname: edgex-device-bacnet
container_name: edgex-device-bacnet-ip
hostname: edgex-device-bacnet-ip
networks:
- edgex-network
env_file:
- common-non-security.env
environment:
SERVICE_HOST: edgex-device-bacnet
SERVICE_HOST: edgex-device-bacnet-ip
REGISTRY_HOST: edgex-core-consul
DATABASE_HOST: edgex-redis
MESSAGEBUS_HOST: edgex-redis
Expand Down
49 changes: 49 additions & 0 deletions compose-builder/add-device-bacnet-mstp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# /*******************************************************************************
# * Copyright 2023 IOTech.
# *
# * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# * in compliance with the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software distributed under the License
# * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# * or implied. See the License for the specific language governing permissions and limitations under
# * the License.
# *
# *******************************************************************************/

version: '3.7'

services:
device-bacnet-mstp:
lenny-goodell marked this conversation as resolved.
Show resolved Hide resolved
image: ${DEVICE_SVC_REPOSITORY}/device-bacnet${ARCH}:${DEVICE_BACNET_VERSION}
command: "-cp=consul://edgex-core-consul:8500 --registry"
entrypoint:
- /device-bacnet-mstp/device-bacnet-c
ports:
- "127.0.0.1:59981:59980"
container_name: edgex-device-bacnet-mstp
hostname: edgex-device-bacnet-mstp
networks:
- edgex-network
env_file:
- common-non-security.env
environment:
SERVICE_HOST: edgex-device-bacnet-mstp
REGISTRY_HOST: edgex-core-consul
DATABASE_HOST: edgex-redis
MESSAGEBUS_HOST: edgex-redis
CLIENTS_CORE_METADATA_HOST: edgex-core-metadata
depends_on:
- consul
- core-data
- core-metadata
security_opt:
- no-new-privileges:true
read_only: true
restart: always
user: "${EDGEX_USER}:${EDGEX_GROUP}"
volumes:
# use host timezone
- /etc/localtime:/etc/localtime:ro
2 changes: 1 addition & 1 deletion compose-builder/gen_secure_compose_ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sed 's/${SERVICE_NAME}:/'"$service_name"':/g' "$ADD_SERVICE_SECURE_FILE_TEMPLATE
sed -i 's/${SERVICE_KEY}/'"$service_key"'/g' "$SERVICE_EXT_COMPOSE_PATH"
sed -i 's,${EXECUTABLE},'"$executable"',g' "$SERVICE_EXT_COMPOSE_PATH"
case "${service_name}" in
device-bacnet | device-coap | device-gpio)
device-bacnet-ip | device-bacnet-mstp | device-coap | device-gpio)
# These services don't have dumb-init in their containers, causing an issue for the wait script, use sh instead
sed -i 's/${SHELL_OVERRIDE}/"\/bin\/sh", /g' "$SERVICE_EXT_COMPOSE_PATH"
;;
Expand Down
3 changes: 2 additions & 1 deletion compose-builder/tui-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ declare -A appServiceDesc=(

## Device Service Descriptions
declare -A deviceServiceDesc=(
[ds-bacnet]="Include BACnet Device Service"
[ds-bacnet-ip]="Include BACnet-IP Device Service"
[ds-bacnet-mstp]="Include BACnet-MSTP Device Service"
[ds-onvif-camera]="Include ONVIF Camera Device Service"
[ds-usb-camera]="Include USB Camera Device Service"
[ds-modbus]="Include ModBus Device Service"
Expand Down