diff --git a/docker-compose.yml b/docker-compose.yml index 860c6e7796..cfc47addd5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,6 +53,8 @@ services: context: ./ui dockerfile: Dockerfile image: streampipes_ui:release-validation + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/cli/deploy/standalone/extensions-all-jvm/docker-compose.yml b/installer/cli/deploy/standalone/extensions-all-jvm/docker-compose.yml index 90686788d6..a355c6c96a 100644 --- a/installer/cli/deploy/standalone/extensions-all-jvm/docker-compose.yml +++ b/installer/cli/deploy/standalone/extensions-all-jvm/docker-compose.yml @@ -17,6 +17,8 @@ version: "3.4" services: extensions-all-jvm: image: ${SP_DOCKER_REGISTRY}/extensions-all-jvm:${SP_VERSION} + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 depends_on: - couchdb environment: diff --git a/installer/cli/deploy/standalone/ui/docker-compose.yml b/installer/cli/deploy/standalone/ui/docker-compose.yml index 0985c3a7d1..3aa23250b6 100644 --- a/installer/cli/deploy/standalone/ui/docker-compose.yml +++ b/installer/cli/deploy/standalone/ui/docker-compose.yml @@ -17,6 +17,8 @@ version: "3.4" services: ui: image: ${SP_DOCKER_REGISTRY}/ui:${SP_VERSION} + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/cli/environments/full b/installer/cli/environments/full index bc9f7da714..cf8789429b 100644 --- a/installer/cli/environments/full +++ b/installer/cli/environments/full @@ -18,9 +18,6 @@ ui backend extensions-all-jvm couchdb -jobmanager -taskmanager zookeeper kafka influxdb -pipeline-elements-all-flink diff --git a/installer/compose/docker-compose.full.yml b/installer/compose/docker-compose.full.yml index a8f88f6e41..8f73e254d7 100644 --- a/installer/compose/docker-compose.full.yml +++ b/installer/compose/docker-compose.full.yml @@ -39,6 +39,8 @@ services: ui: image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/compose/docker-compose.minimal.yml b/installer/compose/docker-compose.minimal.yml index 948dd0d357..a1e747b3c0 100644 --- a/installer/compose/docker-compose.minimal.yml +++ b/installer/compose/docker-compose.minimal.yml @@ -40,6 +40,8 @@ services: ui: image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-iiot-minimal:8090 ports: - "80:8088" depends_on: diff --git a/installer/compose/docker-compose.nats.yml b/installer/compose/docker-compose.nats.yml index b9e5fff611..8313c02dbc 100644 --- a/installer/compose/docker-compose.nats.yml +++ b/installer/compose/docker-compose.nats.yml @@ -40,6 +40,8 @@ services: ui: image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/compose/docker-compose.pulsar.yml b/installer/compose/docker-compose.pulsar.yml index c657b18bba..0775603f21 100644 --- a/installer/compose/docker-compose.pulsar.yml +++ b/installer/compose/docker-compose.pulsar.yml @@ -41,6 +41,8 @@ services: ui: image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/compose/docker-compose.quickstart.yml b/installer/compose/docker-compose.quickstart.yml index 5fea61fc47..bac87eb21f 100644 --- a/installer/compose/docker-compose.quickstart.yml +++ b/installer/compose/docker-compose.quickstart.yml @@ -39,6 +39,8 @@ services: ui: image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 ports: - "80:8088" depends_on: diff --git a/installer/compose/docker-compose.yml b/installer/compose/docker-compose.yml index 25a5be84b6..ce084204f2 100644 --- a/installer/compose/docker-compose.yml +++ b/installer/compose/docker-compose.yml @@ -27,6 +27,8 @@ services: # StreamPipes services backend: image: "${SP_DOCKER_REGISTRY}/backend:${SP_VERSION}" + environment: + - SP_HTTP_SERVER_ADAPTER_ENDPOINT=extensions-all-jvm:8090 depends_on: - couchdb volumes: diff --git a/installer/k8s/README.md b/installer/k8s/README.md index c6da802a0b..23bfce457d 100644 --- a/installer/k8s/README.md +++ b/installer/k8s/README.md @@ -158,6 +158,7 @@ rm -rf ${HOME}/streampipes-k8s | Parameter Name | Description | Value | |------------------------------|-------------------------------------------|---------------------| | extensions.iiot.appName | IIoT extensions application name | extensions-all-iiot | +| extensions.iiot.imageName | IIoT extensions image name | extensions-all-jvm | | extensions.iiot.port | Port for the IIoT extensions application | 8090 | | extensions.iiot.service.name | Name of the IIoT extensions service | extensions-all-iiot | | extensions.iiot.service.port | TargetPort of the IIoT extensions service | 8090 | @@ -179,20 +180,7 @@ rm -rf ${HOME}/streampipes-k8s | external.couchdb.persistence.storageSize | Size of the CouchDB PV | "1Gi" | | external.couchdb.persistence.claimName | Name of the CouchDB PersistentVolumeClaim | "couchdb-pvc" | | external.couchdb.persistence.pvName | Name of the CouchDB PersistentVolume | "couchdb-pv" | -####Couchdb common parameters -| Parameter Name | Description | Value | -|-------------------------------------------------|----------------------------------------------------------|------------------------------------------| -| external.couchdb.appName | CouchDB application name | "couchdb" | -| external.couchdb.version | CouchDB version | 3.3.1 | -| external.couchdb.user | CouchDB admin username | "admin" | -| external.couchdb.password | CouchDB admin password | empty (auto-generated) | -| external.couchdb.port | Port for the CouchDB service | 5984 | -| external.couchdb.service.name | Name of the CouchDB service | "couchdb" | -| external.couchdb.service.port | TargetPort of the CouchDB service | 5984 | -| external.couchdb.persistence.storageClassName | Storage class name for CouchDB PVs | "hostpath" | -| external.couchdb.persistence.storageSize | Size of the CouchDB PV | "1Gi" | -| external.couchdb.persistence.claimName | Name of the CouchDB PersistentVolumeClaim | "couchdb-pvc" | -| external.couchdb.persistence.pvName | Name of the CouchDB PersistentVolume | "couchdb-pv" | + #### Influxdb common parameters diff --git a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml b/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml index 16a1e88bf0..cecc9a18f7 100644 --- a/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml +++ b/installer/k8s/templates/core/extensions-all-iiot-deployment.yaml @@ -34,7 +34,7 @@ spec: command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 {{.Values.streampipes.core.service.name}} {{ .Values.streampipes.core.service.port }} && exit 0 || sleep 3; done; exit 1"] containers: - name: extensions-all-iiot - image: {{ .Values.streampipes.registry }}/extensions-all-iiot:{{ .Values.streampipes.version }} + image: {{ .Values.streampipes.registry }}/{{ .Values.extensions.iiot.imageName }}:{{ .Values.streampipes.version }} imagePullPolicy: {{ .Values.pullPolicy }} ports: - containerPort: {{ .Values.extensions.iiot.port }} diff --git a/installer/k8s/templates/core/ui-ingressroute.yaml b/installer/k8s/templates/core/ui-ingressroute.yaml index 812d83e604..64609e5d01 100644 --- a/installer/k8s/templates/core/ui-ingressroute.yaml +++ b/installer/k8s/templates/core/ui-ingressroute.yaml @@ -39,6 +39,11 @@ spec: services: - name: {{ .Values.streampipes.ui.appName }} port: {{ .Values.streampipes.ui.service.port }} + - match: Host(`{{ .Values.streampipes.ingressroute.host }}`) && PathPrefix(`/endpoints/`) + kind: Rule + services: + - name: {{ .Values.extensions.iiot.appName }} + port: {{ .Values.extensions.iiot.service.port }} {{- if .Values.streampipes.ingressroute.certResolverActive }} tls: certResolver: {{ .Values.streampipes.ingressroute.certResolver}} diff --git a/installer/k8s/values.yaml b/installer/k8s/values.yaml index 36ae91f3a2..d531045a19 100644 --- a/installer/k8s/values.yaml +++ b/installer/k8s/values.yaml @@ -81,6 +81,7 @@ streampipes: extensions: iiot: appName: extensions-all-iiot + imageName: extensions-all-jvm port: 8090 service: name: extensions-all-iiot diff --git a/ui/Dockerfile b/ui/Dockerfile index 723029b839..a0483f862c 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -34,6 +34,7 @@ USER nginx COPY nginx_config/nginx.conf /etc/nginx/nginx.conf COPY nginx_config/default.conf /etc/nginx/conf.d/default.conf +COPY nginx_config/default.conf.template /etc/nginx/conf.d/default.conf.template COPY nginx_config/ssl.conf /app/nginx-confs/ssl.conf COPY docker-entrypoint.sh / diff --git a/ui/docker-entrypoint.sh b/ui/docker-entrypoint.sh index eeb26849d7..d608b80f44 100755 --- a/ui/docker-entrypoint.sh +++ b/ui/docker-entrypoint.sh @@ -16,10 +16,15 @@ set -e if [ ! -z "$NGINX_SSL" ] && [ "$NGINX_SSL" = "true" ]; then - rm /etc/nginx/conf.d/default.conf ln -s /app/nginx-confs/ssl.conf /etc/nginx/conf.d/default.conf +elif [ ! -z "$SP_HTTP_SERVER_ADAPTER_ENDPOINT" ]; then + DEFAULT_CONF_BACKUP="/etc/nginx/conf.d/default.conf_$(date +%s).bak" + echo "Create backup of old configuration $DEFAULT_CONF_BACKUP" + cp /etc/nginx/conf.d/default.conf $DEFAULT_CONF_BACKUP + rm /etc/nginx/conf.d/default.conf + envsubst '\$SP_HTTP_SERVER_ADAPTER_ENDPOINT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf fi exec "$@" \ No newline at end of file diff --git a/ui/nginx_config/default.conf b/ui/nginx_config/default.conf index 5dd4447c2c..ef8f1fb4ce 100644 --- a/ui/nginx_config/default.conf +++ b/ui/nginx_config/default.conf @@ -44,7 +44,7 @@ server { } location ~/endpoints/(?.*)$ { - set $upstream connect-adapters-iiot:8001/api/v1/worker/live/$endpointName; + set $upstream extensions-all-jvm:8090/api/v1/worker/live/$endpointName; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/ui/nginx_config/default.conf.template b/ui/nginx_config/default.conf.template new file mode 100644 index 0000000000..38532388f1 --- /dev/null +++ b/ui/nginx_config/default.conf.template @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +server { + listen 8088 default_server; + resolver 127.0.0.11; + + root /usr/share/nginx/html; + + # Enable gzip compression + gzip on; + gzip_static on; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_proxied any; + gzip_vary on; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + + # StreamPipes + + location /streampipes-backend { + set $upstream backend:8030; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://$upstream; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } + + location ~/endpoints/(?.*)$ { + set $upstream ${SP_HTTP_SERVER_ADAPTER_ENDPOINT}/api/v1/worker/live/$endpointName; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://$upstream; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + } +}