[moinmoin] Rewrite @ OCP 4



commit b6701978c56769f0e3bab41bd99e909b78227d87
Author: Andrea Veri <averi redhat com>
Date:   Tue Apr 19 22:16:13 2022 +0200

    Rewrite @ OCP 4

 Dockerfile                                |  26 ++--
 app_data/httpd-cfg/00_wiki.gnome.org.conf |  66 +--------
 app_data/httpd-cfg/01_www.pango.org.conf  |  42 ++----
 app_data/httpd-cfg/02_es.gnome.org.conf   |  27 +---
 app_data/httpd-pre-init/initialize.sh     |   5 -
 git-pull.sh                               |  14 --
 templates/static-web-cron.yaml            |  35 -----
 templates/wiki-web.yaml                   | 222 ------------------------------
 wiki-web.doap                             |  24 ----
 9 files changed, 32 insertions(+), 429 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index 9dd9775..2eab328 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,24 +1,16 @@
-FROM centos/httpd-24-centos7
-USER root
+FROM registry.access.redhat.com/ubi8/httpd-24:1
 
 ENV MOIN_RELEASE=1.9.11
-WORKDIR /srv/http
 
-RUN yum install python27-mod_wsgi wget python2-pip python-openid git -y 
-RUN pip install moin==${MOIN_RELEASE}
+USER 0
 
-RUN wget https://github.com/moinwiki/moin-1.9/releases/download/${MOIN_RELEASE}/moin-${MOIN_RELEASE}.tar.gz 
&& \
-    tar xvf moin-${MOIN_RELEASE}.tar.gz && rm -f moin-${MOIN_RELEASE}.tar.gz && \
-    ln -s /srv/http/moin-${MOIN_RELEASE} /srv/http/moin
+RUN yum install python2-pip redhat-rpm-config \
+    python2-devel gcc httpd-devel -y
+RUN pip2 install mod-wsgi moin==${MOIN_RELEASE}
 
-RUN ln -s /srv/http/data/www.pango.org/theme /srv/http/moin/MoinMoin/web/static/htdocs/pango 
-
-COPY app_data /opt/app-root/src
-COPY git-pull.sh /usr/local/bin/git-pull.sh
-
-RUN chown -R 1000280000:1000280000 /opt/app-root/src /srv/http/moin-${MOIN_RELEASE} 
-
-EXPOSE 8443
+ADD app_data /tmp/src/
+RUN chown -R 1001:0 /tmp/src
 
 USER 1001
-ENTRYPOINT ["/usr/bin/run-httpd"]
+RUN /usr/libexec/s2i/assemble
+CMD /usr/libexec/s2i/run
diff --git a/app_data/httpd-cfg/00_wiki.gnome.org.conf b/app_data/httpd-cfg/00_wiki.gnome.org.conf
index 8cb4ca7..f0ed4f9 100644
--- a/app_data/httpd-cfg/00_wiki.gnome.org.conf
+++ b/app_data/httpd-cfg/00_wiki.gnome.org.conf
@@ -2,8 +2,8 @@
    ServerName live.gnome.org
 
    SSLEngine on
-   SSLCertificateFile /var/serving-cert/tls.crt 
-   SSLCertificateKeyFile /var/serving-cert/tls.key 
+   SSLCertificateFile /var/serving-cert/tls.crt
+   SSLCertificateKeyFile /var/serving-cert/tls.key
 
    RewriteEngine on
    RewriteRule .* https://wiki.gnome.org%{REQUEST_URI} [NE,R,L]
@@ -16,86 +16,34 @@
     DirectoryIndex index.html
 
     SSLEngine on
-    SSLCertificateFile /var/serving-cert/tls.crt 
-    SSLCertificateKeyFile /var/serving-cert/tls.key 
+    SSLCertificateFile /var/serving-cert/tls.crt
+    SSLCertificateKeyFile /var/serving-cert/tls.key
 
     WSGIDaemonProcess moin_wgo user=apache group=apache processes=8 threads=10 maximum-requests=300 
umask=0007
     WSGIProcessGroup moin_wgo
 
-    # Repeated from httpd.conf so the access rules win over the above rule
-    <Location /server-status>
-      SetHandler server-status
-      <RequireAny>
-       Require ip 127.0.0.1
-      </RequireAny>
-    </Location>
-
     RewriteEngine On
-
-    # Anti-spam rewrites
-    RewriteRule ^/(.*)customer(.*)$ /SpamPrevention [NC,R]
-    RewriteRule ^/(.*)canon(.*)$ /SpamPrevention [NC,R]
-    RewriteRule ^/(.*)tech(.*)support(.*)phone(.*)$ /SpamPrevention [NC,R]
-
-
-    #########################
-    ### REWRITES FROM ABOVE ###
-    #########################
-    
-    # If someone was redirected, bring them back to the main page
-    RewriteRule /please-hold/ / [R,T,L]
-    
-    # Custom rewrite rules for this domain
-    # _2f is no longer used as slash after MoinMoin upgrade (RT3 #1075)
-    #RewriteRule /(.*)_2f(.*) /$1/$2 [R]
     RewriteRule /(.*)_2f(.*) /$1/$2
 
-    # Make use of static.gnome.org to serve css / image files
     RedirectMatch ^/gnome/(.*)$ https://static.gnome.org/wiki.gnome.org/$1
-    RewriteRule ^/favicon.ico$ https://static.gnome.org/wiki.gnome.org/favicon.ico [last]
-    RewriteCond %{QUERY_STRING} '^action=AttachFile&do=get&target=GnomeBrandBook-FullLogo.png$'
-    RewriteRule ^/BrandGuidelines$ https://static.gnome.org/img/GnomeBrandBook-FullLogo.png?
-    RewriteCond %{QUERY_STRING} '^action=AttachFile&do=get&target=dialogo.jpg$'
-    RewriteRule ^/Apps/Dia$ https://static.gnome.org/img/dialogo.jpg
-    RewriteRule ^/Apps/dia/images/dialogo.jpg$ https://static.gnome.org/img/dialogo.jpg?
+    RewriteRule ^/favicon.ico$ https://static.gnome.org/wiki.gnome.org/favicon.ico
+    RewriteRule ^/robots.txt$ https://static.gnome.org/wiki.gnome.org/robots.txt
 
-    <LocationMatch "^/.well-known/acme-challenge">
-        RedirectMatch ^(.*) https://letsencrypt.gnome.org$1
-    </LocationMatch>
-
-    # mod_wsgi 
     WSGIScriptAlias /   /srv/http/wsgi/wiki.gnome.org.wsgi
-    
-    # /$project_name --> /Projects/$project_name migration and other redirects
+
     RedirectPermanent /Vala https://wiki.gnome.org/Projects/Vala
     RedirectPermanent /GnomeShell https://wiki.gnome.org/Projects/GnomeShell
     RedirectPermanent /GnomeIrcChannels /Community/GettingInTouch/IRC
     RedirectMatch permanent /GnomeOS/Design/Whiteboards/(.*) /Design/OS/$1
 
-    # Other redirects
     RewriteCond %{REQUEST_URI} ^/JoinGnome$
     RewriteRule / https://www.gnome.org/get-involved [R=301,L]
 
-    # Compress files before shipping them to the clients
     <IfModule mod_deflate.c>
       AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript
     </IfModule>
-
-    <Location />
-        <Limit POST>
-            SetEnvIf Referer ^http://wiki.gnome.org$ is_spammer
-            SetEnvIf Referer ^https://wiki.gnome.org$ is_spammer
-            SetEnvIf Referer ^$ is_spammer
-            SetEnvIf User-Agent MRSPUTNIK is_spammer
-            deny from env=is_spammer
-        </Limit>
-    </Location>
 </VirtualHost>
 
-<LocationMatch "^/.well-known/acme-challenge">
-  RedirectMatch ^(.*) https://letsencrypt.gnome.org$1
-</LocationMatch>
-
 <Directory "/srv/http/wsgi">
   Require all granted
 </Directory>
diff --git a/app_data/httpd-cfg/01_www.pango.org.conf b/app_data/httpd-cfg/01_www.pango.org.conf
index b0b2838..f4ee777 100644
--- a/app_data/httpd-cfg/01_www.pango.org.conf
+++ b/app_data/httpd-cfg/01_www.pango.org.conf
@@ -1,50 +1,26 @@
 <VirtualHost *:8443>
-  ServerName pango.gnome.org 
-
-  DocumentRoot /srv/http/data/pango.gnome.org/root 
-  DirectoryIndex index.html
+  ServerName pango.gnome.org
 
   SSLEngine on
-  SSLCertificateFile /var/serving-cert/tls.crt 
+  SSLCertificateFile /var/serving-cert/tls.crt
   SSLCertificateKeyFile /var/serving-cert/tls.key
 
-  # Turn on RewriteEngine
-  RewriteEngine On
-
-  # Custom rewrite rules for this domain
-  #RewriteRule ^/Manual$ http://library.gnome.org/devel/pango/unstable/ [last]
-  Redirect /Manual http://library.gnome.org/devel/pango/unstable/
-
-  # Standard moinmoin/mod_python integration rules
-  RewriteRule ^/moin_static1911/(.*)$ /srv/http/moin/MoinMoin/web/static/htdocs/$1 [last]
-  RewriteRule ^/robots.txt$ /srv/http/moin/MoinMoin/web/static/htdocs/robots.txt [last]
-  RewriteRule ^/favicon.ico$ /srv/http/data/pango.gnome.org/root/favicon.ico [last]
+  DocumentRoot /srv/http/data/pango.gnome.org/root
+  DirectoryIndex index.html
 
   WSGIDaemonProcess moin_pango user=apache group=apache processes=8 threads=10 maximum-requests=300 
umask=0007
   WSGIProcessGroup moin_pango
 
-  # mod_wsgi
   WSGIScriptAlias /   /srv/http/wsgi/pango.gnome.org.wsgi
 
-  <Location />
-    <Limit POST>
-      SetEnvIf Referer ^http://www.pango.org$ is_spammer
-      SetEnvIf Referer ^$ is_spammer
-      SetEnvIf User-Agent MRSPUTNIK is_spammer
-      deny from env=is_spammer
-    </Limit>
-  </Location>
+  RewriteEngine On
+  RewriteRule ^/moin_static1911/(.*)$ https://static.gnome.org/wiki.gnome.org/$1
+  RewriteRule ^/robots.txt$ https://static.gnome.org/wiki.gnome.org/robots.txt
+  RewriteRule ^/favicon.ico$ https://static.gnome.org/wiki.gnome.org/favicon.ico
 
+  Redirect /Manual https://docs.gtk.org/Pango
 </VirtualHost>
 
-<LocationMatch "^/.well-known/acme-challenge">
-  RedirectMatch ^(.*) https://letsencrypt.gnome.org$1
-</LocationMatch>
-
 <Directory "/srv/http/wsgi">
   Require all granted
 </Directory>
-
-<Directory "/srv/http/moin/MoinMoin/web/static/htdocs">
-  Require all granted
-</Directory>
diff --git a/app_data/httpd-cfg/02_es.gnome.org.conf b/app_data/httpd-cfg/02_es.gnome.org.conf
index a13951d..780e744 100644
--- a/app_data/httpd-cfg/02_es.gnome.org.conf
+++ b/app_data/httpd-cfg/02_es.gnome.org.conf
@@ -1,36 +1,23 @@
 <VirtualHost *:8443>
   ServerName es.gnome.org
 
-  DocumentRoot /srv/http/data/es.gnome.org/root 
-  DirectoryIndex index.html
-
   SSLEngine on
-  SSLCertificateFile /var/serving-cert/tls.crt 
+  SSLCertificateFile /var/serving-cert/tls.crt
   SSLCertificateKeyFile /var/serving-cert/tls.key
 
-  Alias /moin_static1911/ "/srv/http/data/es.gnome.org/htdocs/"
-  RewriteRule ^/robots.txt$ /srv/http/moin/MoinMoin/web/static/htdocs/robots.txt [last]
+  DocumentRoot /srv/http/data/es.gnome.org/root
+  DirectoryIndex index.html
+
+  RewriteRule ^/moin_static1911/(.*)$ https://static.gnome.org/wiki.gnome.org/$1
+  RewriteRule ^/robots.txt$ https://static.gnome.org/wiki.gnome.org/robots.txt
+  RewriteRule ^/favicon.ico$ https://static.gnome.org/wiki.gnome.org/favicon.ico
 
   WSGIDaemonProcess moin_es user=apache group=apache processes=8 threads=10 maximum-requests=300 umask=0007
   WSGIProcessGroup moin_es
 
-  # mod_wsgi
   WSGIScriptAlias /   /srv/http/wsgi/es.gnome.org.wsgi
-
 </VirtualHost>
 
-<LocationMatch "^/.well-known/acme-challenge">
-  RedirectMatch ^(.*) https://letsencrypt.gnome.org$1
-</LocationMatch>
-
 <Directory "/srv/http/wsgi">
   Require all granted
 </Directory>
-
-<Directory "/srv/http/moin/MoinMoin/web/static/htdocs">
-  Require all granted
-</Directory>
-
-<Directory "/srv/http/data/es.gnome.org/htdocs">
-  Require all granted
-</Directory>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]