From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iGY2DRdgc2CfiwAAgWs5BA (envelope-from ) for ; Sun, 11 Apr 2021 22:46:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CCUcBxdgc2AgawAAB5/wlQ (envelope-from ) for ; Sun, 11 Apr 2021 20:46:15 +0000 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 8B6E0CB00 for ; Sun, 11 Apr 2021 22:46:14 +0200 (CEST) Received: from localhost ([::1]:49984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVgyD-00081l-4Z for larch@yhetil.org; Sun, 11 Apr 2021 16:46:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVgx4-0007zq-CN for guix-patches@gnu.org; Sun, 11 Apr 2021 16:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVgx4-0005mr-4j for guix-patches@gnu.org; Sun, 11 Apr 2021 16:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVgx4-0000Xz-2i for guix-patches@gnu.org; Sun, 11 Apr 2021 16:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47704] [PATCH] services: mysql: Add extra-environment as configuration option. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Apr 2021 20:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47704 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: david larsson Cc: 47704@debbugs.gnu.org Received: via spool by 47704-submit@debbugs.gnu.org id=B47704.16181738592015 (code B ref 47704); Sun, 11 Apr 2021 20:45:02 +0000 Received: (at 47704) by debbugs.gnu.org; 11 Apr 2021 20:44:19 +0000 Received: from localhost ([127.0.0.1]:55928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVgwM-0000WR-GK for submit@debbugs.gnu.org; Sun, 11 Apr 2021 16:44:18 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:44370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVgwJ-0000WI-W1 for 47704@debbugs.gnu.org; Sun, 11 Apr 2021 16:44:17 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by michel.telenet-ops.be with bizsmtp id rYkD2400T0mfAB406YkEzz; Sun, 11 Apr 2021 22:44:14 +0200 Message-ID: <7cfafd05c98540590905ceb5f3cd554fc9e2b79b.camel@telenet.be> From: Maxime Devos Date: Sun, 11 Apr 2021 22:44:09 +0200 In-Reply-To: <7d2d1250a3e87ac67c80897bffe0b82c@selfhosted.xyz> References: <91c1726e12b938f7656d7d7862920f69@selfhosted.xyz> <7d2d1250a3e87ac67c80897bffe0b82c@selfhosted.xyz> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-uAwkIQDLM0cJT3nLpsm8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1618173854; bh=UwrrecMC8IUP7WWHfX6NCmwbhaE/9K5Qz5RX7nt+lC4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=imzfSXg9l/JyWgel54R+8GBxKr/LJMQYDWglbD5zhqEoeuNc/MNC4oHw7LBk533hs tTDC/IE21WCDmFsQqhaTQh8EhK1i422PglljV5rNOCKjR+3f3E7e4j0G1+aAV7mjEV TjQ3k74OSzwzCsSVRnlRmEIXwsG99fEfIfOx3yTsAVI0+mIqylvVuOD6FApb/peFpQ LKW8q/FHN6BYamc1HlxlvQWUpQ0iL5YyG+dmXQwVc7KxnhKeKeMyvLXKmtIQiOMCSf +bekjxqeWK/VxSV8x1pUXrq1CSjNhsBCEWDbXZufEaUyz+p4eorOEDfmk2O3t0VJ71 Q11zjAPhcfTtA== 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618173974; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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=UwrrecMC8IUP7WWHfX6NCmwbhaE/9K5Qz5RX7nt+lC4=; b=eg0LSwX7jqjQScx7FklTTYDUfrDSsfRCtBtWrck6bMYLMvei40fsZQE0dCahVMU2S73/xv pcWyQfiQRyjPPtOxnh6iUOfE0EMcTbbE2ZmEXOTsWyxg9tU/nWTAF8r2aJnN+aRmuiPQti SH5nKTd7QB3ulvV6+H0xPWe4xWQBHHKXdg4aPLEpLkgUD/sxw81MHrjuDf6xWGhEDWaF1Q b0Jlhs1QE5m2r/c6YqujgsR+fLXS79vIllYXxlo1sWFJTnfbsoyQ84rRzTzny+Mf+x39gn lfcHF2cGBT75uTPdSyHkTon1KA+An2tekpL/6FEYG9OjPNP8cG5qq7Y3ENjqhg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618173974; a=rsa-sha256; cv=none; b=Av60TY5hWRG2ONVXpNShB3599m3OI2hkCGjyGkWKLm1wE5WwSoZidBLP0sNoFIe/bKrIVM 8UXSOE7vVqni2YwkpYqS5XpfawuDNaeJ0Trw4+5BSwLyukPTxK1drLVWL/H95mj84xnBQG N64UcBac4qIITEr4WY9GPPUu3RfLtM+JZIbRI/jZ/tekBah9Nmp/MN3w2bxUTCxKAUz4IG jkwklZb7Pb84RQhlFedsr4O/7c7yFQtBGowaEqaXYbs/8jSRA2DGCTFMzB8MxfwBa43yT7 iwyj+OheeAAaOdP0kl3Gw/EWDUt4hcYHsYvVbHoNd2OtceaAVhCIP0YNZTsvjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=imzfSXg9; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -3.43 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=imzfSXg9; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 8B6E0CB00 X-Spam-Score: -3.43 X-Migadu-Scanner: scn0.migadu.com X-TUID: Me6B+rkemJzT --=-uAwkIQDLM0cJT3nLpsm8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2021-04-11 at 20:07 +0200, david larsson wrote: > Hi Maxime! >=20 > On 2021-04-11 17:33, Maxime Devos wrote: > > Please corect the galera package to refer to the coreutils (ls, stat,= =20 > > ...) > > by absolute file name instead, using something like > >=20 > > (add-after 'install > > (substitute* "INSTALL-LOCATION/wsrep_sst_rsync" > > (("\\bls\\b") (string-append (assoc-ref inputs "coreutils")=20 > > "/bin/ls")) > > ...)) > >=20 > > (Likewise for rsync, gawk, iproute ...) > >=20 > > Don't use (which "ls") instead of string-append + assoc-ref! (which=20 > > "ls") is > > incorrect when cross-compiling; > >=20 > > That way, people don't have to fiddle with PATH in their configuration= =20 > > file. >=20 > I think you misundestood here - these rsync, gawk, iproute etc are=20 > executed as part of scripts in the mysqld/bin package output folder Ok, I should have asked to modify the mariadb package instead. > (see=20 > `ls -la $(dirname $(readlink -f $(which mysqld)))/` ) because the Galera= =20 > add-on was (at least partially) merged into the regular mariadb sources,= =20 > so the scripts where the binaries are needed are not from the galera=20 > package outputs but the mysql one. The galera package in guix master=20 > today only provides the #$galera "/lib/libgalera_smm.so file. So the mariadb package has the scripts, and the galera package has a librar= y. > I agree it=20 > would be nice to patch all the shell scripts in the $#mysql/bin folder= =20 > but this would 1. require maintaining all the additional patching of=20 > those scripts as part of the mysql package This shouldn't be complicated, though possibly somewhat tedious. I took a look at /gnu/store/bjgz8jnfsbb4qvaa9csfy8i3x1i3ivp7-mariadb-10.5.8= /bin/wsrep_* (your hash may vary). The following should be =E2=80=98absolutised=E2=80= =99: * In wsrep_sst_mariabackup: OS=3D$(uname) sfmt=3D"tar" if pv --help 2>/dev/null | grep -q FORMAT;then mariabackup wsrep_log_error mbstream xbcrypt (*) [more things] * In wsrep_sst_*: other things (eg. rm) The following shouldn't be required, and could be commented out: # Setting the path for lsof on CentOS export PATH=3D"/usr/sbin:/sbin:$PATH" It's a little tedious, but it should be worth it. This could be done in the post-install phase of mariadb. For an (almost) good example on how to =E2=80=98absolutise=E2=80=99, see 'xvfb-run'. Actually, it uses "wh= ich" which is incorrect when cross-compiling, but that can be worked-around by adding (setenv "PATH" (string-append BINDIR-OF-INPUTS-COREUTILS ":" BINDIR-OF-INPUTS-AWK ...)) About xbcrypt (*): I have no idea from which package this comes. Is it an optional dependency? If it is optional, _not_ patching it could make sense, as to avoid increasing the closure. This would extra-environment. > and 2. since custom=20 > wsrep_sst_ shell scripts are possible and are usually added to=20 > /usr/bin/wsrep_sst_ those binaries will also require setting=20 > additional environment variables or the same type of patching > (which would therefore "require" this patch to make it easier). I'd recommend that these custom shell scripts are patched as well, but idk how they would be used with mariadb, perhaps there are some complications here. That said, if that's too much work or too error-prone, I've an alternative proposal below, which is a little more =E2=80=98high level=E2=80=99 than as= king the user to spell out the PATH: Take a look at 'nscd-shepherd-service' in gnu/serices/base.scm: [snip] #:environment-variables (list (string-append "LD_LIBRARY_PATH=3D" (string-join (map (lambda (dir) (string-append dir "/lib")) (list #$@name-services)) ":"))))) Replace LD_LIBRARY_PATH with PATH. Add a "extensions" field to . Replace 'name-services' with 'extensions'. Procedures you need to modify: * mysql-cofiguration-file: add the field to $ * mysql-shepherd-service: add #:environment-variables as appropriate * mysql-upgrade-shepherd-service: also, maybe, I don't know? Possible problems: maybe some scripts need some additional environment variables. Mabe provide both an "extensions" field, and an "extra-environment" field, and combine the results? > > If possible, consider writing a "system test" automatically testing > > some very basic functionality of mariadb + galera=20 > > (gnu/tests/databases.scm). >=20 > I would have liked to, but Im sorry - I do not have the time/skill for= =20 > this for the time being. I hope the current patch is simple enough that= =20 > an additional test is not currently needed. For the patch as you've submitted it, the lack of a system test shouldn't be a problem, as Guix System doesn't support mariadb + galera. The system test is more for if =E2=80=98we=E2=80=99 add a 'galera' field to 'mysql-con= figuration' as I suggested. > > It seems extra-environment is still useful. "USER=3Dmysql" should=20 > > probably be > > added automatically, though (see my proposal below). >=20 > Yes, in particular for custom wsrep scripts. > The "USER=3Dmysql" may not be=20 > needed per se for the example snippet config I sent earlier as I did not= =20 > make sure that the list of environment variables there were the minimal= =20 > amount needed; I mainly hoped to provide a repeatable example of=20 > something to test with. Warning: I didn't actually test your patch. I don't have a mysql service. > > Perhaps you could extend "mysql-configuration" with a "galera" field > > (with #f as default)? Theoretical example: > >=20 > > (mysql-configuration [...] (galera [...])) > > > .. and modify mysql-service-type to insert appropriate configuration= =20 > > entries > > and perhaps add things to the PATH of the shepherd service as=20 > > appropriate. > >=20 > > Escape hatches like "extra-content" are useful, but this seems a bit > > neater. >=20 > This looks nice! I agree that something like what you show here is the= =20 > better option, at the same time I don't have the time/skill to provide a= =20 > patch with a well-featured interface to the galera options for the time= =20 > being. The "escape hatch" would therefore be very useful for now, and=20 > less hassle to maintain - compare with for example the vpn service and= =20 > the amount of emails in the lists regarding lack of options that could= =20 > have easily been added via some g-expression strings. Somewhat off-topic, which e-mails would these be? > In general I don't=20 > see the harm in providing both "the escape hatch" way to add options to= =20 > a configuration file and the guile interface which is otherwise nicer=20 > (IMO). Agreed. I believe the current plan is to: * add the 'extra-environment' escape hatch. * (possibly [dubious-discuss]) Add the extensions field (a list of package objects). This adds the listed packages to PATH. Slightly neater than 'extra-environment', but is not as general as 'extra-environment'. * The contents of 'extra-environment' and and 'extensions' are merged. > Best regards, > David ^W^W^W^W^W Maxime --=-uAwkIQDLM0cJT3nLpsm8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYHNfmRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7t3HAP93dk3g0LqnHS4M2eSHlTNxIvUI SDLmLDY9ANYNLptPUAEA1W1G/6CJ+Mk7/whluJgTq9SHJnZ0LLCR2/3C3RQZ+w4= =1nDU -----END PGP SIGNATURE----- --=-uAwkIQDLM0cJT3nLpsm8--