From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id wDrqFTPOuGa74QAAe85BDQ:P1 (envelope-from ) for ; Sun, 11 Aug 2024 14:44:03 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id wDrqFTPOuGa74QAAe85BDQ (envelope-from ) for ; Sun, 11 Aug 2024 16:44:03 +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=IDMIMHnf; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=RcYW5Xsm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1723387443; 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=CqhqDsxmKfhX8XLfiWoMzu6qZu15FDbazPXDTBmQZpM=; b=ffrqxMUzXsSXLyCWuVdmXQD+k23hyPqMkFDdtJbuzouEgfWt+ohXoOuUZcEcfbfEnEn09q 4LMAjk4fmQLtEIxPnN3DzfJFWJU8rASiXgmGTp2VslD/JF+QGiDizDBW4L7jKtLcuoGEXe /ujiapx5WLpBE2d4Qs78SE932qtpj3YXMspyOD64FxVxk+C9K/DqaUJwY9e2vGLptY6rYb Jh/bEppOBHd/HbgNierALaBbDBxbMb//caymVMc16echlQlQq6mfZMK1htDw0xHW+sf9xs t9rbkekO0wEjdl0KVyVq2/fJBseUHQ5dlltEVuz3gV2ogRzERIU2qmurNcWcIA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1723387443; a=rsa-sha256; cv=none; b=lDipbrcHDFhfZCnKOWnCzfXjjPtpjHRWAIM4F0BtlClH9dpjEaA11BpZSXM4BtVnXjH6xL zQXwCqY/PWfOeS/ViVz1uditIxrgleMT8g0IJCaPgHv8ijDPf9GDLncE+wvm8sMxQ2bah5 OXZHCaP8HAVTwGX1o2qjdUZ/5QoBLYyfl7Wf8M1kHJ7umrRLnAacGpuDPjsE3oppNhZ7gA q6arZgBjwoXpdpTvWGcC7D3/pxHTS0k71KtU8BLr3bHW0V52R3Lb+O8vhbtDF4DenldiQX JKrxoAu3VykSOZXplb0TZXL44ihQPvdB06nNz9QppB5Lt15C7sWlDFVgtYvv4w== 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=IDMIMHnf; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=RcYW5Xsm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" 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 C5B2869EDF for ; Sun, 11 Aug 2024 16:44:01 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sd9nK-0008KG-BO; Sun, 11 Aug 2024 10:43:42 -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 1sd9nI-0008Jz-HQ for guix-patches@gnu.org; Sun, 11 Aug 2024 10:43:40 -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 1sd9nF-0002V5-69; Sun, 11 Aug 2024 10:43:38 -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:References:In-Reply-To:Date:From:To:Subject; bh=iZxZr+dMQWBjdmAgwrobnq+2tpzLPsVE7rCJLenlj4I=; b=IDMIMHnfYuUk6XL891zGTHaAafyC2jR5zaSJUH9e+4MxtYhD98LXE9ocCXY9wz5bMhszrHjFrUCOZ6IVmK0Q6YT7hxDyDftXH4RTZKbwPbjdQ/eumGBG3CY4F4IEzKoJIcHboPd21WDK7QfTbecXVRyW0z3gwIk9P2gPXTyoXA55I5HZ3TuZIhV+velDPkACEjg4fCbTjuAbl9RZi8AoDFRmCGLRKd0favnrK8Oq6IZjrOBMGQy8D53wS38kdho30ulk3SIJiAUeoqyo9g4Qr9Q0/2bvTy5ix5KXA7X2fIkpkPkP+NI2erAKZI4dn9PmNMI2tkzC6xALkMEzidd3kw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sd9ne-00073V-6V; Sun, 11 Aug 2024 10:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72577] [PATCH 1/1] services: agate: Change variable names and add system test. Resent-From: Rodion Goritskov Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sun, 11 Aug 2024 14:44: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 , Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 72577-submit@debbugs.gnu.org id=B72577.172338738827053 (code B ref 72577); Sun, 11 Aug 2024 14:44:02 +0000 Received: (at 72577) by debbugs.gnu.org; 11 Aug 2024 14:43:08 +0000 Received: from localhost ([127.0.0.1]:41837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd9mm-00072G-8g for submit@debbugs.gnu.org; Sun, 11 Aug 2024 10:43:08 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:44448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd9mj-00071l-It for 72577@debbugs.gnu.org; Sun, 11 Aug 2024 10:43:06 -0400 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-428ec6c190eso26706655e9.1 for <72577@debbugs.gnu.org>; Sun, 11 Aug 2024 07:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723387289; x=1723992089; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iZxZr+dMQWBjdmAgwrobnq+2tpzLPsVE7rCJLenlj4I=; b=RcYW5XsmRYb2oN31ikDYZpWIWUxFztZaWaofkGgT/FusTefaVQivd1KHo7Qk6dWxsy FogSPHFhmo82Lomqsb7Pp3PSnB9ai//0q8BCV+CAcThnpC9F90e1ZZX+A6glX5c/U0bG TsVG/YebYQEPuKpF3MTso3OYP2SjKIT4CamBfoou5QPe8U1SOYiijDQGailSBQFldrxn 7dL2Unr3HM/lkuFS7BBAwX4T5P9bJXtVp02kH/N8zwicGUTnLCe1JyY6OIBvW+djn+NE bqocQLa7JAlc3yowDTW8Og2hWydkzgMO8SkWYvyARBK6oxLRf6p4jDIbWk/Xb6/UDs4r MQPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387289; x=1723992089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZxZr+dMQWBjdmAgwrobnq+2tpzLPsVE7rCJLenlj4I=; b=CW4rCLx8rxW94wIgoEbJpyVweoG5i56hwo5SvQgGpf5Hhd2mVNK+/wHduql9GFdphv ZIeM17VW2D32Mw/Vs0YSu0h+Mjrb7H+Kh4bzenmR1Od0+Jy/eLGzXnThxxUifR1/mO9B 4F/+qBTHA5YPobW/Z4yp4dz5FoFzDpqIKmdHBMKofQ2GEHaPrdSEFPtY/mMEGOIFQ3+C LTBy9mbbFl1xzAUTiXuoLsGtcr2DN59IWrVFmgb0LnQl2dpKYh41tAZ75jkNVuXcAtFP S3d/etowmygt5NxFg8qAzkUz1qeuF5QOTnDOsqzQU41/9mVyi/+Q7xG/jxkYMX5W67Kj 2Tvg== X-Gm-Message-State: AOJu0YxackUGr7l7Q1zv+GGz/8sfxxdm5vFMkJ9VhlgnoO3QVmR9TYsA JGb4jgkm90wvFYRZpSA9EUSE/c5QJGDEg1XhcUKLjH3HkD/XyPzihjuNPkvd X-Google-Smtp-Source: AGHT+IE/AHr0UsCOpuJxV/n7hc12QFaQtkOCyT/jqlNfdWF4ajCYcZ3pBWKhApSfJL993NNsNitqjA== X-Received: by 2002:a05:600c:45d0:b0:426:5cee:4abc with SMTP id 5b1f17b1804b1-429c3a29abcmr53241995e9.20.1723387287996; Sun, 11 Aug 2024 07:41:27 -0700 (PDT) Received: from bumblebee-mighty.lan ([92.51.75.166]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c750e510sm68538775e9.13.2024.08.11.07.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:41:27 -0700 (PDT) From: Rodion Goritskov Date: Sun, 11 Aug 2024 18:40:59 +0400 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: C5B2869EDF X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -3.35 X-Spam-Score: -3.35 X-TUID: /I506iIyOUYW * 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 | 8 ++-- gnu/services/web.scm | 38 ++++++++-------- gnu/tests/web.scm | 105 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 127 insertions(+), 24 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6e03d8bbcc..271219c4db 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -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..7adb416c39 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-certificatess + (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)))) -- 2.45.2