GNU bug report logs -
#62102
[PATCH] services: Add whoogle-service-type.
Previous Next
Reported by: conses <contact <at> conses.eu>
Date: Fri, 10 Mar 2023 20:13:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62102 in the body.
You can then email your comments to 62102 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Fri, 10 Mar 2023 20:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
conses <contact <at> conses.eu>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Fri, 10 Mar 2023 20:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
---
gnu/services/web.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index d56e893527..66cc640a6d 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -35,6 +35,7 @@ (define-module (gnu services web)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu services admin)
+ #:use-module (gnu services configuration)
#:use-module (gnu services getmail)
#:use-module (gnu services mail)
#:use-module (gnu system pam)
@@ -46,6 +47,7 @@ (define-module (gnu services web)
#:use-module (gnu packages patchutils)
#:use-module (gnu packages php)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages guile)
#:use-module (gnu packages logging)
@@ -235,6 +237,9 @@ (define-module (gnu services web)
varnish-service-type
+ whoogle-service-type
+ whoogle-configuration
+
patchwork-database-configuration
patchwork-database-configuration?
patchwork-database-configuration-engine
@@ -1575,6 +1580,47 @@ (define varnish-service-type
(default-value
(varnish-configuration))))
+
+;;;
+;;; Whoogle
+;;;
+
+(define-configuration/no-serialization whoogle-configuration
+ (whoogle
+ (package whoogle-search)
+ "The @code{whoogle-search} package to use."))
+
+(define (whoogle-shepherd-service config)
+ (list
+ (shepherd-service
+ (provision '(whoogle-search))
+ (start #~(make-forkexec-constructor
+ (list (string-append #$(whoogle-configuration-whoogle config)
+ "/bin/whoogle-search"))
+ #:environment-variables
+ (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
+ (default-environment-variables))))
+ (stop #~(make-kill-destructor))
+ (documentation "Run a @code{whoogle-search} instance."))))
+
+(define (whoogle-profile-service config)
+ (list
+ (whoogle-configuration-whoogle config)))
+
+(define whoogle-service-type
+ (service-type
+ (name 'whoogle-search)
+ (extensions
+ (list
+ (service-extension
+ shepherd-root-service-type
+ whoogle-shepherd-service)
+ (service-extension
+ profile-service-type
+ whoogle-profile-service)))
+ (default-value (whoogle-configuration))
+ (description "Run the @code{whoogle-search} engine.")))
+
;;;
;;; Patchwork
--
2.39.1
--
Best regards,
conses
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Fri, 31 Mar 2023 11:40:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 62102 <at> debbugs.gnu.org (full text, mbox):
Hi,
On 2023-03-10 20:11, conses wrote:
>
> + whoogle-service-type
> + whoogle-configuration
> +
[...]
> patchwork-database-configuration
> patchwork-database-configuration?
> patchwork-database-configuration-engine
> @@ -1575,6 +1580,47 @@ (define varnish-service-type
> (default-value
> (varnish-configuration))))
>
> +
Missing page-break character here?
If you're using Emacs you can insert one with C-q C-l.
> +;;;
> +;;; Whoogle
> +;;;
> +
> +(define-configuration/no-serialization whoogle-configuration
> + (whoogle
> + (package whoogle-search)
> + "The @code{whoogle-search} package to use."))
I prefer this field to be named 'package' instead, to make it less prone
to confusion. The accessor, whoogle-configuration-package, should be exported
as well.
> +(define (whoogle-shepherd-service config)
> + (list
> + (shepherd-service
> + (provision '(whoogle-search))
> + (start #~(make-forkexec-constructor
> + (list (string-append #$(whoogle-configuration-whoogle config)
> + "/bin/whoogle-search"))
In general, you may prefer to use match-record instead of using accessors
as it results in much less code to type.
> + #:environment-variables
> + (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
> + (default-environment-variables))))
Is (default-environment-variables) necessary?
> + (stop #~(make-kill-destructor))
> + (documentation "Run a @code{whoogle-search} instance."))))
> +
> +(define (whoogle-profile-service config)
> + (list
> + (whoogle-configuration-whoogle config)))
[...]
> +
> +(define whoogle-service-type
> + (service-type
> + (name 'whoogle-search)
> + (extensions
> + (list
> + (service-extension
> + shepherd-root-service-type
> + whoogle-shepherd-service)
> + (service-extension
> + profile-service-type
> + whoogle-profile-service)))
You can use match-record here or use the accessor here instead.
(e.g., (compose list whoogle-configuration-package))
Could you add a system test for this service as well?
It makes things easier to check and maintain.
Cheers,
Bruno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Fri, 09 Jun 2023 21:05:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 62102 <at> debbugs.gnu.org (full text, mbox):
Hi conses,
Did you have a chance to look into Bruno’s suggestions below?
Please let us know what you think.
Thanks in advance,
Ludo’.
Bruno Victal <mirai <at> makinata.eu> skribis:
> Hi,
>
> On 2023-03-10 20:11, conses wrote:
>>
>> + whoogle-service-type
>> + whoogle-configuration
>> +
>
> [...]
>
>> patchwork-database-configuration
>> patchwork-database-configuration?
>> patchwork-database-configuration-engine
>> @@ -1575,6 +1580,47 @@ (define varnish-service-type
>> (default-value
>> (varnish-configuration))))
>>
>> +
>
> Missing page-break character here?
> If you're using Emacs you can insert one with C-q C-l.
>
>> +;;;
>> +;;; Whoogle
>> +;;;
>> +
>> +(define-configuration/no-serialization whoogle-configuration
>> + (whoogle
>> + (package whoogle-search)
>> + "The @code{whoogle-search} package to use."))
>
> I prefer this field to be named 'package' instead, to make it less prone
> to confusion. The accessor, whoogle-configuration-package, should be exported
> as well.
>
>> +(define (whoogle-shepherd-service config)
>> + (list
>> + (shepherd-service
>> + (provision '(whoogle-search))
>> + (start #~(make-forkexec-constructor
>> + (list (string-append #$(whoogle-configuration-whoogle config)
>> + "/bin/whoogle-search"))
>
> In general, you may prefer to use match-record instead of using accessors
> as it results in much less code to type.
>
>> + #:environment-variables
>> + (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
>> + (default-environment-variables))))
>
> Is (default-environment-variables) necessary?
>
>> + (stop #~(make-kill-destructor))
>> + (documentation "Run a @code{whoogle-search} instance."))))
>> +
>> +(define (whoogle-profile-service config)
>> + (list
>> + (whoogle-configuration-whoogle config)))
>
> [...]
>
>> +
>> +(define whoogle-service-type
>> + (service-type
>> + (name 'whoogle-search)
>> + (extensions
>> + (list
>> + (service-extension
>> + shepherd-root-service-type
>> + whoogle-shepherd-service)
>> + (service-extension
>> + profile-service-type
>> + whoogle-profile-service)))
>
> You can use match-record here or use the accessor here instead.
> (e.g., (compose list whoogle-configuration-package))
>
>
> Could you add a system test for this service as well?
> It makes things easier to check and maintain.
>
>
> Cheers,
> Bruno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Fri, 09 Jun 2023 21:08:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 62102 <at> debbugs.gnu.org (full text, mbox):
On 2023-06-09 23:03, Ludovic Courtès wrote:
> Hi conses,
>
> Did you have a chance to look into Bruno’s suggestions below?
>
> Please let us know what you think.
>
Hey Ludovic,
Yes, I've noted them but I haven't gotten around to implementing them
yet. I'll give this a shot soon.
>
> Bruno Victal <mirai <at> makinata.eu> skribis:
>
>> Hi,
>>
>> On 2023-03-10 20:11, conses wrote:
>>>
>>> + whoogle-service-type
>>> + whoogle-configuration
>>> +
>>
>> [...]
>>
>>> patchwork-database-configuration
>>> patchwork-database-configuration?
>>> patchwork-database-configuration-engine
>>> @@ -1575,6 +1580,47 @@ (define varnish-service-type
>>> (default-value
>>> (varnish-configuration))))
>>>
>>> +
>>
>> Missing page-break character here?
>> If you're using Emacs you can insert one with C-q C-l.
>>
>>> +;;;
>>> +;;; Whoogle
>>> +;;;
>>> +
>>> +(define-configuration/no-serialization whoogle-configuration
>>> + (whoogle
>>> + (package whoogle-search)
>>> + "The @code{whoogle-search} package to use."))
>>
>> I prefer this field to be named 'package' instead, to make it less prone
>> to confusion. The accessor, whoogle-configuration-package, should be exported
>> as well.
>>
>>> +(define (whoogle-shepherd-service config)
>>> + (list
>>> + (shepherd-service
>>> + (provision '(whoogle-search))
>>> + (start #~(make-forkexec-constructor
>>> + (list (string-append #$(whoogle-configuration-whoogle config)
>>> + "/bin/whoogle-search"))
>>
>> In general, you may prefer to use match-record instead of using accessors
>> as it results in much less code to type.
>>
>>> + #:environment-variables
>>> + (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
>>> + (default-environment-variables))))
>>
>> Is (default-environment-variables) necessary?
>>
>>> + (stop #~(make-kill-destructor))
>>> + (documentation "Run a @code{whoogle-search} instance."))))
>>> +
>>> +(define (whoogle-profile-service config)
>>> + (list
>>> + (whoogle-configuration-whoogle config)))
>>
>> [...]
>>
>>> +
>>> +(define whoogle-service-type
>>> + (service-type
>>> + (name 'whoogle-search)
>>> + (extensions
>>> + (list
>>> + (service-extension
>>> + shepherd-root-service-type
>>> + whoogle-shepherd-service)
>>> + (service-extension
>>> + profile-service-type
>>> + whoogle-profile-service)))
>>
>> You can use match-record here or use the accessor here instead.
>> (e.g., (compose list whoogle-configuration-package))
>>
>>
>> Could you add a system test for this service as well?
>> It makes things easier to check and maintain.
>>
>>
>> Cheers,
>> Bruno
--
Best regards,
Miguel Ángel Moreno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Tue, 08 Aug 2023 15:27:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 62102 <at> debbugs.gnu.org (full text, mbox):
Hey,
Miguel Ángel Moreno <contact <at> conses.eu> skribis:
> On 2023-06-09 23:03, Ludovic Courtès wrote:
>
>> Hi conses,
>>
>> Did you have a chance to look into Bruno’s suggestions below?
>>
>> Please let us know what you think.
>>
>
> Hey Ludovic,
>
> Yes, I've noted them but I haven't gotten around to implementing them
> yet. I'll give this a shot soon.
Friendly ping! :-)
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Sun, 13 Aug 2023 11:45:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 62102 <at> debbugs.gnu.org (full text, mbox):
* gnu/services/web.scm (whoogle-service-type): New variable.
* doc/guix.texi (Web Services): Document it.
---
doc/guix.texi | 32 +++++++++++++++++++++++++
gnu/services/web.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 409ca2ad62..35746ec21e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31031,6 +31031,38 @@ Web Services
@end table
@end deftp
+@subheading Whoogle Search
+@cindex Whoogle Search
+@uref{https://github.com/benbusby/whoogle-search, Whoogle Search} is a
+self-hosted, ad-free, privacy-respecting metasearch engine that collects
+and displays Google search results.
+
+@defvar whoogle-service-type
+Service type for Whoogle Search.
+@end defvar
+
+@deftp {Data Type} whoogle-configuration
+Data type representing Whoogle Search service configuration.
+
+@table @asis
+@item @code{package} (default: @code{whoogle-search})
+The Whoogle Search package to use.
+
+@item @code{host} (default: @code{"127.0.0.1"})
+The host address to run Whoogle on.
+
+@item @code{port} (default: @code{5000})
+The port where Whoogle will be exposed.
+
+@item @code{environment-variables} (default: @code{'()})
+A list of strings with the environment variables to configure Whoogle.
+You can consult
+@uref{https://github.com/benbusby/whoogle-search/blob/main/whoogle.template.env,
+its environment variables template} for the list of available options.
+
+@end table
+@end deftp
+
@subsubheading Patchwork
@cindex Patchwork
Patchwork is a patch tracking system. It can collect patches sent to a
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 818226a4f7..ed53572eec 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -16,6 +16,7 @@
;;; Copyright © 2020, 2021 Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
;;; Copyright © 2022 Simen Endsjø <simendsjo <at> gmail.com>
;;; Copyright © 2023 Bruno Victal <mirai <at> makinata.eu>
+;;; Copyright © 2023 Miguel Ángel Moreno <mail <at> migalmoreno.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -36,6 +37,7 @@ (define-module (gnu services web)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu services admin)
+ #:use-module (gnu services configuration)
#:use-module (gnu services getmail)
#:use-module (gnu services mail)
#:use-module (gnu system pam)
@@ -47,6 +49,7 @@ (define-module (gnu services web)
#:use-module (gnu packages patchutils)
#:use-module (gnu packages php)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages guile)
#:use-module (gnu packages logging)
@@ -240,6 +243,13 @@ (define-module (gnu services web)
varnish-service-type
+ whoogle-service-type
+ whoogle-configuration
+ whoogle-configuration-package
+ whoogle-configuration-host
+ whoogle-configuration-port
+ whoogle-configuration-environment-variables
+
patchwork-database-configuration
patchwork-database-configuration?
patchwork-database-configuration-engine
@@ -1604,6 +1614,52 @@ (define varnish-service-type
(default-value
(varnish-configuration))))
+
+;;;
+;;; Whoogle
+;;;
+
+(define-configuration/no-serialization whoogle-configuration
+ (package
+ (package whoogle-search)
+ "The @code{whoogle-search} package to use.")
+ (host
+ (string "127.0.0.1")
+ "The host address to run Whoogle on.")
+ (port
+ (integer 5000)
+ "The port to run Whoogle on.")
+ (environment-variables
+ (list-of-strings '())
+ "A list of strings specifying environment variables used to configure
+Whoogle."))
+
+(define (whoogle-shepherd-service config)
+ (match-record config <whoogle-configuration>
+ (package host port environment-variables)
+ (list
+ (shepherd-service
+ (provision '(whoogle-search))
+ (start #~(make-forkexec-constructor
+ (list (string-append #$package "/bin/whoogle-search")
+ "--host" #$host "--port" #$(number->string port))
+ #:environment-variables
+ (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
+ '#$environment-variables)))
+ (stop #~(make-kill-destructor))
+ (documentation "Run a @code{whoogle-search} instance.")))))
+
+(define whoogle-service-type
+ (service-type
+ (name 'whoogle-search)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ whoogle-shepherd-service)
+ (service-extension profile-service-type
+ (compose list whoogle-configuration-package))))
+ (default-value (whoogle-configuration))
+ (description "Set up the @code{whoogle-search} metasearch engine.")))
+
;;;
;;; Patchwork
--
2.41.0
--
Best regards,
Miguel Ángel Moreno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Sun, 13 Aug 2023 11:45:03 GMT)
Full text and
rfc822 format available.
Message #23 received at 62102 <at> debbugs.gnu.org (full text, mbox):
On 2023-08-08 17:26, Ludovic Courtès wrote:
> Hey,
>
Hi Ludovic,
> Miguel Ángel Moreno <contact <at> conses.eu> skribis:
>
>> On 2023-06-09 23:03, Ludovic Courtès wrote:
>>
>>> Hi conses,
>>>
>>> Did you have a chance to look into Bruno’s suggestions below?
>>>
>>> Please let us know what you think.
>>>
I addressed Bruno's points, added extra fields to configure this service
further, and documented these in the manual.
In regard to tests, I had a glance at ./tests/services/ to see what kind
of tests there were, and most them test serialization or some
service-specific feature. Since Whoogle is essentially a Flask web
application, I wouldn't know how to go about testing it in the context
of a service.
Other than that, happy to hear your feedback on the new revision :)
>>
>> Hey Ludovic,
>>
>> Yes, I've noted them but I haven't gotten around to implementing them
>> yet. I'll give this a shot soon.
>
> Friendly ping! :-)
>
> Ludo’.
--
Best regards,
Miguel Ángel Moreno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Mon, 12 Feb 2024 05:34:03 GMT)
Full text and
rfc822 format available.
Message #26 received at 62102 <at> debbugs.gnu.org (full text, mbox):
Hi,
Friendly ping on this patch :)
--
Best regards,
Miguel Ángel Moreno
Information forwarded
to
guix-patches <at> gnu.org
:
bug#62102
; Package
guix-patches
.
(Mon, 19 Feb 2024 21:26:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 62102 <at> debbugs.gnu.org (full text, mbox):
Hi,
Miguel Ángel Moreno <mail <at> migalmoreno.com> skribis:
> * gnu/services/web.scm (whoogle-service-type): New variable.
> * doc/guix.texi (Web Services): Document it.
Finally applied! I followed up by expanding the Whoogle intro in the
manual a bit.
Things nice-to-have that come to mind:
• A system test. This is normally required for all new system
services. I was willing to make an exception here because it’s
already taken way too long, but would be nice to have such a test to
ensure the service actually keeps working.
• Running the daemon with ‘least-authority-wrapper’. It’s a good idea
for all network-facing daemons.
• Adding a Home service via ‘define-service-type-mapping’.
Thanks,
Ludo’.
bug closed, send any further explanations to
62102 <at> debbugs.gnu.org and conses <contact <at> conses.eu>
Request was from
Ludovic Courtès <ludo <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Feb 2024 21:26:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 19 Mar 2024 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.