aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-11-25 17:12:24 +0100
committerWojtek Kosior <koszko@koszko.org>2022-11-25 17:12:24 +0100
commit854d7a333f845e181dcdd28df602de601abfe5a6 (patch)
treeb314d46d9fa752299e6e0b85ea327d083136d1b7
parent668dc3b9e42f417d51f125ae99363dbff8a61a84 (diff)
downloadkoszko-org-server-854d7a333f845e181dcdd28df602de601abfe5a6.tar.gz
koszko-org-server-854d7a333f845e181dcdd28df602de601abfe5a6.zip
add hydrillarepos.koszko.org virtualhost
-rw-r--r--Makefile7
-rw-r--r--container.scm20
-rwxr-xr-xguix-container.sh3
-rw-r--r--hosts-extra2
4 files changed, 25 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b0eb3a8..77fc3ae 100644
--- a/Makefile
+++ b/Makefile
@@ -71,8 +71,11 @@ MALCONTENT_DIR = $(TEST_ROOT_DIR)/var/lib/hydrilla/malcontent_dirs
prepare-test-root: sample-malcontent
rm -rf $(TEST_ROOT_DIR)
@# Prepare replacement `/var/www`
- mkdir -p $(TEST_ROOT_DIR)/var/www/koszko.org/html
- printf ':D\n' > $(TEST_ROOT_DIR)/var/www/koszko.org/html/index.html
+ for SITE in koszko.org hydrillarepos.koszko.org; do \
+ mkdir -p $(TEST_ROOT_DIR)/var/www/"$$SITE"/html; \
+ printf 'This is dummy file for %s :D\n' "$$SITE" \
+ > $(TEST_ROOT_DIR)/var/www/"$$SITE"/html/index.html; \
+ done
@# Prepare replacement `/var/log`
mkdir -p $(TEST_ROOT_DIR)/var/log
@# Prepare replacement `/etc`
diff --git a/container.scm b/container.scm
index 32b403e..df97a46 100644
--- a/container.scm
+++ b/container.scm
@@ -66,10 +66,13 @@
(httpd-directive 'Require 'all 'granted))
(httpd-directive 'WSGIScriptAlias aliased-path wsgi-file))))
-(define (koszko-httpd-server-meta server-name)
- (list (httpd-directive 'ServerName server-name)
- (httpd-directive 'ServerAlias (string-append "www." server-name))
- (httpd-directive 'ServerAdmin "koszko@koszko.org")))
+(define* (koszko-httpd-server-meta server-name #:optional (use-www-alias #t))
+ (let ((basic-dirs (list (httpd-directive 'ServerName server-name)
+ (httpd-directive 'ServerAdmin "koszko@koszko.org"))))
+ (if use-www-alias
+ (cons (httpd-directive 'ServerAlias (string-append "www." server-name))
+ basic-dirs)
+ basic-dirs)))
(define (koszko-httpd-redirect-if-other-host host-name)
(httpd-tag 'If (list (format #f "%{HTTP_HOST} != '~a'" host-name))
@@ -182,6 +185,12 @@
(g-string-append (local-file (string-append %here "/hydrilla-wsgi.py"))
"/$1")))))
+(define %hydrillarepos-virtualhost
+ (httpd-virtualhost
+ "*:80"
+ `(,@(koszko-httpd-server-meta "hydrillarepos.koszko.org" #f)
+ ,(httpd-directive 'DocumentRoot "/srv/http/hydrillarepos.koszko.org"))))
+
(define %wsgi-module
(httpd-module
(name "wsgi_module")
@@ -249,7 +258,8 @@
%hydrillabugs-virtualhost
%hachettebugs-virtualhost
%haketilo-virtualhost
- %hydrilla-virtualhost))
+ %hydrilla-virtualhost
+ %hydrillarepos-virtualhost))
(service
(shepherd-service-type
'dummy-network
diff --git a/guix-container.sh b/guix-container.sh
index 3167ac7..42ba006 100755
--- a/guix-container.sh
+++ b/guix-container.sh
@@ -85,11 +85,13 @@ start() {
LOG_REAL="$LOG_DIR"/container
ETC_REAL="$HOST_SYSTEM_ROOT"/etc/guix-container
VAR_HYDRILLA_REAL="$HOST_SYSTEM_ROOT"/var/lib/hydrilla
+ REPOS_REAL="$HOST_SYSTEM_ROOT"/var/www/hydrillarepos.koszko.org/html
HTTP_DIR_SHARE_OPT=--share="$KOSZKO_SIDELOAD_REAL"=/srv/http/koszko.org
LOG_DIR_SHARE_OPT=--share="$LOG_REAL"=/var/log
ETC_DIR_SHARE_OPT=--share="$ETC_REAL"=/etc
VAR_HYDRILLA_DIR_SHARE_OPT=--share="$VAR_HYDRILLA_REAL"=/var/lib/hydrilla
+ REPOS_SHARE_OPT=--share="$REPOS_REAL"=/srv/http/hydrillarepos.koszko.org
mkdir --mode=700 -p "$LOG_DIR"
mkdir --mode=700 -p "$LOG_DIR"/container
@@ -98,6 +100,7 @@ start() {
"$LOG_DIR_SHARE_OPT" \
"$ETC_DIR_SHARE_OPT" \
"$VAR_HYDRILLA_DIR_SHARE_OPT" \
+ "$REPOS_SHARE_OPT" \
>> "$LOG_DIR"/stdout.log 2>> "$LOG_DIR"/stderr.log &
GUILE_PID=$!
diff --git a/hosts-extra b/hosts-extra
index 0debbef..f889977 100644
--- a/hosts-extra
+++ b/hosts-extra
@@ -16,3 +16,5 @@
10.207.87.2 www.haketilo.koszko.org
10.207.87.2 hydrilla.koszko.org
10.207.87.2 www.hydrilla.koszko.org
+10.207.87.2 hydrillarepos.koszko.org
+10.207.87.2 www.hydrillarepos.koszko.org