[PATCH] Avoid using outdated mod_wsgi in Docker setup

Wald Commits scm-commit at wald.intevation.org
Wed Aug 21 17:08:18 CEST 2024


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1724252057 -7200
#      Wed Aug 21 16:54:17 2024 +0200
# Branch 3.2.x
# Node ID a440ebd5c23b4101d4599252047e345d26acc88d
# Parent  a9641367812c0965dddfbf294b406f4c272cd625
Avoid using outdated mod_wsgi in Docker setup

Run Wiki in standalone mode behind reverse proxy, which is provided by
a more up-to-date Apache web server. The wiki container is still based
on CentOS 7, because the included SSO integration component cannot be
build with more recent libraries.

diff -r a9641367812c -r a440ebd5c23b docker/Dockerfile.proxy
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/Dockerfile.proxy	Wed Aug 21 16:54:17 2024 +0200
@@ -0,0 +1,11 @@
+# Docker file for proxy acting as central access point for D4E River
+FROM httpd
+MAINTAINER tom at intevation.de
+
+ADD httpd-proxy.conf $HTTPD_PREFIX/conf/extra/
+
+# Activate necessary modules
+RUN sed -i -e "/^#LoadModule proxy_module/s/#//;/^#LoadModule proxy_http_module/s/#//;/^#LoadModule proxy_ajp_module/s/#//;/^#LoadModule proxy_html_module/s/#//" $HTTPD_PREFIX/conf/httpd.conf
+
+# Include proxy configuration
+RUN echo "Include conf/extra/httpd-proxy.conf" >> $HTTPD_PREFIX/conf/httpd.conf
diff -r a9641367812c -r a440ebd5c23b docker/Dockerfile.wiki
--- a/docker/Dockerfile.wiki	Wed May 29 10:51:00 2024 +0200
+++ b/docker/Dockerfile.wiki	Wed Aug 21 16:54:17 2024 +0200
@@ -7,9 +7,8 @@
 RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb
 
 # Install prerequisites
-RUN yum -q -y install curl ca-certificates \
-        python-setuptools gcc python-devel xmlsec1-nss-devel libtool-ltdl-devel \
-        httpd mod_wsgi
+RUN yum -q -y install curl ca-certificates tar gzip \
+        python-setuptools gcc python-devel xmlsec1-nss-devel libtool-ltdl-devel
 WORKDIR /opt/xmlsec
 RUN curl -sL https://pypi.python.org/packages/source/p/pyxmlsec-next/pyxmlsec-next-0.3.1.tar.gz | \
     tar -xz
@@ -34,10 +33,7 @@
 # Volume for Wiki data
 VOLUME $WIKI/wiki/data
 
-USER root
+ENV PYTHONPATH $WIKI
 
-# httpd config
-ADD httpd-wiki.conf /etc/httpd/conf.d/
-
-EXPOSE 80
-CMD ["/usr/sbin/httpd", "-DFOREGROUND"]
+CMD ["/opt/wiki/moin-1.9.9/wiki/server/moin", "server", "standalone", \
+     "--hostname="]
diff -r a9641367812c -r a440ebd5c23b docker/docker-compose.yml
--- a/docker/docker-compose.yml	Wed May 29 10:51:00 2024 +0200
+++ b/docker/docker-compose.yml	Wed Aug 21 16:54:17 2024 +0200
@@ -48,11 +48,18 @@
       context: ./
       dockerfile: ./Dockerfile.wiki
     image: "d4e/river_wiki"
-    depends_on:
-      - client
     volumes:
       - wiki-data:/opt/wiki/moin-1.9.9/wiki/data
       - ./wikiconfig_local.py:/opt/wiki/moin-1.9.9/wikiconfig_local.py
+  proxy:
+    build:
+      context: ./
+      dockerfile: ./Dockerfile.proxy
+    image: "d4e/river_proxy"
+    depends_on:
+      - client
+      - mapserv
+      - wiki
     ports:
       - 80
 volumes:
diff -r a9641367812c -r a440ebd5c23b docker/httpd-proxy.conf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/httpd-proxy.conf	Wed Aug 21 16:54:17 2024 +0200
@@ -0,0 +1,16 @@
+# GWT client
+RedirectMatch "^/$" "/d4e-river"
+ProxyPass "/d4e-river" "ajp://client:8009/d4e-river"
+ProxyPassReverse "/d4e-river" "ajp://client:8009/d4e-river"
+
+# MapServer
+ProxyPass "/cgi-bin" "http://mapserv/cgi-bin"
+ProxyPassReverse "/cgi-bin" "http://mapserv/cgi-bin"
+
+# Wiki
+ProxyPass "/wiki" "http://wiki:8080"
+ProxyPassReverse "/wiki" "http://wiki:8080"
+ProxyHTMLEnable On
+<Location "/wiki">
+  ProxyHTMLURLMap "/" "/wiki/"
+</Location>
diff -r a9641367812c -r a440ebd5c23b docker/httpd-wiki.conf
--- a/docker/httpd-wiki.conf	Wed May 29 10:51:00 2024 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-ErrorLog /dev/stderr
-CustomLog /dev/stdout combined
-
-# GWT client
-RedirectMatch "^/$" "/d4e-river"
-ProxyPass "/d4e-river" "ajp://client:8009/d4e-river"
-ProxyPassReverse "/d4e-river" "ajp://client:8009/d4e-river"
-
-# MapServer
-ProxyPass "/cgi-bin" "http://mapserv/cgi-bin"
-ProxyPassReverse "/cgi-bin" "http://mapserv/cgi-bin"
-
-# Wiki
-WSGIScriptAlias /wiki /opt/wiki/moin-1.9.9/wiki/server/moin.wsgi
-WSGIDaemonProcess moin user=wiki group=wiki \
-    python-path=/opt/wiki/moin-1.9.9 \
-    processes=5 threads=10 maximum-requests=1000 umask=0007
-WSGIProcessGroup moin
-<Directory /opt/wiki/moin-1.9.9/wiki/server>
-    Require all granted
-</Directory>
diff -r a9641367812c -r a440ebd5c23b docker/wikiconfig_local.py
--- a/docker/wikiconfig_local.py	Wed May 29 10:51:00 2024 +0200
+++ b/docker/wikiconfig_local.py	Wed Aug 21 16:54:17 2024 +0200
@@ -1,8 +1,7 @@
 from wikiconfig import LocalConfig
 
 class Config(LocalConfig):
-    # Keep path prefix in sync with WSGIScriptAlias in httpd config
-    url_prefix_static = '/wiki/moin_static199'
+    url_prefix_static = '/moin_static199'
 
     # Put your local config here.
     # See e.g. https://hg.intevation.de/moin/moin-was/file/tip/README


More information about the Dive4Elements-commits mailing list