From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sKyLK1Aik2NQBgEAbAwnHQ (envelope-from ) for ; Fri, 09 Dec 2022 12:56:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id sI2rKlAik2O7/wAAG6o9tA (envelope-from ) for ; Fri, 09 Dec 2022 12:56:00 +0100 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 575287A38 for ; Fri, 9 Dec 2022 12:56:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3byR-0005cV-9z; Fri, 09 Dec 2022 06:55:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3by4-0005Z2-9w for guix-patches@gnu.org; Fri, 09 Dec 2022 06:55:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3by3-0000p8-1e for guix-patches@gnu.org; Fri, 09 Dec 2022 06:55:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3by2-0006p8-U3 for guix-patches@gnu.org; Fri, 09 Dec 2022 06:55:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59845] [PATCH v2 4/4] doc: Add Integrated Library System section. Resent-From: Yarl Baudig Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Dec 2022 11:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59845 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59845@debbugs.gnu.org Cc: Yarl Baudig Received: via spool by 59845-submit@debbugs.gnu.org id=B59845.167058686326192 (code B ref 59845); Fri, 09 Dec 2022 11:55:02 +0000 Received: (at 59845) by debbugs.gnu.org; 9 Dec 2022 11:54:23 +0000 Received: from localhost ([127.0.0.1]:35564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3bxP-0006oO-6F for submit@debbugs.gnu.org; Fri, 09 Dec 2022 06:54:23 -0500 Received: from msg-2.mailo.com ([213.182.54.12]:42010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3bxN-0006nu-NE for 59845@debbugs.gnu.org; Fri, 09 Dec 2022 06:54:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailoo.org; s=mailo; t=1670586855; bh=6NHzOuOrErU1BzGbzy4R1HE/vt426QHHnI2V0ni/Bi8=; h=X-EA-Auth:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=UipttwcCgkr9J/PiM+Jz548toCeb85q36kqPGH6+FjdRv6/jCjtxu5i3GgSPWzAkh 9VoBUxjPbHoB+M1ISvjkRSRQSnRecZsFrb/BqCObBC8Ul1LbOYuKrCKCnTMdMQkaDJ jkhgdOrjaIZUn6YtsRV+5syemrScyqg2H5636GpQ= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 9 Dec 2022 12:54:15 +0100 (CET) X-EA-Auth: QABgaujEkKdbKUqapKKVWdsuXRSj3Z5g7lPJBJgGDTmLxMv3L6y33OYstCCc4COu9yZn897e3o0mS/kfA4WQ4f5ZA5Kf1PfZKPC4a/QSGeA= From: Yarl Baudig Date: Fri, 9 Dec 2022 12:53:49 +0100 Message-Id: <20221209115349.5821-4-yarl-baudig@mailoo.org> In-Reply-To: <20221209115349.5821-1-yarl-baudig@mailoo.org> References: <20221209115349.5821-1-yarl-baudig@mailoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670586960; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: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=Gf4QAyGQUTY/uY0v7ioZn5BTsOginav5gGObcs/r1Uc=; b=NJDj6ir9oeb4YjJdWamyZHppQOUYgKbSubCF652Gyf4biu2hxNg35NgozaybnRChzzLK3O GQf+Usg//m7oU5Os0G3A30ibN3n5VqCVi71jGJCZa+GUeP4xae7IzW3fp4gWKVYn8Zg2KS QV6/z35ykv7pei85Wq1sxKVvBzWklx2m3DYXwa1mJZnn4WoRDI9gDU7MOpGg0TMBg0eqQe oF+v6ZfdWIx/siveb8UO1lH+kr5bONXbS+cN79tWd4YY8ojXtmM0RiW/+EX05UfHLVBdrP hcYLtuJGzhp9m+iEyqC4pD2iK2ZgjCzftr8Adt96mUHDGglt4OIDks2xvAsXPQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670586960; a=rsa-sha256; cv=none; b=TgnE64HbtjHqQALpFIyCQcWuNSuS6CMNHmC7J7MkOxNoTEYAiFTKjQi8QtgNJOkzw1e7/h Cy/lkm4BcRFhAgIBM2pxBWI1OQBduDO5fahCtWaJqtcQTBbXh8r/zJzU/3RI9ehiWIsORg Hfzui4PJZyNdPltNWwxB1LXoaPheTfOHTKJURXg0C3akX2mdhwH7T5SOmZ7hhSswBA9CD1 k25t1Yt1DxoJPf2swm8DwKwP4sUADaeoo02ZZzogrh78Vwq/3XlG4j9KkjEKLu4LQiVM1m 12XoYaZv0CYJCpRKBtGXoMq95HU6aV2srkc29l29IhURh2O53OFQQBEVMBqgxQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailoo.org header.s=mailo header.b=UipttwcC; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mailoo.org (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 9.06 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailoo.org header.s=mailo header.b=UipttwcC; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mailoo.org (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 575287A38 X-Spam-Score: 9.06 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: NpFunCtGCwa1 doc/guix.texi (System Configuration, Services): Add Integrated Library System Services section. doc/guix.texi (System Configuration, Services, Integrated Library System Services): Add PMB. --- doc/guix.texi | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index a79b777826..60f0072409 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@* Copyright @copyright{} 2022 Simon Streit@* Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* +Copyright @copyright{} 2022 Yarl Baudig Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -402,6 +403,7 @@ Services * Guix Services:: Services relating specifically to Guix. * Linux Services:: Services tied to the Linux kernel. * Hurd Services:: Services specific for a Hurd System. +* Integrated Library System Services:: ILS services. * Miscellaneous Services:: Other services. Defining Services @@ -17720,6 +17722,7 @@ declaration. * Guix Services:: Services relating specifically to Guix. * Linux Services:: Services tied to the Linux kernel. * Hurd Services:: Services specific for a Hurd System. +* Integrated Library System Services:: ILS services. * Miscellaneous Services:: Other services. @end menu @@ -36726,6 +36729,130 @@ An integer specifying the baud rate of the tty. @end table @end deftp +@node Integrated Library System Services +@subsection Integrated Library System Services + +@cindex PMB Service +@subsubheading PMB Service + +@defvr {Scheme Variable} pmb-service-type +Service type for the @uref{https://www.sigb.net/,PMB} Integrated Library System. +The value for this service type is a @code{} record. + +The PMB service needs a web server, @code{mariadb}/@code{mysql}, @code{php} and +is only responsible for copying and changing ownership of files from the +@code{pmb} package. +@end defvr + +Let's start with a demonstration. Here is a sample system configuration (@file{pmb.scm}): + +@lisp +(use-modules (gnu)) +(use-service-modules ils web networking databases) +(use-package-modules databases) + +(operating-system + (host-name "pmb") + (timezone "Europe/Paris") + (file-systems (cons + (file-system + (device (file-system-label "does-not-matter")) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets '("/dev/sdX")))) + (packages (cons* mariadb %base-packages)) + (services + (cons* (service dhcp-client-service-type) + (service php-fpm-service-type + (php-fpm-configuration + (php-ini-file + (plain-file "php.ini" + %default-pmb-php-fpm-configuration)))) + (service nginx-service-type + (nginx-configuration + (server-blocks + (list (nginx-server-configuration + (locations + (list + %default-nginx-pmb-location)) + (listen '("localhost:8080")) + (root "/srv/http/pmb") + (index '("index.php"))))))) + (service mysql-service-type + (mysql-configuration + (extra-content + %default-pmb-mysql-configuration-extra-content))) + (service pmb-service-type) + %base-services))) +@end lisp + +The interesting points are as follows. +We import the @code{mariadb} package so that we will have access to the program +@command{mysql}. This will be useful to set the password of the database's +administrator. We declare a @code{php-fpm} service whose @file{php.ini} file +is set to @code{%default-pmb-php-fpm-configuration}. +The @code{NGinx} service is declared, with a location set to +@code{%default-nginx-pmb-location} and a root set to @file{/srv/http/pmb}, which +is the default for the @code{http-directory} field of @code{}. +The @code{mysql} service is declared with an @code{extra-content} to its configuration: +@code{default-pmb-mysql-configuration-extra-content}. Finally the pmb service. + +Now let's run @command{guix system container -N pmb.scm} (@pxref{Invoking guix system}). +Run the resulting @file{/gnu/store/...run-container}. +Note that we want to keep the state of the database and the php files (because during +the application setup (see below), the php files will be slightly modified. That is also why +the PMB files need to be copied (and chowned) outside the store), we need to create +two folders, say @file{/mnt/data/pmb} and @file{/mnt/data/mysql} and pass @option{--share} +two times. @command{nsenter} into it to set the database's administrator password. + +@example +# mkdir /mnt/data/mysql /mnt/data/pmb +# /gnu/store/...run-container --share=/mnt/data/pmb=/srv/http/pmb \ +--share=/mnt/data/mysql=/var/lib/mysql +# nsenter -a -t +# mysql +> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('guixisgreat'); +@end example + +Go to @uref{localhost:8080}. Follow the steps. Note that for the database server parameters, +``localhost'' won't work, it's ``127.0.0.1'' and the user is ``root''. +Once the installation is complete, you are redirected to the login page. The name is ``admin'', +the password is ``admin''. + +Now lets detail fields. + +@defvr {Scheme Variable} %default-pmb-php-fpm-configuration +This is meant to represent the content of @file{php.ini} for the +@code{php-fpm} service for a recommended configuration. +@end defvr + +@defvr {Scheme Variable} %default-pmb-mysql-configuration-extra-content +Extra content to be added to @code{mariadb}/@code{mysql} configuration for recommended configuration. +@end defvr + +@defvr {Scheme Variable} %default-nginx-pmb-location +Location for nginx based on @code{nginx-php-location}. +@end defvr + +@deftp {Data Type} pmb-configuration +This data type represents the configuration for PMB. + +@table @asis +@item @code{pmb} (default: @code{pmb}) + +@item @code{http-directory} (default: @file{/srv/http/pmb}) +Must match a webserver's root. + +@item @code{php-fpm-user} (default: @code{php-fpm}) + +@item @code{php-fpm-group} (default: @code{php-fpm}) + +@end table +@end deftp + @node Miscellaneous Services @subsection Miscellaneous Services -- 2.38.1