From 68d2f8c3be165d1e7e7019de15220ca54c62aeec Mon Sep 17 00:00:00 2001 From: etj Date: Thu, 4 Apr 2024 15:31:57 +0200 Subject: [PATCH] [Fixes #37] nginx uses hardcoded mount positions --- docker/nginx/docker-entrypoint.sh | 10 ++++++---- docker/nginx/geonode.conf.envsubst | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/nginx/docker-entrypoint.sh b/docker/nginx/docker-entrypoint.sh index e6bec7a..e4b490a 100644 --- a/docker/nginx/docker-entrypoint.sh +++ b/docker/nginx/docker-entrypoint.sh @@ -44,10 +44,12 @@ export GEONODE_LB_PORT=${GEONODE_LB_PORT:-8000} export GEOSERVER_LB_HOST_IP=${GEOSERVER_LB_HOST_IP:-geoserver} export GEOSERVER_LB_PORT=${GEOSERVER_LB_PORT:-8080} -echo "Replacing environement variables" -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT \$RESOLVER' < /etc/nginx/nginx.conf.envsubst > /etc/nginx/nginx.conf -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT \$RESOLVER' < /etc/nginx/nginx.https.available.conf.envsubst > /etc/nginx/nginx.https.available.conf -envsubst '\$HTTP_HOST \$HTTPS_HOST \$HTTP_SCHEME \$GEONODE_LB_HOST_IP \$GEONODE_LB_PORT \$GEOSERVER_LB_HOST_IP \$GEOSERVER_LB_PORT' < /etc/nginx/sites-enabled/geonode.conf.envsubst > /etc/nginx/sites-enabled/geonode.conf +defined_envs=$(printf '${%s} ' $(env | cut -d= -f1)) + +echo "Replacing environment variables" +envsubst "$defined_envs" < /etc/nginx/nginx.conf.envsubst > /etc/nginx/nginx.conf +envsubst "$defined_envs" < /etc/nginx/nginx.https.available.conf.envsubst > /etc/nginx/nginx.https.available.conf +envsubst "$defined_envs" < /etc/nginx/sites-enabled/geonode.conf.envsubst > /etc/nginx/sites-enabled/geonode.conf echo "Enabling or not https configuration" if [ -z "${HTTPS_HOST}" ]; then diff --git a/docker/nginx/geonode.conf.envsubst b/docker/nginx/geonode.conf.envsubst index 1176ce2..26b83dc 100644 --- a/docker/nginx/geonode.conf.envsubst +++ b/docker/nginx/geonode.conf.envsubst @@ -62,7 +62,7 @@ location /geoserver { # GeoNode location /static/ { - alias /mnt/volumes/statics/static/; + alias $STATIC_ROOT; location ~* \.(?:html|js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|txt|woff|woff2|svg|xml)$ { gzip_static always; @@ -74,7 +74,7 @@ location /static/ { } location /uploaded/ { - alias /mnt/volumes/statics/uploaded/; + alias $MEDIA_ROOT; location ~* \.(?:html|js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|txt|woff|woff2|svg|xml)$ { gzip_static always;