This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 1104e6ceea Nginx configuration migraton to version 0.93.0+ (#2474)
1104e6ceea is described below
commit 1104e6ceeab03c7859da9538755e376b61237a0e
Author: Stefan Obermeier <[email protected]>
AuthorDate: Thu Mar 14 08:19:45 2024 +0100
Nginx configuration migraton to version 0.93.0+ (#2474)
---
docker-compose.yml | 3 +++
ui/Dockerfile | 7 +++++++
ui/docker-entrypoint.sh | 19 +++++++++++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index cfc47addd5..dfb554bc19 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -60,6 +60,8 @@ services:
depends_on:
- couchdb
- backend
+ volumes:
+ - nginx:/etc/nginx/
logging: *default-logging
networks:
spnet:
@@ -141,6 +143,7 @@ volumes:
influxdb:
influxdb2:
backend:
+ nginx:
networks:
spnet:
diff --git a/ui/Dockerfile b/ui/Dockerfile
index a0483f862c..4b82c1bd17 100644
--- a/ui/Dockerfile
+++ b/ui/Dockerfile
@@ -17,6 +17,13 @@ FROM nginx:mainline-alpine3.18
COPY dist/streampipes/ui/ /usr/share/nginx/html/
+#Store a copy to have a version if the other is hidden in the volume. Required
for migration from 0.93.0 to 0.95.0. Could be removed after the release of
0.95.0.
+RUN mkdir -p /etc/opt/nginx/
+RUN chown -R nginx:nginx /etc/opt/nginx/
+COPY nginx_config/default.conf.template /etc/opt/nginx/default.conf.template
+RUN chown -R nginx:nginx /etc/opt/nginx/default.conf.template
+
+
RUN chown -R nginx:nginx /usr/share/nginx/html && chmod -R 755
/usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
diff --git a/ui/docker-entrypoint.sh b/ui/docker-entrypoint.sh
index d608b80f44..1e8c325359 100755
--- a/ui/docker-entrypoint.sh
+++ b/ui/docker-entrypoint.sh
@@ -19,11 +19,22 @@ 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
+ if [ ! -f /etc/nginx/conf.d/default.conf ]
+ 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
+ fi
+
+ # Required for migration from 0.93.0 to 0.95.0. Could be removed after the
release of 0.95.0.
+ if [ ! -f /etc/nginx/conf.d/default.conf.template ]
+ then
+ echo "Migrate to new nginx template"
+ cp /etc/opt/nginx/default.conf.template
/etc/nginx/conf.d/default.conf.template
+ fi
+
+ rm -f /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