;; SPDX-License-Identifier: CC0-1.0 ;; Copyright (C) 2022 Wojtek Kosior ;; ;; Available under the terms of Creative Commons Zero v1.0 Universal. (use-modules (gnu)) (use-modules (koszko-org-website)) (use-package-modules web) (use-service-modules web) (use-service-modules shepherd) (define %koszko-org-virtualhost (httpd-virtualhost "*:80" (list "\ ServerName koszko.org ServerAlias www.koszko.org DocumentRoot /srv/http/koszko.org ServerAdmin koszko@koszko.org Redirect permanent / http://koszko.org/ Alias /sideload /srv/http/koszko.org WSGIScriptReloading On " #~(let* ((script-rel "/share/koszko-org-website/wsgi.py") (wsgi-file (string-append #$koszko-org-website script-rel))) (format #f "\ Require all granted WSGIScriptAlias / ~a " wsgi-file wsgi-file))))) (define %wsgi-module (httpd-module (name "wsgi_module") (file (file-append mod-wsgi "/modules/mod_wsgi.so")))) ;; logio is needed for the '%O' log format directive (define %logio-module (httpd-module (name "logio_module") (file (file-append httpd "/modules/mod_logio.so")))) (define %logformat-combined "\"%h %l %u %t \\\"%r\\\" %>s %O \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"\"") (define %koszko-httpd-service (service httpd-service-type (httpd-configuration (config (httpd-config-file (server-name "koszko.org") (error-log "/var/log/httpd/error.log") (modules (cons* %wsgi-module %logio-module %default-httpd-modules)) (extra-config (list (string-join `("LogFormat" ,%logformat-combined "combined")) "\n" "ErrorLog /var/log/httpd/error.log" "\n" "CustomLog /var/log/httpd/access.log combined" "\n" ))))))) (operating-system (host-name "koszko") (timezone "Europe/Warsaw") (file-systems (cons (file-system (device (file-system-label "does-not-matter")) (mount-point "/") (type "ext4")) %base-file-systems)) (bootloader (bootloader-configuration (bootloader grub-bootloader) (targets '("/dev/sdDOES-NOT-MATTER")))) (services (cons* %koszko-httpd-service (simple-service 'koszko-org-website httpd-service-type (list %koszko-org-virtualhost)) (service (shepherd-service-type 'dummy-network (const (shepherd-service (documentation "Provide 'networking' without actually doing anything") (provision '(networking)) (start #~(const #t)) (stop #~(const #t)) (respawn? #f))) (description "Make other services assume network is there.")) #f) %base-services)))