changeset 9803:a440ebd5c23b 3.2.x tip

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.
author Tom Gottfried <tom@intevation.de>
date Wed, 21 Aug 2024 16:54:17 +0200
parents a9641367812c
children
files docker/Dockerfile.proxy docker/Dockerfile.wiki docker/docker-compose.yml docker/httpd-proxy.conf docker/httpd-wiki.conf docker/wikiconfig_local.py
diffstat 6 files changed, 42 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- /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@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
--- 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="]
--- 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:
--- /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>
--- 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>
--- 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

http://dive4elements.wald.intevation.org