[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#47704] [PATCH] services: mysql: Add extra-environment as configurat

From: Maxime Devos
Subject: [bug#47704] [PATCH] services: mysql: Add extra-environment as configuration option.
Date: Sun, 11 Apr 2021 17:33:01 +0200
User-agent: Evolution 3.34.2

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
> # 
> binlog_format=ROW
> default-storage-engine=innodb
> innodb_autoinc_lock_mode=2
> # Galera Provider Configuration
> wsrep_on=ON
> wsrep_provider=" #$galera "/lib/
> # Galera Cluster Configuration
> wsrep_cluster_name=\"test_cluster\"
> wsrep_cluster_address=\"gcomm://redacted,redacted\"
> # according to 
> # 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:

  ;; [...] other fields
    (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

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

I'll take a look at it.


Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]