unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: david larsson <david.larsson@selfhosted.xyz>, 47704@debbugs.gnu.org
Subject: [bug#47704] [PATCH] services: mysql: Add extra-environment as configuration option.
Date: Sun, 11 Apr 2021 17:33:01 +0200	[thread overview]
Message-ID: <dbec1cbdca95fa8997f37ae8455b80b2bca25546.camel@telenet.be> (raw)
In-Reply-To: <91c1726e12b938f7656d7d7862920f69@selfhosted.xyz>

[-- Attachment #1: Type: text/plain, Size: 3810 bytes --]

On Sun, 2021-04-11 at 10:44 +0200, david larsson wrote:
> 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.
> [... reordered ...]
> (extra-environment #~(list (string-append "PATH=/usr/bin:/bin:" #$rsync 
> "/bin:" #$coreutils "/bin:" #$gawk "/bin:" #$grep "/bin:" #$mariadb 
> "/bin:" #$iproute "/sbin:" 
> "/

Please corect the galera package to refer to the coreutils (ls, stat, ...)
by absolute file name instead, using something like

(add-after 'install
  (substitute* "INSTALL-LOCATION/wsrep_sst_rsync"
    (("\\bls\\b") (string-append (assoc-ref inputs "coreutils") "/bin/ls"))
    ...))

(Likewise for rsync, gawk, iproute ...)

Don't use (which "ls") instead of string-append + assoc-ref! (which "ls") is
incorrect when cross-compiling;

That way, people don't have to fiddle with PATH in their configuration file.

> 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.

If possible, consider writing a "system test" automatically testing
some very basic functionality of mariadb + galera (gnu/tests/databases.scm).

> 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 ...
>
> "USER=mysql" 
> "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt" 
> "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs"))

It seems extra-environment is still useful.  "USER=mysql" should probably be
added automatically, though (see my proposal below).

> 
> (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\""))
>                                 ))

Perhaps you could extend "mysql-configuration" with a "galera" field
(with #f as default)?  Theoretical example:

(mysql-configuration
  (port A-DIFFERENT-PORT)
  ;; [...] other fields
  (galera
    (package my-version-of-galera) ; optional
    (cluster-name "test_cluster")
    (cluster-address "gcom://...")
    (synchronization-method 'rsync)
    (node-adress "redacted")
    (node-name "librem13v3guixsd")))

.. and modify mysql-service-type to insert appropriate configuration entries
and perhaps add things to the PATH of the shepherd service as appropriate.

Escape hatches like "extra-content" are useful, but this seems a bit
neater.

> ------------------------------------------------------------------
> 
> Please someone also review [bug#47517] [PATCH] gnu: nginx: Enable stream 
> module

I'll take a look at it.

Greetings,
Maxime. 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2021-04-11 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11  8:44 [bug#47704] [PATCH] services: mysql: Add extra-environment as configuration option david larsson
2021-04-11 15:33 ` Maxime Devos [this message]
2021-04-11 18:07   ` david larsson
2021-04-11 20:44     ` Maxime Devos
2021-04-12 18:06       ` david larsson
2021-04-12 20:09         ` Maxime Devos
2021-04-13 16:58           ` bug#47704: " Leo Prikler
2021-04-13 22:29             ` [bug#47704] " Julien Lepiller
2021-04-13 22:38               ` Leo Prikler
2021-04-13 22:56                 ` Julien Lepiller
2021-04-19  9:59                   ` Leo Prikler
2021-04-27 18:15                     ` david larsson
2021-04-27 18:47                       ` Leo Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbec1cbdca95fa8997f37ae8455b80b2bca25546.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=47704@debbugs.gnu.org \
    --cc=david.larsson@selfhosted.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).