diff options
author | Wojtek Kosior <koszko@koszko.org> | 2023-09-05 14:27:58 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2023-09-07 12:12:59 +0200 |
commit | 18da556c5cb0234a4c1ad3df0b263a452db2ebf1 (patch) | |
tree | 6f85edde0b073de476784d87a0a6ba4234d84f06 | |
parent | 7fe30d5b5e22818712b90664d905483ea3fe54c3 (diff) | |
download | koszko-org-server-18da556c5cb0234a4c1ad3df0b263a452db2ebf1.tar.gz koszko-org-server-18da556c5cb0234a4c1ad3df0b263a452db2ebf1.zip |
Serve archived hydrillabugs.koszko.org website
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | container.scm | 55 | ||||
-rwxr-xr-x | guix-container.sh | 3 | ||||
-rw-r--r-- | hydrillabugs-archived.html | 49 |
4 files changed, 96 insertions, 22 deletions
@@ -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 @@ +<!doctype html> +<!-- + SPDX-License-Identifier: CC0-1.0 + + Copyright (C) 2023 Wojtek Kosior + + Available under the terms of Creative Commons Zero v1.0 Universal. + --> +<html> + <head> + <title>Hydrillabugs archived</title> + + <meta charset="utf-8" /> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + + <style> + body { + color: #555; + } + + #main { + margin: auto; + max-width: 700px; + } + </style> + </head> + + <body> + <div id="main"> + <h1>Hydrillabugs archived</h1> + <p> + 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 <a href="mailto:koszko@koszko.org">koszko@koszko.org</a>. + </p> + <script type="text/plain"> + For anyone interested, archival was done with more or less these: + + wget --timestamping --recursive --level=5 --execute robots=off --no-remove-listing --adjust-extension --page-requisites --reject-regex '^([^/]|/[^r]|/r[^e]|/re[^p]|/rep[^o]|/repo[^s]|/repos[^i]|/reposi[^t]|/reposit[^o]|/reposito[^r]|/repositor[^y]|/repository[^/])+[^0-9][.]html$' --rejected-log=./rejectlist.csv --quiet https://hydrillabugs.koszko.org + (cd hydrillabugs.koszko.org/; find . -type f) > filelist + awk '/\.(html|css)$/{match($1, @/\.(\/.*)\.(html|css)$/, arr); print arr[1] " " arr[1] "." arr[2]}' filelist > hydrillabugs.koszko.org/uri-map.txt + + There are surely better ways. This is just what I came up with. + </script> + </div> + </body> +</html> |