Browse Source

fea(edgex): support edgex nats message bus (#1474) (#1481)

* fix(edgex): upgrade edgex-foundry dependency version

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

* fix(edgex): support edgex nats message bus

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

* fix(edgex): add edgex nats message bus for json config

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

* fix(edgex): add configuration for nats

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

* fix(edgex): update extensions.mod

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

* fix(edgex): update docs about nats message bus

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>
Signed-off-by: Rory Z <rory-z@outlook.com>

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>
Signed-off-by: Rory Z <rory-z@outlook.com>
Co-authored-by: superxan <33817352+superrxan@users.noreply.github.com>
Rory 2 years ago
parent
commit
7583d75a56

+ 1 - 0
.github/workflows/build_packages.yaml

@@ -102,6 +102,7 @@ jobs:
             suffix:
             - ""
             - "-alpine"
+            - "-dev"
             - "-slim"
             - "-slim-python"
             golang:

+ 2 - 2
.github/workflows/run_fvt_tests.yaml

@@ -265,7 +265,7 @@ jobs:
         sudo ./get_helm.sh
         helm version
     - name: build kuiper for docker
-      run: sudo docker build --no-cache -t lfedge/ekuiper:$(git describe --tags --alway)-alpine -f deploy/docker/Dockerfile-alpine .
+      run: sudo docker build --no-cache -t lfedge/ekuiper:$(git describe --tags --alway) -f deploy/docker/Dockerfile .
     - name: run emqx on chart
       env:
         KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
@@ -287,7 +287,7 @@ jobs:
         version=$(git describe --tags --always)
         emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
 
-        sudo docker save lfedge/ekuiper:$version-alpine -o kuier.tar.gz
+        sudo docker save lfedge/ekuiper:$version -o kuier.tar.gz
         sudo k3s ctr image import kuier.tar.gz
 
         sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/chart/ekuiper/Chart.yaml

+ 1 - 1
Makefile

@@ -78,7 +78,7 @@ real_pkg:
 docker:
 	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION) -f deploy/docker/Dockerfile . --load
 	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION)-slim -f deploy/docker/Dockerfile-slim . --load
-	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION)-alpine -f deploy/docker/Dockerfile-alpine . --load
+	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION)-dev -f deploy/docker/Dockerfile-dev . --load
 
 PLUGINS := sinks/file \
 	sinks/influx \

+ 1 - 1
deploy/chart/ekuiper/templates/deployment.yaml

@@ -44,7 +44,7 @@ spec:
         {{- end }}
       containers:
         - name: ekuiper
-          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}-alpine"
+          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           {{- if .Values.ekuiperEnv.enabled }}
           env:

+ 27 - 10
deploy/docker/Dockerfile

@@ -13,28 +13,45 @@
 # limitations under the License.
 
 ARG GO_VERSION=1.18.5
-FROM ghcr.io/lf-edge/ekuiper/base:$GO_VERSION-debian AS builder
+FROM ghcr.io/lf-edge/ekuiper/base:$GO_VERSION-alpine AS builder
 
 COPY . /go/kuiper
 
 WORKDIR /go/kuiper
 
-RUN apt-get clean \
-    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+RUN make build_with_edgex
 
-RUN make build_with_edgex \
-    && ln -s /go/kuiper/_build/kuiper-$(git describe --tags --always)-$(go env GOOS)-$(go env GOARCH) /kuiper
+FROM alpine:3.16
 
-RUN ln -s /go/kuiper/deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
+# Set environment vars
+ENV MAINTAINER="emqx.io" \
+    KUIPER_HOME="/kuiper" \
+    KUIPER__BASIC__CONSOLELOG=true
 
-EXPOSE 9081 20498
+# These vars are not persisted in the final image layer
+ARG KUIPER_USER="kuiper"
+ARG KUIPER_USER_ID="1001"
 
-ENV MAINTAINER="emqx.io"
-ENV KUIPER_HOME /kuiper
-ENV KUIPER__BASIC__CONSOLELOG true
+# (root) Add packages and "kuiper" user
+RUN apk add sed libzmq
 
 WORKDIR ${KUIPER_HOME}
+
+# Set appropriate ownership to allow binary full access to KUIPER_HOME dir
+RUN adduser -DH -s /sbin/nologin -u ${KUIPER_USER_ID} ${KUIPER_USER} && \
+    chown -Rh ${KUIPER_USER}:${KUIPER_USER} ${KUIPER_HOME} && \
+    mkdir -p /usr/local/taos && \
+    chown -Rh ${KUIPER_USER}:${KUIPER_USER} /usr/local/taos
+
+# Run the kuiper process under the kuiper user
+USER ${KUIPER_USER}
+
+COPY --chown=${KUIPER_USER}:${KUIPER_USER} ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
+COPY --chown=${KUIPER_USER}:${KUIPER_USER} --from=builder /go/kuiper/_build/kuiper-* /kuiper/
+
 VOLUME ["${KUIPER_HOME}/etc", "${KUIPER_HOME}/data", "${KUIPER_HOME}/plugins", "${KUIPER_HOME}/log"]
+EXPOSE 9081 20498
+
 ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
 
 CMD ["./bin/kuiperd"]

+ 0 - 57
deploy/docker/Dockerfile-alpine

@@ -1,57 +0,0 @@
-# Copyright 2021 EMQ Technologies Co., Ltd.
-#
-# 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.
-
-ARG GO_VERSION=1.18.5
-FROM ghcr.io/lf-edge/ekuiper/base:$GO_VERSION-alpine AS builder
-
-COPY . /go/kuiper
-
-WORKDIR /go/kuiper
-
-RUN make build_with_edgex
-
-FROM alpine:3.16
-
-# Set environment vars
-ENV MAINTAINER="emqx.io" \
-    KUIPER_HOME="/kuiper" \
-    KUIPER__BASIC__CONSOLELOG=true
-
-# These vars are not persisted in the final image layer
-ARG KUIPER_USER="kuiper"
-ARG KUIPER_USER_ID="1001"
-
-# (root) Add packages and "kuiper" user
-RUN apk add sed libzmq
-
-WORKDIR ${KUIPER_HOME}
-
-# Set appropriate ownership to allow binary full access to KUIPER_HOME dir
-RUN adduser -DH -s /sbin/nologin -u ${KUIPER_USER_ID} ${KUIPER_USER} && \
-    chown -Rh ${KUIPER_USER}:${KUIPER_USER} ${KUIPER_HOME} && \
-    mkdir -p /usr/local/taos && \
-    chown -Rh ${KUIPER_USER}:${KUIPER_USER} /usr/local/taos
-
-# Run the kuiper process under the kuiper user
-USER ${KUIPER_USER}
-
-COPY --chown=${KUIPER_USER}:${KUIPER_USER} ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
-COPY --chown=${KUIPER_USER}:${KUIPER_USER} --from=builder /go/kuiper/_build/kuiper-* /kuiper/
-
-VOLUME ["${KUIPER_HOME}/etc", "${KUIPER_HOME}/data", "${KUIPER_HOME}/plugins", "${KUIPER_HOME}/log"]
-EXPOSE 9081 20498
-
-ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
-
-CMD ["./bin/kuiperd"]

+ 1 - 0
deploy/docker/Dockerfile-alpine

@@ -0,0 +1 @@
+Dockerfile

+ 40 - 0
deploy/docker/Dockerfile-dev

@@ -0,0 +1,40 @@
+# Copyright 2021 EMQ Technologies Co., Ltd.
+#
+# 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.
+
+ARG GO_VERSION=1.18.5
+FROM ghcr.io/lf-edge/ekuiper/base:$GO_VERSION-debian AS builder
+
+COPY . /go/kuiper
+
+WORKDIR /go/kuiper
+
+RUN apt-get clean \
+    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+
+RUN make build_with_edgex \
+    && ln -s /go/kuiper/_build/kuiper-$(git describe --tags --always)-$(go env GOOS)-$(go env GOARCH) /kuiper
+
+RUN ln -s /go/kuiper/deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
+
+EXPOSE 9081 20498
+
+ENV MAINTAINER="emqx.io"
+ENV KUIPER_HOME /kuiper
+ENV KUIPER__BASIC__CONSOLELOG true
+
+WORKDIR ${KUIPER_HOME}
+VOLUME ["${KUIPER_HOME}/etc", "${KUIPER_HOME}/data", "${KUIPER_HOME}/plugins", "${KUIPER_HOME}/log"]
+ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
+
+CMD ["./bin/kuiperd"]

+ 1 - 1
deploy/docker/Dockerfile-kubernetes-tool

@@ -20,7 +20,7 @@ WORKDIR /go/kuiper/tools/kubernetes
 
 RUN go build -o kuiper-kubernetes-tool main.go
 
-FROM alpine:3.15
+FROM alpine:3.16
 
 WORKDIR /kuiper-kubernetes-tool