From 18da556c5cb0234a4c1ad3df0b263a452db2ebf1 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 5 Sep 2023 14:27:58 +0200 Subject: Serve archived hydrillabugs.koszko.org website --- Makefile | 11 ++++++++++ container.scm | 55 +++++++++++++++++++++++++++------------------- guix-container.sh | 3 +++ hydrillabugs-archived.html | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 hydrillabugs-archived.html diff --git a/Makefile b/Makefile index 29705dc..4f5ef58 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,7 @@ sample-malcontent: "$$(realpath $@)" | \ make -C subrepos/hydrilla shell-with-hydrilla-only +HYDRILLABUGS_HTML_DIR = $(TEST_ROOT_DIR)/var/www/hydrillabugs.koszko.org/html LETSENCRYPT_ETC_DIR = $(TEST_ROOT_DIR)/etc/letsencrypt EXIM_ETC_DIR = $(TEST_ROOT_DIR)/etc/exim DOVECOT_ETC_DIR = $(TEST_ROOT_DIR)/etc/dovecot @@ -110,11 +111,21 @@ prepare-test-root: sample-malcontent hydrillarepos.koszko.org/html \ hydrilla.koszko.org/html/downloads \ hydrillarepos.koszko.org/html \ + hydrillabugs.koszko.org/html \ ; do \ mkdir -p $(TEST_ROOT_DIR)/var/www/"$$WWW_SUBDIR"; \ printf 'This is dummy file for %s :D\n' "$$WWW_SUBDIR" \ > $(TEST_ROOT_DIR)/var/www/"$$WWW_SUBDIR"/index.html; \ done + printf '/index /index.html\n' > $(HYDRILLABUGS_HTML_DIR)/uri-map.txt + mkdir -p $(HYDRILLABUGS_HTML_DIR)/javascripts + printf 'console.log("dummy js");\n' \ + > $(HYDRILLABUGS_HTML_DIR)'/javascripts/foo.js?31415' + mkdir -p $(HYDRILLABUGS_HTML_DIR)/stylesheets + printf 'dummy-css {\ncolor: #555;\n}\n' \ + > $(HYDRILLABUGS_HTML_DIR)'/stylesheets/b?a=r&ba=z.css' + printf '/stylesheets/b?a=r&ba=z /stylesheets/b?a=r&ba=z.css' \ + >> $(HYDRILLABUGS_HTML_DIR)/uri-map.txt @# Prepare replacement `/var/log` mkdir -p $(TEST_ROOT_DIR)/var/log @# Prepare replacement `/etc/letsencrypt` diff --git a/container.scm b/container.scm index 9f51721..d57b565 100644 --- a/container.scm +++ b/container.scm @@ -232,27 +232,38 @@ (koszko-httpd-site-conf (name-and-aliases (list "hydrillabugs.koszko.org" "hachettebugs.koszko.org")) (body - `(;; GDPR hack - ,(httpd-directive 'Header 'unset 'Set-Cookie) + `(,(httpd-directive 'DocumentRoot "/srv/http/hydrillabugs.koszko.org") - ,(httpd-tag 'Proxy '("*") - (httpd-directive - 'Redirect 'permanent - "/projects/hachette" "/projects/haketilo") - ;; I don't remember why I added the following line so I'm - ;; keeping it just in case. - (httpd-directive 'RequestHeader 'unset 'Accept-Encoding)) + ,(httpd-directive 'RewriteEngine 'On) - ,(httpd-directive - 'ProxyPass "/projects/haketilo" - "http://10.207.87.1:21011/projects/hachette") - ,(httpd-directive - 'ProxyPassReverse "/projects/haketilo" - "http://10.207.87.1:21011/projects/hachette") + ,(httpd-directive 'RewriteCond "%{REQUEST_METHOD}" "!GET") + ,(httpd-directive 'RewriteRule "^(.*)$" "/hydrillabugs-archived.html" + "[L,R=301,QSD]") + + ,(httpd-directive 'Alias "/hydrillabugs-archived.html" + (local-file "./hydrillabugs-archived.html")) + + ,(httpd-directive 'RewriteRule "/uri-map.txt" "/dummy" "[L,F]") + + ;; Serve wget-archived website. + ,(httpd-directive 'RewriteMap 'add-ext + "txt:/srv/http/hydrillabugs.koszko.org/uri-map.txt") + + ,(httpd-tag 'Location (list "/javascripts") + (httpd-directive 'ForceType "application/javascript")) + + ,(httpd-directive 'RewriteCond "%{QUERY_STRING}" "!^$") + ,(httpd-directive 'RewriteCond "${add-ext:$1?%{QUERY_STRING}|NONE}" + "!NONE") + ,(httpd-directive 'RewriteRule "^(.*)$" "${add-ext:$1?%{QUERY_STRING}}" + "[L,R=301]") + + ,(httpd-directive 'RewriteCond "%{QUERY_STRING}" "!^$") + ,(httpd-directive 'RewriteRule "^(.*)$" "$1?%{QUERY_STRING}?" "[L,QSL]") - ,(httpd-directive 'ProxyPass "/.well-known/acme-challenge/" "!") - ,(httpd-directive 'ProxyPass "/" "http://10.207.87.1:21011/") - ,(httpd-directive 'ProxyPassReverse "/" "http://10.207.87.1:21011/"))))) + ,(httpd-directive 'RewriteCond "%{QUERY_STRING}" "^$") + ,(httpd-directive 'RewriteCond "${add-ext:$1|NONE}" "!NONE") + ,(httpd-directive 'RewriteRule "^(.*)$" "${add-ext:$1}" "[L,R=301]"))))) (add-site-conf (koszko-httpd-site-conf @@ -338,10 +349,10 @@ (name "proxy_http_module") (file (file-append httpd "/modules/mod_proxy_http.so"))))) -(define %headers-module +(define %rewrite-module (httpd-module - (name "headers_module") - (file (file-append httpd "/modules/mod_headers.so")))) + (name "rewrite_module") + (file (file-append httpd "/modules/mod_rewrite.so")))) ;; logio is needed for the '%O' log format directive (define %logio-module @@ -372,7 +383,7 @@ (modules `(,%cgid-module ,%wsgi-module ,@%proxy-http-modules - ,%headers-module + ,%rewrite-module ,%logio-module ,@%default-httpd-modules)) (extra-config diff --git a/guix-container.sh b/guix-container.sh index 5d2983b..1d4d6e0 100755 --- a/guix-container.sh +++ b/guix-container.sh @@ -237,6 +237,7 @@ start() { KOSZKO_SIDELOAD_REAL="$HOST_SYSTEM_ROOT"/var/www/koszko.org/html HYDRILLA_HTTP_REAL="$HOST_SYSTEM_ROOT"/var/www/hydrilla.koszko.org/html HYDRILLAREPOS_HTTP_REAL="$HOST_SYSTEM_ROOT"/var/www/hydrillarepos.koszko.org/html + HYDRILLABUGS_HTTP_REAL="$HOST_SYSTEM_ROOT"/var/www/hydrillabugs.koszko.org/html LOG_REAL="$LOG_DIR"/container ETC_LETSENCRYPT_REAL="$HOST_SYSTEM_ROOT"/etc/letsencrypt ETC_EXIM_REAL="$HOST_SYSTEM_ROOT"/etc/exim @@ -250,6 +251,7 @@ start() { KOSZKO_SIDELOAD_DIR_SHARE_OPT=--share="$KOSZKO_SIDELOAD_REAL"=/srv/http/koszko.org HYDRILLA_HTTP_DIR_SHARE_OPT=--share="$HYDRILLA_HTTP_REAL"=/srv/http/hydrilla.koszko.org HYDRILLAREPOS_HTTP_DIR_SHARE_OPT=--share="$HYDRILLAREPOS_HTTP_REAL"=/srv/http/hydrillarepos.koszko.org + HYDRILLABUGS_HTTP_DIR_SHARE_OPT=--share="$HYDRILLABUGS_HTTP_REAL"=/srv/http/hydrillabugs.koszko.org LOG_DIR_SHARE_OPT=--share="$LOG_REAL"=/var/log ETC_LETSENCRYPT_DIR_SHARE_OPT=--share="$ETC_LETSENCRYPT_REAL"=/etc/letsencrypt ETC_EXIM_DIR_SHARE_OPT=--share="$ETC_EXIM_REAL"=/etc/exim @@ -266,6 +268,7 @@ start() { "$EXECUTABLE" "$KOSZKO_SIDELOAD_DIR_SHARE_OPT" \ "$HYDRILLA_HTTP_DIR_SHARE_OPT" \ "$HYDRILLAREPOS_HTTP_DIR_SHARE_OPT" \ + "$HYDRILLABUGS_HTTP_DIR_SHARE_OPT" \ "$LOG_DIR_SHARE_OPT" \ "$ETC_LETSENCRYPT_DIR_SHARE_OPT" \ "$ETC_EXIM_DIR_SHARE_OPT" \ diff --git a/hydrillabugs-archived.html b/hydrillabugs-archived.html new file mode 100644 index 0000000..360617a --- /dev/null +++ b/hydrillabugs-archived.html @@ -0,0 +1,49 @@ + + + + + Hydrillabugs archived + + + + + + + + + +
+

Hydrillabugs archived

+

+ The feature you were trying to use is no longer available. The + Hydrillabugs issue tracker has been archived and no longer allows + registration, login nor upload of data. In case of questions, please + reach out to koszko@koszko.org. +

+ +
+ + -- cgit v1.2.3