From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KIG4Ob+euWZpewAAqHPOHw:P1 (envelope-from ) for ; Mon, 12 Aug 2024 05:33:52 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id KIG4Ob+euWZpewAAqHPOHw (envelope-from ) for ; Mon, 12 Aug 2024 07:33:52 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=IONsIYen; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=Vo9zjQXK; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1723440831; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=z+u0ZAdwRMTgTBLux5//u+8aiPZdjJTHx6/N/vxn7y0=; b=FXuE5649dm5dwf8P6IfoQpT7mS6yAkrfaG4AqTrYeZhuuvcCwcQU1bthJxj2ROQ0SqXAN2 dtfTbvSfdCII/xBvnrF+c6P76ERapSssRP1mg3XFwObd6DoUcp/yDUrFzgDux7bqSfJppg 0tFLxVUNjc3vHITKOfttOkzqfw/j36ymToRnglJohNK1PbnPQ8qq+wUPectEzojdiBLYFw +LtlL4+Q4f/0bGw+PpBaK2NRYGsTErvash/PMxLtellKxGwK9P1stWNeBeAWcQ4DC6grTZ c6VDVFa+hlhw7gCuXjK3/7KmAh0i37+dqNHDtrVqNhlR2x9s+pTUTxqRXD81Dw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=IONsIYen; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=Vo9zjQXK; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1723440831; a=rsa-sha256; cv=none; b=A/5C16hJJJfpizM/k9n0mWnsFy8IM5zzTwc7EWJy5RR+bMzOmmBl8giSgj/jvonCzzUj7b GEqBVl9sBOCBa2aMrxO6atfSDoSjbvtC3ViwZTKpDWf7DLEBZFp5MwsnDkFrWskDIX0YK0 XzkVAHTdEWDsE2RTFlF6lh0We2xipsNgnWFKsNWfYHooNTXeQmL64zoCTugKe4mdwr/Ynd 4Hnu1ejGRYcgt9l932IJ8bJEyJ79kHxXst9pDsGHI/QergTEYqUvfdqJsT3aFq7fjySbIY S1ybDbm9BikloTW9xoPvrUX0wivCFgne7dfUqYezjdB22DosMWvFhakrFFPaeg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E6F866D46 for ; Mon, 12 Aug 2024 07:33:51 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdNgU-0000eK-Aj; Mon, 12 Aug 2024 01:33:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdNgT-0000eB-AZ for guix-patches@gnu.org; Mon, 12 Aug 2024 01:33:33 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdNgS-0006VQ-AN; Mon, 12 Aug 2024 01:33:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=fkB63BWYbrvzEw5pn28h0Wx2wJHCk6ii2LyT7EXNxQA=; b=IONsIYenYbfjVy2WX3lZjRIWs3iIpKtzFG/M3fcgLY+H5he4aUL7tN9DYjfdtHT/XRE1FZ+in9eTgdnRwFyPtJ/bJeynnh9sQvvE7Op0Ze72AbH3Z+M/krmmj13KrfW/LSzsJaTPCyreDUW6z+wB6EzoUMUYvb9bRQPfSk2IYVyapbW2JBYICyWl2lHPC+CCeQiSQ/Bv/nO/qdUOoo3uXxa/eyO0wNJ8GXPRbtoLMAmf+V6ZuK0Evdo2aOZpIOtixAAOlDDNSY6LaZzMP1E59vvhG3KHYOgzcXBqzo3F7tU0PqQPXIEHIw5YqLpONa5OFT29TG+Tm2CHfkOWQCe1gw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sdNgw-0005uJ-Ei; Mon, 12 Aug 2024 01:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72577] [PATCH v2] services: agate: Change variable names and add system test. References: In-Reply-To: Resent-From: Rodion Goritskov Original-Sender: "Debbugs-submit" Resent-CC: rodion.goritskov@gmail.com, pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Mon, 12 Aug 2024 05:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72577 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72577@debbugs.gnu.org Cc: Rodion Goritskov , Rodion Goritskov , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Rodion Goritskov , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 72577-submit@debbugs.gnu.org id=B72577.172344081322655 (code B ref 72577); Mon, 12 Aug 2024 05:34:02 +0000 Received: (at 72577) by debbugs.gnu.org; 12 Aug 2024 05:33:33 +0000 Received: from localhost ([127.0.0.1]:42267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdNgS-0005tJ-8p for submit@debbugs.gnu.org; Mon, 12 Aug 2024 01:33:32 -0400 Received: from mail-lf1-f46.google.com ([209.85.167.46]:47588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdNgP-0005sx-Mb for 72577@debbugs.gnu.org; Mon, 12 Aug 2024 01:33:30 -0400 Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-52f04150796so5042553e87.3 for <72577@debbugs.gnu.org>; Sun, 11 Aug 2024 22:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723440712; x=1724045512; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fkB63BWYbrvzEw5pn28h0Wx2wJHCk6ii2LyT7EXNxQA=; b=Vo9zjQXKhVeJpu6dIT9SUzK6lAYpeR7alyN6Yix6HKo0RqR2Fqb4rSk67MP6OOWS6j FBWKwyL44Qc46tzl/6PKEDIjf0B6MVNspPbd9QsWXkp+/Q/heiKno6KF/KlHtQg1Cs29 Pb5VJx+UFQQDXYuzD+TvOAz8UcdXm/7tusUN5loezI9VfwMP7tzR565qa+M5yiAX8FEU UtpBJVPs/MzSOG9NUFxmIzBtvu1VkfJm0IBeCl3WOtkrAbYFzOhQFxOslySRbh07dPH3 /ErPiAXibh0gmEc6zJ7LOaRxnHAKMOaqDgBrHX7OSu8ROKyYrn0iwpf6izbPLY+j2F8a 1h8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723440712; x=1724045512; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fkB63BWYbrvzEw5pn28h0Wx2wJHCk6ii2LyT7EXNxQA=; b=RnK20N/IWd1N8D1AyKAXf9cxa4NUSvwPXpEeYKJ1+f+FRr7pT3Jxgjf283PK8IQDAP artzHqUgZsHj8sdQ0MGzyioEwioxehayhqBeiQT7vZTnw00gtuxt/A8eNZEE/B96wZBi dkkiuEcr1UwYJJNfXEJxX8rJ2E8E1Tv8vFBRu/G2ffnE82Tht4CWTuDw3J+vLXgXhRAY 9PJ8J98UsYMFWFQVAeW/BIcpBjrxHQvSwqafKhToDpIYkm5+e1N3wnV38nTpAOz1WBku OcHozKe7ODsUHrladKdlP7Y9E32WeII54famHeGusGr43yKJ2gAT4faHwEjJD7A7rVN2 hTlw== X-Gm-Message-State: AOJu0YzzfTl7nD6HrWVT98WHTmnK2NM/jghZzaMPpW+nlaIgNqxf8F3Y Ga9Ekf+Kbob1IffVooVOYUHSKZ3ui6Tt4Sdp5cGO6unS/FbP7PmY2ivdWk+a X-Google-Smtp-Source: AGHT+IFUxaNmfXpKqhOM9pEExZyZ2ag91XywfZiAjb1si+qviTGU9VLi2lFLp0C7UB6edjyh6or09Q== X-Received: by 2002:a05:6512:3ca9:b0:52e:6d71:e8f1 with SMTP id 2adb3069b0e04-530eea0f9ebmr5794720e87.53.1723440710765; Sun, 11 Aug 2024 22:31:50 -0700 (PDT) Received: from bumblebee-old.lan ([92.51.75.166]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a80bb09014csm197991666b.25.2024.08.11.22.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 22:31:50 -0700 (PDT) From: Rodion Goritskov Date: Mon, 12 Aug 2024 09:31:14 +0400 Message-ID: <2b6a6bd5b88bc70fb686930040d1764e195b08dd.1723440525.git.rodion.goritskov@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 7E6F866D46 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -3.35 X-Spam-Score: -3.35 X-TUID: O/w2/aPx6tv+ * doc/guix.texi (Web Services): Update documentation for agate-service-type. * gnu/services/web.scm (agate-configuration): Rename certs, addr, lang and central-conf variables. * gnu/tests/web.scm (%test-agate): Add system test for agate-service-type. Change-Id: Ie14814fca1d5158acd67899da0c3fc2c5b586c72 --- doc/guix.texi | 10 ++--- gnu/services/web.scm | 38 ++++++++-------- gnu/tests/web.scm | 105 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 128 insertions(+), 25 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6e03d8bbcc..8acba533c2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32955,7 +32955,7 @@ Web Services (service agate-service-type (agate-configuration (content "/srv/gemini") - (certs "/srv/gemini-certs"))) + (certificates "/srv/gemini-certs"))) @end lisp The example above represents the minimal tweaking necessary to get Agate @@ -32992,10 +32992,10 @@ Web Services @item @code{content} (default: @file{"/srv/gemini"}) The directory from which Agate will serve files. -@item @code{certs} (default: @file{"/srv/gemini-certs"}) +@item @code{certificates} (default: @file{"/srv/gemini-certs"}) Root of the certificate directory. Must be filled in with a value from the user. -@item @code{addr} (default: @code{'("0.0.0.0:1965" "[::]:1965")}) +@item @code{addresses} (default: @code{'("[::]:1965" "0.0.0.0:1965")}) A list of the addresses to listen on. @item @code{hostnames} (default: @code{'()}) @@ -33003,7 +33003,7 @@ Web Services specified, corresponding directory names should be present in the @code{content} directory. Optional. -@item @code{lang} (default: @code{#f}) +@item @code{languages} (default: @code{#f}) RFC 4646 language code(s) for text/gemini documents. Optional. @item @code{only-tls13?} (default: @code{#f}) @@ -33013,7 +33013,7 @@ Web Services Set to @code{#t} to serve secret files (files/directories starting with a dot). -@item @code{central-conf?} (default: @code{#f}) +@item @code{central-configuration?} (default: @code{#f}) Set to @code{#t} to look for the .meta configuration file in the @code{content} root directory and will ignore @code{.meta} files in other directories diff --git a/gnu/services/web.scm b/gnu/services/web.scm index e8ddb1d987..cc6f4e6d9b 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -2186,20 +2186,20 @@ (define-record-type* (default agate)) (content agate-configuration-content (default "/srv/gemini")) - (certs agate-configuration-certs - (default "/srv/gemini-certs")) - (addr agate-configuration-addr - (default '("0.0.0.0:1965" "[::]:1965"))) - (hostname agate-configuration-hostname - (default '())) - (lang agate-configuration-lang - (default #f)) + (certificates agate-configuration-certificates + (default "/srv/gemini-certs")) + (addresses agate-configuration-addresses + (default '("[::]:1965" "0.0.0.0:1965"))) + (hostnames agate-configuration-hostnames + (default '())) + (languages agate-configuration-languages + (default #f)) (only-tls13? agate-configuration-only-tls13 (default #f)) (serve-secret? agate-configuration-serve-secret (default #f)) - (central-conf? agate-configuration-central-conf - (default #f)) + (central-configuration? agate-configuration-central-configuration + (default #f)) (ed25519? agate-configuration-ed25519 (default #f)) (skip-port-check? agate-configuration-skip-port-check @@ -2215,9 +2215,9 @@ (define-record-type* (define agate-shepherd-service (match-lambda - (($ package content certs addr - hostname lang only-tls13? - serve-secret? central-conf? + (($ package content certificates addresses + hostnames languages only-tls13? + serve-secret? central-configuration? ed25519? skip-port-check? log-ip? user group log-file) (list (shepherd-service @@ -2228,19 +2228,19 @@ (define agate-shepherd-service #~(make-forkexec-constructor (list #$agate "--content" #$content - "--certs" #$certs + "--certs" #$certificates #$@(append-map (lambda x (append '("--addr") x)) - addr) + addresses) #$@(append-map (lambda x (append '("--hostname") x)) - hostname) - #$@(if lang - (list "--lang" lang) + hostnames) + #$@(if languages + (list "--lang" languages) '()) #$@(if serve-secret? '("--serve-secret") '()) #$@(if only-tls13? '("--only-tls13") '()) - #$@(if central-conf? '("--central-conf") '()) + #$@(if central-configuration? '("--central-conf") '()) #$@(if ed25519? '("--ed25519") '()) #$@(if skip-port-check? '("--skip-port-check") '()) #$@(if log-ip? '("--log-ip") '())) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 16dc6bea49..a071e05e1d 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -34,8 +34,10 @@ (define-module (gnu tests web) #:use-module (gnu services shepherd) #:use-module (gnu services mail) #:use-module (gnu packages databases) + #:use-module (gnu packages guile-xyz) #:use-module (gnu packages patchutils) #:use-module (gnu packages python) + #:use-module (gnu packages tls) #:use-module (gnu packages web) #:use-module (guix packages) #:use-module (guix modules) @@ -50,7 +52,8 @@ (define-module (gnu tests web) %test-php-fpm %test-hpcguix-web %test-tailon - %test-patchwork)) + %test-patchwork + %test-agate)) (define %index.html-contents ;; Contents of the /index.html file. @@ -657,3 +660,103 @@ (define %test-patchwork (name "patchwork") (description "Connect to a running Patchwork service.") (value (run-patchwork-test patchwork)))) + + +;;; +;;; Agate +;;; + +(define %index.gmi-contents + ;; Contents of the /index.gmi file. + "Hello, guix!") + +(define %make-agate-root + ;; Create our server root in /srv. + #~(begin + (mkdir "/srv") + (mkdir "/srv/gemini") + (mkdir "/srv/gemini-certs") + ;; Directory should be writable for Agate user to generate certificates + (let ((user (getpw "agate"))) + (chown "/srv/gemini-certs" (passwd:uid user) (passwd:gid user))) + (call-with-output-file (string-append "/srv/gemini/index.gmi") + (lambda (port) + (display #$%index.gmi-contents port))))) + +(define %agate-os + (simple-operating-system + (service dhcp-client-service-type) + (simple-service 'make-agate-root activation-service-type + %make-agate-root) + (service agate-service-type + (agate-configuration + (hostnames '("localhost")))))) + +(define* (run-agate-test name test-os expected-content) + (define os + (marionette-operating-system + test-os + #:imported-modules '((gnu services herd) + (guix combinators)) + #:extensions (list guile-gemini guile-gnutls))) + + (define forwarded-port 1965) + + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((1965 . ,forwarded-port))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-64) + (gnu build marionette)) + + (define marionette + (make-marionette (list #$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin #$name) + + (test-assert #$(string-append name " service running") + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (match (start-service '#$(string->symbol name)) + (#f #f) + (('service response-parts ...) + (match (assq-ref response-parts 'running) + ((#t) #t) + ((pid) (number? pid)))))) + marionette)) + + (test-assert "Agate TCP port ready, IPv4" + (wait-for-tcp-port #$forwarded-port marionette)) + + (test-assert "Agate TCP port ready, IPv6" + (wait-for-tcp-port #$forwarded-port marionette + #:address + '(make-socket-address + AF_INET6 (inet-pton AF_INET6 "::1") #$forwarded-port))) + + (test-equal "Agate responses with the specified index.gmi" + #$expected-content + (marionette-eval '(begin + (use-modules (ice-9 iconv) + (gemini client) + (gemini request) + (gemini response)) + (bytevector->string (gemini-response-body-bytes + (send-gemini-request + (build-gemini-request #:host "localhost" #:port #$forwarded-port))) + "utf8")) marionette)) + + (test-end)))) + (gexp->derivation "agate-test" test)) + +(define %test-agate + (system-test + (name "agate") + (description "Connect to a running Agate service.") + (value (run-agate-test name %agate-os %index.gmi-contents)))) base-commit: 174ecf5b1077d29498d9de22e27b13047f314feb -- 2.45.2