From b75559179e2914b8187e1d59d2e4154c9d4f1bfe Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 2 Dec 2022 14:27:41 -0500 Subject: services: configuration: Rename location accessor to "source-location". Fixes . * gnu/services/configuration.scm (define-configuration-helper): Rename the accessor of the %location field from "NAME-location" to "NAME-source-location". Signed-off-by: Maxim Cournoyer Reported-by: Pierre Langlois --- gnu/services/configuration.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index dacfc52ba9e..2b3bd4c1f40 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -249,7 +249,7 @@ does not have a default value" field kind))) #'(field ...) #'(field-getter ...) #'(field-default ...)) - (%location #,(id #'stem #'stem #'-location) + (%location #,(id #'stem #'stem #'-source-location) (default (and=> (current-source-location) source-properties->location)) (innate))) -- cgit v1.3 From 10251c4456c4ec97a1f3604431241128f3e04729 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 7 Dec 2022 18:40:42 +0100 Subject: services: zabbix: Don't write user to configuration file. The service already runs with the specified user and group, so there is no use in writing it to the configuration files. This change is mainly done for compatibility with 'zabbix-agent2' which does not understand the User= setting, but also to document the correct data type for the "group" setting. * gnu/services/monitoring.scm (serialize-string): Filter USER and GROUP fields. (group?, serialize-group): Remove variables. (zabbix-server-configuration, zabbix-agent-configuration): Document the GROUP field as 'string'. * doc/guix.texi (Monitoring Services): Adjust accordingly. --- doc/guix.texi | 4 ++-- gnu/services/monitoring.scm | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index a79b7778268..50487a51725 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28126,7 +28126,7 @@ The zabbix-server package. @item @code{user} (default: @code{"zabbix"}) (type: string) User who will run the Zabbix server. -@item @code{group} (default: @code{"zabbix"}) (type: group) +@item @code{group} (default: @code{"zabbix"}) (type: string) Group who will run the Zabbix server. @item @code{db-host} (default: @code{"127.0.0.1"}) (type: string) @@ -28212,7 +28212,7 @@ The zabbix-agent package. @item @code{user} (default: @code{"zabbix"}) (type: string) User who will run the Zabbix agent. -@item @code{group} (default: @code{"zabbix"}) (type: group) +@item @code{group} (default: @code{"zabbix"}) (type: string) Group who will run the Zabbix agent. @item @code{hostname} (default: @code{""}) (type: string) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index d6dc2c1e035..f12b7acb1fe 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -224,15 +224,12 @@ Prometheus.") (define (serialize-string field-name val) - (if (and (string? val) (string=? val "")) + (if (or (eq? 'user field-name) + (eq? 'group field-name) + (and (string? val) (string=? val ""))) "" (serialize-field field-name val))) -(define group? string?) - -(define serialize-group - (const "")) - (define include-files? list?) (define (serialize-include-files field-name val) @@ -256,8 +253,8 @@ Prometheus.") (user (string "zabbix") "User who will run the Zabbix server.") - (group ;for zabbix-server-account procedure - (group "zabbix") + (group + (string "zabbix") "Group who will run the Zabbix server.") (db-host (string "127.0.0.1") @@ -438,7 +435,7 @@ results in a Web interface."))) (string "zabbix") "User who will run the Zabbix agent.") (group - (group "zabbix") + (string "zabbix") "Group who will run the Zabbix agent.") (hostname (string "") -- cgit v1.3 From 40153fe03358a69c1b2f53237511f73ee83910a2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 7 Dec 2022 18:47:10 +0100 Subject: services: zabbix-agent: Adjust command-line when using zabbix_agent2. * gnu/services/monitoring.scm (zabbix-agent-arguments): New procedure. (zabbix-agent-shepherd-service): Use that to determine command line arguments. --- gnu/services/monitoring.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index f12b7acb1fe..9a883515663 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -513,6 +513,18 @@ configuration file.")) (format port #$(serialize-configuration config zabbix-agent-configuration-fields))))))) +(define (zabbix-agent-arguments config) + #~(let* ((config-file #$(zabbix-agent-config-file config)) + (agent #$(zabbix-agent-configuration-zabbix-agent config)) + (agent2? (file-exists? (string-append agent "/sbin/zabbix_agent2")))) + (if agent2? + (list (string-append agent "/sbin/zabbix_agent2") + "-config" config-file + "-foreground") + (list (string-append agent "/sbin/zabbix_agentd") + "--config" config-file + "--foreground")))) + (define (zabbix-agent-shepherd-service config) "Return a for Zabbix agent with CONFIG." (list (shepherd-service @@ -520,10 +532,7 @@ configuration file.")) (requirement '(user-processes)) (documentation "Run Zabbix agent daemon.") (start #~(make-forkexec-constructor - (list #$(file-append (zabbix-agent-configuration-zabbix-agent config) - "/sbin/zabbix_agentd") - "--config" #$(zabbix-agent-config-file config) - "--foreground") + #$(zabbix-agent-arguments config) #:user #$(zabbix-agent-configuration-user config) #:group #$(zabbix-agent-configuration-group config) #:pid-file #$(zabbix-agent-configuration-pid-file config) -- cgit v1.3 From ce1f5ff6cff2a3c820c4212ae8d4c4cfa5ae949c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Dec 2022 22:29:35 +0100 Subject: services: cuirass-remote-worker: Rotate logs. * gnu/services/cuirass.scm (cuirass-remote-worker-log-rotations): New procedure. (cuirass-remote-worker-service-type): Use it. --- gnu/services/cuirass.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index d7c6ab9877a..43a1edcb345 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm @@ -394,12 +394,21 @@ CONFIG." #:log-file #$log-file)) (stop #~(make-kill-destructor)))))) +(define (cuirass-remote-worker-log-rotations config) + "Return the list of log rotations that corresponds to CONFIG." + (list (log-rotation + (files (list (cuirass-remote-worker-log-file config))) + (frequency 'weekly) + (options `("rotate 4" ;don't keep too many of them + ,@%default-log-rotation-options))))) + (define cuirass-remote-worker-service-type (service-type (name 'cuirass-remote-worker) (extensions - (list - (service-extension shepherd-root-service-type - cuirass-remote-worker-shepherd-service))) + (list (service-extension shepherd-root-service-type + cuirass-remote-worker-shepherd-service) + (service-extension rottlog-service-type + cuirass-remote-worker-log-rotations))) (description "Run the Cuirass remote build worker service."))) -- cgit v1.3 From ac682963a385a44874d91052fd5845f2cc0e8f3e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Dec 2022 22:38:24 +0100 Subject: service: cuirass: Rotate remote server logs. * gnu/services/cuirass.scm (cuirass-log-rotations): Add the remote server log when it is used. --- gnu/services/cuirass.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index 43a1edcb345..43b0e0946ee 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm @@ -302,8 +302,13 @@ (define (cuirass-log-rotations config) "Return the list of log rotations that corresponds to CONFIG." (list (log-rotation - (files (list (cuirass-configuration-log-file config) - (cuirass-configuration-web-log-file config))) + (files (append (list (cuirass-configuration-log-file config) + (cuirass-configuration-web-log-file config)) + (let ((server + (cuirass-configuration-remote-server config))) + (if server + (list (cuirass-remote-server-log-file server)) + '())))) (frequency 'weekly) (options `("rotate 40" ;worth keeping ,@%default-log-rotation-options))))) -- cgit v1.3 From 9ccc94afb266428b7feeba805617d31eb8afb23c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Dec 2022 23:05:00 +0100 Subject: services: guix-publish: Keep fewer rotated logs. * gnu/services/base.scm (%guix-publish-log-rotations): Add 'options' field. --- gnu/services/base.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 370696a55e1..ba59e46155d 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2016,7 +2016,9 @@ raise a deprecation warning if the 'compression-level' field was used." (define %guix-publish-log-rotations (list (log-rotation - (files (list "/var/log/guix-publish.log"))))) + (files (list "/var/log/guix-publish.log")) + (options `("rotate 4" ;don't keep too many of them + ,@%default-log-rotation-options))))) (define (guix-publish-activation config) (let ((cache (guix-publish-configuration-cache config))) -- cgit v1.3 From 9336baf258d6fc19e5dfa5bcfc7892d239f24837 Mon Sep 17 00:00:00 2001 From: Bruno Victal Date: Thu, 1 Dec 2022 18:09:47 +0000 Subject: services: configuration: Rewrite 'alist?' procedure. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/configuration.scm (alist?): Rewrite. Co-authored-by: Ludovic Courtès --- gnu/services/configuration.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 2b3bd4c1f40..10cb933ed1c 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -436,7 +436,11 @@ the list result in @code{#t} when applying PRED? on them." (define list-of-strings? (list-of string?)) -(define alist? list?) +(define alist? + (match-lambda + (() #t) + ((head . tail) (and (pair? head) (alist? tail))) + (_ #f))) (define serialize-file-like empty-serializer) -- cgit v1.3 From 8d6feb4b10752fa0261d54d2d906642a5fcc08fa Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 29 Nov 2022 20:39:29 -0300 Subject: services: wireguard: Use the parameterized wireguard package. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/vpn.scm (wireguard-activation): Use the "wg" binary from the package given to . Signed-off-by: 宋文武 --- gnu/services/vpn.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index def381987b4..7b3bb8903c3 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -833,7 +833,7 @@ PostUp = ~a set %i private-key ~a (define (wireguard-activation config) (match-record config - (private-key) + (private-key wireguard) #~(begin (use-modules (guix build utils) (ice-9 popen) @@ -842,7 +842,7 @@ PostUp = ~a set %i private-key ~a (unless (file-exists? #$private-key) (let* ((pipe (open-input-pipe (string-append - #$(file-append wireguard-tools "/bin/wg") + #$(file-append wireguard "/bin/wg") " genkey"))) (key (read-line pipe))) (call-with-output-file #$private-key -- cgit v1.3