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

Nginx conf parameters as env var #2203

Merged
merged 7 commits into from
Dec 28, 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
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/cli/deploy/standalone/ui/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions installer/cli/environments/full
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ ui
backend
extensions-all-jvm
couchdb
jobmanager
taskmanager
zookeeper
kafka
influxdb
pipeline-elements-all-flink
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.nats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.pulsar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions installer/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 2 additions & 14 deletions installer/k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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" |

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better now, but does this delete the couchdb parameters? ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it exits twice in this README.md. For this reason, I removed one version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!


#### Influxdb common parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 5 additions & 0 deletions installer/k8s/templates/core/ui-ingressroute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
1 change: 1 addition & 0 deletions installer/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ streampipes:
extensions:
iiot:
appName: extensions-all-iiot
imageName: extensions-all-jvm
port: 8090
service:
name: extensions-all-iiot
Expand Down
1 change: 1 addition & 0 deletions ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand Down
7 changes: 6 additions & 1 deletion ui/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
2 changes: 1 addition & 1 deletion ui/nginx_config/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ server {
}

location ~/endpoints/(?<endpointName>.*)$ {
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;
Expand Down
56 changes: 56 additions & 0 deletions ui/nginx_config/default.conf.template
Original file line number Diff line number Diff line change
@@ -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/(?<endpointName>.*)$ {
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;
}
}
Loading