From patchwork Sun Apr 11 08:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: david larsson X-Patchwork-Id: 28451 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 69BAA27BC71; Sun, 11 Apr 2021 09:46:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E19A927BC70 for ; Sun, 11 Apr 2021 09:46:14 +0100 (BST) Received: from localhost ([::1]:47964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVVjS-0005mt-1W for patchwork@mira.cbaines.net; Sun, 11 Apr 2021 04:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVVjG-0005lZ-Em for guix-patches@gnu.org; Sun, 11 Apr 2021 04:46:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVVjG-0008LU-6e for guix-patches@gnu.org; Sun, 11 Apr 2021 04:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVVjG-0003j2-4g for guix-patches@gnu.org; Sun, 11 Apr 2021 04:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47704] [PATCH] services: mysql: Add extra-environment as configuration option. Resent-From: david larsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Apr 2021 08:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47704 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47704@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161813071414245 (code B ref -1); Sun, 11 Apr 2021 08:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Apr 2021 08:45:14 +0000 Received: from localhost ([127.0.0.1]:53962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVViN-0003hX-T5 for submit@debbugs.gnu.org; Sun, 11 Apr 2021 04:45:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:48412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVViJ-0003hI-O7 for submit@debbugs.gnu.org; Sun, 11 Apr 2021 04:45:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVViJ-0005Cj-Gk for guix-patches@gnu.org; Sun, 11 Apr 2021 04:45:03 -0400 Received: from server0.selfhosted.xyz ([217.64.149.7]:51200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVViG-0007dI-BN for guix-patches@gnu.org; Sun, 11 Apr 2021 04:45:03 -0400 Received: from server0.selfhosted.xyz (localhost [127.0.0.1]) by server0.selfhosted.xyz (Postfix) with ESMTP id 9773B1D08398 for ; Sun, 11 Apr 2021 10:44:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfhosted.xyz; s=dkim; t=1618130689; bh=NvxHACZ+e8H7FjsLRsozdI8CQBzraNkq+U9du13nHi4=; h=Date:From:To:Subject; b=VRyJZl8DLggIar6Nj2heDxnHZeirzGSX+uXJyMTVsbarMGvx//kvhnxrRtJnl2WD7 PRBTFNanZL+4I0deTkqMos8bHUsfd4LJNiKvc3daNv0ZBvVBq+f12T8xWROCwNXit5 JLay3BKeOOqQv8FwT3fz8VG4FdnA1mRBHnw+z344mKMfI6TcMGG88o3lV358Wj06TT 89ArMmx0qy6JpxxS9tEXNi0B8XW0BoGr0p5uRp6Q1GPWT9DDsvooTssR70JaG4ERw3 IncwCQYgErQ/Kmklw8M4Vjzc35xf+ve6IlNZBdOxTv7OVutOq9jitexCjfKYHz8ju9 vdj0EFH0ahS0Q== X-Fuglu-Suspect: 4ccbea31caa04b95a9482c87fb3ed6d5 X-Fuglu-Spamstatus: NO Received: from webmail.selfhosted.xyz (office.selfhosted.xyz [192.168.1.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mail@selfhosted.xyz) by server0.selfhosted.xyz (Postfix) with ESMTPSA for ; Sun, 11 Apr 2021 10:44:43 +0200 (CEST) MIME-Version: 1.0 Date: Sun, 11 Apr 2021 10:44:43 +0200 From: david larsson Message-ID: <91c1726e12b938f7656d7d7862920f69@selfhosted.xyz> X-Sender: david.larsson@selfhosted.xyz Received-SPF: pass client-ip=217.64.149.7; envelope-from=david.larsson@selfhosted.xyz; helo=server0.selfhosted.xyz X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.33, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi! This patch is needed for the Galera add-on to MariaDB, which runs some scripts like for example wsrep_sst_rsync that needs access to additional binaries in PATH. I tested the patch with (and without) below snippets to the mysql-service in my config.scm and successfully connected to a MariaDB/Galera cluster. I ran these commands to test: guix pull --url=/home/user1/src/guix --profile=/tmp/guix.master --disable-authentication --allow-downgrades ; GUIX_PROFILE="/tmp/guix.master" ; . "$GUIX_PROFILE/etc/profile" ; guix system reconfigure config.scm --fallback --allow-downgrades ------------------------------------------------------------------ (extra-environment #~(list (string-append "PATH=/usr/bin:/bin:" #$rsync "/bin:" #$coreutils "/bin:" #$gawk "/bin:" #$grep "/bin:" #$mariadb "/bin:" #$iproute "/sbin:" "/run/setuid-programs:/run/current-system/profile/bin:/run/current-system/profile/sbin" ) (string-append "SHELL=" #$bash) "USER=mysql" "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt" "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs")) (extra-content #~(string-append "log_error=/var/lib/mysql/log_error.log # https://www.percona.com/blog/2017/07/26/what-is-innodb_autoinc_lock_mode-and-why-should-i-care/ binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 # Galera Provider Configuration wsrep_on=ON wsrep_provider=" #$galera "/lib/libgalera_smm.so # Galera Cluster Configuration wsrep_cluster_name=\"test_cluster\" wsrep_cluster_address=\"gcomm://redacted,redacted\" # according to https://galeracluster.com/library/documentation/mysql-wsrep-options.html # leaving it empty starts a new cluster, so you should immediately reconfigure again after doing this. #wsrep_cluster_address=\"gcomm://\" # Galera Synchronization Configuration wsrep_sst_method=rsync # Galera Node Configuration wsrep_node_address=\"redacted\" wsrep_node_name=\"librem13v3guixsd\"")) )) ------------------------------------------------------------------ Please someone also review [bug#47517] [PATCH] gnu: nginx: Enable stream module which adds support for tcp loadbalancing that can be used to scale a MariaDB/Galera cluster. Best regards, David From 927444652f4b774928de78c1558b4e942abff203 Mon Sep 17 00:00:00 2001 From: methuselah-0 Date: Sun, 11 Apr 2021 10:30:01 +0200 Subject: [PATCH] services: mysql: Add extra-environment as configuration option. * gnu/services/databases.scm (mysql-configuration): Add extra-environment (mysql-service): Use #:log-file and #:environment-variables * doc/guix.texi: Document it. --- doc/guix.texi | 3 +++ gnu/services/databases.scm | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index c23d044ff5..298585a695 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19809,6 +19809,9 @@ Socket file to use for local (non-network) connections. @item @code{extra-content} (default: @code{""}) Additional settings for the @file{my.cnf} configuration file. +@item @code{extra-environment} (default: @code{#~'()}) +List of environment variables passed to the @command{mysqld} process. + @item @code{auto-upgrade?} (default: @code{#t}) Whether to automatically run @command{mysql_upgrade} after starting the service. This is necessary to upgrade the @dfn{system schema} after diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index a841e7a50e..8d266c1cba 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2018 Julien Lepiller ;;; Copyright © 2019 Robert Vollmert ;;; Copyright © 2020 Marius Bakke +;;; Copyright © 2021 David Larsson ;;; ;;; This file is part of GNU Guix. ;;; @@ -527,6 +528,7 @@ created after the PostgreSQL database is started."))) (port mysql-configuration-port (default 3306)) (socket mysql-configuration-socket (default "/run/mysqld/mysqld.sock")) (extra-content mysql-configuration-extra-content (default "")) + (extra-environment mysql-configuration-extra-environment (default #~'())) (auto-upgrade? mysql-configuration-auto-upgrade? (default #t))) (define %mysql-accounts @@ -611,11 +613,14 @@ FLUSH PRIVILEGES; (provision '(mysql)) (documentation "Run the MySQL server.") (start (let ((mysql (mysql-configuration-mysql config)) + (extra-env (mysql-configuration-extra-environment config)) (my.cnf (mysql-configuration-file config))) #~(make-forkexec-constructor (list (string-append #$mysql "/bin/mysqld") (string-append "--defaults-file=" #$my.cnf)) - #:user "mysql" #:group "mysql"))) + #:user "mysql" #:group "mysql" + #:log-file "/var/log/mysqld.log" + #:environment-variables #$extra-env))) (stop #~(make-kill-destructor))))) (define (mysql-upgrade-wrapper mysql socket-file) -- 2.30.2